Author: sergeyhalipov
Date: 2007-06-21 08:36:40 -0400 (Thu, 21 Jun 2007)
New Revision: 1249
Modified:
trunk/richfaces/tree/src/main/config/component/tree.xml
trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-86
Modified: trunk/richfaces/tree/src/main/config/component/tree.xml
===================================================================
--- trunk/richfaces/tree/src/main/config/component/tree.xml 2007-06-21 11:41:43 UTC (rev
1248)
+++ trunk/richfaces/tree/src/main/config/component/tree.xml 2007-06-21 12:36:40 UTC (rev
1249)
@@ -207,7 +207,13 @@
</description>
<defaultvalue>false</defaultvalue>
</property>
-
+
+ <property>
+ <name>stateAdvisor</name>
+ <classname>java.lang.Object</classname>
+ <description>
+ </description>
+ </property>
</component>
&listeners;
Modified:
trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
---
trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2007-06-21
11:41:43 UTC (rev 1248)
+++
trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2007-06-21
12:36:40 UTC (rev 1249)
@@ -47,6 +47,8 @@
import org.richfaces.component.UITree;
import org.richfaces.component.UITreeNode;
import org.richfaces.component.nsutils.NSUtils;
+import org.richfaces.component.state.TreeState;
+import org.richfaces.component.state.TreeStateAdvisor;
public abstract class TreeRendererBase extends CompositeRenderer {
@@ -79,6 +81,23 @@
throws IOException {
navigator.followRowKey((TreeRowKey) rowKey);
+
+ TreeState componentState = (TreeState) tree.getComponentState();
+ TreeStateAdvisor stateAdvisor =
(TreeStateAdvisor)tree.getAttributes().get("stateAdvisor");
+ if (null != stateAdvisor) {
+ Boolean adviseOpened = stateAdvisor.adviseNodeOpened(tree);
+ if (null != adviseOpened)
+ if (adviseOpened.booleanValue())
+ componentState.expandNode((TreeRowKey)rowKey);
+ else
+ componentState.collapseNode((TreeRowKey)rowKey);
+
+ Boolean adviseSelected = stateAdvisor.adviseNodeSelected(tree);
+ if (null != adviseSelected)
+ if (adviseSelected.booleanValue())
+ componentState.setSelected((TreeRowKey)rowKey);
+ }
+
if (tree.isSelected()) {
holder.setValue(tree.getNodeFacet().getClientId(context));