Author: nbelaevski
Date: 2010-12-03 12:10:51 -0500 (Fri, 03 Dec 2010)
New Revision: 20372
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
Log:
https://jira.jboss.org/browse/RF-9719
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
===================================================================
---
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-12-03
16:58:10 UTC (rev 20371)
+++
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-12-03
17:10:51 UTC (rev 20372)
@@ -22,8 +22,10 @@
package org.richfaces.demo;
import java.io.Serializable;
+import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
@@ -111,6 +113,8 @@
private String toggleNodeEvent = "";
+ private String executeTestText;
+
private static Object staticGetNodeData() {
FacesContext facesContext = FacesContext.getCurrentInstance();
return facesContext.getApplication().evaluateExpressionGet(facesContext,
"#{node}", Object.class);
@@ -230,5 +234,15 @@
this.toggleNodeEvent = toggleNodeEvent;
}
+ public String getExecuteTestText() {
+ return executeTestText;
+ }
+
+ public void setExecuteTestText(String executeTestText) {
+ this.executeTestText = executeTestText;
+ }
+ public String getCurrentTimeAsString() {
+ return DateFormat.getTimeInstance().format(new Date());
+ }
}
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-12-03 16:58:10 UTC (rev
20371)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-12-03 17:10:51 UTC (rev
20372)
@@ -212,6 +212,38 @@
</it:treeNode>
</it:tree>
+ execute/render:
+ <h:panelGrid columns="2" id="executeRenderTreeGrid">
+ <it:tree var="node" value="#{treeBean.rootNodes}"
execute="executeRenderTreeGrid" render="selectionIndicator"
+ selection="#{treeBean.selection}"
selectionType="#{treeBean.selectionType}"
toggleType="#{treeBean.toggleType}">
+ <it:treeNode>
+ #{node.data}
+ </it:treeNode>
+ </it:tree>
+
+ <h:panelGroup layout="block" id="selectionIndicator"
style="margin-left: 50px;">
+ Current time: #{treeBean.currentTimeAsString}
+
+ <br />
+
+ Current selection: #{treeBean.selection}
+
+ <br />
+
+ Test text:
+ <h:inputText value="#{treeBean.executeTestText}" />
+
+ <br />
+
+ <a4j:outputPanel ajaxRendered="true">
+ Current time: #{treeBean.currentTimeAsString}
+ <br />
+ <h:outputText value="#{treeBean.executeTestText}" />
+ </a4j:outputPanel>
+
+ </h:panelGroup>
+ </h:panelGrid>
+
<a4j:log />
</h:form>
</h:body>
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
16:58:10 UTC (rev 20371)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-03
17:10:51 UTC (rev 20372)
@@ -192,6 +192,10 @@
public abstract String getToggleNodeEvent();
+ public abstract Object getExecute();
+
+ public abstract Object getRender();
+
@Override
public String getFamily() {
return COMPONENT_FAMILY;
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-12-03
16:58:10 UTC (rev 20371)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-12-03
17:10:51 UTC (rev 20372)
@@ -39,6 +39,7 @@
import javax.faces.context.PartialViewContext;
import javax.faces.context.ResponseWriter;
+import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.component.AbstractTree;
@@ -176,12 +177,10 @@
encodeSelectionStateInput(context, component);
writer.endUpdate();
- writer.startEval();
-
JSFunction function = new JSFunction("RichFaces.$",
component.getClientId(context));
- writer.write(function.toScript() +
".__updateSelectionFromInput();");
-
- writer.endEval();
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ ajaxContext.appendOncomplete(function.toScript() +
".__updateSelectionFromInput();");
} else {
throw new IllegalArgumentException(metaComponentId);
}
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-12-03
16:58:10 UTC (rev 20371)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-12-03
17:10:51 UTC (rev 20372)
@@ -347,8 +347,6 @@
},
destroy: function() {
- richfaces.ui.TreeNode.prototype.destroy.call(this);
-
if (this.__toggleNodeEvent) {
this.__treeRootElt.undelegate(".rf-trn", this.__toggleNodeEvent, this,
this.__nodeToggleActivated);
}