Author: lfryc(a)redhat.com
Date: 2010-12-15 12:11:08 -0500 (Wed, 15 Dec 2010)
New Revision: 20587
Added:
modules/tests/metamer/trunk/application/src/main/webapp/resources/images/loading.gif
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/treeAdaptors.xhtml
Log:
rich:tree - added loading facet testing (RF-9827, RF-9838)
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeBean.java 2010-12-15
17:10:12 UTC (rev 20586)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeBean.java 2010-12-15
17:11:08 UTC (rev 20587)
@@ -32,6 +32,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
+import javax.faces.event.ComponentSystemEvent;
import javax.swing.tree.TreeNode;
import org.richfaces.component.UITree;
@@ -63,6 +64,9 @@
private Map<String, Country> countriesCache = new HashMap<String,
Country>();
private Map<String, Company> companiesCache = new HashMap<String,
Company>();
+ private boolean testLoadingFacet = false;
+ private boolean delayedRender = false;
+
/**
* Initializes the managed bean.
*/
@@ -75,7 +79,7 @@
attributes.get("rendered").setValue(true);
attributes.get("toggleType").setValue("ajax");
attributes.get("selectionType").setValue("ajax");
-
+
// FIXME attributes not in taglib
attributes.setAttribute("iconLeaf", null);
attributes.setAttribute("iconExpanded", null);
@@ -143,6 +147,7 @@
}
public List<TreeNode> getRoot() {
+
return root;
}
@@ -153,4 +158,30 @@
public void setSelection(Collection<Object> selection) {
this.selection = selection;
}
+
+ public boolean isTestLoadingFacet() {
+ return testLoadingFacet;
+ }
+
+ public void setTestLoadingFacet(boolean testLoadingFacet) {
+ this.testLoadingFacet = testLoadingFacet;
+ }
+
+ public boolean isDelayedRender() {
+ return delayedRender;
+ }
+
+ public void setDelayedRender(boolean delayedRender) {
+ this.delayedRender = delayedRender;
+ }
+
+ public void preRenderView(ComponentSystemEvent event) {
+ if (delayedRender) {
+ try {
+ Thread.sleep(1000);
+ } catch (Exception e) {
+ throw new IllegalStateException();
+ }
+ }
+ }
}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/simple.xhtml 2010-12-15
17:10:12 UTC (rev 20586)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/simple.xhtml 2010-12-15
17:11:08 UTC (rev 20587)
@@ -27,12 +27,14 @@
-->
<ui:composition template="/templates/template.xhtml">
+ <ui:param name="componentId" value="richTree" />
<ui:define name="head">
<f:metadata>
<f:viewParam name="templates"
value="#{templateBean.templates}">
<f:converter converterId="templatesListConverter" />
</f:viewParam>
+ <f:event type="preRenderView"
listener="#{richTreeBean.preRenderView}" />
</f:metadata>
</ui:define>
@@ -85,6 +87,7 @@
nodeClass="#{richTreeBean.attributes['nodeClass'].value}"
selectionChangeListener="#{richTreeListenerBean.processSelectionChange}"
toggleListener="#{richTreeListenerBean.processToggle}"
+ render="@this treeInfo"
<rich:treeNode type="country"
@@ -97,6 +100,9 @@
labelClass="#{richTreeNodeBean.attributes[0]['labelClass'].value}"
styleClass="#{richTreeNodeBean.attributes[0]['styleClass'].value}"
+ <f:facet name="loading">
+ <h:graphicImage value="/resources/images/loading.gif"
rendered="#{richTreeBean.testLoadingFacet}" />
+ </f:facet>
#{node.name}
</rich:treeNode>
@@ -111,6 +117,10 @@
labelClass="#{richTreeNodeBean.attributes[1]['labelClass'].value}"
styleClass="#{richTreeNodeBean.attributes[1]['styleClass'].value}"
+ <f:facet name="loading">
+ <h:graphicImage value="/resources/images/loading.gif"
rendered="#{richTreeBean.testLoadingFacet}" />
+ </f:facet>
+
#{node.name}
</rich:treeNode>
@@ -181,8 +191,20 @@
</ui:define>
<ui:define name="outOfTemplateAfter">
- <a4j:outputPanel ajaxRendered="true">
- <h:panelGrid id="selectionOutput" columns="2">
+
+
+ <a4j:outputPanel id="treeInfo">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="Test Loading Facet:" />
+ <h:selectBooleanCheckbox
value="#{richTreeBean.testLoadingFacet}">
+ <a4j:ajax render="#{nestedComponentId}" />
+ </h:selectBooleanCheckbox>
+
+ <h:outputLabel value="Delayed Render (1sec):" />
+ <h:selectBooleanCheckbox
value="#{richTreeBean.delayedRender}">
+ <a4j:ajax />
+ </h:selectBooleanCheckbox>
+
<h:outputLabel value="Selection:" />
<h:outputText value="#{richTreeBean.selection}" />
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/treeAdaptors.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/treeAdaptors.xhtml 2010-12-15
17:10:12 UTC (rev 20586)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/treeAdaptors.xhtml 2010-12-15
17:11:08 UTC (rev 20587)
@@ -33,6 +33,7 @@
<f:viewParam name="templates"
value="#{templateBean.templates}">
<f:converter converterId="templatesListConverter" />
</f:viewParam>
+ <f:event type="preRenderView"
listener="#{richTreeBean.preRenderView}" />
</f:metadata>
</ui:define>
@@ -97,7 +98,9 @@
iconClass="#{richTreeNodeBean.attributes[0]['iconClass'].value}"
labelClass="#{richTreeNodeBean.attributes[0]['labelClass'].value}"
styleClass="#{richTreeNodeBean.attributes[0]['styleClass'].value}">
-
+ <f:facet name="loading">
+ <h:graphicImage value="/resources/images/loading.gif"
rendered="#{richTreeBean.testLoadingFacet}" />
+ </f:facet>
<a4j:outputPanel id="panel">
#{node.label}
</a4j:outputPanel>
@@ -134,6 +137,9 @@
labelClass="#{richTreeNodeBean.attributes[1]['labelClass'].value}"
styleClass="#{richTreeNodeBean.attributes[1]['styleClass'].value}"
+ <f:facet name="loading">
+ <h:graphicImage value="/resources/images/loading.gif"
rendered="#{richTreeBean.testLoadingFacet}" />
+ </f:facet>
#{node.label}
</rich:treeNode>
</rich:treeModelRecursiveAdaptor>
@@ -146,6 +152,15 @@
<a4j:outputPanel ajaxRendered="true">
<h:panelGrid id="selectionOutput" columns="2">
+ <h:outputLabel value="Test Loading Facet:" />
+ <h:selectBooleanCheckbox
value="#{richTreeBean.testLoadingFacet}">
+ <a4j:ajax render="#{nestedComponentId}" />
+ </h:selectBooleanCheckbox>
+
+ <h:outputLabel value="Delayed Render (1sec):" />
+ <h:selectBooleanCheckbox
value="#{richTreeBean.delayedRender}">
+ <a4j:ajax />
+ </h:selectBooleanCheckbox>
<h:outputLabel value="Recursive Leaf Children Nullable:" />
<h:selectBooleanCheckbox
value="#{richTreeModelRecursiveAdaptorBean.leafChildrenNullable}">
Added:
modules/tests/metamer/trunk/application/src/main/webapp/resources/images/loading.gif
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/images/loading.gif
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/resources/images/loading.gif 2010-12-15
17:11:08 UTC (rev 20587)
@@ -0,0 +1,48 @@
+GIF89a
+
+�N1l�@3�0����D���PP����f8 � ��e�
+
+$�|n
+��%n B
+
+(&�i
+$~$'�M
+&&I )&Ot
+
+ �wpxV���(-(�G�[xƂ�Qv_x
+�����C�
+Q
+
+
+LL�"&
+��)&$( H'�"&
+
+
+
+[[�$
+g]�
+�B
+�C
+
+\�\B�
+
+ �!$$
+��&(
+HC�
+
+�
+v'
+
+��I
+
+
+vB%
+�� X
+
+&�"��
+I�
+
\ No newline at end of file