Author: nbelaevski
Date: 2010-12-14 14:44:26 -0500 (Tue, 14 Dec 2010)
New Revision: 20567
Modified:
trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
Log:
https://issues.jboss.org/browse/RF-9993
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-14
18:07:01 UTC (rev 20566)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-14
19:44:26 UTC (rev 20567)
@@ -246,10 +246,6 @@
private Object rowKey = null;
- private boolean rowDataIsSet = false;
-
- private Object rowData;
-
private String clientId;
private Object originalVarValue;
@@ -371,34 +367,6 @@
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
@@ -647,15 +615,11 @@
}
public Object getRowData() {
- if (rowDataIsSet) {
- return rowData;
- }
-
return getExtendedDataModel().getRowData();
}
public boolean isRowAvailable() {
- return rowDataIsSet || getExtendedDataModel().isRowAvailable();
+ return getExtendedDataModel().isRowAvailable();
}
/**
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-14
18:07:01 UTC (rev 20566)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-14
19:44:26 UTC (rev 20567)
@@ -141,6 +141,8 @@
private transient TreeRange treeRange;
+ private transient UIComponent currentComponent = this;
+
public AbstractTree() {
setKeepSaved(true);
setRendererType("org.richfaces.TreeRenderer");
@@ -261,13 +263,13 @@
return Iterators.filter(children, new MatchingTreeNodePredicate(nodeType));
}
- protected UIComponent getCurrentComponent() {
+ protected void setupCurrentComponent() {
ExtendedDataModel<?> dataModel = getExtendedDataModel();
if (dataModel instanceof DeclarativeTreeModel) {
- return ((DeclarativeTreeModel) dataModel).getCurrentComponent();
+ currentComponent = ((DeclarativeTreeModel) dataModel).getCurrentComponent();
+ } else {
+ currentComponent = this;
}
-
- return this;
}
private boolean isDefaultTreeNode(AbstractTreeNode node) {
@@ -279,7 +281,7 @@
String nodeType = getNodeType();
- Iterator<UIComponent> nodesItr = findMatchingTreeNodeComponent(nodeType,
getCurrentComponent());
+ Iterator<UIComponent> nodesItr = findMatchingTreeNodeComponent(nodeType,
currentComponent);
boolean hasOnlyDefaultNodes = true;
while (nodesItr.hasNext()) {
@@ -593,5 +595,11 @@
getTreeDataModel().restoreFromSnapshot(tuple);
setRowKey(context, tuple.getRowKey());
}
+
+ @Override
+ protected void restoreChildState(FacesContext facesContext) {
+ setupCurrentComponent();
+ super.restoreChildState(facesContext);
+ }
}