Author: ilya_shaikovsky
Date: 2010-01-14 11:50:06 -0500 (Thu, 14 Jan 2010)
New Revision: 16297
Modified:
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/datafilterslider/DemoInventoryList.java
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataFilterSlider/examples/filterData.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-8206
Modified:
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/datafilterslider/DemoInventoryList.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/datafilterslider/DemoInventoryList.java 2010-01-14
16:08:21 UTC (rev 16296)
+++
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/datafilterslider/DemoInventoryList.java 2010-01-14
16:50:06 UTC (rev 16297)
@@ -4,9 +4,11 @@
import java.util.List;
import javax.faces.component.UIData;
+import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.richfaces.component.UIDataFltrSlider;
+import org.richfaces.function.RichFunction;
public class DemoInventoryList {
@@ -119,62 +121,32 @@
public List getCarMakeIndex() {
return carMakeIndex;
}
-
+
public void setCarMakeIndex(List carMakeIndex) {
this.carMakeIndex = carMakeIndex;
}
- private UIData carMakeIndexUIData;
+ List carInventory = null;
-
- public UIData getCarMakeIndexUIData() {
- return carMakeIndexUIData;
+ public void setCarInventory(List carInventory) {
+ this.carInventory = carInventory;
}
- public void setCarMakeIndexUIData(UIData carMakeIndexUIData) {
- this.carMakeIndexUIData = carMakeIndexUIData;
- }
-
- public Object getCarInventory() {
-
- if (uiData == null){
+ public List getCarInventory() {
+ if (carInventory == null){
loadCarTable("1");
}
-
- return getUiData().getValue();
-
+ return carInventory;
}
protected void loadCarMakeIndex() {
-
carMakeIndex = dataFilterSliderDao.getAllCarMakes();
}
- UIData uiData;
-
-
- public UIData getUiData() {
- if(uiData == null){
- uiData = new UIData();
- }
- return uiData;
- }
-
- public void setUiData(UIData uiData) {
- this.uiData = uiData;
- }
-
public void loadCarTable(String id) {
- try{
-
- getUiData().setValue(dataFilterSliderDao.getCarsById(id));
-
- }catch(Exception e){
- e.printStackTrace();
- }
+ setCarInventory(dataFilterSliderDao.getCarsById(id));
}
-
private static final String carMileageColumnName = "Mileage";
private static final String carMileageMktAvgColumnName = "MktAvg";
private static final String carPriceColumnName = "Price";
@@ -218,24 +190,20 @@
loadCarTable(filterValue);
}
- UIDataFltrSlider dataFilterSlider;
-
-
- public UIDataFltrSlider getDataFilterSlider() {
- return dataFilterSlider;
- }
-
- public void setDataFilterSlider(UIDataFltrSlider dataFilterSlider) {
- this.dataFilterSlider = dataFilterSlider;
- }
-
public void filterCarList(ActionEvent event) {
+ String sliderId = FacesContext.getCurrentInstance().
+ getExternalContext().getRequestParameterMap().get("sliderId");
+ UIDataFltrSlider slider=null;
- UIDataFltrSlider slider = getDataFilterSlider();
- slider.resetDataTable();
-
+ if (sliderId!=null){
+ slider = (UIDataFltrSlider)RichFunction.findComponent(sliderId);
+ slider.resetDataTable();
+ }
+
try{
- filterValue = String.valueOf(carMakeIndexUIData.getRowIndex());
+ filterValue = FacesContext.getCurrentInstance().
+ getExternalContext().getRequestParameterMap().get("rowKey");
+
filterRule = getAttribute(event, "filterRule");
if (filterRule.equals("showTable")){
@@ -244,8 +212,10 @@
}catch(Exception e){
e.printStackTrace();
}
-
- slider.filterDataTable(slider.getHandleValue());
+
+ if (slider!=null){
+ slider.filterDataTable(slider.getHandleValue());
+ }
}
private static String getAttribute(ActionEvent event, String name) {
@@ -258,7 +228,7 @@
public int getGenRandom() {
return dataFilterSliderDao.genRand();
}
-
+
public void setGenRandom(int genRandom) {
this.genRandom = genRandom;
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataFilterSlider/examples/filterData.xhtml
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataFilterSlider/examples/filterData.xhtml 2010-01-14
16:08:21 UTC (rev 16296)
+++
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataFilterSlider/examples/filterData.xhtml 2010-01-14
16:50:06 UTC (rev 16297)
@@ -14,31 +14,31 @@
<h:form id="form1">
<a4j:queue />
- <rich:dataFilterSlider sliderListener="#{dfsBean.doSlide}"
- binding="#{inventoryList.dataFilterSlider}" for="carList"
+ <rich:dataFilterSlider for="carList"
forValRef="inventoryList.carInventory" filterBy="getMileage"
manualInput="true" onSlide="true" onChange="true"
storeResults="true"
width="200px" startRange="10000" endRange="60000"
increment="10000"
- trailer="true" handleValue="60000"/>
+ trailer="true" handleValue="60000" id="slider"/>
<rich:spacer height="15" />
- <h:dataTable id="carIndex" rows="10"
- binding="#{inventoryList.carMakeIndexUIData}"
+ <rich:dataTable id="carIndex" rows="10"
+ rowKeyVar="rowKey"
value="#{inventoryList.carMakeIndex}" var="category"
styleClass="list-table1" columnClasses="column-index"
rowClasses="list-row3">
- <h:column>
+ <rich:column>
<a4j:commandLink actionListener="#{inventoryList.filterCarList}"
reRender="carList">
<h:outputText value="#{category}" />
<f:attribute name="filterRule" value="showTable" />
-
+ <f:param name="sliderId" value="slider"/>
+ <f:param name="rowKey" value="#{rowKey}"/>
</a4j:commandLink>
- </h:column>
+ </rich:column>
- </h:dataTable>
+ </rich:dataTable>
<rich:spacer height="15" />
<rich:dataTable width="300" id="carList" rows="10"