Author: ilya_shaikovsky
Date: 2008-03-13 14:27:40 -0400 (Thu, 13 Mar 2008)
New Revision: 6795
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/SortingBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/externalSortingUsage.xhtml
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeature.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/examples/externalMultipleSorting.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/examples/simpleSingleSorting.xhtml
Log:
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2008-03-13
17:51:09 UTC (rev 6794)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2008-03-13
18:27:40 UTC (rev 6795)
@@ -12,7 +12,6 @@
import org.richfaces.component.UIScrollableDataTable;
import org.richfaces.demo.datafilterslider.DemoInventoryItem;
-import org.richfaces.model.ScrollableTableDataModel.SimpleRowKey;
import org.richfaces.model.selection.SimpleSelection;
/**
@@ -29,7 +28,7 @@
private ArrayList<Facet> columns = new ArrayList<Facet>();
private static int DECIMALS = 1;
private static int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;
-
+
private List <DemoInventoryItem> allCars = null;
public DataTableScrollerBean() {
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/SortingBean.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/SortingBean.java
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/SortingBean.java 2008-03-13
18:27:40 UTC (rev 6795)
@@ -0,0 +1,189 @@
+/**
+ *
+ */
+package org.richfaces.demo.dataTableScroller;
+
+import java.util.ArrayList;
+
+import javax.faces.model.SelectItem;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+public class SortingBean {
+ SelectItem[] sortByItems = new SelectItem[5];
+ SelectItem[] sortDirectionItems = new SelectItem[3];
+ private int firstSortOption=0;
+ private int secondSortOption=0;
+ private int thirdSortOption=0;
+ private int fourthSortOption=0;
+ private boolean modelSorted;
+ private boolean makeSorted;
+ private boolean priceSorted;
+ private boolean mileageSorted;
+ private String modelDirection = "UNSORTED";
+ private String makeDirection = "UNSORTED";
+ private String priceDirection = "UNSORTED";
+ private String mileageDirection = "UNSORTED";
+ ArrayList<String> prioritList = new ArrayList<String>();
+
+ public SortingBean() {
+ sortByItems[0] = new SelectItem(0,"None");
+ sortByItems[1] = new SelectItem(1,"Model");
+ sortByItems[2] = new SelectItem(2,"Price");
+ sortByItems[3] = new SelectItem(3,"Make");
+ sortByItems[4] = new SelectItem(4,"Mileage");
+
+ sortDirectionItems[0] = new SelectItem("None");
+ sortDirectionItems[1] = new SelectItem("Asc");
+ sortDirectionItems[2] = new SelectItem("Desc");
+ }
+
+ public void checkSort(int value){
+ switch (value) {
+ case 1:
+ prioritList.add("model");
+ setModelDirection("ASCENDING");
+ setModelSorted(true);
+ break;
+ case 2:
+ prioritList.add("price");
+ setPriceDirection("ASCENDING");
+ setPriceSorted(true);
+ break;
+ case 3:
+ prioritList.add("make");
+ setMakeDirection("ASCENDING");
+ setMakeSorted(true);
+ break;
+ case 4:
+ prioritList.add("mileage");
+ setMileageDirection("ASCENDING");
+ setMileageSorted(true);
+ break;
+ }
+
+ }
+
+ public String changeSorting() {
+ prioritList.clear();
+ setModelSorted(false); setModelDirection("UNSORTED");
+ setMakeSorted(false); setMakeDirection("UNSORTED");
+ setPriceSorted(false); setPriceDirection("UNSORTED");
+ setMileageSorted(false);setMileageDirection("UNSORTED");
+ checkSort(firstSortOption);
+ checkSort(secondSortOption);
+ checkSort(thirdSortOption);
+ checkSort(fourthSortOption);
+ return null;
+ }
+
+ public SelectItem[] getSortByItems() {
+ return sortByItems;
+ }
+
+ public SelectItem[] getSortDirectionItems() {
+ return sortDirectionItems;
+ }
+
+ public boolean isModelSorted() {
+ return modelSorted;
+ }
+
+ public void setModelSorted(boolean modelSorted) {
+ this.modelSorted = modelSorted;
+ }
+
+ public boolean isMakeSorted() {
+ return makeSorted;
+ }
+
+ public void setMakeSorted(boolean makeSorted) {
+ this.makeSorted = makeSorted;
+ }
+
+ public boolean isPriceSorted() {
+ return priceSorted;
+ }
+
+ public void setPriceSorted(boolean priceSorted) {
+ this.priceSorted = priceSorted;
+ }
+
+ public boolean isMileageSorted() {
+ return mileageSorted;
+ }
+
+ public void setMileageSorted(boolean mileageSorted) {
+ this.mileageSorted = mileageSorted;
+ }
+
+ public ArrayList<String> getPrioritList() {
+ return prioritList;
+ }
+
+ public String getModelDirection() {
+ return modelDirection;
+ }
+
+ public void setModelDirection(String modelDirection) {
+ this.modelDirection = modelDirection;
+ }
+
+ public String getMakeDirection() {
+ return makeDirection;
+ }
+
+ public void setMakeDirection(String makeDirection) {
+ this.makeDirection = makeDirection;
+ }
+
+ public String getPriceDirection() {
+ return priceDirection;
+ }
+
+ public void setPriceDirection(String priceDirection) {
+ this.priceDirection = priceDirection;
+ }
+
+ public String getMileageDirection() {
+ return mileageDirection;
+ }
+
+ public void setMileageDirection(String mileageDirection) {
+ this.mileageDirection = mileageDirection;
+ }
+
+ public int getFirstSortOption() {
+ return firstSortOption;
+ }
+
+ public void setFirstSortOption(int firstSortOption) {
+ this.firstSortOption = firstSortOption;
+ }
+
+ public int getSecondSortOption() {
+ return secondSortOption;
+ }
+
+ public void setSecondSortOption(int secondSortOption) {
+ this.secondSortOption = secondSortOption;
+ }
+
+ public int getThirdSortOption() {
+ return thirdSortOption;
+ }
+
+ public void setThirdSortOption(int thirdSortOption) {
+ this.thirdSortOption = thirdSortOption;
+ }
+
+ public int getFourthSortOption() {
+ return fourthSortOption;
+ }
+
+ public void setFourthSortOption(int fourthSortOption) {
+ this.fourthSortOption = fourthSortOption;
+ }
+}
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-03-13
17:51:09 UTC (rev 6794)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-03-13
18:27:40 UTC (rev 6795)
@@ -298,6 +298,11 @@
<managed-bean-class>org.richfaces.demo.fileUpload.FileUploadBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>sortingBean</managed-bean-name>
+
<managed-bean-class>org.richfaces.demo.dataTableScroller.SortingBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep1.xhtml</from-view-id>
<navigation-case>
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeature.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeature.xhtml 2008-03-13
17:51:09 UTC (rev 6794)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeature.xhtml 2008-03-13
18:27:40 UTC (rev 6795)
@@ -11,9 +11,12 @@
<rich:tab label="Filtering Feature">
<ui:include
src="/richfaces/sortingFilteringFeatures/filteringUsage.xhtml"/>
</rich:tab>
- <rich:tab label="Sorting Feature">
+ <rich:tab label="Built-in Sorting Feature">
<ui:include
src="/richfaces/sortingFilteringFeatures/sortingUsage.xhtml"/>
</rich:tab>
+ <rich:tab label="External Sorting">
+ <ui:include
src="/richfaces/sortingFilteringFeatures/externalSortingUsage.xhtml"/>
+ </rich:tab>
</rich:tabPanel>
</ui:define>
</ui:composition>
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/examples/externalMultipleSorting.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/examples/externalMultipleSorting.xhtml 2008-03-13
17:51:09 UTC (rev 6794)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/examples/externalMultipleSorting.xhtml 2008-03-13
18:27:40 UTC (rev 6795)
@@ -0,0 +1,67 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ <style>
+ .top{
+ vertical-align:top;
+ }
+ </style>
+
+ <h:panelGrid columns="2" columnClasses="top">
+ <rich:dataTable value="#{dataTableScrollerBean.allCars}"
var="category" rows="30" id="table">
+ <rich:column id="make" sortBy="#{category.make}"
sortOrder="#{sortingBean.makeDirection}">
+ <f:facet name="header"><h:outputText
styleClass="headerText" value="Make" /></f:facet>
+ <h:outputText value="#{category.make}" />
+ </rich:column>
+ <rich:column id="model" sortBy="#{category.model}"
sortOrder="#{sortingBean.modelDirection}">
+ <f:facet name="header"><h:outputText
styleClass="headerText" value="Model" /></f:facet>
+ <h:outputText value="#{category.model}" />
+ </rich:column>
+ <rich:column id="price" sortBy="#{category.price}"
sortOrder="#{sortingBean.priceDirection}">
+ <f:facet name="header"><h:outputText
styleClass="headerText" value="Price" /></f:facet>
+ <h:outputText value="#{category.price}" />
+ </rich:column>
+ <rich:column id="mileage" sortBy="#{category.mileage}"
sortOrder="#{sortingBean.mileageDirection}">
+ <f:facet name="header"><h:outputText
styleClass="headerText" value="Mileage" /></f:facet>
+ <h:outputText value="#{category.mileage}" />
+ </rich:column>
+ <rich:column width="200px" id="vin">
+ <f:facet name="header"><h:outputText
styleClass="headerText" value="VIN" /></f:facet>
+ <h:outputText value="#{category.vin}" />
+ </rich:column>
+ <rich:column id="stock">
+ <f:facet name="header"><h:outputText
styleClass="headerText" value="Stock" /></f:facet>
+ <h:outputText value="#{category.stock}" />
+ </rich:column>
+ </rich:dataTable>
+ <h:form>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Specify Sorting Conditions:"/>
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:outputText value="First Sort Property"/>
+ <h:selectOneMenu value="#{sortingBean.firstSortOption}">
+ <f:selectItems value="#{sortingBean.sortByItems}"/>
+ </h:selectOneMenu>
+ <h:outputText value="Second Sort Property"/>
+ <h:selectOneMenu value="#{sortingBean.secondSortOption}">
+ <f:selectItems value="#{sortingBean.sortByItems}"/>
+ </h:selectOneMenu>
+ <h:outputText value="Third Sort Property"/>
+ <h:selectOneMenu value="#{sortingBean.thirdSortOption}">
+ <f:selectItems value="#{sortingBean.sortByItems}"/>
+ </h:selectOneMenu>
+ <h:outputText value="Fourth Sort Property"/>
+ <h:selectOneMenu value="#{sortingBean.fourthSortOption}">
+ <f:selectItems value="#{sortingBean.sortByItems}"/>
+ </h:selectOneMenu>
+ </h:panelGrid>
+ <a4j:commandButton value="Sort Table" reRender="table"
action="#{sortingBean.changeSorting}"/>
+ </rich:panel>
+ </h:form>
+ </h:panelGrid>
+</ui:composition>
\ No newline at end of file
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/examples/simpleSingleSorting.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/examples/simpleSingleSorting.xhtml 2008-03-13
17:51:09 UTC (rev 6794)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/examples/simpleSingleSorting.xhtml 2008-03-13
18:27:40 UTC (rev 6795)
@@ -4,13 +4,24 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
+ <style>
+ .center{
+ text-align:center;
+ }
+ </style>
<h:form>
- <rich:dataTable value="#{capitalsBean.capitals}" var="cap"
width="300px">
+ <rich:dataTable value="#{capitalsBean.capitals}" var="cap"
width="300px" columnClasses="center">
<f:facet name="header">
<h:outputText value="Sorting Example"/>
</f:facet>
- <rich:column sortBy="#{cap.state}">
+ <rich:column>
<f:facet name="header">
+ <h:outputText value="State Flag"></h:outputText>
+ </f:facet>
+ <h:graphicImage value="#{cap.stateFlag}"/>
+ </rich:column>
+ <rich:column sortBy="#{cap.state}">
+ <f:facet name="header">
<h:outputText value="State Name"></h:outputText>
</f:facet>
<h:outputText value="#{cap.state}"></h:outputText>
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/externalSortingUsage.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/externalSortingUsage.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/sortingFilteringFeatures/externalSortingUsage.xhtml 2008-03-13
18:27:40 UTC (rev 6795)
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:rich="http://richfaces.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+
+ <p>
+ SHORT DESCRIPTION
+ </p>
+
+ <div class="sample-container" >
+
+ <ui:include
src="/richfaces/sortingFilteringFeatures/examples/externalMultipleSorting.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/richfaces/sortingFilteringFeatures/examples/externalMultipleSorting.xhtml"/>
+ </ui:include>
+ </div>
+
+ <p>
+ DESCRIPTION
+ </p>
+
+ </ui:define>
+
+ </ui:composition>
+</html>