Author: nbelaevski
Date: 2010-12-01 11:30:13 -0500 (Wed, 01 Dec 2010)
New Revision: 20262
Modified:
trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
Log:
RF-9680:
- Added children() method to TreeDataModel & tuples
- Related refactorings for UIDataAdaptor
- Redesign API for walking over model
- Renderer updated for new API
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-01
16:27:24 UTC (rev 20261)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-01
16:30:13 UTC (rev 20262)
@@ -246,6 +246,10 @@
private Object rowKey = null;
+ private boolean rowDataIsSet = false;
+
+ private Object rowData;
+
private String clientId;
private Object originalVarValue;
@@ -367,6 +371,34 @@
return rowKey;
}
+ private void setRowKeyAndData(FacesContext facesContext, Object rowKey, boolean
localRowDataAvailable, Object localRowData) {
+ this.saveChildState(facesContext);
+
+ this.rowKey = rowKey;
+
+ if (localRowDataAvailable) {
+ this.rowData = localRowData;
+ this.rowDataIsSet = (rowKey != null);
+ } else {
+ this.rowData = null;
+ this.rowDataIsSet = false;
+
+ getExtendedDataModel().setRowKey(rowKey);
+ }
+
+ this.clientId = null;
+
+ boolean rowSelected = (rowKey != null) && isRowAvailable();
+
+ setupVariable(facesContext, rowSelected);
+
+ this.restoreChildState(facesContext);
+ }
+
+ protected void setRowKeyAndData(FacesContext facesContext, Object rowKey, Object
localRowData) {
+ setRowKeyAndData(facesContext, rowKey, true, localRowData);
+ }
+
/**
* Setup current row by key. Perform same functionality as
* {@link javax.faces.component.UIData#setRowIndex(int)}, but for key object - it may
be not only
@@ -615,11 +647,15 @@
}
public Object getRowData() {
+ if (rowDataIsSet) {
+ return rowData;
+ }
+
return getExtendedDataModel().getRowData();
}
public boolean isRowAvailable() {
- return getExtendedDataModel().isRowAvailable();
+ return rowDataIsSet || getExtendedDataModel().isRowAvailable();
}
/**
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-12-01
16:27:24 UTC (rev 20261)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-12-01
16:30:13 UTC (rev 20262)
@@ -162,7 +162,8 @@
writeTreeNodeEndElement();
} catch (IOException e) {
- throw new FacesException(e.getMessage(), e);
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
}
Show replies by date