JBoss Rich Faces SVN: r419 - trunk/richfaces/common/src/test/java/org/richfaces/json.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-13 21:22:47 -0400 (Fri, 13 Apr 2007)
New Revision: 419
Modified:
trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java
Log:
Json's main() call removed form tests
Modified: trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java
===================================================================
--- trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java 2007-04-14 00:43:07 UTC (rev 418)
+++ trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java 2007-04-14 01:22:47 UTC (rev 419)
@@ -40,13 +40,6 @@
super.tearDown();
}
- /**
- * Test method for {@link org.richfaces.json.Test#main(java.lang.String[])}.
- */
- public void testMain() {
- Test.main(null);
- }
-
public void testMap() throws Exception {
JSONMap map = new JSONMap("{text: 12, moreData: { key: value, key1: 23.04 }}");
assertEquals(12, ((Integer) map.get("text")).intValue());
19 years
JBoss Rich Faces SVN: r418 - in trunk/richfaces: common/src/test/java/org/richfaces/json and 39 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-13 20:43:07 -0400 (Fri, 13 Apr 2007)
New Revision: 418
Removed:
trunk/richfaces/modal-panel/src/main/java/org/richfaces/renderkit/html/images/
Modified:
trunk/richfaces/common/src/main/java/org/richfaces/json/JSONMap.java
trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java
trunk/richfaces/dataFilterSlider/pom.xml
trunk/richfaces/dataTable/pom.xml
trunk/richfaces/datascroller/pom.xml
trunk/richfaces/datascroller/src/main/config/component/datascroller.xml
trunk/richfaces/drag-drop/pom.xml
trunk/richfaces/drag-drop/src/main/config/component/dndParam.xml
trunk/richfaces/drag-drop/src/main/config/component/dragIndicator.xml
trunk/richfaces/drag-drop/src/main/config/component/dragSupport.xml
trunk/richfaces/drag-drop/src/main/config/component/dropSupport.xml
trunk/richfaces/dropdown-menu/pom.xml
trunk/richfaces/gmap/pom.xml
trunk/richfaces/gmap/src/main/config/component/gmap.xml
trunk/richfaces/inputnumber-slider/pom.xml
trunk/richfaces/inputnumber-slider/src/main/config/component/inputNumberSlider.xml
trunk/richfaces/menu-components/pom.xml
trunk/richfaces/modal-panel/pom.xml
trunk/richfaces/modal-panel/src/main/config/component/modalPanel.xml
trunk/richfaces/paint2D/pom.xml
trunk/richfaces/paint2D/src/main/config/component/paint2D.xml
trunk/richfaces/panelbar/pom.xml
trunk/richfaces/panelbar/src/main/config/component/panelbar.xml
trunk/richfaces/panelmenu/pom.xml
trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java
trunk/richfaces/simpleTogglePanel/pom.xml
trunk/richfaces/simpleTogglePanel/src/main/config/component/simpleTogglePanel.xml
trunk/richfaces/spacer/pom.xml
trunk/richfaces/spacer/src/main/config/component/spacer.xml
trunk/richfaces/suggestionbox/pom.xml
trunk/richfaces/suggestionbox/src/main/config/component/suggestionbox.xml
trunk/richfaces/tabPanel/pom.xml
trunk/richfaces/tabPanel/src/main/config/component/tabPanel.xml
trunk/richfaces/togglePanel/pom.xml
trunk/richfaces/togglePanel/src/main/config/component/togglePanel.xml
trunk/richfaces/toolBar/pom.xml
trunk/richfaces/toolBar/src/main/config/component/toolBar.xml
trunk/richfaces/tree/pom.xml
trunk/richfaces/tree/src/main/config/component/tree.xml
trunk/richfaces/tree/src/main/config/component/treeNode.xml
trunk/richfaces/tree/src/main/java/org/richfaces/component/ListRowKey.java
trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java
trunk/richfaces/tree/src/main/java/org/richfaces/component/UITreeNode.java
trunk/richfaces/tree/src/main/java/org/richfaces/component/state/TreeState.java
trunk/richfaces/tree/src/main/java/org/richfaces/component/state/events/TreeStateCommandEvent.java
trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java
trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
Log:
- Enabled automatic tests generation
- Added more tests for JSON, Tree
Modified: trunk/richfaces/common/src/main/java/org/richfaces/json/JSONMap.java
===================================================================
--- trunk/richfaces/common/src/main/java/org/richfaces/json/JSONMap.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/common/src/main/java/org/richfaces/json/JSONMap.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -97,14 +97,7 @@
}
public void remove() {
- if (this.currentName != null) {
-
- jsonObject.remove(this.currentName);
-
- this.currentName = null;
- } else {
- throw new IllegalArgumentException("remove() called without current key");
- }
+ throw new UnsupportedOperationException();
}
};
Modified: trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java
===================================================================
--- trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/common/src/test/java/org/richfaces/json/JsonTest.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -4,8 +4,11 @@
package org.richfaces.json;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import junit.framework.TestCase;
@@ -97,19 +100,74 @@
assertTrue(map.isEmpty());
}
- public void testMapGetString() throws Exception {
- JSONMap map = new JSONMap("{key: {innerKey: value, moreKey: {deepKey: aaa}}}");
+ public void testMapAddiition() throws Exception {
+ JSONMap map = new JSONMap();
+ Set set = map.entrySet();
+ set.add(new JsonTestMockMapEntry("boolean", new Boolean(true)));
+ set.add(new JsonTestMockMapEntry("double", new Double(23.45)));
+ set.add(new JsonTestMockMapEntry("integer", new Integer(56)));
+ set.add(new JsonTestMockMapEntry("long", new Long(89)));
+ set.add(new JsonTestMockMapEntry("string", "testString"));
- String[] split = map.getString().split("\n");
- assertTrue(split[1].startsWith("\"innerKey"));
- assertTrue(split[2].startsWith("\"moreKey"));
+ HashSet hashSet = new HashSet();
+
+ hashSet.add("15");
+ hashSet.add(new Double(45.01));
+
+ HashSet etalonSet = (HashSet) hashSet.clone();
+
+
+ HashMap hashMap = new HashMap();
+
+ hashMap.put("16", new Boolean(false));
+ hashMap.put("key", new Double(145.01));
+
+ HashMap etalonMap = (HashMap) hashMap.clone();
+
+ set.add(new JsonTestMockMapEntry("collection", hashSet));
+ set.add(new JsonTestMockMapEntry("map", hashMap));
+
+ assertEquals(Boolean.TRUE, map.get("boolean"));
+ assertEquals(new Double(23.45), map.get("double"));
+ assertEquals(new Integer(56), map.get("integer"));
+ assertEquals(new Long(89), map.get("long"));
+ assertEquals("testString", map.get("string"));
- split = map.getString(3).split("\n");
- assertTrue(split[1].startsWith(" \"innerKey"));
- assertTrue(split[2].startsWith(" \"moreKey"));
+ Collection collection = (Collection) map.get("collection");
+ assertTrue(etalonSet.containsAll(collection));
+ etalonSet.removeAll(collection);
+ assertTrue(etalonSet.isEmpty());
+
+ assertEquals(etalonMap, map.get("map"));
+ }
- split = map.getString(8).split("\n");
- assertTrue(split[1].startsWith(" \"innerKey"));
- assertTrue(split[2].startsWith(" \"moreKey"));
+}
+
+class JsonTestMockMapEntry implements Map.Entry {
+
+ private Object key;
+ private Object value;
+
+
+
+ public JsonTestMockMapEntry(Object key, Object value) {
+ super();
+ this.key = key;
+ this.value = value;
}
-}
+
+ public Object getKey() {
+ return key;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object setValue(Object newValue) {
+ Object oldValue = value;
+ value = newValue;
+ return oldValue;
+ }
+
+}
\ No newline at end of file
Modified: trunk/richfaces/dataFilterSlider/pom.xml
===================================================================
--- trunk/richfaces/dataFilterSlider/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/dataFilterSlider/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -22,6 +22,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/dataTable/pom.xml
===================================================================
--- trunk/richfaces/dataTable/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/dataTable/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/datascroller/pom.xml
===================================================================
--- trunk/richfaces/datascroller/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/datascroller/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/richfaces/datascroller/src/main/config/component/datascroller.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/datascroller/src/main/config/component/datascroller.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -10,6 +10,10 @@
<family>org.richfaces.Datascroller</family>
<classname>org.richfaces.component.html.HtmlDatascroller</classname>
<superclass>org.richfaces.component.UIDatascroller</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlDatascrollerComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[
]]>
Modified: trunk/richfaces/drag-drop/pom.xml
===================================================================
--- trunk/richfaces/drag-drop/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/drag-drop/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -22,6 +22,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/drag-drop/src/main/config/component/dndParam.xml
===================================================================
--- trunk/richfaces/drag-drop/src/main/config/component/dndParam.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/drag-drop/src/main/config/component/dndParam.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -6,6 +6,10 @@
<family>org.richfaces.DndParam</family>
<classname>org.richfaces.component.html.HtmlDndParam</classname>
<superclass>org.richfaces.component.UIDndParam</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlDndParamComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[A component is used for parameters transmission in Drag and Drop operations. It's also used for dragIndicator elements definition with transmitting some values for rendering in it.
]]>
Modified: trunk/richfaces/drag-drop/src/main/config/component/dragIndicator.xml
===================================================================
--- trunk/richfaces/drag-drop/src/main/config/component/dragIndicator.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/drag-drop/src/main/config/component/dragIndicator.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -6,6 +6,10 @@
<family>org.richfaces.DragIndicator</family>
<classname>org.richfaces.component.html.HtmlDragIndicator</classname>
<superclass>org.richfaces.component.UIDragIndicator</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlDragIndicatorComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[It's a component appearing under a mouse cursor during Drag'n'Drop operation and containing information on dragged element and elements.
]]>
Modified: trunk/richfaces/drag-drop/src/main/config/component/dragSupport.xml
===================================================================
--- trunk/richfaces/drag-drop/src/main/config/component/dragSupport.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/drag-drop/src/main/config/component/dragSupport.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -6,6 +6,10 @@
<family>org.richfaces.DragSupport</family>
<classname>org.richfaces.component.html.HtmlDragSupport</classname>
<superclass>org.richfaces.component.UIDragSupport</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlDragSupportComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[
]]>
Modified: trunk/richfaces/drag-drop/src/main/config/component/dropSupport.xml
===================================================================
--- trunk/richfaces/drag-drop/src/main/config/component/dropSupport.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/drag-drop/src/main/config/component/dropSupport.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -7,6 +7,10 @@
<family>org.richfaces.DropSupport</family>
<classname>org.richfaces.component.html.HtmlDropSupport</classname>
<superclass>org.richfaces.component.UIDropSupport</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlDropSupportComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[
]]>
Modified: trunk/richfaces/dropdown-menu/pom.xml
===================================================================
--- trunk/richfaces/dropdown-menu/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/dropdown-menu/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/gmap/pom.xml
===================================================================
--- trunk/richfaces/gmap/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/gmap/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/gmap/src/main/config/component/gmap.xml
===================================================================
--- trunk/richfaces/gmap/src/main/config/component/gmap.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/gmap/src/main/config/component/gmap.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -11,6 +11,7 @@
It presents the google map in JSF applications
]]>
</description>
+ <test />
<renderer generate="true" override="true">
<name>org.richfaces.GmapRenderer</name>
<template>gmap.jspx</template>
Modified: trunk/richfaces/inputnumber-slider/pom.xml
===================================================================
--- trunk/richfaces/inputnumber-slider/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/inputnumber-slider/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/inputnumber-slider/src/main/config/component/inputNumberSlider.xml
===================================================================
--- trunk/richfaces/inputnumber-slider/src/main/config/component/inputNumberSlider.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/inputnumber-slider/src/main/config/component/inputNumberSlider.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -12,6 +12,10 @@
<superclass>
org.richfaces.component.UIInputNumberSlider
</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlInputNumberSliderComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[A component that lets selecting a number from a numeric region. It is a horizontal
aligned scroll-like control with its own input field (optional) present. The keyboard input in a
Modified: trunk/richfaces/menu-components/pom.xml
===================================================================
--- trunk/richfaces/menu-components/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/menu-components/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/modal-panel/pom.xml
===================================================================
--- trunk/richfaces/modal-panel/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/modal-panel/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/modal-panel/src/main/config/component/modalPanel.xml
===================================================================
--- trunk/richfaces/modal-panel/src/main/config/component/modalPanel.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/modal-panel/src/main/config/component/modalPanel.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -6,6 +6,10 @@
<family>org.richfaces.ModalPanel</family>
<classname>org.richfaces.component.html.HtmlModalPanel</classname>
<superclass>org.richfaces.component.UIModalPanel</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlModalPanelComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[
]]>
Modified: trunk/richfaces/paint2D/pom.xml
===================================================================
--- trunk/richfaces/paint2D/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/paint2D/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/paint2D/src/main/config/component/paint2D.xml
===================================================================
--- trunk/richfaces/paint2D/src/main/config/component/paint2D.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/paint2D/src/main/config/component/paint2D.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -6,6 +6,10 @@
<family>javax.faces.Output</family>
<classname>org.richfaces.component.html.HtmlPaint2D</classname>
<superclass>org.richfaces.component.UIPaint2D</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlPaint2DComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[
Create an image by paint in a managed bean, same as paint (Graphics g) in SWING components.
Modified: trunk/richfaces/panelbar/pom.xml
===================================================================
--- trunk/richfaces/panelbar/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/panelbar/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/panelbar/src/main/config/component/panelbar.xml
===================================================================
--- trunk/richfaces/panelbar/src/main/config/component/panelbar.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/panelbar/src/main/config/component/panelbar.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -9,6 +9,10 @@
<family>org.richfaces.PanelBar</family>
<classname>org.richfaces.component.html.HtmlPanelBar</classname>
<superclass>org.richfaces.component.UIPanelBar</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlPanelBarComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[A component with categories sliding up and down to reveal and hide items under selected
categories (as used in Microsoft Outlook).
@@ -86,6 +90,10 @@
<description>Slider Panel Item</description>
<classname>org.richfaces.component.html.HtmlPanelBarItem</classname>
<superclass>org.richfaces.component.UIPanelBarItem</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlPanelBarItemComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<renderer generate="true" override="true">
<name>org.richfaces.PanelBarItemRenderer</name>
<template>panelBarItem.jspx</template>
Modified: trunk/richfaces/panelmenu/pom.xml
===================================================================
--- trunk/richfaces/panelmenu/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/panelmenu/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -24,6 +24,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java
===================================================================
--- trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,27 +21,35 @@
package org.richfaces.component;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.Page;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.ajax4jsf.framework.resource.InternetResourceBuilder;
-import org.ajax4jsf.framework.resource.ResourceBuilderImpl;
-import org.ajax4jsf.framework.resource.InternetResource;
-import org.ajax4jsf.framework.util.image.ImageInfo;
-import org.richfaces.renderkit.html.SeparatorRendererBase;
-
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
import javax.servlet.http.HttpServletResponse;
+import org.ajax4jsf.framework.resource.InternetResource;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceBuilderImpl;
+import org.ajax4jsf.framework.util.image.ImageInfo;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
/**
* Unit test for Separator component.
*/
public class SeparatorComponentTest extends AbstractAjax4JsfTestCase {
+ private static final String[] SUPPORTED_TYPES = {
+ UISeparator.LINE_TYPE_BEVEL,
+ UISeparator.LINE_TYPE_DASHED,
+ UISeparator.LINE_TYPE_DOTTED,
+ UISeparator.LINE_TYPE_DOUBLE,
+ UISeparator.LINE_TYPE_SOLID
+ };
+
private UISeparator ui;
private UIComponent form;
private UIOutput out1;
@@ -140,5 +148,45 @@
//image recognizable?
assertTrue(info.check());
assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+
+
+ ui.setLineType(UISeparator.LINE_TYPE_DOTTED);
+ renderView();
+ resource = builder.getResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, ui);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+
+ ui.setLineType(UISeparator.LINE_TYPE_DASHED);
+ renderView();
+ resource = builder.getResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, ui);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+
+ ui.setLineType(UISeparator.LINE_TYPE_DOUBLE);
+ renderView();
+ resource = builder.getResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, ui);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
}
}
Modified: trunk/richfaces/simpleTogglePanel/pom.xml
===================================================================
--- trunk/richfaces/simpleTogglePanel/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/simpleTogglePanel/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/simpleTogglePanel/src/main/config/component/simpleTogglePanel.xml
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/main/config/component/simpleTogglePanel.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/simpleTogglePanel/src/main/config/component/simpleTogglePanel.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -6,6 +6,10 @@
<family>org.richfaces.SimpleTogglePanel</family>
<classname>org.richfaces.component.html.HtmlSimpleTogglePanel</classname>
<superclass>org.richfaces.component.UISimpleTogglePanel</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlSimpleTogglePanelComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[Wrapper component with named facets. Every facet will be shown after activation
corresponding toggleControl(the other will be hidden).
Modified: trunk/richfaces/spacer/pom.xml
===================================================================
--- trunk/richfaces/spacer/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/spacer/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/spacer/src/main/config/component/spacer.xml
===================================================================
--- trunk/richfaces/spacer/src/main/config/component/spacer.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/spacer/src/main/config/component/spacer.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -12,6 +12,10 @@
By using style='display:block' can be used as a line spacer.
]]>
</description>
+ <test>
+ <classname>org.richfaces.component.html.HtmlSpacerComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<renderer generate="true" override="true">
<name>org.richfaces.SpacerRenderer</name>
<template>spacer.jspx</template>
Modified: trunk/richfaces/suggestionbox/pom.xml
===================================================================
--- trunk/richfaces/suggestionbox/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/suggestionbox/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -22,6 +22,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/suggestionbox/src/main/config/component/suggestionbox.xml
===================================================================
--- trunk/richfaces/suggestionbox/src/main/config/component/suggestionbox.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/suggestionbox/src/main/config/component/suggestionbox.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -8,6 +8,10 @@
org.richfaces.component.html.HtmlSuggestionBox
</classname>
<superclass>org.richfaces.component.UISuggestionBox</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlSuggestionBoxComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[
This element adds "on-keypress" suggestions capabilites to any input text component (like <h:inputText>).
Modified: trunk/richfaces/tabPanel/pom.xml
===================================================================
--- trunk/richfaces/tabPanel/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tabPanel/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/tabPanel/src/main/config/component/tabPanel.xml
===================================================================
--- trunk/richfaces/tabPanel/src/main/config/component/tabPanel.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tabPanel/src/main/config/component/tabPanel.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -9,6 +9,10 @@
<family>org.richfaces.TabPanel</family>
<classname>org.richfaces.component.html.HtmlTabPanel</classname>
<superclass>org.richfaces.component.UITabPanel</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlTabPanelComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[A tab panel displaying tabs for grouping content of a panel.
]]>
@@ -105,6 +109,10 @@
<family>org.richfaces.Tab</family>
<classname>org.richfaces.component.html.HtmlTab</classname>
<superclass>org.richfaces.component.UITab</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlTabComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[A tab section within a tab panel]]>
</description>
Modified: trunk/richfaces/togglePanel/pom.xml
===================================================================
--- trunk/richfaces/togglePanel/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/togglePanel/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/togglePanel/src/main/config/component/togglePanel.xml
===================================================================
--- trunk/richfaces/togglePanel/src/main/config/component/togglePanel.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/togglePanel/src/main/config/component/togglePanel.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -12,6 +12,10 @@
<classname>
org.richfaces.component.html.HtmlTogglePanel
</classname>
+ <test>
+ <classname>org.richfaces.component.html.HtmlTogglePanelComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[A collapsible panel, which content is shown/hidden after activating a header control.
]]>
@@ -91,6 +95,10 @@
<superclass>
org.richfaces.component.UIToggleControl
</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlToggleControlComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<renderer generate="true" override="true">
<name>org.richfaces.ToggleControlRenderer</name>
Modified: trunk/richfaces/toolBar/pom.xml
===================================================================
--- trunk/richfaces/toolBar/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/toolBar/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/toolBar/src/main/config/component/toolBar.xml
===================================================================
--- trunk/richfaces/toolBar/src/main/config/component/toolBar.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/toolBar/src/main/config/component/toolBar.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -7,6 +7,10 @@
<family>org.richfaces.ToolBar</family>
<classname>org.richfaces.component.html.HtmlToolBar</classname>
<superclass>org.richfaces.component.UIToolBar</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlToolBarComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[A horizontal bar with Action items on it that accepts any JSF components as children.]]>
</description>
@@ -94,6 +98,10 @@
<family>org.richfaces.ToolBar</family>
<superclass>org.richfaces.component.UIToolBarGroup</superclass>
<classname>org.richfaces.component.html.HtmlToolBarGroup</classname>
+ <test>
+ <classname>org.richfaces.component.html.HtmlToolBarGroupComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[The ToolBarGroup component description.]]>
</description>
Modified: trunk/richfaces/tree/pom.xml
===================================================================
--- trunk/richfaces/tree/pom.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/pom.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -22,6 +22,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Modified: trunk/richfaces/tree/src/main/config/component/tree.xml
===================================================================
--- trunk/richfaces/tree/src/main/config/component/tree.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/main/config/component/tree.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -12,6 +12,10 @@
<family>org.richfaces.Tree</family>
<classname>org.richfaces.component.html.HtmlTree</classname>
<superclass>org.richfaces.component.UITree</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlTreeComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[
]]>
Modified: trunk/richfaces/tree/src/main/config/component/treeNode.xml
===================================================================
--- trunk/richfaces/tree/src/main/config/component/treeNode.xml 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/main/config/component/treeNode.xml 2007-04-14 00:43:07 UTC (rev 418)
@@ -12,6 +12,10 @@
<family>org.richfaces.TreeNode</family>
<classname>org.richfaces.component.html.HtmlTreeNode</classname>
<superclass>org.richfaces.component.UITreeNode</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlTreeNodeComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
<description>
<![CDATA[
]]>
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/component/ListRowKey.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/component/ListRowKey.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/component/ListRowKey.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -179,10 +179,6 @@
if (rowKey instanceof ListRowKey) {
ListRowKey listRowKey = (ListRowKey) rowKey;
- if (listRowKey == null) {
- return false;
- }
-
int commonLength = getCommonPathLength(listRowKey);
if (commonLength != 0) {
return commonLength == depth();
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
-import java.util.NoSuchElementException;
import java.util.Set;
import javax.faces.application.Application;
@@ -445,7 +444,7 @@
protected Iterator fixedChildren() {
- return new NullIterator();
+ return getFacets().values().iterator();
}
@@ -614,14 +613,26 @@
addFacesListener(listener);
}
- public Object getDragValue() {
- return getRowKey();
+ public void removeChangeExpandListener(NodeExpandedListener listener) {
+ removeFacesListener(listener);
}
- public UIComponent getComponent() {
- return this;
+ public void removeNodeSelectListener(NodeSelectedListener listener) {
+ removeFacesListener(listener);
}
+ public NodeExpandedListener[] getChangeExpandListeners() {
+ return (NodeExpandedListener[]) getFacesListeners(NodeExpandedListener.class);
+ }
+
+ public NodeSelectedListener[] getNodeSelectListeners() {
+ return (NodeSelectedListener[]) getFacesListeners(NodeSelectedListener.class);
+ }
+
+ public Object getDragValue() {
+ return getRowKey();
+ }
+
public Object getDropValue() {
return getRowKey();
}
@@ -754,22 +765,4 @@
}
}
-/**
- * @author Nick Belaevski - nbelaevski(a)exadel.com created 04.01.2007
- *
- * Iterator stub class
- */
-class NullIterator implements Iterator {
- public boolean hasNext() {
- return false;
- }
-
- public Object next() {
- throw new NoSuchElementException();
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-}
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/component/UITreeNode.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/component/UITreeNode.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/component/UITreeNode.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -8,7 +8,6 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
@@ -32,9 +31,6 @@
public abstract class UITreeNode extends UIComponentBase implements
TreeListenerEventsProducer, Draggable, Dropzone {
- private String dragType;
- private Object acceptedTypes;
-
public static final String COMPONENT_TYPE = "org.richfaces.TreeNode";
public static final String COMPONENT_FAMILY = "org.richfaces.TreeNode";
@@ -80,11 +76,13 @@
public abstract String getSelectedClass();
public boolean hasAjaxSubmitSelection() {
- if ("inherit".equals(getAjaxSubmitSelection())) {
+ String ajaxSubmitSelection = getAjaxSubmitSelection();
+ if ("inherit".equals(ajaxSubmitSelection) ||
+ ajaxSubmitSelection == null || ajaxSubmitSelection.length() == 0) {
return getUITree().isAjaxSubmitSelection();
- } else if ("true".equals(getAjaxSubmitSelection())) {
+ } else if ("true".equals(ajaxSubmitSelection)) {
return true;
- } else if ("false".equals(getAjaxSubmitSelection())) {
+ } else if ("false".equals(ajaxSubmitSelection)) {
return false;
} else {
throw new IllegalArgumentException(
@@ -121,6 +119,23 @@
addFacesListener(listener);
}
+ public void removeChangeExpandListener(NodeExpandedListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public void removeNodeSelectListener(NodeSelectedListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public NodeExpandedListener[] getChangeExpandListeners() {
+ return (NodeExpandedListener[]) getFacesListeners(NodeExpandedListener.class);
+ }
+
+ public NodeSelectedListener[] getNodeSelectListeners() {
+ return (NodeSelectedListener[]) getFacesListeners(NodeSelectedListener.class);
+ }
+
+
/**
* Finds direct parent {@link UITree} component or throws
* {@link ClassCastException} if parent is not {@link UITree}
@@ -142,10 +157,6 @@
}
}
- public UIComponent getComponent() {
- return this;
- }
-
public void addDropListener(DropListener listener) {
addFacesListener(listener);
}
@@ -198,82 +209,4 @@
// TODO Auto-generated method stub
}
-
- /*
- * Key of a drag object. It's used to define a necessity of processing the current dragged element on the drop zone side
- * Getter for dragType
- * @return dragType value from local variable or value bindings
- */
- public String getDragType( ){
- if (null != this.dragType)
- {
- return this.dragType;
- }
- ValueBinding vb = getValueBinding("dragType");
- if (null != vb){
- return (String)vb.getValue(getFacesContext());
- } else {
- UITree tree = getUITree();
- if (tree != null) {
- return tree.getDragType();
- }
-
- return null;
- }
- }
- /*
- * Key of a drag object. It's used to define a necessity of processing the current dragged element on the drop zone side
- * Setter for dragType
- * @param dragType - new value
- */
- public void setDragType( String __dragType ){
- this.dragType = __dragType;
- }
- /*
- * List of drag types to be processd by the current drop zone.
- * Getter for acceptedTypes
- * @return acceptedTypes value from local variable or value bindings
- */
- public Object getAcceptedTypes( ){
- if (null != this.acceptedTypes)
- {
- return this.acceptedTypes;
- }
- ValueBinding vb = getValueBinding("acceptedTypes");
- if (null != vb){
- return (Object)vb.getValue(getFacesContext());
- } else {
- UITree tree = getUITree();
- if (tree != null) {
- return tree.getAcceptedTypes();
- }
-
- return null;
- }
- }
- /*
- * List of drag types to be processd by the current drop zone.
- * Setter for acceptedTypes
- * @param acceptedTypes - new value
- */
- public void setAcceptedTypes( Object __acceptedTypes ){
- this.acceptedTypes = __acceptedTypes;
- }
-
- public Object saveState(FacesContext context) {
- Object superState = super.saveState(context);
- Object[] state = new Object[3];
- state[0] = superState;
- state[1] = this.dragType;
- state[2] = this.acceptedTypes;
-
- return state;
- }
-
- public void restoreState(FacesContext context, Object state) {
- Object[] _state = (Object[]) state;
- super.restoreState(context, _state[0]);
- this.dragType = (String) _state[1];
- this.acceptedTypes = _state[2];
- }
}
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/component/state/TreeState.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/component/state/TreeState.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/component/state/TreeState.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -45,7 +45,7 @@
* @author Nick Belaevski - nbelaevski(a)exadel.com created 23.11.2006
*
*/
-public class TreeState implements DataComponentState, TreeStateCommandsListener,StateHolder {
+public class TreeState implements DataComponentState, TreeStateCommandsListener, StateHolder {
private final class Visitor implements DataVisitor {
private TreeRowKey key;
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/component/state/events/TreeStateCommandEvent.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/component/state/events/TreeStateCommandEvent.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/component/state/events/TreeStateCommandEvent.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -28,8 +28,6 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
-import org.richfaces.component.UITree;
-
/**
* @author Nick - mailto:nbelaevski@exadel.com
* created 01.12.2006
@@ -64,9 +62,5 @@
}
}
- protected UITree getTree() {
- return (UITree) getComponent();
- }
-
protected abstract void execute(TreeStateCommandsListener commandsListener) throws IOException;
}
Modified: trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,7 @@
package org.richfaces.component;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
@@ -28,6 +29,8 @@
import junit.framework.TestCase;
+import org.apache.commons.collections.iterators.ArrayIterator;
+
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
* created 09.04.2007
@@ -129,4 +132,166 @@
assertTrue(key1.equals(key2));
assertTrue(key1.toString().equals(key2.toString()));
}
+
+ public void testEqualsAndHash() {
+ List keyBase = new ArrayList();
+ keyBase.add(new Long(12));
+ keyBase.add("string");
+
+ List keyBase1 = new ArrayList();
+ keyBase1.add(keyBase);
+ keyBase1.add(new Double(23.56));
+ keyBase1.add("moreStrings");
+
+ List keyBase2 = new ArrayList();
+ keyBase2.add(keyBase);
+ keyBase2.add(new Double(23.56));
+ keyBase2.add("moreStrings");
+
+ ListRowKey rowKey = new ListRowKey(keyBase);
+ ListRowKey rowKey1 = new ListRowKey(keyBase1);
+ ListRowKey rowKey2 = new ListRowKey(keyBase2);
+
+ assertTrue(rowKey.equals(rowKey));
+ assertTrue(rowKey1.equals(rowKey1));
+ assertTrue(rowKey2.equals(rowKey2));
+
+ assertTrue(rowKey1.equals(rowKey2));
+ assertTrue(rowKey2.equals(rowKey1));
+
+ assertFalse(rowKey.equals(rowKey1));
+ assertFalse(rowKey.equals(rowKey2));
+ assertFalse(rowKey1.equals(rowKey));
+ assertFalse(rowKey2.equals(rowKey));
+
+ assertFalse(rowKey.equals(null));
+ assertFalse(rowKey1.equals(null));
+ assertFalse(rowKey2.equals(null));
+
+ TreeRowKey treeKey = new TreeRowKey() {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3323949145821721122L;
+
+ public int depth() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getCommonPathLength(TreeRowKey otherRowKey) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getPath() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator getSubPathIterator(int fromIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator iterator() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+
+ assertFalse(rowKey.equals(treeKey));
+ assertFalse(rowKey1.equals(treeKey));
+ assertFalse(rowKey2.equals(rowKey));
+
+ assertTrue(rowKey1.hashCode() == rowKey2.hashCode());
+
+ assertFalse(rowKey.hashCode() == rowKey1.hashCode());
+ assertFalse(rowKey.hashCode() == rowKey2.hashCode());
+ }
+
+ public void testSubPathIterator() throws Exception {
+ List keyBase = new ArrayList();
+ keyBase.add(new Long(13));
+ keyBase.add("string");
+
+ ListRowKey listRowKey = new ListRowKey(keyBase);
+ Iterator iterator = listRowKey.getSubPathIterator(0);
+ assertTrue(iterator.hasNext());
+ assertEquals(new Long(13), iterator.next());
+ assertTrue(iterator.hasNext());
+ assertEquals("string", iterator.next());
+ assertFalse(iterator.hasNext());
+
+ iterator = listRowKey.getSubPathIterator(1);
+ assertTrue(iterator.hasNext());
+ assertEquals("string", iterator.next());
+ assertFalse(iterator.hasNext());
+
+ iterator = listRowKey.getSubPathIterator(2);
+ assertFalse(iterator.hasNext());
+ }
+
+ public void testIsSubkey() throws Exception {
+ List keyBase = new ArrayList();
+ keyBase.add(new Long(12));
+
+ ListRowKey listRowKey = new ListRowKey(keyBase);
+
+ keyBase.add("string");
+
+ ListRowKey listRowKey1 = new ListRowKey(keyBase);
+
+ assertFalse(new ListRowKey().isSubKey(listRowKey1));
+ assertFalse(new ListRowKey().isSubKey(listRowKey));
+ assertTrue(listRowKey.isSubKey(new ListRowKey()));
+ assertTrue(listRowKey1.isSubKey(new ListRowKey()));
+
+ assertTrue(listRowKey.isSubKey(listRowKey1));
+ assertFalse(listRowKey1.isSubKey(listRowKey));
+
+ assertTrue(listRowKey.isSubKey(listRowKey));
+ assertTrue(listRowKey1.isSubKey(listRowKey1));
+
+ assertFalse(listRowKey.isSubKey(null));
+ assertFalse(listRowKey1.isSubKey(null));
+
+ TreeRowKey treeRowKey = new TreeRowKey() {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6975483562771738488L;
+
+ private Object[] data = new Object[] {
+ new Long(12),
+ "string",
+ new Double(3.14159265)
+ };
+
+ public int depth() {
+ return 3;
+ }
+
+ public int getCommonPathLength(TreeRowKey otherRowKey) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getPath() {
+ return "12:string:3.14159265";
+ }
+
+ public Iterator getSubPathIterator(int fromIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator iterator() {
+ return new ArrayIterator(data);
+ }
+
+ };
+
+ assertTrue(listRowKey.isSubKey(treeRowKey));
+ assertTrue(listRowKey1.isSubKey(treeRowKey));
+
+ assertFalse(treeRowKey.isSubKey(listRowKey));
+ assertFalse(treeRowKey.isSubKey(listRowKey));
+ }
}
Modified: trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeComponentTest.java 2007-04-13 18:58:54 UTC (rev 417)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeComponentTest.java 2007-04-14 00:43:07 UTC (rev 418)
@@ -21,6 +21,7 @@
package org.richfaces.component;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -30,18 +31,32 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.UIInput;
+import javax.faces.component.UIOutput;
import javax.faces.component.UIViewRoot;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlForm;
import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
import javax.servlet.http.HttpServletResponse;
+import org.ajax4jsf.dnd.event.DragEvent;
+import org.ajax4jsf.dnd.event.DragListener;
+import org.ajax4jsf.dnd.event.DropEvent;
+import org.ajax4jsf.dnd.event.DropListener;
import org.ajax4jsf.framework.resource.InternetResource;
import org.ajax4jsf.framework.resource.InternetResourceBuilder;
import org.ajax4jsf.framework.resource.ResourceBuilderImpl;
import org.ajax4jsf.framework.util.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
+import org.richfaces.component.events.NodeExpandedEvent;
+import org.richfaces.component.events.NodeExpandedListener;
+import org.richfaces.component.events.NodeSelectedEvent;
+import org.richfaces.component.events.NodeSelectedListener;
+import org.richfaces.component.state.events.ExpandAllCommandEvent;
+import org.richfaces.component.state.events.TreeStateCommandEvent;
import org.richfaces.component.xml.XmlTreeDataBuilder;
import org.xml.sax.InputSource;
@@ -91,7 +106,8 @@
private UICommand command = null;
private UIInput input = null;
private UIForm form = null;
- private UIComponent tree = null;
+ private UITree tree = null;
+ private UITreeNode treeNode = null;
/**
* Create the test case
@@ -125,9 +141,9 @@
form.getChildren().add(command);
- tree = application.createComponent(UITree.COMPONENT_TYPE);
+ tree = (UITree) application.createComponent(UITree.COMPONENT_TYPE);
- ((UITree) tree).setValue(
+ tree.setValue(
XmlTreeDataBuilder.build(
new InputSource(
this.getClass().
@@ -135,11 +151,14 @@
)));
form.getChildren().add(tree);
- ((UITree) tree).queueExpandAll();
+ tree.queueExpandAll();
+
+ treeNode = (UITreeNode) application.createComponent(UITreeNode.COMPONENT_TYPE);
+ treeNode.setType("node");
+
+ tree.getChildren().add(treeNode);
}
-
-
public void tearDown() throws Exception {
super.tearDown();
@@ -147,6 +166,7 @@
this.form = null;
this.command = null;
this.tree = null;
+ this.treeNode = null;
}
/**
@@ -156,8 +176,8 @@
public void testComponent() throws Exception
{
HtmlPage renderedView = renderView();
- System.out.println(renderedView.getWebResponse().getContentAsString());
-
+ //System.out.println(renderedView.getWebResponse().getContentAsString());
+/*
HtmlInput htmlInput = (HtmlInput) renderedView.getHtmlElementById(input.getClientId(facesContext));
htmlInput.setValueAttribute("testInput");
@@ -171,8 +191,6 @@
externalContext.addRequestParameterMap((String) keyValue.getKey(), (String) keyValue.getValue());
}
- System.out.println(this.webConnection.getLastParameters());
-
UIViewRoot root = facesContext.getViewRoot();
root.processDecodes(facesContext);
root.processValidators(facesContext);
@@ -180,7 +198,7 @@
root.processApplication(facesContext);
renderedView = renderView();
- System.out.println(renderedView.getWebResponse().getContentAsString());
+*/
}
public void testRenderStyle() throws Exception {
@@ -266,5 +284,442 @@
public void testProcess() {
}
+
+
+ /**
+ * Test method for {@link org.richfaces.component.UITreeNode#addChangeExpandListener(org.richfaces.component.events.NodeExpandedListener)}.
+ */
+ public final void testAddChangeExpandListener() {
+ NodeExpandedListener listener = new NodeExpandedListener() {
+
+ public void processExpansion(NodeExpandedEvent nodeExpandedEvent)
+ throws AbortProcessingException {
+ }
+
+ };
+ assertTrue(tree.getChangeExpandListeners().length == 0);
+ assertTrue(treeNode.getChangeExpandListeners().length == 0);
+
+ tree.addChangeExpandListener(listener);
+ treeNode.addChangeExpandListener(listener);
+
+ assertTrue(tree.getChangeExpandListeners().length == 1);
+ assertTrue(treeNode.getChangeExpandListeners().length == 1);
+
+ assertSame(listener, tree.getChangeExpandListeners()[0]);
+ assertSame(listener, treeNode.getChangeExpandListeners()[0]);
+
+ tree.removeChangeExpandListener(listener);
+ treeNode.removeChangeExpandListener(listener);
+
+ assertTrue(tree.getChangeExpandListeners().length == 0);
+ assertTrue(treeNode.getChangeExpandListeners().length == 0);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITreeNode#addNodeSelectListener(org.richfaces.component.events.NodeSelectedListener)}.
+ */
+ public final void testAddNodeSelectListener() {
+ NodeSelectedListener listener = new NodeSelectedListener() {
+
+ public void processSelection(NodeSelectedEvent nodeSelectedEvent)
+ throws AbortProcessingException {
+ }
+
+ };
+ assertTrue(tree.getNodeSelectListeners().length == 0);
+ assertTrue(treeNode.getNodeSelectListeners().length == 0);
+
+ tree.addNodeSelectListener(listener);
+ treeNode.addNodeSelectListener(listener);
+
+ assertTrue(tree.getNodeSelectListeners().length == 1);
+ assertTrue(treeNode.getNodeSelectListeners().length == 1);
+
+ assertSame(listener, tree.getNodeSelectListeners()[0]);
+ assertSame(listener, treeNode.getNodeSelectListeners()[0]);
+
+ tree.removeNodeSelectListener(listener);
+ treeNode.removeNodeSelectListener(listener);
+
+ assertTrue(tree.getNodeSelectListeners().length == 0);
+ assertTrue(treeNode.getNodeSelectListeners().length == 0);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITreeNode#getUITree()}.
+ */
+ public final void testGetUITree() {
+ assertSame(tree, treeNode.getUITree());
+ UITreeNode treeNode2 = (UITreeNode) application.createComponent(UITreeNode.COMPONENT_TYPE);
+ UIOutput output = new UIOutput();
+ tree.getChildren().add(output);
+ output.getChildren().add(treeNode2);
+ try {
+ treeNode2.getUITree();
+
+ fail();
+ } catch (Exception e) {
+ }
+
+ UITreeNode treeNode3 = (UITreeNode) application.createComponent(UITreeNode.COMPONENT_TYPE);
+ assertNull(treeNode3.getUITree());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITreeNode#addDropListener(org.ajax4jsf.dnd.event.DropListener)}.
+ */
+ public final void testAddDropListener() {
+ DropListener listener = new DropListener() {
+
+ public void processDrop(DropEvent event) {
+ }
+
+ };
+ assertTrue(tree.getDropListeners().length == 0);
+ assertTrue(treeNode.getDropListeners().length == 0);
+
+ tree.addDropListener(listener);
+ treeNode.addDropListener(listener);
+
+ assertTrue(tree.getDropListeners().length == 1);
+ assertTrue(treeNode.getDropListeners().length == 1);
+
+ assertSame(listener, tree.getDropListeners()[0]);
+ assertSame(listener, treeNode.getDropListeners()[0]);
+
+ tree.removeDropListener(listener);
+ treeNode.removeDropListener(listener);
+
+ assertTrue(tree.getDropListeners().length == 0);
+ assertTrue(treeNode.getDropListeners().length == 0);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITreeNode#addDragListener(org.ajax4jsf.dnd.event.DragListener)}.
+ */
+ public final void testAddDragListener() {
+ DragListener listener = new DragListener() {
+
+ public void processDrag(DragEvent event) {
+ }
+
+ };
+ assertTrue(tree.getDragListeners().length == 0);
+ assertTrue(treeNode.getDragListeners().length == 0);
+
+ tree.addDragListener(listener);
+ treeNode.addDragListener(listener);
+
+ assertTrue(tree.getDragListeners().length == 1);
+ assertTrue(treeNode.getDragListeners().length == 1);
+
+ assertSame(listener, tree.getDragListeners()[0]);
+ assertSame(listener, treeNode.getDragListeners()[0]);
+
+ tree.removeDragListener(listener);
+ treeNode.removeDragListener(listener);
+
+ assertTrue(tree.getDragListeners().length == 0);
+ assertTrue(treeNode.getDragListeners().length == 0);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITreeNode#getAttributes()}.
+ */
+ public final void testGetAttributes() {
+ assertSame(tree.getAttributes(), tree.getOrCreateDefaultFacet().getAttributes());
+ assertNotSame(tree.getAttributes(), treeNode.getAttributes());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITreeNode#getDragValue()}.
+ */
+ public final void testGetDragValue() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITreeNode#getDropValue()}.
+ */
+ public final void testGetDropValue() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#resetDataModel()}.
+ */
+ public final void testResetDataModel() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#getTreeNode()}.
+ */
+ public final void testGetTreeNode() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#queueEvent(javax.faces.event.FacesEvent)}.
+ */
+ public final void testQueueEventFacesEvent() {
+ NodeExpandedEvent nodeExpandedEvent = new NodeExpandedEvent(tree);
+ NodeSelectedEvent nodeSelectedEvent = new NodeSelectedEvent(tree);
+ ExpandAllCommandEvent expandAllCommandEvent = new ExpandAllCommandEvent(tree);
+ DragEvent dragEvent = new DragEvent(tree);
+ DropEvent dropEvent = new DropEvent(tree);
+
+ tree.queueEvent(nodeExpandedEvent);
+ tree.queueEvent(nodeSelectedEvent);
+ tree.queueEvent(expandAllCommandEvent);
+ tree.queueEvent(dragEvent);
+ tree.queueEvent(dropEvent);
+
+ assertEquals(PhaseId.INVOKE_APPLICATION, nodeExpandedEvent.getPhaseId());
+ assertEquals(PhaseId.UPDATE_MODEL_VALUES, nodeSelectedEvent.getPhaseId());
+ assertEquals(PhaseId.INVOKE_APPLICATION, expandAllCommandEvent.getPhaseId());
+ assertEquals(PhaseId.INVOKE_APPLICATION, dragEvent.getPhaseId());
+ assertEquals(PhaseId.INVOKE_APPLICATION, dropEvent.getPhaseId());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#queueEvent(javax.faces.event.FacesEvent)}.
+ */
+ public final void testQueueEventFacesEventImmediate() {
+ tree.setImmediate(true);
+
+ NodeExpandedEvent nodeExpandedEvent = new NodeExpandedEvent(tree);
+ NodeSelectedEvent nodeSelectedEvent = new NodeSelectedEvent(tree);
+ ExpandAllCommandEvent expandAllCommandEvent = new ExpandAllCommandEvent(tree);
+ DragEvent dragEvent = new DragEvent(tree);
+ DropEvent dropEvent = new DropEvent(tree);
+
+ tree.queueEvent(nodeExpandedEvent);
+ tree.queueEvent(nodeSelectedEvent);
+ tree.queueEvent(expandAllCommandEvent);
+ tree.queueEvent(dragEvent);
+ tree.queueEvent(dropEvent);
+
+ assertEquals(PhaseId.APPLY_REQUEST_VALUES, nodeExpandedEvent.getPhaseId());
+ assertEquals(PhaseId.APPLY_REQUEST_VALUES, nodeSelectedEvent.getPhaseId());
+ assertEquals(PhaseId.APPLY_REQUEST_VALUES, expandAllCommandEvent.getPhaseId());
+ assertEquals(PhaseId.APPLY_REQUEST_VALUES, dragEvent.getPhaseId());
+ assertEquals(PhaseId.APPLY_REQUEST_VALUES, dropEvent.getPhaseId());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#getNodeFacet()}.
+ */
+ public final void testGetNodeFacet() {
+ tree.setNodeFace("node");
+ assertSame(treeNode, tree.getNodeFacet());
+ }
+
+ public final void testGetOrCreateNodeFacet1() {
+ tree.setNodeFace(null);
+ assertNotNull(tree.getOrCreateDefaultFacet());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#getNodeFacet()}.
+ */
+ public final void testGetOrCreateNodeFacet2() {
+ tree.setNodeFace("node1");
+ assertNotNull(tree.getOrCreateDefaultFacet());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#walk(javax.faces.context.FacesContext, org.ajax4jsf.ajax.repeat.DataVisitor)}.
+ */
+ public final void testWalkFacesContextDataVisitor() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#walk(javax.faces.context.FacesContext, org.ajax4jsf.ajax.repeat.DataVisitor, org.richfaces.component.TreeRowKey, java.lang.Object)}.
+ */
+ public final void testWalkFacesContextDataVisitorTreeRowKeyObject() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#walkModel(javax.faces.context.FacesContext, org.ajax4jsf.ajax.repeat.DataVisitor, org.richfaces.component.TreeRowKey, java.lang.Object)}.
+ */
+ public final void testWalkModel() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#processDecodes(javax.faces.context.FacesContext)}.
+ */
+ public final void testProcessDecodesFacesContext() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#dataChildren()}.
+ */
+ public final void testDataChildren() {
+ UIOutput output = new UIOutput();
+ UIInput input = new UIInput();
+ UIInput input1 = new UIInput();
+
+ treeNode.getChildren().add(output);
+ treeNode.getChildren().add(input);
+
+ UITreeNode defaultFacet = tree.getOrCreateDefaultFacet();
+ defaultFacet.getChildren().add(input1);
+
+ tree.setNodeFace("node");
+
+ Iterator dataChildren = tree.dataChildren();
+ assertTrue(dataChildren.hasNext());
+ assertSame(treeNode, dataChildren.next());
+ assertFalse(dataChildren.hasNext());
+
+ tree.setNodeFace("");
+ dataChildren = tree.dataChildren();
+ assertTrue(dataChildren.hasNext());
+ assertSame(defaultFacet, dataChildren.next());
+ assertFalse(dataChildren.hasNext());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#isLeaf()}.
+ */
+ public final void testIsLeaf() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#isExpanded()}.
+ */
+ public final void testIsExpanded() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#isSelected()}.
+ */
+ public final void testIsSelected() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#fixedChildren()}.
+ */
+ public final void testFixedChildren() {
+ Iterator fixedChildren = tree.fixedChildren();
+ assertFalse(fixedChildren.hasNext());
+
+ UIInput input = new UIInput();
+ UIOutput output = new UIOutput();
+ tree.getFacets().put("facet1", input);
+ tree.getFacets().put("facet2", output);
+
+ fixedChildren = tree.fixedChildren();
+ List children = new ArrayList();
+
+ assertTrue(fixedChildren.hasNext());
+ children.add(fixedChildren.next());
+ assertTrue(fixedChildren.hasNext());
+ children.add(fixedChildren.next());
+ assertFalse(fixedChildren.hasNext());
+
+ assertTrue(children.contains(input));
+ assertTrue(children.contains(output));
+ assertEquals(2, children.size());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#createComponentState()}.
+ */
+ public final void testCreateComponentState() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#isStopInCollapsed()}.
+ */
+ public final void testIsStopInCollapsed() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#broadcast(javax.faces.event.FacesEvent)}.
+ */
+ public final void testBroadcastFacesEvent() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#hasAjaxSubmitSelection()}.
+ */
+ public final void testHasAjaxSubmitSelection() {
+ assertTrue(tree.isAjaxSubmitSelection() == tree.hasAjaxSubmitSelection());
+ assertFalse(tree.isAjaxSubmitSelection());
+ assertFalse(treeNode.hasAjaxSubmitSelection());
+
+ treeNode.setAjaxSubmitSelection("true");
+ assertTrue(treeNode.hasAjaxSubmitSelection());
+
+ treeNode.setAjaxSubmitSelection("inherit");
+ assertFalse(treeNode.hasAjaxSubmitSelection());
+
+ tree.setAjaxSubmitSelection(true);
+ assertTrue(tree.isAjaxSubmitSelection() == tree.hasAjaxSubmitSelection());
+ assertTrue(tree.isAjaxSubmitSelection());
+
+ assertTrue(treeNode.hasAjaxSubmitSelection());
+
+ treeNode.setAjaxSubmitSelection("false");
+ assertTrue(tree.isAjaxSubmitSelection());
+ assertFalse(treeNode.hasAjaxSubmitSelection());
+
+ treeNode.setAjaxSubmitSelection(null);
+ treeNode.hasAjaxSubmitSelection();
+ assertTrue(treeNode.hasAjaxSubmitSelection());
+
+ treeNode.setAjaxSubmitSelection("");
+ treeNode.hasAjaxSubmitSelection();
+ assertTrue(treeNode.hasAjaxSubmitSelection());
+
+ try {
+ treeNode.setAjaxSubmitSelection("untrue");
+ treeNode.hasAjaxSubmitSelection();
+
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#createDataModel()}.
+ */
+ public final void testCreateDataModel() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#queueNodeExpand(org.richfaces.component.TreeRowKey)}.
+ */
+ public final void testQueueNodeExpand() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#queueNodeCollapse(org.richfaces.component.TreeRowKey)}.
+ */
+ public final void testQueueNodeCollapse() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#queueExpandAll()}.
+ */
+ public final void testQueueExpandAll() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#queueCollapseAll()}.
+ */
+ public final void testQueueCollapseAll() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#getRowData(java.lang.Object)}.
+ */
+ public final void testGetRowDataObject() {
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UITree#getTreeNode(java.lang.Object)}.
+ */
+ public final void testGetTreeNodeObject() {
+ }
}
19 years
JBoss Rich Faces SVN: r417 - trunk/richfaces/inputnumber-spinner/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-04-13 14:58:54 -0400 (Fri, 13 Apr 2007)
New Revision: 417
Modified:
trunk/richfaces/inputnumber-spinner/src/main/config/component/inputNumberSpinner.xml
Log:
Modified: trunk/richfaces/inputnumber-spinner/src/main/config/component/inputNumberSpinner.xml
===================================================================
--- trunk/richfaces/inputnumber-spinner/src/main/config/component/inputNumberSpinner.xml 2007-04-13 18:58:35 UTC (rev 416)
+++ trunk/richfaces/inputnumber-spinner/src/main/config/component/inputNumberSpinner.xml 2007-04-13 18:58:54 UTC (rev 417)
@@ -9,6 +9,11 @@
<family>org.richfaces.inputNumberSpinner</family>
<classname>org.richfaces.component.html.HtmlInputNumberSpinner</classname>
<superclass>org.richfaces.component.UIInputNumberSpinner</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlInputNumberSpinnerComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+
<description>
<![CDATA[Spinner component - A single line input field that lets the user select a number using the controls near the
text field. User can change value using Up/Down keyboard keys. The keyboard Input in field if it isn't
@@ -26,6 +31,11 @@
<superclass>
org.ajax4jsf.framework.taglib.HtmlComponentTagBase
</superclass>
+ <test>
+ <classname>org.richfaces.taglib.HtmlInputNumberSpinnerTagTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+
</tag>
<property>
<name>minValue</name>
19 years
JBoss Rich Faces SVN: r416 - trunk/richfaces/inputnumber-spinner.
by richfaces-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-04-13 14:58:35 -0400 (Fri, 13 Apr 2007)
New Revision: 416
Modified:
trunk/richfaces/inputnumber-spinner/pom.xml
Log:
Modified: trunk/richfaces/inputnumber-spinner/pom.xml
===================================================================
--- trunk/richfaces/inputnumber-spinner/pom.xml 2007-04-13 18:07:07 UTC (rev 415)
+++ trunk/richfaces/inputnumber-spinner/pom.xml 2007-04-13 18:58:35 UTC (rev 416)
@@ -16,11 +16,19 @@
<version>1.1.1-SNAPSHOT</version>
<executions>
<execution>
+ <id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
19 years
JBoss Rich Faces SVN: r415 - trunk/richfaces/dataFilterSlider/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-13 14:07:07 -0400 (Fri, 13 Apr 2007)
New Revision: 415
Modified:
trunk/richfaces/dataFilterSlider/src/main/templates/dataFilterSlider.jspx
Log:
Build broken fixed
Modified: trunk/richfaces/dataFilterSlider/src/main/templates/dataFilterSlider.jspx
===================================================================
--- trunk/richfaces/dataFilterSlider/src/main/templates/dataFilterSlider.jspx 2007-04-13 17:29:02 UTC (rev 414)
+++ trunk/richfaces/dataFilterSlider/src/main/templates/dataFilterSlider.jspx 2007-04-13 18:07:07 UTC (rev 415)
@@ -9,7 +9,7 @@
xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
class="org.richfaces.renderkit.html.DataFilterSliderRenderer"
baseclass="org.richfaces.renderkit.DataFilterSliderRendererBase"
- component="org.richfaces.component.UIDataFilterSlider">
+ component="org.richfaces.component.UIDataFltrSlider">
<h:styles>css/dataFilterSlider.xcss</h:styles>
<h:scripts>new org.ajax4jsf.framework.resource.PrototypeScript(),scripts/scriptaculous-js-1.6.5/src/slider.js</h:scripts>
19 years
JBoss Rich Faces SVN: r414 - in trunk/richfaces/tree/src: main/java/org/richfaces/renderkit and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-13 13:29:02 -0400 (Fri, 13 Apr 2007)
New Revision: 414
Modified:
trunk/richfaces/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java
trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java
trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java
trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java
trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java
trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeNodeTest.java
trunk/richfaces/tree/src/test/java/org/richfaces/component/xml/TreeDataBuilderTest.java
Log:
Tree not expanding in "ajax" mode reopened fixed
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java 2007-04-13 17:12:45 UTC (rev 413)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java 2007-04-13 17:29:02 UTC (rev 414)
@@ -46,9 +46,10 @@
public void process(FacesContext context, Object rowKey, Object argument)
throws IOException {
- treeDataModel.setRowKey(rowKey);
- locateTreeNode((TreeRowKey) rowKey, true).setData(
- treeDataModel.getRowData());
+ TreeRowKey treeRowKey = (TreeRowKey) rowKey;
+ treeDataModel.setRowKey(treeRowKey);
+ locateTreeNode(treeRowKey, true).setData(treeDataModel.getRowData());
+
if (visitor != null) {
visitor.process(context, rowKey, argument);
}
@@ -115,7 +116,7 @@
TreeNode treeNode = treeDataModel.locateTreeNode(rowKey);
if (treeNode != null) {
- if (cachedTreeNode == null || (!treeNode.isLeaf() && cachedTreeNode.isLeaf())) {
+ if (cachedTreeNode == null || (cachedTreeNode.isLeaf() && !treeNode.isLeaf())) {
//fill cache
treeDataModel.walk(context, new Visitor(dataVisitor), range,
rowKey, argument, last);
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java 2007-04-13 17:12:45 UTC (rev 413)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java 2007-04-13 17:29:02 UTC (rev 414)
@@ -25,6 +25,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
+import java.util.Set;
import javax.faces.application.Application;
import javax.faces.component.NamingContainer;
@@ -129,7 +130,7 @@
Application application = facesContext.getApplication();
defaultFacet = (UITreeNode) application
.createComponent(UITreeNode.COMPONENT_TYPE);
- defaultFacet.setId(facesContext.getViewRoot().createUniqueId());
+ defaultFacet.setId("_defaultNodeFace");
defaultFacet.setParent(this);
defaultFacet.getAttributes().put(
UITreeNode.DEFAULT_NODE_FACE_ATTRIBUTE_NAME, Boolean.TRUE);
@@ -248,9 +249,19 @@
if (cacheableModel != null) {
if (cacheableModel.isTransient()) {
state.setTreeDataModel(null);
+ setExtendedDataModel(createDataModel(false));
+ } else {
+ Set ajaxKeys = getAjaxKeys();
+ for (Iterator iterator = ajaxKeys.iterator(); iterator
+ .hasNext();) {
+ TreeRowKey treeRowKey = (TreeRowKey) iterator.next();
+
+ cacheableModel.resetSub(treeRowKey);
+ }
}
}
+
// transfer nodes delayed to open to rendering queue
state.transferQueuedNodes();
// re-set stopInCollapsed to handle AJAX switch type change
@@ -478,8 +489,7 @@
return isAjaxSubmitSelection();
}
-
- protected ExtendedDataModel createDataModel() {
+ private ExtendedDataModel createDataModel(boolean allowTransientModel) {
TreeState state = ((TreeState) getComponentState());
CacheableTreeDataModel stateModel = state.getTreeDataModel();
@@ -488,7 +498,7 @@
if (stateModel == null) {
String preserveModel = getPreserveModel();
- if (PRESERVE_MODEL_REQUEST.equals(preserveModel)) {
+ if (allowTransientModel && PRESERVE_MODEL_REQUEST.equals(preserveModel)) {
stateModel = new CacheableTreeRequestDataModel(treeDataModel);
state.setTreeDataModel(stateModel);
} else if (PRESERVE_MODEL_STATE.equals(preserveModel)) {
@@ -504,6 +514,11 @@
return stateModel;
}
+
+
+ protected ExtendedDataModel createDataModel() {
+ return createDataModel(true);
+ }
/**
* Queues expansion command for node whose row key is equal to rowKey
@@ -691,8 +706,8 @@
String id = super.getId();
if (id == null) {
- id = FacesContext.getCurrentInstance().getViewRoot()
- .createUniqueId();
+ id = "_defaultNodeFaceOutput";//FacesContext.getCurrentInstance().getViewRoot()
+ //.createUniqueId();
setId(id);
}
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java 2007-04-13 17:12:45 UTC (rev 413)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java 2007-04-13 17:29:02 UTC (rev 414)
@@ -30,7 +30,6 @@
import org.richfaces.component.state.events.CollapseNodeCommandEvent;
import org.richfaces.component.state.events.ExpandNodeCommandEvent;
import org.richfaces.component.util.ViewUtil;
-import org.richfaces.renderkit.DnDParametersEncoder;
/**
* @author Nick - mailto:nbelaevski@exadel.com created 23.11.2006
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2007-04-13 17:12:45 UTC (rev 413)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2007-04-13 17:29:02 UTC (rev 414)
@@ -41,13 +41,11 @@
import org.ajax4jsf.framework.util.javascript.JSFunction;
import org.ajax4jsf.framework.util.javascript.JSReference;
import org.ajax4jsf.framework.util.javascript.ScriptUtils;
-import org.richfaces.component.CacheableTreeDataModel;
import org.richfaces.component.LastElementAware;
import org.richfaces.component.TreeRowKey;
import org.richfaces.component.UITree;
import org.richfaces.component.UITreeNode;
import org.richfaces.component.nsutils.NSUtils;
-import org.richfaces.component.state.TreeState;
public abstract class TreeRendererBase extends CompositeRenderer {
@@ -159,7 +157,7 @@
while (ajaxKeysItr.hasNext()) {
TreeRowKey key = (TreeRowKey) ajaxKeysItr.next();
tree.setRowKey(key);
-
+
String id = tree.getNodeFacet().getClientId(context);
if (ids.isEmpty() || ids.contains(id) || ids.contains(tree.getClientId(context))/* handle tree updates requests */) {
writeContent(context, tree, key);
@@ -301,12 +299,6 @@
TreeRowKey rowKey = (TreeRowKey) key;
- TreeState state = (TreeState) input.getComponentState();
- CacheableTreeDataModel cacheableModel = state.getTreeDataModel();
- if (cacheableModel != null) {
- cacheableModel.resetSub(rowKey);
- }
-
final TreeDataModelEventNavigator levelNavigator = new TreeDataModelEventNavigator(
input, rowKey) {
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java 2007-04-13 17:12:45 UTC (rev 413)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java 2007-04-13 17:29:02 UTC (rev 414)
@@ -31,7 +31,6 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.framework.resource.ResourceContext;
-import org.richfaces.renderkit.html.images.TreeImageBase.TreeImageData;
public class TreePlusImage extends TreeImageBase {
private static final Dimension dimensions = new Dimension(16, 16);
Modified: trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java 2007-04-13 17:12:45 UTC (rev 413)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java 2007-04-13 17:29:02 UTC (rev 414)
@@ -21,9 +21,7 @@
package org.richfaces.component;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
Modified: trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeNodeTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeNodeTest.java 2007-04-13 17:12:45 UTC (rev 413)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeNodeTest.java 2007-04-13 17:29:02 UTC (rev 414)
@@ -23,10 +23,6 @@
import java.util.Iterator;
-import javax.faces.component.UIViewRoot;
-
-import org.richfaces.component.html.HtmlTree;
-
import junit.framework.TestCase;
/**
Modified: trunk/richfaces/tree/src/test/java/org/richfaces/component/xml/TreeDataBuilderTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/xml/TreeDataBuilderTest.java 2007-04-13 17:12:45 UTC (rev 413)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/xml/TreeDataBuilderTest.java 2007-04-13 17:29:02 UTC (rev 414)
@@ -24,11 +24,11 @@
import java.util.Iterator;
import java.util.Map;
+import junit.framework.TestCase;
+
import org.richfaces.component.TreeNode;
import org.xml.sax.InputSource;
-import junit.framework.TestCase;
-
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
* created 30.03.2007
19 years
JBoss Rich Faces SVN: r413 - trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-04-13 13:12:45 -0400 (Fri, 13 Apr 2007)
New Revision: 413
Modified:
trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
Log:
Fix round float values to precision.
Modified: trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
===================================================================
--- trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-04-13 16:35:49 UTC (rev 412)
+++ trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-04-13 17:12:45 UTC (rev 413)
@@ -99,28 +99,25 @@
this.valueChanged = false;
},
- calculateAvailableValues : function(){
+ calculateAvailableValues : function(){
var values = new Array();
- var value = Number(this.minimum);
+ var value = this.roundFloat(this.minimum);
var i = 0;
while (value < this.maximum){
values[i] = value;
- value += Number(this.step);
+ value = this.roundFloat(value + parseFloat(this.step));
i++;
}
- values[i] = Number(this.maximum);
+ values[i] = this.roundFloat(this.maximum);
return values;
},
roundFloat: function(x){
- if (!this.digCount) return Math.round(x);
- for (var i=0;i<this.digCount;i++)
- x *= 10;
- x = Math.round(x);
- for (var i=0;i<this.digCount;i++)
- x /= 10;
- return x;
+ if (!this.digCount)
+ return Math.round(x);
+
+ return parseFloat(Number(x).toFixed(this.digCount));
},
windowMouseOut : function(evt){
19 years
JBoss Rich Faces SVN: r412 - trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: pkotikov
Date: 2007-04-13 12:35:49 -0400 (Fri, 13 Apr 2007)
New Revision: 412
Modified:
trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component/InputNumberSpinnerComponentTest.java
Log:
Tests updated. Unused code removed.
Modified: trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component/InputNumberSpinnerComponentTest.java
===================================================================
--- trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component/InputNumberSpinnerComponentTest.java 2007-04-13 16:35:41 UTC (rev 411)
+++ trunk/richfaces/inputnumber-spinner/src/test/java/org/richfaces/component/InputNumberSpinnerComponentTest.java 2007-04-13 16:35:49 UTC (rev 412)
@@ -263,9 +263,7 @@
root.processApplication(facesContext);
renderedView = renderView();
- inputContainer = (HtmlElement) renderedView.getHtmlElementById(spinner.getClientId(facesContext)+"Edit");
- htmlSliderInput = (HtmlInput) inputContainer.getLastChild();
- htmlSliderInput.setValueAttribute(value); assertTrue( value.equals(((UIInputNumberSpinner)spinner).getValue()) );
+ assertTrue( value.equals(((UIInputNumberSpinner)spinner).getValue()) );
}
public void testDecode() throws Exception{
19 years
JBoss Rich Faces SVN: r411 - trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: pkotikov
Date: 2007-04-13 12:35:41 -0400 (Fri, 13 Apr 2007)
New Revision: 411
Modified:
trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java
Log:
Tests updated. Unused code removed.
Modified: trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java
===================================================================
--- trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java 2007-04-13 16:31:10 UTC (rev 410)
+++ trunk/richfaces/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java 2007-04-13 16:35:41 UTC (rev 411)
@@ -260,7 +260,6 @@
root.processApplication(facesContext);
renderedView = renderView();
- htmlSliderInput = (HtmlInput) renderedView.getHtmlElementById(slider.getClientId(facesContext)+"Input");
assertTrue( value.equals(((UIInputNumberSlider)slider).getValue()) );
}
19 years
JBoss Rich Faces SVN: r410 - in trunk/richfaces/dataFilterSlider/src: main/templates and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pkotikov
Date: 2007-04-13 12:31:10 -0400 (Fri, 13 Apr 2007)
New Revision: 410
Added:
trunk/richfaces/dataFilterSlider/src/test/java/org/richfaces/component/DataFilterSliderComponentTest.java
Removed:
trunk/richfaces/dataFilterSlider/src/test/java/org/richfaces/component/JSFComponentTest.java
Modified:
trunk/richfaces/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java
trunk/richfaces/dataFilterSlider/src/main/templates/dataFilterSlider.jspx
Log:
JUnit test created. Bug with identical id for different dfSliders on page fixed.
Modified: trunk/richfaces/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java
===================================================================
--- trunk/richfaces/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java 2007-04-13 15:28:50 UTC (rev 409)
+++ trunk/richfaces/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java 2007-04-13 16:31:10 UTC (rev 410)
@@ -52,12 +52,14 @@
}
public String renderSliderJs1(FacesContext context, UIDataFltrSlider slider) throws IOException {
+
+ String clientId = slider.getClientId(context);
- String sliderScript = "var dataFilterSlider = new Control.Slider('slider-handle', 'slider-track', {\n" +
+ String sliderScript = "var dataFilterSlider = new Control.Slider('"+ clientId +"slider-handle', '"+ clientId +"slider-track', {\n" +
"range: $R(" + slider.getStartRange() + "," + slider.getEndRange() + "),\n" +
"values: [" + slider.getSliderRange() + "],\n" +
- "startSpan: 'slider-trailer',\n" +
- "sliderValue:$('slider_val').value,\n";
+ "startSpan: '"+ clientId +"slider-trailer',\n" +
+ "sliderValue:$('"+ clientId +"slider_val').value,\n";
if (slider.isOnSlide()) {
sliderScript = sliderScript +
@@ -76,14 +78,16 @@
public String renderSliderJs2(FacesContext context, UIDataFltrSlider slider) throws IOException {
- String formClientId = _findFormClientId(context, slider);
+ String clientId = slider.getClientId(context);
+
+ String formClientId = _findFormClientId(context, slider);
String sliderClientId = slider.getClientId(context);
String id = slider.getId();
String sliderHandlerScript = "function updateSlider1(value) {\n" +
- "$('slider_val').value = value;\n" +
+ "$('"+ clientId +"slider_val').value = value;\n" +
"try{\n" +
"eval(document.forms['" + formClientId + "'].action);\n" +
"}catch(exception){\n" +
@@ -115,15 +119,16 @@
ExternalContext external = context.getExternalContext();
Map requestParams = external.getRequestParameterMap();
+ String clientId = component.getClientId(context);
UIDataFltrSlider dataFilterSlider = (UIDataFltrSlider) component;
Integer oldSliderVal = dataFilterSlider.getHandleValue();
//Here we get new slider val and compare with old value
Integer newSliderVal = dataFilterSlider.getStartRange();
- if (requestParams.get("slider_val") != null
- && !"".equals(requestParams.get("slider_val"))) {
- newSliderVal = Integer.valueOf(requestParams.get("slider_val").toString());
+ if (requestParams.get(clientId + "slider_val") != null
+ && !"".equals(requestParams.get(clientId + "slider_val"))) {
+ newSliderVal = Integer.valueOf(requestParams.get(clientId + "slider_val").toString());
}
if (newSliderVal.equals(oldSliderVal)) {
Modified: trunk/richfaces/dataFilterSlider/src/main/templates/dataFilterSlider.jspx
===================================================================
--- trunk/richfaces/dataFilterSlider/src/main/templates/dataFilterSlider.jspx 2007-04-13 15:28:50 UTC (rev 409)
+++ trunk/richfaces/dataFilterSlider/src/main/templates/dataFilterSlider.jspx 2007-04-13 16:31:10 UTC (rev 410)
@@ -9,7 +9,7 @@
xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
class="org.richfaces.renderkit.html.DataFilterSliderRenderer"
baseclass="org.richfaces.renderkit.DataFilterSliderRendererBase"
- component="org.richfaces.component.UIDataFltrSlider">
+ component="org.richfaces.component.UIDataFilterSlider">
<h:styles>css/dataFilterSlider.xcss</h:styles>
<h:scripts>new org.ajax4jsf.framework.resource.PrototypeScript(),scripts/scriptaculous-js-1.6.5/src/slider.js</h:scripts>
@@ -22,22 +22,22 @@
</jsp:scriptlet>
<div class="slider-container #{component.styleClass}">
- <div id="slider-range" class="range #{component.rangeStyleClass}" style="width:#{component.attributes['width']}">
- <div id="slider-range-decor" class="range-decor">
+ <div id="#{clientId}slider-range" class="range #{component.rangeStyleClass}" style="width:#{component.attributes['width']}">
+ <div id="#{clientId}slider-range-decor" class="range-decor">
<jsp:scriptlet>
<![CDATA[
boolean trailer = attributeToBoolean(component, "trailer");
if (trailer) {
]]>
</jsp:scriptlet>
- <div id="slider-trailer" class="trailer #{component.trailerStyleClass}">
+ <div id="#{clientId}slider-trailer" class="trailer #{component.trailerStyleClass}">
<jsp:scriptlet>
<![CDATA[
}
]]>
</jsp:scriptlet>
- <div id="slider-track" class="track #{component.trackStyleClass}" style="width:#{component.attributes['width']}">
- <div id="slider-handle" class="handle #{component.handleStyleClass}">
+ <div id="#{clientId}slider-track" class="track #{component.trackStyleClass}" style="width:#{component.attributes['width']}">
+ <div id="#{clientId}slider-handle" class="handle #{component.handleStyleClass}">
<img src="#{arrow}" width="7" height="8" alt="" border="0" />
</div>
</div>
@@ -63,7 +63,7 @@
]]>
</jsp:scriptlet>
- <input type="text" onchange="dataFilterSlider.setValue(this.value);" class="slider-input-field #{component.fieldStyleClass}" name="slider_val" id="slider_val" value="#{component.handleValue}"/>
+ <input type="text" onchange="dataFilterSlider.setValue(this.value);" class="slider-input-field #{component.fieldStyleClass}" name="#{clientId}slider_val" id="#{clientId}slider_val" value="#{component.handleValue}"/>
<jsp:scriptlet>
<![CDATA[
@@ -71,7 +71,7 @@
]]>
</jsp:scriptlet>
- <input type="hidden" name="slider_val" id="slider_val" value="#{component.handleValue}"/>
+ <input type="hidden" name="#{clientId}slider_val" id="#{clientId}slider_val" value="#{component.handleValue}"/>
<jsp:scriptlet>
<![CDATA[
Added: trunk/richfaces/dataFilterSlider/src/test/java/org/richfaces/component/DataFilterSliderComponentTest.java
===================================================================
--- trunk/richfaces/dataFilterSlider/src/test/java/org/richfaces/component/DataFilterSliderComponentTest.java (rev 0)
+++ trunk/richfaces/dataFilterSlider/src/test/java/org/richfaces/component/DataFilterSliderComponentTest.java 2007-04-13 16:31:10 UTC (rev 410)
@@ -0,0 +1,310 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.awt.Dimension;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.ValueBinding;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ajax4jsf.framework.resource.InternetResource;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.Java2Dresource;
+import org.ajax4jsf.framework.resource.ResourceBuilderImpl;
+import org.ajax4jsf.framework.util.image.ImageInfo;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+import org.richfaces.event.DataFilterSliderEvent;
+import org.richfaces.renderkit.html.images.SliderFieldGradient;
+import org.richfaces.renderkit.html.images.SliderTrackGradient;
+
+import com.gargoylesoftware.htmlunit.KeyValuePair;
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+/**
+ * Unit test for simple Component.
+ */
+public class DataFilterSliderComponentTest extends AbstractAjax4JsfTestCase {
+
+ private UIForm form = null;
+ private UIComponent dfSlider = null;
+ private UICommand command = null;
+ private static Set javaScripts = new HashSet();
+
+ /**
+ * Create the test case
+ *
+ * @param testName
+ * name of the test case
+ */
+
+ static {
+ javaScripts.add("prototype.js");
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/scriptaculous-js-1.6.5/src/slider.js");
+ }
+
+ public DataFilterSliderComponentTest(String testName) {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ facesContext.getViewRoot().getChildren().add(form);
+
+ command = new HtmlCommandLink();
+ command.setId("command");
+ form.getChildren().add(command);
+
+ dfSlider = application.createComponent(UIDataFltrSlider.COMPONENT_TYPE);
+ dfSlider.setId("slider");
+ ((UIDataFltrSlider)dfSlider).setStartRange(Integer.valueOf(0));
+ ((UIDataFltrSlider)dfSlider).setEndRange(Integer.valueOf(100));
+ ((UIDataFltrSlider)dfSlider).setIncrement(Integer.valueOf(1));
+ form.getChildren().add(dfSlider);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ this.form = null;
+ this.dfSlider = null;
+ this.command = null;
+ }
+
+ /**
+ * Test component renders correctly
+ *
+ * @throws Exception
+ */
+ public void testComponent() throws Exception {
+ ((UIDataFltrSlider)dfSlider).setTrailer(true);
+ HtmlPage renderedView = renderView();
+
+ HtmlElement htmlSlider = renderedView.getHtmlElementById(dfSlider.getClientId(facesContext)+"slider-range");
+ assertTrue(htmlSlider.getAttributeValue("class").contains("range"));
+ assertTrue(((HtmlElement)htmlSlider.getParentNode()).getAttributeValue("class").contains("slider-container"));
+
+ HtmlElement htmlSliderTrailer = renderedView.getHtmlElementById(dfSlider.getClientId(facesContext)+"slider-trailer");
+ assertTrue(htmlSliderTrailer.getAttributeValue("class").contains("trailer"));
+
+ HtmlElement htmlSliderTrack = renderedView.getHtmlElementById(dfSlider.getClientId(facesContext)+"slider-track");
+ assertTrue(htmlSliderTrack.getAttributeValue("class").contains("track"));
+ assertTrue(htmlSliderTrack.getAttributeValue("style").equals("width:" + dfSlider.getAttributes().get("width")));
+
+ HtmlElement htmlSliderHandle = renderedView.getHtmlElementById(dfSlider.getClientId(facesContext)+"slider-handle");
+ assertTrue(htmlSliderHandle.getAttributeValue("class").contains("handle"));
+
+ HtmlElement htmlSliderInput = renderedView.getHtmlElementById(dfSlider.getClientId(facesContext)+"slider_val");
+ assertTrue(((HtmlInput)htmlSliderInput).getTypeAttribute().equals("text"));
+ assertTrue(htmlSliderInput.getAttributeValue("class").contains("slider-input-field"));
+ assertTrue(htmlSliderInput.getAttributeValue("onchange").equals("dataFilterSlider.setValue(this.value);"));
+ }
+
+ public void testImages() throws Exception {
+ InternetResource image = InternetResourceBuilder.getInstance().createResource(null, SliderFieldGradient.class.getName());
+ Dimension imageDim = ((Java2Dresource)image).getDimensions(facesContext, null);
+ assertTrue( imageDim.getWidth() == 31 && imageDim.getHeight() == 55);
+
+ image = InternetResourceBuilder.getInstance().createResource(null, SliderTrackGradient.class.getName());
+ imageDim = ((Java2Dresource)image).getDimensions(facesContext, null);
+ assertTrue( imageDim.getWidth() == 7 && imageDim.getHeight() == 10);
+
+ }
+
+ public void testRenderImages() throws Exception {
+ renderView();
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ InternetResource resource = builder.getResource("org/richfaces/renderkit/html/css/dataFilterSlider.xcss");
+ assertNotNull(resource);
+ String uri = "http:" + resource.getUri(facesContext, null);
+ Page page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+
+ String[] resources = new String[] {
+ SliderFieldGradient.class.getName(),
+ SliderTrackGradient.class.getName(),
+ };
+
+ for (int i = 0; i < resources.length; i++) {
+ resource = builder.getResource(resources[i]);
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, null);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ ImageInfo info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+ }
+ }
+
+ public void testHiddenInput() throws Exception {
+ ((UIDataFltrSlider)dfSlider).setManualInput(false);
+ HtmlPage renderedView = renderView();
+ HtmlElement htmlSliderInput = renderedView.getHtmlElementById(dfSlider.getClientId(facesContext)+"slider_val");
+ assertTrue(((HtmlInput)htmlSliderInput).getTypeAttribute().equals("hidden"));
+ }
+
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ assertEquals(1, links.size());
+ HtmlElement link = (HtmlElement) links.get(0);
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/dataFilterSlider.xcss"));
+ }
+
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+ }
+
+ public void testUpdate() throws Exception {
+ //tests if component handles value bindings correctly
+ HtmlPage renderedView = renderView();
+
+ String value = "5";
+
+ HtmlInput htmlSliderInput = (HtmlInput) renderedView.getHtmlElementById(dfSlider.getClientId(facesContext)+"slider_val");
+ htmlSliderInput.setValueAttribute(value);
+
+ HtmlAnchor htmlLink = (HtmlAnchor) renderedView.getHtmlElementById(command.getClientId(facesContext));
+ htmlLink.click();
+
+ List lastParameters = this.webConnection.getLastParameters();
+ for (Iterator iterator = lastParameters.iterator(); iterator.hasNext();) {
+ KeyValuePair keyValue = (KeyValuePair) iterator.next();
+
+ externalContext.addRequestParameterMap((String) keyValue.getKey(), (String) keyValue.getValue());
+ }
+
+ UIViewRoot root = facesContext.getViewRoot();
+ root.processDecodes(facesContext);
+ root.processValidators(facesContext);
+ root.processUpdates(facesContext);
+ root.processApplication(facesContext);
+
+ renderedView = renderView();
+ assertTrue( value.equals(String.valueOf(((UIDataFltrSlider)dfSlider).getHandleValue())));
+ }
+
+ public void testDecode() throws Exception{
+ //Tests if component accepts request parameters and stores them in submittedValue().
+ //If component is immediate, validation (possibly with conversion) should occur on that phase.
+ final SliderBean bean = new SliderBean();
+ ((UIDataFltrSlider)dfSlider).setValueBinding("value",
+ new ValueBinding() {
+ public Class getType(FacesContext context) throws EvaluationException, PropertyNotFoundException {
+ return String.class;
+ }
+ public Object getValue(FacesContext context) throws EvaluationException, PropertyNotFoundException {
+ return bean.getValue();
+ }
+ public boolean isReadOnly(FacesContext context) throws EvaluationException, PropertyNotFoundException {
+ return false;
+ }
+ public void setValue(FacesContext context, Object value) throws EvaluationException, PropertyNotFoundException {
+ bean.setValue((String)value);
+ }
+ });
+ HtmlPage renderedView = renderView();
+ HtmlAnchor htmlLink = (HtmlAnchor) renderedView.getHtmlElementById(command.getClientId(facesContext));
+ htmlLink.click();
+ externalContext.addRequestParameterMap(dfSlider.getClientId(facesContext),"66");
+ dfSlider.processDecodes(facesContext);
+ assertTrue(bean.getValue().equals("66"));
+ }
+
+ public void testListener() {
+ //HtmlPage page = renderView();
+ UIDataFltrSlider slider = (UIDataFltrSlider) dfSlider;
+ SliderListenerBean bean = new SliderListenerBean();
+ DataFilterSliderEvent event = new DataFilterSliderEvent(slider,Integer.valueOf(10),Integer.valueOf(50));
+ //MethodBinding binding = application.createMethodBinding(bean.doSlide(), null);
+ //slider.setSliderListener(binding);
+ }
+
+ private final class SliderBean {
+
+ private String value;
+
+ SliderBean (){
+ this.value = "66";
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ }
+
+ private final class SliderListenerBean {
+ public void doSlide(DataFilterSliderEvent event) {
+ Integer oldSliderVal = event.getOldSliderVal();
+ Integer newSliderVal = event.getNewSliderVal();
+ }
+ }
+}
Deleted: trunk/richfaces/dataFilterSlider/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/dataFilterSlider/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-13 15:28:50 UTC (rev 409)
+++ trunk/richfaces/dataFilterSlider/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-13 16:31:10 UTC (rev 410)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
19 years