[richfaces-svn-commits] JBoss Rich Faces SVN: r2066 - trunk/framework/test/src/test/java/org/richfaces/model.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Sun Aug 5 19:48:15 EDT 2007
Author: nbelaevski
Date: 2007-08-05 19:48:15 -0400 (Sun, 05 Aug 2007)
New Revision: 2066
Modified:
trunk/framework/test/src/test/java/org/richfaces/model/StackingTreeDataModelTest.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/test/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java 2007-08-05 23:48:11 UTC (rev 2065)
+++ trunk/framework/test/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java 2007-08-05 23:48:15 UTC (rev 2066)
@@ -154,6 +154,32 @@
assertNull(listener.getComponent());
}
+ public void testActiveData() throws Exception {
+ final ValueBinding fileVB = application.createValueBinding("#{directory.files}");
+ StackingTreeModel localFilesModel = new StackingTreeModel("file", "file", new StackingTreeModelDataProvider() {
+ public Object getData() {
+ return fileVB.getValue(facesContext);
+ }
+
+ }) {
+ protected boolean isActiveData() {
+ Map requestMap = externalContext.getRequestMap();
+ Object object = requestMap.get("file");
+ assertNotNull(object);
+ File file = (File) object;
+ if (file.getTag() == 61) {
+ return false;
+ }
+
+ return super.isActiveData();
+ }
+ };
+ directoriesModel.removeStackingModel(filesModel);
+ directoriesModel.addStackingModel(localFilesModel);
+
+ stackingTreeModel.walk(facesContext, new StackingTreeDataModelTestVisitor3(), null, null);
+ }
+
public void testKey() throws Exception {
Key key = new Key("aaa", new Integer(10));
Key key2 = new Key("aaa", new Integer(11));
@@ -347,6 +373,8 @@
assertFalse(stackingTreeModel.isLeaf());
} else if (named instanceof File) {
assertTrue(stackingTreeModel.isLeaf());
+ } else {
+ fail();
}
counter++;
@@ -387,5 +415,31 @@
return counter;
}
}
+
+ class StackingTreeDataModelTestVisitor3 implements DataVisitor, LastElementAware {
+
+ private boolean last;
+
+ public void process(FacesContext context, Object rowKey, Object argument)
+ throws IOException {
+
+ stackingTreeModel.setRowKey(rowKey);
+ Named named = (Named) stackingTreeModel.getRowData();
+ int tag = named.getTag();
+
+ if (tag == 60) {
+ assertTrue(last);
+ }
+ assertFalse(tag == 61);
+ }
+
+ public void resetLastElement() {
+ this.last = false;
+ }
+
+ public void setLastElement() {
+ this.last = true;
+ }
+ }
}
More information about the richfaces-svn-commits
mailing list