Author: ilya_shaikovsky
Date: 2010-05-24 05:37:30 -0400 (Mon, 24 May 2010)
New Revision: 17199
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/region/
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/region/RegionBean.java
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsBean.java
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CarsBean.java
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/filter/
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/filter/CarsFilteringBean.java
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFiltering.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableSorting.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/region/
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/region/region.xhtml
Removed:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/capitals/CapitalsBean.java
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/CarsBean.java
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/subtables.xhtml
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/UserBean.java
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
root/examples/richfaces-showcase/trunk/src/main/webapp/WEB-INF/web.xml
root/examples/richfaces-showcase/trunk/src/main/webapp/resources/rich/panel.xhtml
Log:
https://jira.jboss.org/browse/RF-8291
https://jira.jboss.org/browse/RF-8298
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/UserBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/UserBean.java 2010-05-24
06:41:57 UTC (rev 17198)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/UserBean.java 2010-05-24
09:37:30 UTC (rev 17199)
@@ -1,12 +1,13 @@
package org.richfaces.demo.common;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.RequestScoped;
+import javax.faces.bean.ViewScoped;
@ManagedBean(name = "userBean")
-@RequestScoped
+@ViewScoped
public class UserBean {
private String name = "";
+ private String email = "";
private String password = "";
private String address;
private Integer age;
@@ -23,6 +24,14 @@
this.recordStatus = "User " + this.name + " stored
succesfully";
}
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
public String getRecordStatus() {
return recordStatus;
}
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/region/RegionBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/region/RegionBean.java
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/region/RegionBean.java 2010-05-24
09:37:30 UTC (rev 17199)
@@ -0,0 +1,42 @@
+package org.richfaces.demo.region;
+
+import java.io.Serializable;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.demo.common.UserBean;
+
+@ManagedBean
+@ViewScoped
+public class RegionBean implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3844974441732156513L;
+ private UserBean user1;
+ private UserBean user2;
+
+ public UserBean getUser1() {
+ return user1;
+ }
+
+ public UserBean getUser2() {
+ return user2;
+ }
+
+ public void setUser1(UserBean user1) {
+ this.user1 = user1;
+ }
+
+ public void setUser2(UserBean user2) {
+ this.user2 = user2;
+ }
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+}
Copied:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsBean.java
(from rev 17197,
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/capitals/CapitalsBean.java)
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsBean.java
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsBean.java 2010-05-24
09:37:30 UTC (rev 17199)
@@ -0,0 +1,31 @@
+package org.richfaces.demo.tables;
+
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.SessionScoped;
+
+import org.richfaces.demo.tables.data.capitals.Capital;
+
+@ManagedBean
+@SessionScoped
+public class CapitalsBean {
+
+ @ManagedProperty(value = "#{capitalsParser.capitalsList}")
+ private List<Capital> capitals;
+
+ public CapitalsBean() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public List<Capital> getCapitals() {
+ return capitals;
+ }
+
+ public void setCapitals(List<Capital> capitals) {
+ this.capitals = capitals;
+ }
+
+
+}
Copied:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CarsBean.java
(from rev 17197,
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/CarsBean.java)
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CarsBean.java
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CarsBean.java 2010-05-24
09:37:30 UTC (rev 17199)
@@ -0,0 +1,210 @@
+/**
+ *
+ */
+package org.richfaces.demo.tables;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.ViewScoped;
+import javax.faces.model.SelectItem;
+
+import org.richfaces.demo.common.data.RandomHelper;
+import org.richfaces.demo.tables.data.carstore.InventoryItem;
+import org.richfaces.demo.tables.data.carstore.InventoryVendorItem;
+import org.richfaces.demo.tables.data.carstore.InventoryVendorList;
+import org.richfaces.demo.tables.filter.CarsFilteringBean;
+
+@ManagedBean(name = "carsBean")
+@ViewScoped
+public class CarsBean implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3832235132261771583L;
+ private static final int DECIMALS = 1;
+ private static final int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;
+ private List<InventoryItem> allInventoryItems = null;
+ private List<InventoryVendorList> inventoryVendorLists = null;
+ @ManagedProperty("#{carsFilteringBean}")
+ private CarsFilteringBean filteringBean;
+
+ public List<SelectItem> getVendorOptions() {
+ List<SelectItem> result = new ArrayList<SelectItem>();
+ result.add(new SelectItem("",""));
+ for (InventoryVendorList vendorList : getInventoryVendorLists()) {
+ if
((filteringBean.getVendorFilter()==null)||(!filteringBean.getVendorFilter().equalsIgnoreCase(vendorList.getVendor()))){
+ result.add(new SelectItem(vendorList.getVendor()));
+
+ }
+ }
+ return result;
+ }
+
+ public List<String> getAllVendors() {
+ List<String> result = new ArrayList<String>();
+ for (InventoryVendorList vendorList : getInventoryVendorLists()) {
+ result.add(vendorList.getVendor());
+ }
+ return result;
+ }
+
+ public List<InventoryVendorList> getInventoryVendorLists() {
+ synchronized (this) {
+ if (inventoryVendorLists == null) {
+ inventoryVendorLists = new ArrayList<InventoryVendorList>();
+ List<InventoryItem> inventoryItems = getAllInventoryItems();
+
+ Collections.sort(inventoryItems, new Comparator<InventoryItem>() {
+ public int compare(InventoryItem o1, InventoryItem o2) {
+ if (o1.getVendor().equals(o2.getVendor())) {
+ return 0;
+ }
+ return 1;
+ }
+ });
+ Iterator<InventoryItem> iterator = inventoryItems.iterator();
+ InventoryVendorList vendorList = new InventoryVendorList();
+ vendorList.setVendor(inventoryItems.get(0).getVendor());
+ while (iterator.hasNext()) {
+ InventoryItem item = iterator.next();
+ InventoryVendorItem newItem = new InventoryVendorItem();
+ itemToVendorItem(item, newItem);
+ if (!item.getVendor().equals(vendorList.getVendor())) {
+ inventoryVendorLists.add(vendorList);
+ vendorList = new InventoryVendorList();
+ vendorList.setVendor(item.getVendor());
+ }
+ vendorList.getVendorItems().add(newItem);
+ }
+ inventoryVendorLists.add(vendorList);
+ }
+ }
+ return inventoryVendorLists;
+ }
+
+ private void itemToVendorItem(InventoryItem item, InventoryVendorItem newItem) {
+ newItem.setActivity(item.getActivity());
+ newItem.setChangePrice(item.getChangePrice());
+ newItem.setChangeSearches(item.getChangeSearches());
+ newItem.setDaysLive(item.getDaysLive());
+ newItem.setExposure(item.getExposure());
+ newItem.setInquiries(item.getInquiries());
+ newItem.setMileage(item.getMileage());
+ newItem.setMileageMarket(item.getMileageMarket());
+ newItem.setModel(item.getModel());
+ newItem.setPrice(item.getPrice());
+ newItem.setPriceMarket(item.getPriceMarket());
+ newItem.setPrinted(item.getPrinted());
+ newItem.setStock(item.getStock());
+ newItem.setVin(item.getVin());
+ }
+
+ public List<InventoryItem> getAllInventoryItems() {
+ synchronized (this) {
+ if (allInventoryItems == null) {
+ allInventoryItems = new ArrayList<InventoryItem>();
+
+ for (int k = 0; k <= 5; k++) {
+ try {
+ switch (k) {
+ case 0:
+ allInventoryItems.addAll(createCar("Chevrolet",
"Corvette", 5));
+ allInventoryItems.addAll(createCar("Chevrolet",
"Malibu", 8));
+ allInventoryItems.addAll(createCar("Chevrolet",
"Tahoe", 6));
+
+ break;
+
+ case 1:
+ allInventoryItems.addAll(createCar("Ford",
"Taurus", 12));
+ allInventoryItems.addAll(createCar("Ford",
"Explorer", 11));
+
+ break;
+
+ case 2:
+ allInventoryItems.addAll(createCar("Nissan",
"Maxima", 9));
+ allInventoryItems.addAll(createCar("Nissan",
"Frontier", 6));
+
+ break;
+
+ case 3:
+ allInventoryItems.addAll(createCar("Toyota",
"4-Runner", 7));
+ allInventoryItems.addAll(createCar("Toyota",
"Camry", 15));
+ allInventoryItems.addAll(createCar("Toyota",
"Avalon", 13));
+
+ break;
+
+ case 4:
+ allInventoryItems.addAll(createCar("GMC",
"Sierra", 8));
+ allInventoryItems.addAll(createCar("GMC",
"Yukon", 10));
+
+ break;
+
+ case 5:
+ allInventoryItems.addAll(createCar("Infiniti",
"G35", 6));
+ allInventoryItems.addAll(createCar("Infiniti",
"EX35", 5));
+
+ break;
+
+ default:
+ break;
+ }
+ } catch (Exception e) {
+ System.out.println("!!!!!!loadallInventoryItems Error:
" + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ return allInventoryItems;
+ }
+
+ public List<InventoryItem> createCar(String vendor, String model, int count) {
+ ArrayList<InventoryItem> iiList = null;
+
+ try {
+ int arrayCount = count;
+ InventoryItem[] demoInventoryItemArrays = new InventoryItem[arrayCount];
+
+ for (int j = 0; j < demoInventoryItemArrays.length; j++) {
+ InventoryItem ii = new InventoryItem();
+
+ ii.setVendor(vendor);
+ ii.setModel(model);
+ ii.setStock(RandomHelper.randomstring(6, 7));
+ ii.setVin(RandomHelper.randomstring(14, 15));
+ ii.setMileage(new BigDecimal(RandomHelper.rand(5000,
80000)).setScale(DECIMALS, ROUNDING_MODE));
+ ii.setMileageMarket(new BigDecimal(RandomHelper.rand(25000,
45000)).setScale(DECIMALS, ROUNDING_MODE));
+ ii.setPrice(new Integer(RandomHelper.rand(15000, 55000)));
+ ii.setPriceMarket(new BigDecimal(RandomHelper.rand(15000,
55000)).setScale(DECIMALS, ROUNDING_MODE));
+ ii.setDaysLive(RandomHelper.rand(1, 90));
+ ii.setChangeSearches(new BigDecimal(RandomHelper.rand(0,
5)).setScale(DECIMALS, ROUNDING_MODE));
+ ii.setChangePrice(new BigDecimal(RandomHelper.rand(0,
5)).setScale(DECIMALS, ROUNDING_MODE));
+ ii.setExposure(new BigDecimal(RandomHelper.rand(0, 5)).setScale(DECIMALS,
ROUNDING_MODE));
+ ii.setActivity(new BigDecimal(RandomHelper.rand(0, 5)).setScale(DECIMALS,
ROUNDING_MODE));
+ ii.setPrinted(new BigDecimal(RandomHelper.rand(0, 5)).setScale(DECIMALS,
ROUNDING_MODE));
+ ii.setInquiries(new BigDecimal(RandomHelper.rand(0,
5)).setScale(DECIMALS, ROUNDING_MODE));
+ demoInventoryItemArrays[j] = ii;
+ }
+
+ iiList = new
ArrayList<InventoryItem>(Arrays.asList(demoInventoryItemArrays));
+ } catch (Exception e) {
+ System.out.println("!!!!!!createCategory Error: " +
e.getMessage());
+ e.printStackTrace();
+ }
+
+ return iiList;
+ }
+
+ public void setFilteringBean(CarsFilteringBean filteringBean) {
+ this.filteringBean = filteringBean;
+ }
+}
Deleted:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/capitals/CapitalsBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/capitals/CapitalsBean.java 2010-05-24
06:41:57 UTC (rev 17198)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/capitals/CapitalsBean.java 2010-05-24
09:37:30 UTC (rev 17199)
@@ -1,29 +0,0 @@
-package org.richfaces.demo.tables.data.capitals;
-
-import java.util.List;
-
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ManagedProperty;
-import javax.faces.bean.SessionScoped;
-
-@ManagedBean
-@SessionScoped
-public class CapitalsBean {
-
- @ManagedProperty(value = "#{capitalsParser.capitalsList}")
- private List<Capital> capitals;
-
- public CapitalsBean() {
- // TODO Auto-generated constructor stub
- }
-
- public List<Capital> getCapitals() {
- return capitals;
- }
-
- public void setCapitals(List<Capital> capitals) {
- this.capitals = capitals;
- }
-
-
-}
Deleted:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/CarsBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/CarsBean.java 2010-05-24
06:41:57 UTC (rev 17198)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/data/carstore/CarsBean.java 2010-05-24
09:37:30 UTC (rev 17199)
@@ -1,173 +0,0 @@
-/**
- *
- */
-package org.richfaces.demo.tables.data.carstore;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
-
-import org.richfaces.demo.common.data.RandomHelper;
-
-@ManagedBean(name = "carsBean")
-@SessionScoped
-public class CarsBean {
- private static final int DECIMALS = 1;
- private static final int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;
- private List<InventoryItem> allInventoryItems = null;
- private List<InventoryVendorList> inventoryVendorLists = null;
-
- public List<InventoryVendorList> getInventoryVendorLists() {
- synchronized (this) {
- if (inventoryVendorLists == null){
- inventoryVendorLists = new ArrayList<InventoryVendorList>();
- List<InventoryItem> inventoryItems = getAllInventoryItems();
-
- Collections.sort(inventoryItems, new Comparator<InventoryItem>() {
- public int compare(InventoryItem o1, InventoryItem o2) {
- if (o1.getVendor().equals(o2.getVendor())){
- return 0;
- }
- return 1;
- }
- });
- Iterator<InventoryItem> iterator = inventoryItems.iterator();
- InventoryVendorList vendorList = new InventoryVendorList();
- vendorList.setVendor(inventoryItems.get(0).getVendor());
- while (iterator.hasNext()){
- InventoryItem item = iterator.next();
- InventoryVendorItem newItem = new InventoryVendorItem();
- itemToVendorItem(item, newItem);
- if (!item.getVendor().equals(vendorList.getVendor())){
- inventoryVendorLists.add(vendorList);
- vendorList = new InventoryVendorList();
- vendorList.setVendor(item.getVendor());
- }
- vendorList.getVendorItems().add(newItem);
- }
- inventoryVendorLists.add(vendorList);
- }
- }
- return inventoryVendorLists;
- }
-
- private void itemToVendorItem(InventoryItem item, InventoryVendorItem newItem) {
- newItem.setActivity(item.getActivity());
- newItem.setChangePrice(item.getChangePrice());
- newItem.setChangeSearches(item.getChangeSearches());
- newItem.setDaysLive(item.getDaysLive());
- newItem.setExposure(item.getExposure());
- newItem.setInquiries(item.getInquiries());
- newItem.setMileage(item.getMileage());
- newItem.setMileageMarket(item.getMileageMarket());
- newItem.setModel(item.getModel());
- newItem.setPrice(item.getPrice());
- newItem.setPriceMarket(item.getPriceMarket());
- newItem.setPrinted(item.getPrinted());
- newItem.setStock(item.getStock());
- newItem.setVin(item.getVin());
- }
-
- public List<InventoryItem> getAllInventoryItems() {
- synchronized (this) {
- if (allInventoryItems == null) {
- allInventoryItems = new ArrayList<InventoryItem>();
-
- for (int k = 0; k <= 5; k++) {
- try {
- switch (k) {
- case 0:
- allInventoryItems.addAll(createCar("Chevrolet",
"Corvette", 5));
- allInventoryItems.addAll(createCar("Chevrolet",
"Malibu", 8));
- allInventoryItems.addAll(createCar("Chevrolet",
"Tahoe", 6));
-
- break;
-
- case 1:
- allInventoryItems.addAll(createCar("Ford",
"Taurus", 12));
- allInventoryItems.addAll(createCar("Ford",
"Explorer", 11));
-
- break;
-
- case 2:
- allInventoryItems.addAll(createCar("Nissan",
"Maxima", 9));
- allInventoryItems.addAll(createCar("Nissan",
"Frontier", 6));
-
- break;
-
- case 3:
- allInventoryItems.addAll(createCar("Toyota",
"4-Runner", 7));
- allInventoryItems.addAll(createCar("Toyota",
"Camry", 15));
- allInventoryItems.addAll(createCar("Toyota",
"Avalon", 13));
-
- break;
-
- case 4:
- allInventoryItems.addAll(createCar("GMC",
"Sierra", 8));
- allInventoryItems.addAll(createCar("GMC",
"Yukon", 10));
-
- break;
-
- case 5:
- allInventoryItems.addAll(createCar("Infiniti",
"G35", 6));
- allInventoryItems.addAll(createCar("Infiniti",
"EX35", 5));
-
- break;
-
- default:
- break;
- }
- } catch (Exception e) {
- System.out.println("!!!!!!loadallInventoryItems Error:
" + e.getMessage());
- e.printStackTrace();
- }
- }
- }
- }
- return allInventoryItems;
- }
-
- public List<InventoryItem> createCar(String vendor, String model, int count) {
- ArrayList<InventoryItem> iiList = null;
-
- try {
- int arrayCount = count;
- InventoryItem[] demoInventoryItemArrays = new InventoryItem[arrayCount];
-
- for (int j = 0; j < demoInventoryItemArrays.length; j++) {
- InventoryItem ii = new InventoryItem();
-
- ii.setVendor(vendor);
- ii.setModel(model);
- ii.setStock(RandomHelper.randomstring(6, 7));
- ii.setVin(RandomHelper.randomstring(14, 15));
- ii.setMileage(new BigDecimal(RandomHelper.rand(5000,
80000)).setScale(DECIMALS, ROUNDING_MODE));
- ii.setMileageMarket(new BigDecimal(RandomHelper.rand(25000,
45000)).setScale(DECIMALS, ROUNDING_MODE));
- ii.setPrice(new Integer(RandomHelper.rand(15000, 55000)));
- ii.setPriceMarket(new BigDecimal(RandomHelper.rand(15000,
55000)).setScale(DECIMALS, ROUNDING_MODE));
- ii.setDaysLive(RandomHelper.rand(1, 90));
- ii.setChangeSearches(new BigDecimal(RandomHelper.rand(0,
5)).setScale(DECIMALS, ROUNDING_MODE));
- ii.setChangePrice(new BigDecimal(RandomHelper.rand(0,
5)).setScale(DECIMALS, ROUNDING_MODE));
- ii.setExposure(new BigDecimal(RandomHelper.rand(0, 5)).setScale(DECIMALS,
ROUNDING_MODE));
- ii.setActivity(new BigDecimal(RandomHelper.rand(0, 5)).setScale(DECIMALS,
ROUNDING_MODE));
- ii.setPrinted(new BigDecimal(RandomHelper.rand(0, 5)).setScale(DECIMALS,
ROUNDING_MODE));
- ii.setInquiries(new BigDecimal(RandomHelper.rand(0,
5)).setScale(DECIMALS, ROUNDING_MODE));
- demoInventoryItemArrays[j] = ii;
- }
-
- iiList = new
ArrayList<InventoryItem>(Arrays.asList(demoInventoryItemArrays));
- } catch (Exception e) {
- System.out.println("!!!!!!createCategory Error: " +
e.getMessage());
- e.printStackTrace();
- }
-
- return iiList;
- }
-}
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/filter/CarsFilteringBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/filter/CarsFilteringBean.java
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/filter/CarsFilteringBean.java 2010-05-24
09:37:30 UTC (rev 17199)
@@ -0,0 +1,65 @@
+package org.richfaces.demo.tables.filter;
+
+import java.io.Serializable;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.demo.tables.data.carstore.InventoryItem;
+import org.richfaces.model.Filter;
+
+@ManagedBean
+@ViewScoped
+public class CarsFilteringBean implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5680001353441022183L;
+ private String vinFilter;
+ private String vendorFilter;
+ private Long mileageFilter;
+
+ public Filter<?> getMileageFilterImpl() {
+ return new Filter<InventoryItem>() {
+ public boolean accept(InventoryItem item) {
+ Long mileage = getMileageFilter();
+ if (mileage == null || mileage.compareTo(item.getMileage().longValue())
>= 0) {
+ return true;
+ }
+ return false;
+ }
+ };
+ }
+
+ public boolean acceptVendor(InventoryItem item){
+ String vendor = getVendorFilter();
+ if (vendor ==null || vendor.length()==0 || vendor.equals(item.getVendor())){
+ return true;
+ }
+ return false;
+ }
+
+ public Long getMileageFilter() {
+ return mileageFilter;
+ }
+
+ public void setMileageFilter(Long mileageFilter) {
+ this.mileageFilter = mileageFilter;
+ }
+
+ public String getVendorFilter() {
+ return vendorFilter;
+ }
+
+ public void setVendorFilter(String vendorFilter) {
+ this.vendorFilter = vendorFilter;
+ }
+
+ public String getVinFilter() {
+ return vinFilter;
+ }
+
+ public void setVinFilter(String vinFilter) {
+ this.vinFilter = vinFilter;
+ }
+}
Modified:
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-05-24
06:41:57 UTC (rev 17198)
+++
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-05-24
09:37:30 UTC (rev 17199)
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- NOTES(TODO: move to some readme in future): id for sample should equals to xhtml
page name with the sample
-the same for demo id - it should be equals to name of the folder where samples placed
-->
+ <!--
+ NOTES(TODO: move to some readme in future): id for sample should
+ equals to xhtml page name with the sample the same for demo id - it
+ should be equals to name of the folder where samples placed
+ -->
<root>
<group>
<name>Ajax Action</name>
@@ -16,10 +19,10 @@
<sample>
<id>selectsUpdates</id>
<name>Dynamic Selects</name>
- </sample>
+ </sample>
</samples>
</demo>
- <demo new="true">
+ <demo>
<id>commandButton</id>
<name>a4j:commandButton</name>
<samples>
@@ -29,26 +32,26 @@
</sample>
</samples>
</demo>
- <demo new="true">
+ <demo>
<id>commandLink</id>
- <name>a4j:commandLink</name>
+ <name>a4j:commandLink</name>
<samples>
<sample>
- <id>commandLink</id>
+ <id>commandLink</id>
<name>Command Link Simple</name>
</sample>
</samples>
- </demo>
- <demo new="true">
+ </demo>
+ <demo>
<id>jsFunction</id>
- <name>a4j:jsFunction</name>
+ <name>a4j:jsFunction</name>
<samples>
<sample>
<id>jsFunction</id>
<name>jsFunction Simple</name>
</sample>
</samples>
- </demo>
+ </demo>
<demo new="true">
<id>poll</id>
<name>a4j:poll</name>
@@ -58,8 +61,8 @@
<name>Poll Simple</name>
</sample>
</samples>
- </demo>
- <demo new="true">
+ </demo>
+ <demo>
<id>push</id>
<name>a4j:push</name>
<samples>
@@ -68,11 +71,11 @@
<name>push Simple</name>
</sample>
</samples>
- </demo>
+ </demo>
</demos>
</group>
<group>
- <name>Ajax Queue</name>
+ <name>Ajax Queue</name>
<demos>
<demo new="true">
<id>queue</id>
@@ -83,7 +86,7 @@
<name>queue</name>
</sample>
</samples>
- </demo>
+ </demo>
<demo new="true">
<id>attachQueue</id>
<name>a4j:attachQueue</name>
@@ -94,12 +97,12 @@
</sample>
</samples>
</demo>
- </demos>
+ </demos>
</group>
<group>
- <name>Ajax Output/Indication</name>
+ <name>Ajax Output/Containers</name>
<demos>
- <demo new="true">
+ <demo>
<id>outputPanel</id>
<name>a4j:outputPanel</name>
<samples>
@@ -110,10 +113,10 @@
<sample>
<id>compositemessages</id>
<name>Auto update for h:messages component</name>
- </sample>
+ </sample>
</samples>
- </demo>
- <demo new="true">
+ </demo>
+ <demo>
<id>status</id>
<name>a4j:status</name>
<samples>
@@ -128,10 +131,20 @@
<sample>
<id>viewusage</id>
<name>Common status for view</name>
- </sample>
+ </sample>
</samples>
- </demo>
+ </demo>
<demo new="true">
+ <id>region</id>
+ <name>a4j:region</name>
+ <samples>
+ <sample>
+ <id>region</id>
+ <name>Region</name>
+ </sample>
+ </samples>
+ </demo>
+ <demo>
<id>mediaOutput</id>
<name>a4j:mediaOutput</name>
<samples>
@@ -142,10 +155,10 @@
<sample>
<id>imgUsage</id>
<name>mediaOutput for flash output</name>
- </sample>
+ </sample>
</samples>
- </demo>
- <demo new="true">
+ </demo>
+ <demo>
<id>log</id>
<name>a4j:log</name>
<samples>
@@ -154,8 +167,8 @@
<name>Log usage</name>
</sample>
</samples>
- </demo>
- </demos>
+ </demo>
+ </demos>
</group>
<group new="true">
<name>Data Iteration</name>
@@ -171,7 +184,15 @@
<sample>
<id>tableSorting</id>
<name>Data Table Sorting</name>
- </sample>
+ </sample>
+ <sample>
+ <id>tableFiltering</id>
+ <name>Data Table Filtering</name>
+ </sample>
+ <sample>
+ <id>tableFilteringAPI</id>
+ <name>Data Table Filtering API usage</name>
+ </sample>
</samples>
</demo>
<demo>
@@ -183,7 +204,7 @@
<name>ExtendedData Table Basic Usage</name>
</sample>
</samples>
- </demo>
- </demos>
+ </demo>
+ </demos>
</group>
</root>
Modified: root/examples/richfaces-showcase/trunk/src/main/webapp/WEB-INF/web.xml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/WEB-INF/web.xml 2010-05-24
06:41:57 UTC (rev 17198)
+++ root/examples/richfaces-showcase/trunk/src/main/webapp/WEB-INF/web.xml 2010-05-24
09:37:30 UTC (rev 17199)
@@ -17,14 +17,6 @@
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
- <context-param>
- <param-name>org.richfaces.CONTROL_SKINNING</param-name>
- <param-value>enable</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
- <param-value>enable</param-value>
- </context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/resources/rich/panel.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/resources/rich/panel.xhtml 2010-05-24
06:41:57 UTC (rev 17198)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/resources/rich/panel.xhtml 2010-05-24
09:37:30 UTC (rev 17199)
@@ -12,6 +12,7 @@
<body>
<composite:interface>
+ <composite:attribute name="id" required="false"/>
<composite:attribute name="style" required="false"/>
<composite:attribute name="styleClass" required="false"/>
<composite:attribute name="headerClass" required="false"/>
@@ -21,7 +22,7 @@
<composite:implementation>
<h:outputStylesheet name="rich/css/panel.css" />
- <div class="rich-panel #{compositeComponent.attrs.styleClass}"
+ <div class="rich-panel #{compositeComponent.attrs.styleClass}"
id="#{cc.attrs.id}"
style="#{cc.attrs.style}"
onclick="#{compositeComponent.attrs.onclick}"
ondblclick="#{compositeComponent.attrs.ondblclick}"
Deleted:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/subtables.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/subtables.xhtml 2010-05-24
06:41:57 UTC (rev 17198)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/subtables.xhtml 2010-05-24
09:37:30 UTC (rev 17199)
@@ -1,41 +0,0 @@
-<!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:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets"
-
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:tbl="http://richfaces.org/rich">
-
- <ui:composition>
- <h:form>
- <tbl:dataTable value="#{carsBean.allCars}" var="car"
id="table">
- <tbl:column>
- <f:facet name="header">
- <h:outputText value="Make" />
- </f:facet>
- <h:outputText value="#{car.make}"/>
- </tbl:column>
- <tbl:column>
- <f:facet name="header">
- <h:outputText value="Model" />
- </f:facet>
- <h:outputText value="#{car.model}"/>
- </tbl:column>
- <tbl:column>
- <f:facet name="header">
- <h:outputText value="Price" />
- </f:facet>
- <h:outputText value="#{car.price}"/>
- </tbl:column>
- <tbl:column>
- <f:facet name="header">
- <h:outputText value="Actions" />
- </f:facet>
- <a4j:commandLink value="Edit" action="#{carsBean.edit}"
render="table"/>
- <h:outputText value=" " />
- <a4j:commandLink value="Remove" action="#{carsBean.remove}"
render="table"/>
- </tbl:column>
- </tbl:dataTable>
- </h:form>
- </ui:composition>
-</html>
\ No newline at end of file
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFiltering.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFiltering.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFiltering.xhtml 2010-05-24
09:37:30 UTC (rev 17199)
@@ -0,0 +1,66 @@
+<!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:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:tbl="http://richfaces.org/rich"
+
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
+
+<ui:composition>
+ <h:form id="form">
+ <tbl:dataTable value="#{carsBean.allInventoryItems}" var="car"
+ id="table" rows="20">
+ <tbl:column accept="#{carsFiteringBean.acceptVendor}">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Vendor " />
+ <h:selectOneMenu value="#{carsFilteringBean.vendorFilter}">
+ <f:selectItems value="#{carsBean.vendorOptions}" />
+ <a4j:ajax render="form:table" execute="@this"
event="change"/>
+ </h:selectOneMenu>
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.vendor}" />
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:outputText value="Model" />
+ </f:facet>
+ <h:outputText value="#{car.model}" />
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{car.price}" />
+ </tbl:column>
+ <tbl:column filter="#{carsFilteringBean.mileageFilterImpl}">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Mileage < " />
+ <h:inputText value="#{carsFilteringBean.mileageFilter}">
+ <f:convertNumber groupingUsed="true"/>
+ <f:validateLongRange maximum="500000"/>
+ <a4j:ajax event="blur" render="form:table"
execute="@this" />
+ </h:inputText>
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.mileage}" />
+ </tbl:column>
+ <tbl:column
+ filterExpression="#{fn:containsIgnoreCase(car.vin,carFilteringBean.vinFilter)}">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="VIN " />
+ <h:inputText value="#{carFilteringBean.vinFilter}">
+ <a4j:ajax event="blur" render="form:table"
execute="@this" />
+ </h:inputText>
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.vin}" />
+ </tbl:column>
+ </tbl:dataTable>
+ </h:form>
+</ui:composition>
+</html>
\ No newline at end of file
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml 2010-05-24
09:37:30 UTC (rev 17199)
@@ -0,0 +1,80 @@
+<!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:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:tbl="http://richfaces.org/rich"
+
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich">
+
+<ui:composition>
+ <h:form id="form">
+ <h:panelGrid columns="2">
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Quick Filter Panel" />
+ </f:facet>
+ <fieldset><legend>Filter By Vendor</legend>
+ <ul>
+ <a4j:repeat value="#{carsBean.allVendors}" var="vendor">
+ <li><h:outputLink
+ value="javascript:document.getElementById('form:table').richfaces.component.filter('vendor',
'#{vendor}')">#{vendor}</h:outputLink>
+ </li>
+ </a4j:repeat>
+ </ul>
+ </fieldset>
+ </rich:panel>
+ <tbl:dataTable value="#{carsBean.allInventoryItems}" var="car"
+ id="table" rows="20">
+ <tbl:column id="vendor"
+ filterExpression="#{carsFilteringBean.vendorFilter == '' or
carsFilteringBean.vendorFilter == null or carsFilteringBean.vendorFilter ==
car.vendor}">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Vendor" />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.vendor}" />
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:outputText value="Model" />
+ </f:facet>
+ <h:outputText value="#{car.model}" />
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{car.price}" />
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Mileage" />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.mileage}" />
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Days Live" />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.daysLive}" />
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="VIN " />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.vin}" />
+ </tbl:column>
+ </tbl:dataTable>
+ </h:panelGrid>
+
+ </h:form>
+</ui:composition>
+</html>
\ No newline at end of file
Copied:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableSorting.xhtml
(from rev 17197,
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/subtables.xhtml)
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableSorting.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableSorting.xhtml 2010-05-24
09:37:30 UTC (rev 17199)
@@ -0,0 +1,41 @@
+<!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:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:tbl="http://richfaces.org/rich">
+
+ <ui:composition>
+ <h:form>
+ <tbl:dataTable value="#{carsBean.allCars}" var="car"
id="table">
+ <tbl:column>
+ <f:facet name="header">
+ <h:outputText value="Make" />
+ </f:facet>
+ <h:outputText value="#{car.make}"/>
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:outputText value="Model" />
+ </f:facet>
+ <h:outputText value="#{car.model}"/>
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{car.price}"/>
+ </tbl:column>
+ <tbl:column>
+ <f:facet name="header">
+ <h:outputText value="Actions" />
+ </f:facet>
+ <a4j:commandLink value="Edit" action="#{carsBean.edit}"
render="table"/>
+ <h:outputText value=" " />
+ <a4j:commandLink value="Remove" action="#{carsBean.remove}"
render="table"/>
+ </tbl:column>
+ </tbl:dataTable>
+ </h:form>
+ </ui:composition>
+</html>
\ No newline at end of file
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/region/region.xhtml
===================================================================
--- root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/region/region.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/region/region.xhtml 2010-05-24
09:37:30 UTC (rev 17199)
@@ -0,0 +1,81 @@
+<!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:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich">
+
+<ui:composition>
+ <p>a4j:region component designed for marking zones which should be
+ processed during Ajax requests without using execute definitions at
+ Ajax behaviors/components. This allow to decouple the processing definitions from
components id's
+ and use declarative wrapping by this tag instead.</p>
+ <p>In RichFaces 3.3 all the view was processed
+ if no regions specified as View Root itself was region by default. And in 4.x -
+ all the controls has execute="@this" by default according to JSF 2
specifications. But if the controls
+ wrapped with region component and has no execute definitions - them uses
execute="@region"</p>
+ <p>
+ Look to the simple example bellow. There are two similar user info panels. But the ajax
behaviors inside the
+ first panel uses execute declarations and pointed to panelGrid id. And the second panel
inputs just wrapped
+ to region without any additional execute definitions.
+ </p>
+ <h:form>
+ <h:panelGrid columns="2">
+ <rich:panel id="userInfoPanel1">
+ <f:facet name="header">
+ User Info Panel explicitly execute'd by Id
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:outputText value="User Name: " />
+ <h:inputText value="#{regionBean.user1.name}">
+ <a4j:ajax render="echopanel1" event="blur"
+ execute="userInfoPanel1" />
+ </h:inputText>
+ <h:outputText value="User email: " />
+ <h:inputText value="#{regionBean.user1.email}">
+ <a4j:ajax render="echopanel1" event="blur"
+ execute="userInfoPanel1" />
+ </h:inputText>
+ </h:panelGrid>
+ </rich:panel>
+ <rich:panel id="echopanel1">
+ <f:facet name="header">
+ Echo Panel
+ </f:facet>
+ <h:outputText value="#{regionBean.user1.name}" />
+ <h:outputText value="#{regionBean.user1.email}" />
+ </rich:panel>
+ </h:panelGrid>
+ </h:form>
+ <h:form>
+ <h:panelGrid columns="2">
+ <rich:panel>
+ <f:facet name="header">
+ User Info Panel with Region
+ </f:facet>
+ <a4j:region>
+ <h:panelGrid columns="2">
+ <h:outputText value="User Name: " />
+ <h:inputText value="#{regionBean.user1.name}">
+ <a4j:ajax render="echopanel2" event="blur" />
+ </h:inputText>
+ <h:outputText value="User email: " />
+ <h:inputText value="#{regionBean.user1.email}">
+ <a4j:ajax render="echopanel2" event="blur" />
+ </h:inputText>
+ </h:panelGrid>
+ </a4j:region>
+ </rich:panel>
+ <rich:panel id="echopanel2">
+ <f:facet name="header">
+ Echo Panel
+ </f:facet>
+ <h:outputText value="#{regionBean.user1.name}" />
+ <h:outputText value="#{regionBean.user1.email}" />
+ </rich:panel>
+ </h:panelGrid>
+ </h:form>
+ <a4j:log />
+</ui:composition>
+</html>
\ No newline at end of file