Author: ilya_shaikovsky
Date: 2011-04-12 06:31:45 -0400 (Tue, 12 Apr 2011)
New Revision: 22414
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/ExtTableSelectionBean.java
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/extendedDataTable/exTableSelection.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/extendedDataTable/samples/exTableSelection-sample.xhtml
Log:
merge with 4.1.0
http://jira.jboss.org/browse/RF-10843
+ fixed non-working EDT selection sample. (injection errors after switching to
@viewScope)
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/ExtTableSelectionBean.java
===================================================================
---
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/ExtTableSelectionBean.java 2011-04-12
09:49:44 UTC (rev 22413)
+++
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/ExtTableSelectionBean.java 2011-04-12
10:31:45 UTC (rev 22414)
@@ -7,28 +7,29 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
import javax.faces.event.AjaxBehaviorEvent;
import org.richfaces.component.UIExtendedDataTable;
import org.richfaces.demo.tables.model.cars.InventoryItem;
@ManagedBean
-@SessionScoped
-public class ExtTableSelectionBean implements Serializable{
+@ViewScoped
+public class ExtTableSelectionBean implements Serializable {
+ private String selectionMode="multiple";
private Collection<Object> selection;
@ManagedProperty(value = "#{carsBean.allInventoryItems}")
private List<InventoryItem> inventoryItems;
private List<InventoryItem> selectionItems = new
ArrayList<InventoryItem>();
-
- public void selectionListener(AjaxBehaviorEvent event){
- UIExtendedDataTable dataTable = (UIExtendedDataTable)event.getComponent();
+
+ public void selectionListener(AjaxBehaviorEvent event) {
+ UIExtendedDataTable dataTable = (UIExtendedDataTable) event.getComponent();
Object originalKey = dataTable.getRowKey();
selectionItems.clear();
- for (Object selectionKey: selection) {
+ for (Object selectionKey : selection) {
dataTable.setRowKey(selectionKey);
- if (dataTable.isRowAvailable()){
- selectionItems.add((InventoryItem)dataTable.getRowData());
+ if (dataTable.isRowAvailable()) {
+ selectionItems.add((InventoryItem) dataTable.getRowData());
}
}
dataTable.setRowKey(originalKey);
@@ -57,4 +58,12 @@
public void setSelectionItems(List<InventoryItem> selectionItems) {
this.selectionItems = selectionItems;
}
+
+ public String getSelectionMode() {
+ return selectionMode;
+ }
+
+ public void setSelectionMode(String selectionMode) {
+ this.selectionMode = selectionMode;
+ }
}
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/extendedDataTable/exTableSelection.xhtml
===================================================================
---
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/extendedDataTable/exTableSelection.xhtml 2011-04-12
09:49:44 UTC (rev 22413)
+++
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/extendedDataTable/exTableSelection.xhtml 2011-04-12
10:31:45 UTC (rev 22414)
@@ -8,11 +8,12 @@
<p>This example demonstrates selection management using the built-in selection
functionality.</p>
<p>The <b>selectionMode</b> attribute, which controls the selection
mode, has three possible values:</p>
<ul>
+<li>none</li>
+<li>single</li>
<li>multiple</li>
-<li>single</li>
-<li>none</li>
+<li>multipleKeyboardFree - <b>new!</b></li>
</ul>
-<p>To manage your selection, use the <b>selection</b> attribute, which
points to
+<p>To manage your selection at server-side, use the <b>selection</b>
attribute, which points to
a collection of objects. The collection holds <b>rowKey</b> identifiers of
the currently selected rows.</p>
<ui:include src="#{demoNavigator.sampleIncludeURI}" />
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/extendedDataTable/samples/exTableSelection-sample.xhtml
===================================================================
---
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/extendedDataTable/samples/exTableSelection-sample.xhtml 2011-04-12
09:49:44 UTC (rev 22413)
+++
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/extendedDataTable/samples/exTableSelection-sample.xhtml 2011-04-12
10:31:45 UTC (rev 22414)
@@ -7,10 +7,18 @@
xmlns:rich="http://richfaces.org/rich">
<h:panelGrid columns="2">
<h:form>
+ <fieldset style="margin-bottom: 10px;"><legend><h:outputText
value="Selection Mode " /></legend>
+ <h:selectOneRadio value="#{extTableSelectionBean.selectionMode}">
+ <f:selectItem itemLabel="Single" itemValue="single"/>
+ <f:selectItem itemLabel="Multiple" itemValue="multiple"/>
+ <f:selectItem itemLabel="Multiple Keyboard-free"
itemValue="multipleKeyboardFree"/>
+ <a4j:ajax render="table, res"/>
+ </h:selectOneRadio>
+ </fieldset>
<rich:extendedDataTable
value="#{extTableSelectionBean.inventoryItems}" var="car"
selection="#{extTableSelectionBean.selection}" id="table"
- frozenColumns="2" style="height:300px; width:500px;">
+ frozenColumns="2" style="height:300px; width:500px;"
selectionMode="#{extTableSelectionBean.selectionMode}">
<a4j:ajax execute="@form"
event="selectionchange"
listener="#{extTableSelectionBean.selectionListener}"
render=":res" />