JBoss Rich Faces SVN: r20333 - trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 05:19:42 -0500 (Fri, 03 Dec 2010)
New Revision: 20333
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
Log:
toolbar.ecss instead if toolBar.ecss
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2010-12-03 10:19:01 UTC (rev 20332)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2010-12-03 10:19:42 UTC (rev 20333)
@@ -42,7 +42,7 @@
import org.richfaces.renderkit.RendererBase;
-@ResourceDependency(library = "org.richfaces", name = "toolBar.ecss")
+@ResourceDependency(library = "org.richfaces", name = "toolbar.ecss")
public abstract class ToolBarRendererBase extends RendererBase {
public static final String RENDERER_TYPE = "org.richfaces.ToolBarRenderer";
13 years, 6 months
JBoss Rich Faces SVN: r20332 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 05:19:01 -0500 (Fri, 03 Dec 2010)
New Revision: 20332
Added:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.ecss
Log:
rename toolBar -> toolbar
Added: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.ecss (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolbar.ecss 2010-12-03 10:19:01 UTC (rev 20332)
@@ -0,0 +1,62 @@
+.rf-tb {
+ border:1px solid;
+ border-color:'#{richSkin.panelBorderColor}';
+ color:'#{richSkin.headerTextColor}';
+ font-family:'#{richSkin.headerFamilyFont}';
+ font-size:'#{richSkin.headerSizeFont}';
+ font-weight:'#{richSkin.headerWeightFont}';
+ padding:0px;
+ background-color:'#{richSkin.headerBackgroundColor}';
+ background-position:left top;
+ background-repeat:repeat-x;
+ /*check gradient from headerGradientColor to headerBackgroundColor*/
+ background-image:url("#{resource['org.richfaces.renderkit.html.GradientA']}");
+ width:100%;
+}
+
+.rf-tb-itm {
+ padding:0 8px;
+ white-space:nowrap;
+}
+
+.rf-tb-sep {
+ padding:0 10px;
+ text-align:center;
+ background-repeat:no-repeat;
+ background-position:center center;
+ height: 100%;
+}
+
+.rf-tb-cntr{
+ vertical-align:middle;
+}
+
+.rf-tb-sep-grid, .rf-tb-sep-line, .rf-tb-sep-disc, .rf-tb-sep-square {
+ padding: 0px 0px 0px 0px;
+ background-position:center center;
+ height: 80%;
+}
+
+.rf-tb-sep-grid {
+ background-image:url("#{resource['org.richfaces.renderkit.html.images.GridSeparatorImage']}");
+ width: 9px;
+ background-repeat: repeat-y;
+}
+
+.rf-tb-sep-line {
+ width: 2px;
+ background-image:url("#{resource['org.richfaces.renderkit.html.images.LineSeparatorImage']}");
+ background-repeat: repeat-y;
+}
+
+.rf-tb-sep-disc {
+ width: 9px;
+ background-image:url("#{resource['org.richfaces.renderkit.html.images.DotSeparatorImage']}");
+ background-repeat: no-repeat;
+}
+
+.rf-tb-sep-square {
+ width: 9px;
+ background-image:url("#{resource['org.richfaces.renderkit.html.images.SquareSeparatorImage']}");
+ background-repeat: no-repeat;
+}
\ No newline at end of file
13 years, 6 months
JBoss Rich Faces SVN: r20331 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 05:18:18 -0500 (Fri, 03 Dec 2010)
New Revision: 20331
Removed:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss
Log:
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss 2010-12-03 10:14:01 UTC (rev 20330)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss 2010-12-03 10:18:18 UTC (rev 20331)
@@ -1,62 +0,0 @@
-.rf-tb {
- border:1px solid;
- border-color:'#{richSkin.panelBorderColor}';
- color:'#{richSkin.headerTextColor}';
- font-family:'#{richSkin.headerFamilyFont}';
- font-size:'#{richSkin.headerSizeFont}';
- font-weight:'#{richSkin.headerWeightFont}';
- padding:0px;
- background-color:'#{richSkin.headerBackgroundColor}';
- background-position:left top;
- background-repeat:repeat-x;
- /*check gradient from headerGradientColor to headerBackgroundColor*/
- background-image:url("#{resource['org.richfaces.renderkit.html.GradientA']}");
- width:100%;
-}
-
-.rf-tb-itm {
- padding:0 8px;
- white-space:nowrap;
-}
-
-.rf-tb-sep {
- padding:0 10px;
- text-align:center;
- background-repeat:no-repeat;
- background-position:center center;
- height: 100%;
-}
-
-.rf-tb-cntr{
- vertical-align:middle;
-}
-
-.rf-tb-sep-grid, .rf-tb-sep-line, .rf-tb-sep-disc, .rf-tb-sep-square {
- padding: 0px 0px 0px 0px;
- background-position:center center;
- height: 80%;
-}
-
-.rf-tb-sep-grid {
- background-image:url("#{resource['org.richfaces.renderkit.html.images.GridSeparatorImage']}");
- width: 9px;
- background-repeat: repeat-y;
-}
-
-.rf-tb-sep-line {
- width: 2px;
- background-image:url("#{resource['org.richfaces.renderkit.html.images.LineSeparatorImage']}");
- background-repeat: repeat-y;
-}
-
-.rf-tb-sep-disc {
- width: 9px;
- background-image:url("#{resource['org.richfaces.renderkit.html.images.DotSeparatorImage']}");
- background-repeat: no-repeat;
-}
-
-.rf-tb-sep-square {
- width: 9px;
- background-image:url("#{resource['org.richfaces.renderkit.html.images.SquareSeparatorImage']}");
- background-repeat: no-repeat;
-}
\ No newline at end of file
13 years, 6 months
JBoss Rich Faces SVN: r20330 - in trunk/ui/output/ui/src/main: java/org/richfaces/renderkit/html and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 05:14:01 -0500 (Fri, 03 Dec 2010)
New Revision: 20330
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBar.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBarGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss
Log:
https://jira.jboss.org/browse/RF-9886, https://jira.jboss.org/browse/RF-9885
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBar.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBar.java 2010-12-03 10:02:10 UTC (rev 20329)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBar.java 2010-12-03 10:14:01 UTC (rev 20330)
@@ -32,7 +32,7 @@
import org.richfaces.renderkit.html.ToolBarRendererBase;
@JsfComponent(family = AbstractToolBar.COMPONENT_FAMILY, type = AbstractToolBar.COMPONENT_TYPE,
- renderer=@JsfRenderer(type = ToolBarRendererBase.RENDERER_TYPE), tag = @Tag(name="toolBar")
+ renderer=@JsfRenderer(type = ToolBarRendererBase.RENDERER_TYPE), tag = @Tag(name="toolbar")
)
public abstract class AbstractToolBar extends UIComponentBase {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBarGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBarGroup.java 2010-12-03 10:02:10 UTC (rev 20329)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBarGroup.java 2010-12-03 10:14:01 UTC (rev 20330)
@@ -37,7 +37,7 @@
import org.richfaces.renderkit.html.ToolBarGroupRenderer;
@JsfComponent(family = AbstractToolBar.COMPONENT_FAMILY, type = AbstractToolBarGroup.COMPONENT_TYPE,
- renderer=@JsfRenderer(type = ToolBarGroupRenderer.RENDERER_TYPE), tag = @Tag(name="toolBarGroup"))
+ renderer=@JsfRenderer(type = ToolBarGroupRenderer.RENDERER_TYPE), tag = @Tag(name="toolbarGroup"))
public abstract class AbstractToolBarGroup extends UIComponentBase {
public static final String COMPONENT_TYPE = "org.richfaces.ToolBarGroup";
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2010-12-03 10:02:10 UTC (rev 20329)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2010-12-03 10:14:01 UTC (rev 20330)
@@ -236,11 +236,15 @@
writer.startElement(HtmlConstants.TD_ELEM, component);
String separatorClass = "rf-tb-sep";
-
+ concatClasses(separatorClass, (String) component.getAttributes().get("separatorClass"));
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, separatorClass, null);
+
if (separator != null) {
String itemSeparatorClass = "rf-tb-sep-" + separator.toString().toLowerCase();
- separatorClass = concatClasses(separatorClass, itemSeparatorClass, (String) component.getAttributes().get("separatorClass"));
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, separatorClass, null);
+ writer.startElement(HtmlConstants.DIV_ELEM, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, itemSeparatorClass, null);
+ writer.write(" ");
+ writer.endElement(HtmlConstants.DIV_ELEM);
} else {
concatClasses(separatorClass, (String) component.getAttributes().get("separatorClass"));
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, separatorClass, null);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-03 10:02:10 UTC (rev 20329)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-03 10:14:01 UTC (rev 20330)
@@ -7,7 +7,7 @@
<namespace>http://richfaces.org/output</namespace>
<tag>
- <tag-name>toolBar</tag-name>
+ <tag-name>toolbar</tag-name>
<component>
<component-type>org.richfaces.ToolBar</component-type>
<renderer-type>org.richfaces.ToolBarRenderer</renderer-type>
@@ -86,7 +86,7 @@
</attribute>
</tag>
<tag>
- <tag-name>toolBarGroup</tag-name>
+ <tag-name>toolbarGroup</tag-name>
<component>
<component-type>org.richfaces.ToolBarGroup</component-type>
<renderer-type>org.richfaces.ToolBarGroupRenderer</renderer-type>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss 2010-12-03 10:02:10 UTC (rev 20329)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss 2010-12-03 10:14:01 UTC (rev 20330)
@@ -24,24 +24,39 @@
text-align:center;
background-repeat:no-repeat;
background-position:center center;
+ height: 100%;
}
.rf-tb-cntr{
vertical-align:middle;
}
+.rf-tb-sep-grid, .rf-tb-sep-line, .rf-tb-sep-disc, .rf-tb-sep-square {
+ padding: 0px 0px 0px 0px;
+ background-position:center center;
+ height: 80%;
+}
+
.rf-tb-sep-grid {
background-image:url("#{resource['org.richfaces.renderkit.html.images.GridSeparatorImage']}");
+ width: 9px;
+ background-repeat: repeat-y;
}
.rf-tb-sep-line {
+ width: 2px;
background-image:url("#{resource['org.richfaces.renderkit.html.images.LineSeparatorImage']}");
+ background-repeat: repeat-y;
}
.rf-tb-sep-disc {
+ width: 9px;
background-image:url("#{resource['org.richfaces.renderkit.html.images.DotSeparatorImage']}");
+ background-repeat: no-repeat;
}
.rf-tb-sep-square {
+ width: 9px;
background-image:url("#{resource['org.richfaces.renderkit.html.images.SquareSeparatorImage']}");
+ background-repeat: no-repeat;
}
\ No newline at end of file
13 years, 6 months
JBoss Rich Faces SVN: r20329 - in trunk: ui/output/ui/src/main/java/org/richfaces/renderkit/html and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-12-03 05:02:10 -0500 (Fri, 03 Dec 2010)
New Revision: 20329
Modified:
trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
Log:
RF-9317 - panelMenu components
none icon
and action for PanelMenuItem and PanelMenuGroup
Modified: trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2010-12-03 10:02:10 UTC (rev 20329)
@@ -61,7 +61,6 @@
topItemDisableIconLeft="disc"
topGroupDisableIconLeft="disc"
itemChangeListener="#{modalPanel.itemChangeEventListener}"
- action="#{modalPanel.action}"
>
<pn:panelMenuGroup label="Group 1">
@@ -78,7 +77,7 @@
label="Group 2.2"
iconLeftCollapsed="chevron"
iconLeftExpanded="chevronDown">
- <pn:panelMenuItem label="Item 2.2.1" />
+ <pn:panelMenuItem label="Item 2.2.1" action="#{modalPanel.action}"/>
<pn:panelMenuItem label="Item 2.2.2" name="myFavariteIten" />
<pn:panelMenuItem label="Item 2.2.3"/>
</pn:panelMenuGroup>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-03 10:02:10 UTC (rev 20329)
@@ -76,10 +76,10 @@
String compClientId = component.getClientId(context);
String clientId = requestMap.get(compClientId);
if (clientId != null && clientId.equals(compClientId)) {
- new ActionEvent(component).queue();
AbstractPanelMenuItem panelItem = panelMenu.getItem(newValue);
if (panelItem != null) {
+ new ActionEvent(panelItem).queue();
context.getPartialViewContext().getRenderIds().add(panelItem.getClientId(context));
//TODO nick - this should be done on encode, not on decode
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-03 10:02:10 UTC (rev 20329)
@@ -9,14 +9,14 @@
<behavior-id>org.richfaces.component.behavior.ToggleControl</behavior-id>
<behavior-class>org.richfaces.component.behavior.ToggleControl</behavior-class>
</behavior>
-
- <component>
+
+ <component>
<component-type>org.richfaces.ToolBar</component-type>
<component-class>org.richfaces.component.UIToolBar</component-class>
<property>
<description>
- A mutable Map of the attributes associated with
- this component, keyed by attribute name.
+ A mutable Map of the attributes associated with
+ this component, keyed by attribute name.
</description>
<display-name>Attributes Map</display-name>
<icon/>
@@ -1524,6 +1524,18 @@
<component-type>org.richfaces.PanelMenuItem</component-type>
<component-class>org.richfaces.component.html.HtmlPanelMenuItem</component-class>
<property>
+ <property-name>action</property-name>
+ <property-class>javax.faces.el.MethodBinding</property-class>
+ </property>
+ <property>
+ <property-name>actionExpression</property-name>
+ <property-class>javax.el.MethodExpression</property-class>
+ </property>
+ <property>
+ <property-name>actionListener</property-name>
+ <property-class>javax.faces.el.MethodBinding</property-class>
+ </property>
+ <property>
<description></description>
<property-name>icon</property-name>
<property-class>java.lang.String</property-class>
@@ -1584,6 +1596,18 @@
<component-type>org.richfaces.PanelMenuGroup</component-type>
<component-class>org.richfaces.component.html.HtmlPanelMenuGroup</component-class>
<property>
+ <property-name>action</property-name>
+ <property-class>javax.faces.el.MethodBinding</property-class>
+ </property>
+ <property>
+ <property-name>actionExpression</property-name>
+ <property-class>javax.el.MethodExpression</property-class>
+ </property>
+ <property>
+ <property-name>actionListener</property-name>
+ <property-class>javax.faces.el.MethodBinding</property-class>
+ </property>
+ <property>
<description></description>
<property-name>expanded</property-name>
<property-class>boolean</property-class>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-03 10:02:10 UTC (rev 20329)
@@ -6,7 +6,7 @@
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" version="2.0" id="output">
<namespace>http://richfaces.org/output</namespace>
- <tag>
+ <tag>
<tag-name>toolBar</tag-name>
<component>
<component-type>org.richfaces.ToolBar</component-type>
@@ -160,8 +160,8 @@
<type>boolean</type>
</attribute>
</tag>
-
-
+
+
<tag>
<tag-name>toggleControl</tag-name>
<behavior>
@@ -213,6 +213,27 @@
<renderer-type>org.richfaces.PanelMenuItem</renderer-type>
</component>
<attribute>
+ <description>MethodExpression representing the application action to invoke when this component is activated by the user. The expression must evaluate to a public method that takes no parameters, and returns an Object (the toString() of which is called to derive the logical outcome) which is passed to the NavigationHandler for this application.</description>
+ <display-name>Application Action</display-name>
+ <icon/>
+ <name>action</name>
+ <type>javax.faces.el.MethodBinding</type>
+ </attribute>
+ <attribute>
+ <description>MethodExpression representing the application action to invoke when this component is activated by the user. The expression must evaluate to a public method that takes no parameters, and returns an Object (the toString() of which is called to derive the logical outcome) which is passed to the NavigationHandler for this application.</description>
+ <display-name>Application Action</display-name>
+ <icon/>
+ <name>actionExpression</name>
+ <type>javax.el.MethodExpression</type>
+ </attribute>
+ <attribute>
+ <description><p> MethodExpression representing an action listener method that will be notified when this component is activated by the user. The expression must evaluate to a public method that takes an ActionEvent parameter, with a return type of void, <span class="changed_added_2_0">or to a public method that takes no arguments with a return type of void. In the latter case, the method has no way of easily knowing where the event came from, but this can be useful in cases where a notification is needed that "some action happened".</span> </p></description>
+ <display-name>Action Listener</display-name>
+ <icon/>
+ <name>actionListener</name>
+ <type>javax.faces.el.MethodBinding</type>
+ </attribute>
+ <attribute>
<description></description>
<name>icon</name>
<type>java.lang.String</type>
@@ -392,6 +413,27 @@
</component>
<attribute>
+ <description>MethodExpression representing the application action to invoke when this component is activated by the user. The expression must evaluate to a public method that takes no parameters, and returns an Object (the toString() of which is called to derive the logical outcome) which is passed to the NavigationHandler for this application.</description>
+ <display-name>Application Action</display-name>
+ <icon/>
+ <name>action</name>
+ <type>javax.faces.el.MethodBinding</type>
+ </attribute>
+ <attribute>
+ <description>MethodExpression representing the application action to invoke when this component is activated by the user. The expression must evaluate to a public method that takes no parameters, and returns an Object (the toString() of which is called to derive the logical outcome) which is passed to the NavigationHandler for this application.</description>
+ <display-name>Application Action</display-name>
+ <icon/>
+ <name>actionExpression</name>
+ <type>javax.el.MethodExpression</type>
+ </attribute>
+ <attribute>
+ <description><p> MethodExpression representing an action listener method that will be notified when this component is activated by the user. The expression must evaluate to a public method that takes an ActionEvent parameter, with a return type of void, <span class="changed_added_2_0">or to a public method that takes no arguments with a return type of void. In the latter case, the method has no way of easily knowing where the event came from, but this can be useful in cases where a notification is needed that "some action happened".</span> </p></description>
+ <display-name>Action Listener</display-name>
+ <icon/>
+ <name>actionListener</name>
+ <type>javax.faces.el.MethodBinding</type>
+ </attribute>
+ <attribute>
<description></description>
<name>expanded</name>
<type>boolean</type>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2010-12-03 10:02:10 UTC (rev 20329)
@@ -279,6 +279,7 @@
.rf-pm-chevron-up { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:ChevronUp.png']})" }
.rf-pm-disc { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Disc.png']})" }
.rf-pm-grid { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Grid.png']})" }
+.rf-pm-none { width: 16px; height: 16px; }
.rf-pm-spacer { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Spacer.png']})" }
.rf-pm-triangle { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:Triangle.png']})" }
.rf-pm-triangle-down { width: 16px; height: 16px; background-image: "url(#{resource['org.richfaces.images:TriangleDown.png']})" }
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml 2010-12-03 10:02:10 UTC (rev 20329)
@@ -5,13 +5,13 @@
<tbody>
<tr>
<td class="rf-pm-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-grid" style="display:none"></div>
- <div class="rf-pm-ico-exp rf-pm-grid" style="display:block"></div>
+ <div class="rf-pm-ico-colps rf-pm-none" style="display:none"></div>
+ <div class="rf-pm-ico-exp rf-pm-none" style="display:block"></div>
</td>
<td class="rf-pm-gr-lbl">Group Label</td>
<td class="rf-pm-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-grid" style="display:none"></div>
- <div class="rf-pm-ico-exp rf-pm-grid" style="display:block"></div>
+ <div class="rf-pm-ico-colps rf-pm-none" style="display:none"></div>
+ <div class="rf-pm-ico-exp rf-pm-none" style="display:block"></div>
</td>
</tr>
</tbody>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml 2010-12-03 10:02:10 UTC (rev 20329)
@@ -5,13 +5,13 @@
<tbody>
<tr>
<td class="rf-pm-top-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-grid" style="display:none"></div>
- <div class="rf-pm-ico-exp rf-pm-grid" style="display:block"></div>
+ <div class="rf-pm-ico-colps rf-pm-none" style="display:none"></div>
+ <div class="rf-pm-ico-exp rf-pm-none" style="display:block"></div>
</td>
<td class="rf-pm-top-gr-lbl">Group Label</td>
<td class="rf-pm-top-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-grid" style="display:none"></div>
- <div class="rf-pm-ico-exp rf-pm-grid" style="display:block"></div>
+ <div class="rf-pm-ico-colps rf-pm-none" style="display:none"></div>
+ <div class="rf-pm-ico-exp rf-pm-none" style="display:block"></div>
</td>
</tr>
</tbody>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-12-03 10:02:10 UTC (rev 20329)
@@ -5,13 +5,13 @@
<tbody>
<tr>
<td class="rf-pm-gr-ico">
- <div class="rf-pm-ico-colps rf-pm-grid" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-grid" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-pm-none" style="display:block"></div>
+ <div class="rf-pm-ico-exp rf-pm-none" style="display:none"></div>
</td>
<td class="rf-pm-gr-lbl">panelMenuGroup</td>
<td class="rf-pm-gr-exp-ico">
- <div class="rf-pm-ico-colps rf-pm-grid" style="display:block"></div>
- <div class="rf-pm-ico-exp rf-pm-grid" style="display:none"></div>
+ <div class="rf-pm-ico-colps rf-pm-none" style="display:block"></div>
+ <div class="rf-pm-ico-exp rf-pm-none" style="display:none"></div>
</td>
</tr>
</tbody>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2010-12-03 10:02:10 UTC (rev 20329)
@@ -2,9 +2,9 @@
<table class="rf-pm-itm-gr">
<tbody>
<tr>
- <td class="rf-pm-itm-ico rf-pm-grid"></td>
+ <td class="rf-pm-itm-ico rf-pm-none"></td>
<td class="rf-pm-itm-lbl">panelMenuItem</td>
- <td class="rf-pm-itm-exp-ico rf-pm-grid"></td>
+ <td class="rf-pm-itm-exp-ico rf-pm-none"></td>
</tr>
</tbody>
</table>
13 years, 6 months
JBoss Rich Faces SVN: r20328 - management/design-4x/dropDownMenu-new.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-03 04:36:22 -0500 (Fri, 03 Dec 2010)
New Revision: 20328
Added:
management/design-4x/dropDownMenu-new/DropDownMenu4.dia
Log:
Property diagram added.
Added: management/design-4x/dropDownMenu-new/DropDownMenu4.dia
===================================================================
(Binary files differ)
Property changes on: management/design-4x/dropDownMenu-new/DropDownMenu4.dia
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
13 years, 6 months
JBoss Rich Faces SVN: r20327 - trunk/ui/input/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-03 04:18:06 -0500 (Fri, 03 Dec 2010)
New Revision: 20327
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
Log:
https://jira.jboss.org/browse/RFPL-932 Calendar component: client-side events review
synchronized server side default attribute values with client-side ones
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-03 08:59:29 UTC (rev 20326)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-03 09:18:06 UTC (rev 20327)
@@ -83,6 +83,8 @@
public static final String TIME_PATTERN = "HH:mm";
public static final String DEFAULT_DATE_PATTERN = "MMM d, yyyy";
+
+ public static final String DEFAULT_DATE_VALUE = "12:00:00";
Logger log = RichfacesLogger.COMPONENTS.getLogger();
@@ -216,7 +218,7 @@
@Attribute
public abstract String getButtonIconDisabled();
- @Attribute(defaultValue = "12:00:00")
+ @Attribute(defaultValue = "AbstractCalendar.DEFAULT_DATE_VALUE")
public abstract Object getDefaultTime();
@Attribute(defaultValue = "getDefaultPreloadBegin(getCurrentDateOrDefault())")
13 years, 6 months
JBoss Rich Faces SVN: r20326 - trunk/ui/input/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-03 03:59:29 -0500 (Fri, 03 Dec 2010)
New Revision: 20326
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
Log:
https://jira.jboss.org/browse/RFPL-932 Calendar component: client-side events review
synchronized server side default attribute values with client-side ones
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-03 08:17:16 UTC (rev 20325)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-03 08:59:29 UTC (rev 20326)
@@ -216,7 +216,7 @@
@Attribute
public abstract String getButtonIconDisabled();
- @Attribute
+ @Attribute(defaultValue = "12:00:00")
public abstract Object getDefaultTime();
@Attribute(defaultValue = "getDefaultPreloadBegin(getCurrentDateOrDefault())")
13 years, 6 months
JBoss Rich Faces SVN: r20325 - in trunk/ui/input/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-03 03:17:16 -0500 (Fri, 03 Dec 2010)
New Revision: 20325
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
trunk/ui/input/ui/src/main/templates/calendar.template.xml
Log:
Client event and attributes for calendar renaming
https://jira.jboss.org/browse/RF-9685
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-03 01:31:15 UTC (rev 20324)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-03 08:17:16 UTC (rev 20325)
@@ -280,19 +280,19 @@
@Attribute(events = @EventName("dateselect"))
public abstract String getOndateselect();
- @Attribute(events = @EventName("dateselected"))
- public abstract String getOndateselected();
+ @Attribute(events = @EventName("beforedateselect"))
+ public abstract String getOnbeforedateselect();
@Attribute(events = @EventName("currentdateselect"))
public abstract String getOncurrentdateselect();
- @Attribute(events = @EventName("currentdateselected"))
- public abstract String getOncurrentdateselected();
+ @Attribute(events = @EventName("beforecurrentdateselect"))
+ public abstract String getOnbeforecurrentdateselect();
@Attribute(events = @EventName("complete"))
public abstract String getOncomplete();
- @Attribute(events = @EventName("collapse"))
+ @Attribute(events = @EventName("hide"))
public abstract String getOncollapse();
@Attribute(events = @EventName("datemouseout"))
@@ -301,14 +301,14 @@
@Attribute(events = @EventName("datemouseover"))
public abstract String getOndatemouseover();
- @Attribute(events = @EventName("expand"))
- public abstract String getOnExpand();
+ @Attribute(events = @EventName("show"))
+ public abstract String getOnshow();
@Attribute(events = @EventName("timeselect"))
public abstract String getOntimeselect();
- @Attribute(events = @EventName("timeselected"))
- public abstract String getOntimeselected();
+ @Attribute(events = @EventName("beforetimeselect"))
+ public abstract String getOnbeforetimeselect();
@Attribute(events = @EventName("clean"))
public abstract String getOnclean();
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-12-03 01:31:15 UTC (rev 20324)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-12-03 08:17:16 UTC (rev 20325)
@@ -267,9 +267,9 @@
var defaultLabels = {apply:'Apply', today:'Today', clean:'Clean', ok:'OK', cancel:'Cancel', close:'x'};
- var eventHandlerNames = ["change", "dateselect", "dateselected", "currentdateselect",
- "currentdateselected", "currentdateselect", "clean", "complete", "collapse",
- "datemouseout", "datemouseover", "expand", "timeselect", "timeselected"];
+ var eventHandlerNames = ["change", "dateselect", "beforedateselect", "currentdateselect",
+ "beforecurrentdateselect", "currentdateselect", "clean", "complete", "collapse",
+ "datemouseout", "datemouseover", "show", "hide", "timeselect", "beforetimeselect"];
// Constructor definition
rf.ui.Calendar = function(componentId, locale, options, markups) {
@@ -878,7 +878,7 @@
if (!this.params.popup || !this.isVisible) return;
- if (this.invokeEvent("collapse", rf.getDomElement(this.id)))
+ if (this.invokeEvent("hide", rf.getDomElement(this.id)))
{
if (this.isEditorVisible) this.hideEditor();
this.scrollElements && rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
@@ -906,7 +906,7 @@
var element = rf.getDomElement(this.id);
- if (this.invokeEvent("expand", element, e))
+ if (this.invokeEvent("show", element, e))
{
var base = rf.getDomElement(this.POPUP_ID)
var baseInput = base.firstChild;
@@ -1470,7 +1470,7 @@
// the "currentdateselected" Event is fired.
this.currentDate = date;
if (noUpdate) this.render(); else this.onUpdate();
- this.invokeEvent("currentdateselected", rf.getDomElement(this.id), null, date);
+ this.invokeEvent("currentdateselect", rf.getDomElement(this.id), null, date);
return true;
}
}
@@ -1480,7 +1480,7 @@
changeCurrentDateOffset: function(yearOffset, monthOffset) {
var date = new Date(this.currentDate.getFullYear()+yearOffset, this.currentDate.getMonth()+monthOffset,1);
- if (this.invokeEvent("currentdateselect", rf.getDomElement(this.id), null, date))
+ if (this.invokeEvent("beforecurrentdateselect", rf.getDomElement(this.id), null, date))
{
// fix for RF-2450.
// Additional event is fired: after the hidden input with current date
@@ -1488,7 +1488,7 @@
// the "currentdateselected" Event is fired.
this.currentDate = date;
this.onUpdate();
- this.invokeEvent("currentdateselected", rf.getDomElement(this.id), null, date);
+ this.invokeEvent("currentdateselect", rf.getDomElement(this.id), null, date);
}
},
@@ -1588,7 +1588,7 @@
if ( (oldSelectedDate - newSelectedDate) && (oldSelectedDate!=null || newSelectedDate!=null) )
{
isDateChange = true;
- flag = this.invokeEvent("dateselect", eventData.element, eventData.event, date);
+ flag = this.invokeEvent("beforedateselect", eventData.element, eventData.event, date);
}
if (flag)
@@ -1657,7 +1657,7 @@
// call user event
if (isDateChange)
{
- this.invokeEvent("dateselected", eventData.element, eventData.event, this.selectedDate);
+ this.invokeEvent("dateselect", eventData.element, eventData.event, this.selectedDate);
if (!this.params.showApplyButton)
{
this.setInputField(this.selectedDate!=null ? this.getSelectedDateString(this.params.datePattern) : "", eventData.event);
@@ -1671,10 +1671,10 @@
resetSelectedDate: function()
{
if (!this.selectedDate) return;
- if (this.invokeEvent("dateselect", null, null, null))
+ if (this.invokeEvent("beforedateselect", null, null, null))
{
this.selectedDate = null;
- this.invokeEvent("dateselected", null, null, null);
+ this.invokeEvent("dateselect", null, null, null);
this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.params.disabled || this.params.readonly ? null : "rf-ca-btn"));
this.invokeEvent("clean", null, null, null);
@@ -1791,12 +1791,12 @@
}
}
var date = new Date(this.selectedDate.getFullYear(), this.selectedDate.getMonth(), this.selectedDate.getDate(), h, m, s);
- if (date-this.selectedDate && this.invokeEvent("timeselect",null, null, date))
+ if (date-this.selectedDate && this.invokeEvent("beforetimeselect",null, null, date))
{
this.selectedDate = date;
this.renderHF();
if (!this.params.popup || !this.params.showApplyButton) this.setInputField(this.getSelectedDateString(this.params.datePattern), null);
- this.invokeEvent("timeselected",null, null, this.selectedDate);
+ this.invokeEvent("timeselect",null, null, this.selectedDate);
}
}
if (this.params.popup && !this.params.showApplyButton) this.close(false);
Modified: trunk/ui/input/ui/src/main/templates/calendar.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/calendar.template.xml 2010-12-03 01:31:15 UTC (rev 20324)
+++ trunk/ui/input/ui/src/main/templates/calendar.template.xml 2010-12-03 08:17:16 UTC (rev 20325)
@@ -70,7 +70,7 @@
<cdk:scriptObject name="options">
<cdk:scriptOption attributes="enableManualInput disabled readonly resetTimeOnDateSelect showApplyButton popup showInput showHeader showFooter showWeeksBar todayControlMode datePattern jointPoint direction boundaryDatesMode horizontalOffset verticalOffset hidePopupOnScrol showWeekDaysBar styleClass mode" />
- <cdk:scriptOption attributes="onchange ondateselect ondateselected oncurrentdateselected oncollapse onexpand ondatemouseover ondatemouseout onclean ontimeselect ontimeselected" wrapper="eventHandler" />
+ <cdk:scriptOption attributes="onchange ondateselect onbeforedateselect onbeforecurrentdateselect onhide onshow ondatemouseover ondatemouseout onclean ontimeselect onbeforetimeselect" wrapper="eventHandler" />
<cdk:scriptOption name="currentDate" value="#{getCurrentDate(facesContext, component)}" />
<cdk:scriptOption name="selectedDate" value="#{getSelectedDate(facesContext, component)}" />
<cdk:scriptOption name="dayCellClass" value="#{getDayCellClass(facesContext, component)}" />
13 years, 6 months
JBoss Rich Faces SVN: r20324 - in trunk/ui: common/ui/src/main/java/org/richfaces/convert and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-02 20:31:15 -0500 (Thu, 02 Dec 2010)
New Revision: 20324
Added:
trunk/ui/common/ui/src/main/java/org/richfaces/convert/
trunk/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/NodesTreeSequenceKeyModel.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/BaseTupleIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/ClassicTreeNodeTuplesIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/DeclarativeTreeDataModelCompositeTuplesIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/IterableDataTuplesIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/MapDataTuplesIterator.java
Removed:
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeTuplesIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelCompositeTuplesIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelTuplesIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeTuplesIterator.java
Modified:
trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeySequenceRowKeyConverter.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java
Log:
Merge branch 'RF-9686'
Copied: trunk/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java (from rev 20320, trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeySequenceRowKeyConverter.java)
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java (rev 0)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.convert;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import com.google.common.base.Strings;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class ConverterUtil {
+
+ private static final Converter STRING_CONVERTER = new Converter() {
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ if (value == null) {
+ return "";
+ }
+
+ return value.toString();
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ if (Strings.isNullOrEmpty(value)) {
+ return null;
+ }
+
+ return value;
+ }
+ };
+
+ private ConverterUtil() {}
+
+ public static Converter stringConverter() {
+ return STRING_CONVERTER;
+ }
+
+}
Modified: trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java
===================================================================
--- trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -28,6 +28,7 @@
*/
public interface TreeDataVisitor {
+ //TODO make it possible to stop when visit complete
public void enterNode();
public void exitNode();
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -495,7 +495,7 @@
Object value = getValue();
if (value == null) {
- dataModel = new DeclarativeTreeDataModelImpl(this, getVar(), getVariablesMap(getFacesContext()));
+ dataModel = new DeclarativeTreeDataModelImpl(this);
} else {
dataModel = new SwingTreeNodeDataModelImpl();
dataModel.setWrappedData(getValue());
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java (from rev 20320, trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.model.DeclarativeModelKey;
+import org.richfaces.model.SequenceRowKey;
+
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class DeclarativeTreeDataModelWalker {
+
+ private static final Logger LOGGER = RichfacesLogger.COMPONENTS.getLogger();
+
+ private String var;
+
+ private FacesContext facesContext;
+
+ private UIComponent rootComponent;
+
+ private UIComponent currentComponent;
+
+ private Map<String, Object> contextMap;
+
+ private Object data;
+
+ public DeclarativeTreeDataModelWalker(AbstractTree rootComponent) {
+ super();
+
+ this.rootComponent = rootComponent;
+ this.facesContext = FacesContext.getCurrentInstance();
+ this.contextMap = rootComponent.getVariablesMap(facesContext);
+ this.var = rootComponent.getVar();
+ this.currentComponent = rootComponent;
+
+ }
+
+ protected UIComponent getChildModelComponent(String modelId) {
+ UIComponent modelComponent;
+
+ if (currentComponent instanceof TreeModelRecursiveAdaptor && modelId.equals(currentComponent.getId())) {
+ modelComponent = currentComponent;
+ } else {
+ modelComponent = Iterables.find(currentComponent.getChildren(), ComponentPredicates.withId(modelId));
+ }
+
+ return modelComponent;
+ }
+
+ protected Object getNodes(UIComponent modelComponent) {
+ Object nodes = null;
+
+ if (modelComponent instanceof TreeModelRecursiveAdaptor) {
+ TreeModelRecursiveAdaptor recursiveAdaptor = (TreeModelRecursiveAdaptor) modelComponent;
+
+ if (currentComponent.equals(modelComponent)) {
+ nodes = recursiveAdaptor.getNodes();
+ } else {
+ nodes = recursiveAdaptor.getRoots();
+ }
+ } else {
+ nodes = ((TreeModelAdaptor) modelComponent).getNodes();
+ }
+
+ return nodes;
+ }
+
+ protected FacesContext getFacesContext() {
+ return facesContext;
+ }
+
+ protected UIComponent getRootComponent() {
+ return rootComponent;
+ }
+
+ public UIComponent getCurrentComponent() {
+ return currentComponent;
+ }
+
+ public Object getData() {
+ return data;
+ }
+
+ public void walk(SequenceRowKey key) {
+ Object initialContextValue = null;
+
+ if (var != null) {
+ initialContextValue = contextMap.remove(var);
+ }
+
+ try {
+ walkSimpleKeys(key.getSimpleKeys());
+ } finally {
+ if (var != null) {
+ try {
+ contextMap.put(var, initialContextValue);
+ } catch (Exception e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ protected DeclarativeModelKey convertKey(Object nodes, DeclarativeModelKey declarativeModelKey) {
+ return declarativeModelKey;
+ }
+
+ protected Object getData(Object nodes, Object key) {
+ if (nodes instanceof Iterable<?>) {
+ Iterable<?> iterable = (Iterable<?>) nodes;
+ return Iterables.get(iterable, (Integer) key);
+ } else {
+ return ((Map<?, ?>) nodes).get(key);
+ }
+ }
+
+ protected void walkSimpleKeys(Object simpleKey) {
+ DeclarativeModelKey segment = (DeclarativeModelKey) simpleKey;
+
+ if (var != null) {
+ contextMap.put(var, this.data);
+ }
+
+ UIComponent modelComponent = getChildModelComponent(segment.getModelId());
+ Object nodes = getNodes(modelComponent);
+
+ this.currentComponent = modelComponent;
+ DeclarativeModelKey convertedKey = convertKey(nodes, segment);
+ this.data = getData(nodes, convertedKey.getModelKey());
+ }
+
+ protected void walkSimpleKeys(Object[] simpleKeys) {
+ for (Object simpleKey : simpleKeys) {
+ walkSimpleKeys(simpleKey);
+ }
+ }
+
+}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeySequenceRowKeyConverter.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeySequenceRowKeyConverter.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeySequenceRowKeyConverter.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -21,18 +21,83 @@
*/
package org.richfaces.convert;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
import javax.faces.convert.IntegerConverter;
+import org.richfaces.component.AbstractTree;
+import org.richfaces.component.DeclarativeTreeDataModelWalker;
import org.richfaces.model.DeclarativeModelKey;
+import org.richfaces.model.SequenceRowKey;
/**
* @author Nick Belaevski
*
*/
public class DeclarativeModelKeySequenceRowKeyConverter extends SequenceRowKeyConverter<DeclarativeModelKey> {
+ private final class KeyConvertingWalker extends DeclarativeTreeDataModelWalker {
+
+ private final FacesContext context;
+
+ private DeclarativeModelKey[] convertedSimpleKeys;
+
+ private int keysIdx;
+
+ private KeyConvertingWalker(AbstractTree rootComponent, FacesContext context) {
+ super(rootComponent);
+ this.context = context;
+ }
+
+ @Override
+ protected DeclarativeModelKey convertKey(Object nodes, DeclarativeModelKey declarativeModelKey) {
+ DeclarativeModelKey convertedKey;
+
+ if (nodes instanceof Iterable<?>) {
+ String modelKeyAsString = (String) declarativeModelKey.getModelKey();
+ Object modelKey = INTEGER_CONVERTER.getAsObject(context, getRootComponent(), modelKeyAsString);
+ convertedKey = new DeclarativeModelKey(declarativeModelKey.getModelId(), modelKey);
+ } else {
+ convertedKey = declarativeModelKey;
+ }
+
+ convertedSimpleKeys[keysIdx++] = convertedKey;
+
+ return super.convertKey(nodes, convertedKey);
+ }
+
+ @Override
+ public void walk(SequenceRowKey key) {
+ convertedSimpleKeys = new DeclarativeModelKey[key.getSimpleKeys().length];
+ keysIdx = 0;
+ super.walk(key);
+ }
+
+ public DeclarativeModelKey[] getConvertedSimpleKeys() {
+ return convertedSimpleKeys;
+ }
+ }
+
+ private static final Converter INTEGER_CONVERTER = new IntegerConverter();
+
public DeclarativeModelKeySequenceRowKeyConverter() {
- super(DeclarativeModelKey.class, new DeclarativeModelKeyConverter(new IntegerConverter()));
+ super(DeclarativeModelKey.class, new DeclarativeModelKeyConverter(ConverterUtil.stringConverter()));
}
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException {
+ SequenceRowKey key = (SequenceRowKey) super.getAsObject(context, component, value);
+
+ if (key != null) {
+
+ KeyConvertingWalker walker = new KeyConvertingWalker((AbstractTree) component, context);
+ walker.walk(key);
+
+ key = new SequenceRowKey((Object[]) walker.getConvertedSimpleKeys());
+ }
+
+ return key;
+ }
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -26,12 +26,13 @@
import javax.faces.convert.Converter;
import org.richfaces.convert.ObjectSequenceRowKeyConverter;
+import org.richfaces.model.iterators.ClassicTreeNodeTuplesIterator;
/**
* @author Nick Belaevski
*
*/
-public class ClassicTreeNodeDataModelImpl extends TreeSequenceKeyModel<TreeNode> {
+public class ClassicTreeNodeDataModelImpl extends NodesTreeSequenceKeyModel<TreeNode> {
private static final Converter DEFAULT_CONVERTER = new ObjectSequenceRowKeyConverter();
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeTuplesIterator.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeTuplesIterator.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeTuplesIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.model;
-
-import java.util.Iterator;
-
-import com.google.common.collect.UnmodifiableIterator;
-
-/**
- * @author Nick Belaevski
- *
- */
-final class ClassicTreeNodeTuplesIterator extends UnmodifiableIterator<TreeDataModelTuple> {
-
- private TreeNode treeNode;
-
- private SequenceRowKey baseKey;
-
- private Iterator<Object> childrenKeysIterator = null;
-
- public ClassicTreeNodeTuplesIterator(TreeNode treeNode, SequenceRowKey baseKey) {
- super();
- this.treeNode = treeNode;
- this.baseKey = baseKey;
- this.childrenKeysIterator = treeNode.getChildrenKeysIterator();
- }
-
- public boolean hasNext() {
- return childrenKeysIterator.hasNext();
- }
-
- public TreeDataModelTuple next() {
- Object nextChildKey = childrenKeysIterator.next();
- Object rowKey = (baseKey != null ? baseKey.append(nextChildKey) : new SequenceRowKey(nextChildKey));
-
- return new TreeDataModelTuple(rowKey, treeNode.getChild(nextChildKey));
- }
-
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelCompositeTuplesIterator.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelCompositeTuplesIterator.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelCompositeTuplesIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.model;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.faces.component.UIComponent;
-
-import org.richfaces.component.ComponentPredicates;
-import org.richfaces.component.TreeModelAdaptor;
-import org.richfaces.component.TreeModelRecursiveAdaptor;
-
-import com.google.common.collect.ForwardingIterator;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-
-final class DeclarativeTreeDataModelCompositeTuplesIterator extends ForwardingIterator<TreeDataModelTuple> {
-
- private UIComponent component;
-
- private SequenceRowKey key;
-
- private Iterator<TreeDataModelTuple> iterator;
-
- public DeclarativeTreeDataModelCompositeTuplesIterator(UIComponent component, SequenceRowKey key) {
- super();
- this.component = component;
- this.key = key;
- }
-
- @Override
- protected Iterator<TreeDataModelTuple> delegate() {
- if (iterator == null) {
- List<Iterator<TreeDataModelTuple>> list = Lists.newArrayList();
-
- if (component instanceof TreeModelRecursiveAdaptor) {
- TreeModelRecursiveAdaptor parentRecursiveAdaptor = (TreeModelRecursiveAdaptor) component;
-
- Collection<?> nodes = (Collection<?>) parentRecursiveAdaptor.getNodes();
-
- if (nodes != null) {
- list.add(new DeclarativeTreeDataModelTuplesIterator(component, key, nodes.iterator()));
- }
- }
-
- if (component.getChildCount() > 0) {
- for (UIComponent child : Iterables.filter(component.getChildren(), ComponentPredicates.isRendered())) {
- Collection<?> nodes = null;
-
- if (child instanceof TreeModelRecursiveAdaptor) {
- TreeModelRecursiveAdaptor treeModelRecursiveAdaptor = (TreeModelRecursiveAdaptor) child;
-
- nodes = (Collection<?>) treeModelRecursiveAdaptor.getRoots();
- } else if (child instanceof TreeModelAdaptor) {
- TreeModelAdaptor treeModelAdaptor = (TreeModelAdaptor) child;
-
- nodes = (Collection<?>) treeModelAdaptor.getNodes();
- }
-
- if (nodes != null) {
- list.add(new DeclarativeTreeDataModelTuplesIterator(child, key, nodes.iterator()));
- }
- }
- }
-
- iterator = Iterators.concat(list.iterator());
- }
-
- return iterator;
- }
-
-}
\ No newline at end of file
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -22,18 +22,16 @@
package org.richfaces.model;
import java.util.Iterator;
-import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.convert.Converter;
import org.richfaces.component.AbstractTree;
-import org.richfaces.component.ComponentPredicates;
+import org.richfaces.component.DeclarativeTreeDataModelWalker;
import org.richfaces.component.TreeModelAdaptor;
import org.richfaces.component.TreeModelRecursiveAdaptor;
import org.richfaces.convert.DeclarativeModelKeySequenceRowKeyConverter;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
+import org.richfaces.model.iterators.DeclarativeTreeDataModelCompositeTuplesIterator;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
@@ -44,23 +42,15 @@
*/
public class DeclarativeTreeDataModelImpl extends TreeSequenceKeyModel<Object> implements DeclarativeTreeModel<Object> {
- private static final Logger LOGGER = RichfacesLogger.MODEL.getLogger();
-
private static final Converter DEFAULT_CONVERTER = new DeclarativeModelKeySequenceRowKeyConverter();
- private String var;
+ private AbstractTree tree;
- private Map<String, Object> contextMap;
-
- private UIComponent tree;
-
private UIComponent currentComponent;
- public DeclarativeTreeDataModelImpl(AbstractTree tree, String var, Map<String, Object> contextMap) {
+ public DeclarativeTreeDataModelImpl(AbstractTree tree) {
this.tree = tree;
this.currentComponent = tree;
- this.var = var;
- this.contextMap = contextMap;
}
public UIComponent getCurrentComponent() {
@@ -96,64 +86,18 @@
@Override
protected void setupKey(SequenceRowKey key) {
- Object initialContextValue = null;
+ setRowKeyAndData(null, null);
+ this.currentComponent = tree;
- if (var != null) {
- initialContextValue = contextMap.remove(var);
- }
+ if (key != null) {
+ DeclarativeTreeDataModelWalker walker = new DeclarativeTreeDataModelWalker(tree);
+ walker.walk(key);
- try {
- this.currentComponent = tree;
-
- super.setupKey(key);
- } finally {
- if (var != null) {
- try {
- contextMap.put(var, initialContextValue);
- } catch (Exception e) {
- LOGGER.error(e.getMessage(), e);
- }
- }
+ setRowKeyAndData(key, walker.getData());
+ this.currentComponent = walker.getCurrentComponent();
}
}
- @Override
- protected Object setupChildContext(Object keyObject) {
- DeclarativeModelKey segment = (DeclarativeModelKey) keyObject;
- if (var != null) {
- contextMap.put(var, getData());
- }
-
- String modelId = segment.getModelId();
-
- UIComponent modelComponent;
-
- if (currentComponent instanceof TreeModelRecursiveAdaptor && modelId.equals(currentComponent.getId())) {
- modelComponent = currentComponent;
- } else {
- modelComponent = Iterables.find(currentComponent.getChildren(), ComponentPredicates.withId(modelId));
- }
-
- Object nodes = null;
-
- if (modelComponent instanceof TreeModelRecursiveAdaptor) {
- TreeModelRecursiveAdaptor recursiveAdaptor = (TreeModelRecursiveAdaptor) modelComponent;
-
- if (currentComponent.equals(modelComponent)) {
- nodes = recursiveAdaptor.getNodes();
- } else {
- nodes = recursiveAdaptor.getRoots();
- }
- } else {
- nodes = ((TreeModelAdaptor) modelComponent).getNodes();
- }
-
- Object data = Iterables.get((Iterable<?>) nodes, (Integer) segment.getModelKey());
- this.currentComponent = modelComponent;
-
- return data;
- }
-
public TreeDataModelTuple createSnapshot() {
return new DeclarativeTreeDataModelTuple(getRowKey(), getData(), getCurrentComponent());
}
@@ -161,7 +105,7 @@
public void restoreFromSnapshot(TreeDataModelTuple tuple) {
DeclarativeTreeDataModelTuple declarativeModelTuple = (DeclarativeTreeDataModelTuple) tuple;
- super.restoreFromSnapshot(declarativeModelTuple);
+ setRowKeyAndData((SequenceRowKey) tuple.getRowKey(), tuple.getData());
this.currentComponent = declarativeModelTuple.getComponent();
}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelTuplesIterator.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelTuplesIterator.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelTuplesIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.model;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIComponent;
-
-import com.google.common.collect.UnmodifiableIterator;
-
-final class DeclarativeTreeDataModelTuplesIterator extends UnmodifiableIterator<TreeDataModelTuple> {
-
- private UIComponent component;
-
- private SequenceRowKey baseKey;
-
- private int counter = 0;
-
- private Iterator<?> dataIterator;
-
- public DeclarativeTreeDataModelTuplesIterator(UIComponent component, SequenceRowKey baseKey, Iterator<?> dataIterator) {
- super();
- this.component = component;
- this.baseKey = baseKey;
- this.dataIterator = dataIterator;
- }
-
- public TreeDataModelTuple next() {
- Object nextNode = dataIterator.next();
- DeclarativeModelKey key = new DeclarativeModelKey(component.getId(), counter++);
-
- SequenceRowKey newKey = (baseKey != null ? baseKey.append(key) : new SequenceRowKey(key));
-
- return new DeclarativeTreeDataModelTuple(newKey, nextNode, component);
- }
-
- public boolean hasNext() {
- return dataIterator.hasNext();
- }
-
-}
\ No newline at end of file
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/NodesTreeSequenceKeyModel.java (from rev 20320, trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeDataModelImpl.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/NodesTreeSequenceKeyModel.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/NodesTreeSequenceKeyModel.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.model;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public abstract class NodesTreeSequenceKeyModel<V> extends TreeSequenceKeyModel<V> {
+
+ private V rootNode;
+
+ protected V getRootNode() {
+ return rootNode;
+ }
+
+ protected void setRootNode(V rootNode) {
+ this.rootNode = rootNode;
+ }
+
+ protected void setupKey(SequenceRowKey key) {
+ setRowKeyAndData(null, rootNode);
+
+ if (key != null) {
+ V data = getRootNode();
+
+ for (Object simpleKey: key.getSimpleKeys()) {
+ data = setupChildContext(simpleKey);
+ setData(data);
+ }
+
+ setRowKeyAndData(key, data);
+ }
+ }
+
+ protected abstract V setupChildContext(Object segment);
+
+ public TreeDataModelTuple createSnapshot() {
+ return new TreeDataModelTuple(getRowKey(), getData());
+ }
+
+ public void restoreFromSnapshot(TreeDataModelTuple tuple) {
+ setRowKeyAndData((SequenceRowKey) tuple.getRowKey(), (V) tuple.getData());
+ }
+
+}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -29,6 +29,7 @@
import javax.swing.tree.TreeNode;
import org.richfaces.convert.IntegerSequenceRowKeyConverter;
+import org.richfaces.model.iterators.IterableDataTuplesIterator;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
@@ -36,7 +37,7 @@
* @author Nick Belaevski
*
*/
-public class SwingTreeNodeDataModelImpl extends TreeSequenceKeyModel<TreeNode> {
+public class SwingTreeNodeDataModelImpl extends NodesTreeSequenceKeyModel<TreeNode> {
private static final Converter DEFAULT_CONVERTER = new IntegerSequenceRowKeyConverter();
@@ -78,7 +79,7 @@
public Iterator<TreeDataModelTuple> children() {
Iterator<TreeNode> children = Iterators.forEnumeration((Enumeration<TreeNode>) getData().children());
- return new SwingTreeNodeTuplesIterator(getRowKey(), children);
+ return new IterableDataTuplesIterator(getRowKey(), children);
}
public boolean isLeaf() {
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeTuplesIterator.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeTuplesIterator.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeTuplesIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.model;
-
-import java.util.Iterator;
-
-import javax.swing.tree.TreeNode;
-
-import com.google.common.collect.UnmodifiableIterator;
-
-final class SwingTreeNodeTuplesIterator extends UnmodifiableIterator<TreeDataModelTuple> {
-
- private SequenceRowKey baseKey;
-
- private Iterator<TreeNode> children;
-
- private int counter = 0;
-
- SwingTreeNodeTuplesIterator(SequenceRowKey baseKey, Iterator<TreeNode> children) {
- this.baseKey = baseKey;
- this.children = children;
- }
-
- private int getNextCounterValue() {
- return counter++;
- }
-
- public boolean hasNext() {
- return children.hasNext();
- }
-
- public TreeDataModelTuple next() {
- TreeNode node = children.next();
-
- SequenceRowKey key;
-
- if (baseKey != null) {
- key = baseKey.append(getNextCounterValue());
- } else {
- key = new SequenceRowKey(getNextCounterValue());
- }
-
- return new TreeDataModelTuple(key, node);
- }
-
-}
\ No newline at end of file
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java 2010-12-03 00:28:30 UTC (rev 20323)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -34,8 +34,6 @@
*/
public abstract class TreeSequenceKeyModel<V> extends ExtendedDataModel<V> implements TreeDataModel<V> {
- private V rootNode;
-
private V data;
private SequenceRowKey rowKey;
@@ -52,10 +50,6 @@
}
}
- protected void resetRowKeyAndData() {
- setRowKeyAndData(null, rootNode);
- }
-
protected void setData(V data) {
this.data = data;
}
@@ -77,31 +71,8 @@
return data;
}
- protected void setupKey(SequenceRowKey key) {
- resetRowKeyAndData();
-
- if (key != null) {
- V data = getRootNode();
-
- for (Object simpleKey: key.getSimpleKeys()) {
- data = setupChildContext(simpleKey);
- setData(data);
- }
-
- setRowKeyAndData(key, data);
- }
- }
-
- protected abstract V setupChildContext(Object segment);
+ protected abstract void setupKey(SequenceRowKey key);
- protected V getRootNode() {
- return rootNode;
- }
-
- protected void setRootNode(V rootNode) {
- this.rootNode = rootNode;
- }
-
//TODO ExtendedDataModel legacy
@Override
public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
@@ -138,14 +109,6 @@
throw new UnsupportedOperationException();
}
- public TreeDataModelTuple createSnapshot() {
- return new TreeDataModelTuple(getRowKey(), getData());
- }
-
- public void restoreFromSnapshot(TreeDataModelTuple tuple) {
- setRowKeyAndData((SequenceRowKey) tuple.getRowKey(), (V) tuple.getData());
- }
-
public Object getParentRowKey(Object rowKey) {
SequenceRowKey key = getRowKey();
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/BaseTupleIterator.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/BaseTupleIterator.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/BaseTupleIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.model.iterators;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.model.DeclarativeModelKey;
+import org.richfaces.model.DeclarativeTreeDataModelTuple;
+import org.richfaces.model.SequenceRowKey;
+import org.richfaces.model.TreeDataModelTuple;
+
+import com.google.common.collect.UnmodifiableIterator;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public abstract class BaseTupleIterator extends UnmodifiableIterator<TreeDataModelTuple> {
+
+ private SequenceRowKey baseKey;
+
+ private UIComponent component;
+
+ private Object rowKey;
+
+ private Object data;
+
+ public BaseTupleIterator(SequenceRowKey baseKey) {
+ this(baseKey, null);
+ }
+
+ public BaseTupleIterator(SequenceRowKey baseKey, UIComponent component) {
+ super();
+ this.baseKey = baseKey;
+ this.component = component;
+ }
+
+ protected abstract void proceedToNext();
+
+ protected UIComponent getComponent() {
+ return component;
+ }
+
+ protected SequenceRowKey getBaseKey() {
+ return baseKey;
+ }
+
+ protected void setKeyAndData(Object rowKey, Object data) {
+ this.rowKey = rowKey;
+ this.data = data;
+ }
+
+ protected Object getKey() {
+ return rowKey;
+ }
+
+ public final TreeDataModelTuple next() {
+ proceedToNext();
+
+ Object modelKey = getWrappedKey();
+ SequenceRowKey nextKey = getCompositeKey(modelKey);
+ return createTuple(nextKey);
+ }
+
+ protected TreeDataModelTuple createTuple(SequenceRowKey key) {
+ TreeDataModelTuple result;
+
+ if (component != null) {
+ result = new DeclarativeTreeDataModelTuple(key, data, component);
+ } else {
+ result = new TreeDataModelTuple(key, data);
+ }
+
+ return result;
+ }
+
+ protected Object getWrappedKey() {
+ Object modelKey;
+
+ if (getComponent() != null) {
+ modelKey = new DeclarativeModelKey(getComponent().getId(), getKey());
+ } else {
+ modelKey = getKey();
+ }
+
+ return modelKey;
+ }
+
+ protected SequenceRowKey getCompositeKey(Object modelKey) {
+ SequenceRowKey result;
+
+ if (getBaseKey() != null) {
+ result = getBaseKey().append(modelKey);
+ } else {
+ result = new SequenceRowKey(modelKey);
+ }
+
+ return result;
+ }
+}
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/ClassicTreeNodeTuplesIterator.java (from rev 20320, trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeTuplesIterator.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/ClassicTreeNodeTuplesIterator.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/ClassicTreeNodeTuplesIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.model.iterators;
+
+import java.util.Iterator;
+
+import org.richfaces.model.SequenceRowKey;
+import org.richfaces.model.TreeNode;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ClassicTreeNodeTuplesIterator extends BaseTupleIterator {
+
+ private TreeNode treeNode;
+
+ private SequenceRowKey baseKey;
+
+ private Iterator<Object> childrenKeysIterator = null;
+
+ public ClassicTreeNodeTuplesIterator(TreeNode treeNode, SequenceRowKey baseKey) {
+ super(baseKey);
+ this.treeNode = treeNode;
+ this.childrenKeysIterator = treeNode.getChildrenKeysIterator();
+ }
+
+ public boolean hasNext() {
+ return childrenKeysIterator.hasNext();
+ }
+
+ @Override
+ protected void proceedToNext() {
+ Object key = childrenKeysIterator.next();
+ TreeNode data = treeNode.getChild(key);
+
+ setKeyAndData(key, data);
+ }
+
+}
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/DeclarativeTreeDataModelCompositeTuplesIterator.java (from rev 20320, trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelCompositeTuplesIterator.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/DeclarativeTreeDataModelCompositeTuplesIterator.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/DeclarativeTreeDataModelCompositeTuplesIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.model.iterators;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.component.ComponentPredicates;
+import org.richfaces.component.TreeModelAdaptor;
+import org.richfaces.component.TreeModelRecursiveAdaptor;
+import org.richfaces.model.SequenceRowKey;
+import org.richfaces.model.TreeDataModelTuple;
+
+import com.google.common.collect.ForwardingIterator;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+
+public class DeclarativeTreeDataModelCompositeTuplesIterator extends ForwardingIterator<TreeDataModelTuple> {
+
+ private UIComponent component;
+
+ private SequenceRowKey key;
+
+ private Iterator<TreeDataModelTuple> iterator;
+
+ public DeclarativeTreeDataModelCompositeTuplesIterator(UIComponent component, SequenceRowKey key) {
+ super();
+ this.component = component;
+ this.key = key;
+ }
+
+ @Override
+ protected Iterator<TreeDataModelTuple> delegate() {
+ if (iterator == null) {
+ List<Iterator<TreeDataModelTuple>> list = Lists.newArrayList();
+
+ if (component instanceof TreeModelRecursiveAdaptor) {
+ TreeModelRecursiveAdaptor parentRecursiveAdaptor = (TreeModelRecursiveAdaptor) component;
+
+ Object nodes = parentRecursiveAdaptor.getNodes();
+
+ Iterator<TreeDataModelTuple> tuplesIterator = createTuplesIterator(component, nodes);
+ if (tuplesIterator != null) {
+ list.add(tuplesIterator);
+ }
+ }
+
+ if (component.getChildCount() > 0) {
+ for (UIComponent child : Iterables.filter(component.getChildren(), ComponentPredicates.isRendered())) {
+ Object nodes = null;
+
+ if (child instanceof TreeModelRecursiveAdaptor) {
+ TreeModelRecursiveAdaptor treeModelRecursiveAdaptor = (TreeModelRecursiveAdaptor) child;
+
+ nodes = treeModelRecursiveAdaptor.getRoots();
+ } else if (child instanceof TreeModelAdaptor) {
+ TreeModelAdaptor treeModelAdaptor = (TreeModelAdaptor) child;
+
+ nodes = treeModelAdaptor.getNodes();
+ }
+
+ Iterator<TreeDataModelTuple> tuplesIterator = createTuplesIterator(child, nodes);
+ if (tuplesIterator != null) {
+ list.add(tuplesIterator);
+ }
+ }
+ }
+
+ iterator = Iterators.concat(list.iterator());
+ }
+
+ return iterator;
+ }
+
+ private Iterator<TreeDataModelTuple> createTuplesIterator(UIComponent component, Object nodes) {
+ if (nodes != null) {
+ if (nodes instanceof Iterable<?>) {
+ Iterable<?> iterable = (Iterable<?>) nodes;
+
+ return new IterableDataTuplesIterator(key, iterable.iterator(), component);
+ } else if (nodes instanceof Map<?, ?>) {
+ Map<?, ?> map = (Map<?, ?>) nodes;
+
+ return new MapDataTuplesIterator(key, map, component);
+ }
+ }
+
+ return null;
+ }
+
+}
\ No newline at end of file
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/IterableDataTuplesIterator.java (from rev 20320, trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeTuplesIterator.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/IterableDataTuplesIterator.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/IterableDataTuplesIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.model.iterators;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.model.SequenceRowKey;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class IterableDataTuplesIterator extends BaseTupleIterator {
+
+ private Iterator<?> iterator;
+
+ private int counter = 0;
+
+ public IterableDataTuplesIterator(SequenceRowKey baseKey, Iterator<?> children) {
+ this(baseKey, children, null);
+ }
+
+ public IterableDataTuplesIterator(SequenceRowKey baseKey, Iterator<?> children, UIComponent component) {
+ super(baseKey, component);
+ this.iterator = children;
+ }
+
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ @Override
+ protected void proceedToNext() {
+ setKeyAndData(getNextCounterValue(), iterator.next());
+ }
+
+ private int getNextCounterValue() {
+ return counter++;
+ }
+
+}
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/MapDataTuplesIterator.java (from rev 20320, trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ClassicTreeNodeTuplesIterator.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/MapDataTuplesIterator.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/iterators/MapDataTuplesIterator.java 2010-12-03 01:31:15 UTC (rev 20324)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.model.iterators;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.model.SequenceRowKey;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MapDataTuplesIterator extends BaseTupleIterator {
+
+ private Map<?, ?> dataMap;
+
+ private Iterator<?> keys;
+
+ public MapDataTuplesIterator(SequenceRowKey baseKey, Map<?, ?> dataMap) {
+ this(baseKey, dataMap, null);
+ }
+
+ public MapDataTuplesIterator(SequenceRowKey baseKey, Map<?, ?> dataMap, UIComponent component) {
+ super(baseKey, component);
+
+ this.dataMap = dataMap;
+ this.keys = dataMap.keySet().iterator();
+ }
+
+ public boolean hasNext() {
+ return keys.hasNext();
+ }
+
+ @Override
+ protected void proceedToNext() {
+ Object key = keys.next();
+ setKeyAndData(key, dataMap.get(key));
+ }
+
+}
13 years, 6 months