[richfaces-svn-commits] JBoss Rich Faces SVN: r2067 - trunk/framework/api/src/main/java/org/richfaces/model.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Sun Aug 5 19:48:19 EDT 2007
Author: nbelaevski
Date: 2007-08-05 19:48:19 -0400 (Sun, 05 Aug 2007)
New Revision: 2067
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
Log:
- isActiveData() method added to StackingTreeModel
- unit test for StackingTreeModel updated
- active, activeRoot, activeNodes attributes introduced for UITreeNodes & UIRecursiveTreeNodes
- new attributes are used in sample application
Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-08-05 23:48:15 UTC (rev 2066)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-08-05 23:48:19 UTC (rev 2067)
@@ -234,25 +234,45 @@
getRoot().setRowKey(argumentKey);
}
- ShiftingDataVisitor shiftingDataVisitor = new ShiftingDataVisitor(
+ final ShiftingDataVisitor shiftingDataVisitor = new ShiftingDataVisitor(
new Visitor1(dataVisitor));
if (treeRange == null || treeRange.processChildren(argumentKey)) {
Iterator iterator = this.getInternalModelsIterator();
while (iterator.hasNext()) {
- StackingTreeModel model = (StackingTreeModel) iterator.next();
-
+ final StackingTreeModel model = (StackingTreeModel) iterator.next();
+ final ExtendedDataModel scalarModel = model.getDataModel();
+
Argument argument2 = new Argument();
argument2.listRowKey = argumentKey;
argument2.argument = argument;
// setup current model
argument2.model = model;
argument2.range = range;
- model.getDataModel().walk(context, shiftingDataVisitor, null,
- argument2);
+
+ scalarModel.walk(context, new DataVisitor() {
+ public void process(FacesContext context,
+ Object rowKey, Object argument)
+ throws IOException {
+
+ Object key = scalarModel.getRowKey();
+ scalarModel.setRowKey(rowKey);
+ Object data = scalarModel.getRowData();
+
+ Object variable = model.setupVariable(data, context);
+ boolean activeData = model.isActiveData();
+ model.setupVariable(variable, context);
+ scalarModel.setRowKey(key);
+
+ if (activeData) {
+ shiftingDataVisitor.process(context, rowKey, argument);
+ }
+ }
+
+ }, null, argument2);
+
}
-
}
shiftingDataVisitor.end(context);
@@ -406,6 +426,11 @@
model.setParent(this);
}
+ public void removeStackingModel(StackingTreeModel model) {
+ this.models.remove(model.id);
+ model.setParent(null);
+ }
+
/*
* (non-Javadoc)
*
@@ -506,6 +531,10 @@
}
}
+ protected boolean isActiveData() {
+ return true;
+ }
+
protected boolean isActive() {
return true;
}
More information about the richfaces-svn-commits
mailing list