Author: pkawiak
Date: 2008-08-05 04:46:31 -0400 (Tue, 05 Aug 2008)
New Revision: 9906
Added:
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/i18n/messages_pl.properties
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/beans/ExtendedDataTableControlBean.java
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/pages/stateTestPage.jsp
Modified:
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/i18n/messages.properties
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/beans/ExtendedDataTableBB.java
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/model/impl/DemoPatientProvider.java
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/pages/index.jsp
Log:
Improving extended data table's developer's demo
Modified:
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/i18n/messages.properties
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/i18n/messages.properties 2008-08-04
23:37:51 UTC (rev 9905)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/i18n/messages.properties 2008-08-05
08:46:31 UTC (rev 9906)
@@ -3,3 +3,14 @@
patient.id=Id
patient.lastName=Last name
patient.admissionDate=Admission date
+table.width=Width
+table.height=Height
+table.update=Update values
+table.sortMode=Sort mode
+table.selectionMode=Selection mode
+table.patientsNumber=Number of patients
+table.testComponentState=Test component state
+table.back=Back
+demo.testPageTitle=Component state test page
+table.paginated=Enable paginator
+table.rowsNumber=Number of rows
Added:
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/i18n/messages_pl.properties
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/i18n/messages_pl.properties
(rev 0)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/i18n/messages_pl.properties 2008-08-05
08:46:31 UTC (rev 9906)
@@ -0,0 +1,5 @@
+demo.title=Extended data table demonstration
+patient.firstName=First name
+patient.id=Id
+patient.lastName=Last name
+patient.admissionDate=Admission date
Modified:
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/beans/ExtendedDataTableBB.java
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/beans/ExtendedDataTableBB.java 2008-08-04
23:37:51 UTC (rev 9905)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/beans/ExtendedDataTableBB.java 2008-08-05
08:46:31 UTC (rev 9906)
@@ -26,13 +26,14 @@
private Comparator<DemoPatient> dateComparator;
private String tableState = null;
private ExtendedTableDataModel<DemoPatient> dataModel;
+ private Integer patientsNumber = 100;
public ExtendedDataTableBB() {
}
public ExtendedTableDataModel<DemoPatient> getDataModel(){
if (dataModel == null){
- dataModel = new ExtendedTableDataModel<DemoPatient>(new
DemoPatientProvider());
+ dataModel = new ExtendedTableDataModel<DemoPatient>(new
DemoPatientProvider(patientsNumber));
}
return dataModel;
}
@@ -55,6 +56,17 @@
return null;
}
+ public Integer getPatientsNumber() {
+ return patientsNumber;
+ }
+
+ public void setPatientsNumber(Integer patientsNumber) {
+ if (patientsNumber != this.patientsNumber) {
+ dataModel = new ExtendedTableDataModel<DemoPatient>(new
DemoPatientProvider(patientsNumber));
+ }
+ this.patientsNumber = patientsNumber;
+ }
+
public List<DemoPatient> getSelectedItems() {
if (selectedItems == null){
selectedItems = new ArrayList<DemoPatient>();
Added:
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/beans/ExtendedDataTableControlBean.java
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/beans/ExtendedDataTableControlBean.java
(rev 0)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/beans/ExtendedDataTableControlBean.java 2008-08-05
08:46:31 UTC (rev 9906)
@@ -0,0 +1,94 @@
+package org.richfaces.samples.extdt.beans;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+public class ExtendedDataTableControlBean {
+
+ String width = "500px";
+ String height = "500px";
+ List<SelectItem> sortModeSelectItems = new ArrayList<SelectItem>();
+ List<SelectItem> selectionModeSelectItems = new ArrayList<SelectItem>();
+ String sortMode;
+ String selectionMode;
+ Integer rowsNumber;
+ boolean paginated = false;
+
+ public ExtendedDataTableControlBean() {
+ sortModeSelectItems.add(new SelectItem("single", "single"));
+ sortModeSelectItems.add(new SelectItem("multi", "multi"));
+ selectionModeSelectItems.add(new SelectItem("single",
"single"));
+ selectionModeSelectItems.add(new SelectItem("multi",
"multi"));
+ selectionModeSelectItems.add(new SelectItem("none",
"none"));
+ }
+
+ public boolean isPaginated() {
+ return paginated;
+ }
+
+ public void setPaginated(boolean paginated) {
+ this.paginated = paginated;
+ }
+
+ public Integer getRowsNumber() {
+ return rowsNumber;
+ }
+
+ public void setRowsNumber(Integer rowsNumber) {
+ this.rowsNumber = rowsNumber;
+ }
+
+ public List<SelectItem> getSelectionModeSelectItems() {
+ return selectionModeSelectItems;
+ }
+
+ public void setSelectionModeSelectItems(
+ List<SelectItem> selectionModeSelectItems) {
+ this.selectionModeSelectItems = selectionModeSelectItems;
+ }
+
+
+
+ public List<SelectItem> getSortModeSelectItems() {
+ return sortModeSelectItems;
+ }
+
+ public void setSortModeSelectItems(List<SelectItem> sortModeSelectItems) {
+ this.sortModeSelectItems = sortModeSelectItems;
+ }
+
+ public String getSortMode() {
+ return sortMode;
+ }
+
+ public void setSortMode(String sortMode) {
+ this.sortMode = sortMode;
+ }
+
+ public String getSelectionMode() {
+ return selectionMode;
+ }
+
+ public void setSelectionMode(String selectionMode) {
+ this.selectionMode = selectionMode;
+ }
+
+ public String getWidth() {
+ return width;
+ }
+
+ public void setWidth(String width) {
+ this.width = width;
+ }
+
+ public String getHeight() {
+ return height;
+ }
+
+ public void setHeight(String height) {
+ this.height = height;
+ }
+
+}
Modified:
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/model/impl/DemoPatientProvider.java
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/model/impl/DemoPatientProvider.java 2008-08-04
23:37:51 UTC (rev 9905)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/java/org/richfaces/samples/extdt/model/impl/DemoPatientProvider.java 2008-08-05
08:46:31 UTC (rev 9906)
@@ -42,13 +42,15 @@
};
private List<DemoPatient> items;
+ private Integer itemsNumber;
private Random random = new Random();
private long now = new Date().getTime();
- public DemoPatientProvider() {
+ public DemoPatientProvider(Integer itemsNumber) {
super();
+ this.itemsNumber = itemsNumber;
}
private Date generateRandomDate(){
@@ -80,7 +82,7 @@
protected List<DemoPatient> getItems() {
if (items == null){
- int l = 100;
+ int l = itemsNumber;
items = new ArrayList<DemoPatient>(l);
for (int i=0;i<l;i++) {
items.add(new DemoPatient(i,
Modified:
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2008-08-04
23:37:51 UTC (rev 9905)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2008-08-05
08:46:31 UTC (rev 9906)
@@ -1,2 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
-<PROCESS model-entity="JSFProcess"/>
+<PROCESS model-entity="JSFProcess">
+ <PROCESS-ITEM NAME="rules:*" PATH="*" SHAPE="32,17,0,0"
model-entity="JSFProcessGroup">
+ <PROCESS-ITEM ID="rules:*:0" NAME="item" PATH="*"
model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT ID="stateTest::#pages#stateTestPage.jsp"
+ NAME="output" PATH="/pages/stateTestPage.jsp"
+ TARGET="rules:#pages#stateTestPage.jsp" TITLE="stateTest"
model-entity="JSFProcessItemOutput"/>
+ <PROCESS-ITEM-OUTPUT ID="index::#pages#index.jsp"
NAME="output1"
+ PATH="/pages/index.jsp" TARGET="rules:#pages#index.jsp"
+ TITLE="index" model-entity="JSFProcessItemOutput"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM NAME="rules:#pages#stateTestPage.jsp"
+ PATH="/pages/stateTestPage.jsp" SHAPE="32,465,0,0"
model-entity="JSFProcessGroup"/>
+ <PROCESS-ITEM NAME="rules:#pages#index.jsp"
PATH="/pages/index.jsp"
+ SHAPE="32,577,0,0" model-entity="JSFProcessGroup"/>
+</PROCESS>
Modified:
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-08-04
23:37:51 UTC (rev 9905)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-08-05
08:46:31 UTC (rev 9906)
@@ -1,21 +1,38 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
-
xmlns:xi="http://www.w3.org/2001/XInclude"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
- <managed-bean>
- <managed-bean-name>extendedDataTableBean</managed-bean-name>
-
<managed-bean-class>org.richfaces.samples.extdt.beans.ExtendedDataTableBB</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
- <application>
- <locale-config>
- <default-locale>pl</default-locale>
- <supported-locale>de</supported-locale>
- <supported-locale>en</supported-locale>
- </locale-config>
- <resource-bundle>
- <base-name>i18n.messages</base-name>
- <var>msg</var>
- </resource-bundle>
- </application>
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <managed-bean>
+ <managed-bean-name>extendedDataTableBean</managed-bean-name>
+
<managed-bean-class>org.richfaces.samples.extdt.beans.ExtendedDataTableBB</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>extendedDataTableControlBean</managed-bean-name>
+
<managed-bean-class>org.richfaces.samples.extdt.beans.ExtendedDataTableControlBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <navigation-rule>
+ <display-name>all</display-name>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>stateTest</from-outcome>
+ <to-view-id>/pages/stateTestPage.jsp</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>index</from-outcome>
+ <to-view-id>/pages/index.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <application>
+ <locale-config>
+ <default-locale>pl</default-locale>
+ <supported-locale>de</supported-locale>
+ <supported-locale>en</supported-locale>
+ </locale-config>
+ <resource-bundle>
+ <base-name>i18n.messages</base-name>
+ <var>msg</var>
+ </resource-bundle>
+ </application>
</faces-config>
Modified: trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/pages/index.jsp
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/pages/index.jsp 2008-08-04
23:37:51 UTC (rev 9905)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/pages/index.jsp 2008-08-05
08:46:31 UTC (rev 9906)
@@ -11,19 +11,49 @@
<h:outputText value="#{msg['demo.title']}">
</h:outputText>
</title>
+ <style type="text/css">
+
+ .leftColumn {
+ width: 50%;
+ height: 100%;
+ }
+
+ .rightColumn {
+ width: 50%;
+ height: 100%;
+ }
+
+ #mainPanel {
+ width: 100%;
+ height: 100%;
+ }
+
+ #leftPanel {
+ width: 100%;
+ height: 100%;
+ }
+
+ #rightPanel {
+ width: 100%;
+ height: 100%;
+ }
+ </style>
</head>
<body>
+ <h:panelGrid columns="2" id="mainPanel"
columnClasses="leftColumn, rightColumn">
+ <rich:panel id="leftPanel">
<h:form>
<extdt:extendedDataTable id="demoTable"
value="#{extendedDataTableBean.dataModel}"
var="patient"
- width="500px"
- height="500px"
+ rows="#{extendedDataTableControlBean.rowsNumber}"
+ width="#{extendedDataTableControlBean.width}"
+ height="#{extendedDataTableControlBean.height}"
selectedClass="dataTableSelectedRow"
footerClass="demo-footer"
- sortMode="single"
- selectionMode="multi"
+ sortMode="#{extendedDataTableControlBean.sortMode}"
+ selectionMode="#{extendedDataTableControlBean.selectionMode}"
selection="#{extendedDataTableBean.selection}"
rowKeyVar="rkvar"
tableState="#{extendedDataTableBean.tableState}">
@@ -65,7 +95,62 @@
<h:outputText value="#{patient.admissionDate}" />
</rich:column>
</extdt:extendedDataTable>
+ <rich:datascroller
+ style="width: #{extendedDataTableControlBean.width}"
+ rendered="#{extendedDataTableControlBean.paginated}"
+ for="demoTable">
+ </rich:datascroller>
</h:form>
+ </rich:panel>
+ <rich:panel id="rightPanel">
+ <h:form>
+ <h:panelGrid columns="2">
+ <h:outputLabel value="#{msg['table.width']}"
for="tableWidthInput" />
+ <h:inputText
+ id="tableWidthInput"
+ value="#{extendedDataTableControlBean.width}" />
+ <h:outputLabel value="#{msg['table.height']}"
for="tableHeightInput" />
+ <h:inputText
+ id="tableHeightInput"
+ value="#{extendedDataTableControlBean.height}" />
+ <h:outputLabel value="#{msg['table.patientsNumber']}"
for="tablePatientsNumberInput" />
+ <h:inputText
+ id="tablePatientsNumberInput"
+ value="#{extendedDataTableBean.patientsNumber}" />
+ <h:outputLabel value="#{msg['table.sortMode']}"
for="tableSortModeSelect" />
+ <h:selectOneMenu
+ id="tableSortModeSelect"
+ value="#{extendedDataTableControlBean.sortMode}"
+ >
+ <f:selectItems
value="#{extendedDataTableControlBean.sortModeSelectItems}"/>
+ </h:selectOneMenu>
+ <h:outputLabel value="#{msg['table.selectionMode']}"
for="tableSelectionModeSelect" />
+ <h:selectOneMenu
+ id="tableSelectionModeSelect"
+ value="#{extendedDataTableControlBean.selectionMode}"
+ >
+ <f:selectItems
value="#{extendedDataTableControlBean.selectionModeSelectItems}"/>
+ </h:selectOneMenu>
+ <h:outputLabel value="#{msg['table.paginated']}"
for="paginatedChecxbox" />
+ <h:selectBooleanCheckbox
+ id="paginatedCheckbox"
+ value="#{extendedDataTableControlBean.paginated}" />
+ <h:outputLabel value="#{msg['table.rowsNumber']}"
for="tableRowsNumberInput" />
+ <h:inputText
+ id="tableRowsNumberInput"
+ value="#{extendedDataTableControlBean.rowsNumber}" />
+ </h:panelGrid>
+ <a4j:commandButton value="#{msg['table.update']}"
reRender="mainPanel">
+ </a4j:commandButton>
+ <a4j:commandButton
value="#{msg['table.testComponentState']}"
+ action="stateTest"
+ >
+ </a4j:commandButton>
+ <rich:messages>
+ </rich:messages>
+ </h:form>
+ </rich:panel>
+ </h:panelGrid>
</body>
</html>
</f:view>
\ No newline at end of file
Added:
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/pages/stateTestPage.jsp
===================================================================
---
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/pages/stateTestPage.jsp
(rev 0)
+++
trunk/sandbox/samples/extendedDataTable-sample/src/main/webapp/pages/stateTestPage.jsp 2008-08-05
08:46:31 UTC (rev 9906)
@@ -0,0 +1,24 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<f:view>
+ <html>
+ <head>
+ <title>
+ <h:outputText value="#{msg['demo.testPageTitle']}">
+ </h:outputText>
+ </title>
+
+ </head>
+
+<body>
+ <h:form>
+ <a4j:commandButton value="#{msg['table.back']}"
+ action="index"
+ >
+ </a4j:commandButton>
+ </h:form>
+</body>
+</html>
+</f:view>
\ No newline at end of file