Author: nbelaevski
Date: 2008-08-07 11:22:45 -0400 (Thu, 07 Aug 2008)
New Revision: 9976
Added:
trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/
trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/Bean.java
trunk/samples/tree-demo/src/main/webapp/images/rf-3899.png
trunk/samples/tree-demo/src/main/webapp/pages/rf-3899.jsp
Modified:
trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml
Log:
https://jira.jboss.org/jira/browse/RF-3899
Added: trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/Bean.java
===================================================================
--- trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/Bean.java
(rev 0)
+++ trunk/samples/tree-demo/src/main/java/org/richfaces/rf3899/Bean.java 2008-08-07
15:22:45 UTC (rev 9976)
@@ -0,0 +1,58 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.rf3899;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UITree;
+
+/**
+ */
+
+public class Bean {
+
+ private static final String KEY_NAME = Bean.class.getName();
+ private int requestCounter = -1;
+
+ private int getRequestNumber() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Map<String, Object> map = context.getExternalContext().getRequestMap();
+ if (map.get(KEY_NAME) == null) {
+ map.put(KEY_NAME, Boolean.TRUE);
+ return ++requestCounter;
+ } else {
+ return requestCounter;
+ }
+ }
+
+ public Boolean adviseNodeOpened(UITree tree) {
+ int num = getRequestNumber();
+
+ if (num < 1) {
+ return Boolean.FALSE;
+ } else {
+ return Boolean.TRUE;
+ }
+ }
+}
Modified: trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-08-07 15:22:38
UTC (rev 9975)
+++ trunk/samples/tree-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-08-07 15:22:45
UTC (rev 9976)
@@ -23,5 +23,11 @@
<managed-bean-name>skinBean</managed-bean-name>
<managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>rf3899</managed-bean-name>
+ <managed-bean-class>org.richfaces.rf3899.Bean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
Added: trunk/samples/tree-demo/src/main/webapp/images/rf-3899.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/tree-demo/src/main/webapp/images/rf-3899.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/tree-demo/src/main/webapp/pages/rf-3899.jsp
===================================================================
--- trunk/samples/tree-demo/src/main/webapp/pages/rf-3899.jsp (rev
0)
+++ trunk/samples/tree-demo/src/main/webapp/pages/rf-3899.jsp 2008-08-07 15:22:45 UTC (rev
9976)
@@ -0,0 +1,40 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j" %>
+<%@ taglib
uri="http://labs.jboss.com/jbossrichfaces/ui/tree"
prefix="rich"%>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ Try to expand any node. The whole tree should be expanded.
+
+ <h:panelGroup layout="block" id="imageHidden"
style="padding: 10px; border: 1px solid navy;">
+ <h:outputLink value="#"
onclick="Element.show('imageShown'); Element.hide('imageHidden');
return false;">
+ Click here to see the wrong variant
+ </h:outputLink>
+ </h:panelGroup>
+ <h:panelGroup layout="block" id="imageShown"
style="padding: 10px; border: 1px solid navy; display: none;">
+ <h:graphicImage value="../images/rf-3899.png" /><br />
+ <h:outputLink value="#"
onclick="Element.hide('imageShown'); Element.show('imageHidden');
return false;">
+ Hide
+ </h:outputLink>
+ </h:panelGroup>
+
+
+ <a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+ </a4j:outputPanel>
+
+ <h:form>
+ <rich:tree value="#{bean.data}" switchType="server"
immediate="true"
adviseNodeOpened="#{rf3899.adviseNodeOpened}"></rich:tree>
+ </h:form>
+
+ <a4j:status startText="...start..." />
+
+ <a4j:log hotkey="O" />
+
+ </f:view>
+ </body>
+</html>