Author: nbelaevski
Date: 2009-01-28 09:26:14 -0500 (Wed, 28 Jan 2009)
New Revision: 12467
Added:
trunk/samples/simpleTogglePanel-sample/src/main/webapp/pages/index.xhtml
Modified:
trunk/samples/simpleTogglePanel-sample/src/main/java/org/richfaces/Bean.java
trunk/samples/simpleTogglePanel-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/simpleTogglePanel-sample/src/main/webapp/WEB-INF/web.xml
trunk/samples/simpleTogglePanel-sample/src/main/webapp/pages/index.jsp
Log:
https://jira.jboss.org/jira/browse/RF-3552
Modified: trunk/samples/simpleTogglePanel-sample/src/main/java/org/richfaces/Bean.java
===================================================================
---
trunk/samples/simpleTogglePanel-sample/src/main/java/org/richfaces/Bean.java 2009-01-28
14:25:42 UTC (rev 12466)
+++
trunk/samples/simpleTogglePanel-sample/src/main/java/org/richfaces/Bean.java 2009-01-28
14:26:14 UTC (rev 12467)
@@ -21,6 +21,11 @@
package org.richfaces;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
/**
* @author $Autor$
*/
@@ -34,7 +39,14 @@
private String height = "150px";
private String style = "width: 50%; border: 2px solid gold;";
+ private String[] items = new String[] {"Item 1", "Item 2",
"Item 3"};
+ private Map<String, Object> openedData = new HashMap<String, Object>();
+
+ private Map<String, Object> clientOpenedData = new HashMap<String,
Object>();
+
+ private Object opened;
+
public String getStyle() {
return style;
}
@@ -91,5 +103,30 @@
this.olympus = olympus;
}
-
+ public Object getOpened() {
+ return opened;
+ }
+
+ public void setOpened(Object opened) {
+ this.opened = opened;
+ System.out.println("Bean.setOpened() " + opened);
+ }
+
+ public String[] getItems() {
+ return items;
+ }
+
+ public Map<String, Object> getOpenedData() {
+ return openedData;
+ }
+
+ public Map<String, Object> getClientOpenedData() {
+ return clientOpenedData;
+ }
+
+ public void action() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Object currentItem = context.getApplication().evaluateExpressionGet(context,
"#{item}", Object.class);
+ System.out.println("Bean.action() " + currentItem);
+ }
}
\ No newline at end of file
Modified: trunk/samples/simpleTogglePanel-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/samples/simpleTogglePanel-sample/src/main/webapp/WEB-INF/faces-config.xml 2009-01-28
14:25:42 UTC (rev 12466)
+++
trunk/samples/simpleTogglePanel-sample/src/main/webapp/WEB-INF/faces-config.xml 2009-01-28
14:26:14 UTC (rev 12467)
@@ -18,6 +18,10 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
<navigation-rule>
<from-view-id>/pages/pageRF_2195.jsf</from-view-id>
<navigation-case>
Modified: trunk/samples/simpleTogglePanel-sample/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/simpleTogglePanel-sample/src/main/webapp/WEB-INF/web.xml 2009-01-28
14:25:42 UTC (rev 12466)
+++ trunk/samples/simpleTogglePanel-sample/src/main/webapp/WEB-INF/web.xml 2009-01-28
14:26:14 UTC (rev 12467)
@@ -20,6 +20,11 @@
<param-value>false</param-value>
</context-param>
+ <context-param>
+ <param-name>facelets.VIEW_MAPPINGS</param-name>
+ <param-value>*.xhtml</param-value>
+ </context-param>
+
<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
Modified: trunk/samples/simpleTogglePanel-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/simpleTogglePanel-sample/src/main/webapp/pages/index.jsp 2009-01-28
14:25:42 UTC (rev 12466)
+++ trunk/samples/simpleTogglePanel-sample/src/main/webapp/pages/index.jsp 2009-01-28
14:26:14 UTC (rev 12467)
@@ -1,5 +1,6 @@
<%@ 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/simpleTogglePanel"
prefix="stp" %>
<html>
<head>
@@ -167,6 +168,55 @@
<h:outputText value="Just text!" />
</stp:simpleTogglePanel>
+ <h:form>
+ <a4j:repeat value="#{bean.items}" var="item"
rowKeyVar="rowKey">
+ <stp:simpleTogglePanel opened="#{bean.openedData[rowKey]}"
switchType="ajax" label="Ajax - #{item}">
+ <a4j:commandButton action="#{bean.action}" value="action"
/>
+ </stp:simpleTogglePanel>
+ </a4j:repeat>
+ </h:form>
+
+ <h:form>
+ <a4j:repeat value="#{bean.items}" var="item"
rowKeyVar="rowKey">
+ <stp:simpleTogglePanel opened="#{bean.clientOpenedData[rowKey]}"
switchType="client" label="Client - #{item}">
+ <a4j:commandButton action="#{bean.action}" value="action"
/>
+ </stp:simpleTogglePanel>
+ </a4j:repeat>
+
+ <h:commandLink value="Submit" />
+ </h:form>
+
+ <a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+ </a4j:outputPanel>
+
+ <h:form>
+ <stp:simpleTogglePanel id="immediatePanel" immediate="true"
switchType="ajax" label="Immediate">
+ Immediate: <h:inputText value="" required="true"
label="Immediate input inside immediate panel" immediate="true"
/><br />
+ <h:inputText value="" required="true" label="Non-immediate
input inside immediate panel" />
+ </stp:simpleTogglePanel>
+ </h:form>
+
+ <h:form>
+ <stp:simpleTogglePanel id="nonImmediatePanel" immediate="false"
switchType="ajax" label="Not immediate">
+ Immediate: <h:inputText value="" required="true"
label="Immediate input" immediate="true" /><br />
+ <h:inputText value="" required="true" label="Non-immediate
input" />
+ </stp:simpleTogglePanel>
+ </h:form>
+
+ <h:form>
+ <stp:simpleTogglePanel value="#{bean.opened}"
+ switchType="ajax" label="Panel">
+ Panel
+ </stp:simpleTogglePanel>
+ </h:form>
+
+ <h:form>
+ <stp:simpleTogglePanel opened="#{bean.opened}"
+ switchType="ajax" label="Panel">
+ Panel
+ </stp:simpleTogglePanel>
+ </h:form>
</f:view>
</body>
</html>
Added: trunk/samples/simpleTogglePanel-sample/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/samples/simpleTogglePanel-sample/src/main/webapp/pages/index.xhtml
(rev 0)
+++ trunk/samples/simpleTogglePanel-sample/src/main/webapp/pages/index.xhtml 2009-01-28
14:26:14 UTC (rev 12467)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:stp="http://labs.jboss.com/jbossrichfaces/ui/simpleTogglePanel...
+ <html>
+ <head></head>
+ <body>
+ <h:form>
+ <stp:simpleTogglePanel value="#{bean.opened}"
+ switchType="ajax" label="Panel">
+ Panel
+ </stp:simpleTogglePanel>
+ </h:form>
+
+ <h:form>
+ <stp:simpleTogglePanel opened="#{bean.opened}"
+ switchType="ajax" label="Panel">
+ Panel
+ </stp:simpleTogglePanel>
+ </h:form>
+ </body>
+ </html>
+</ui:composition>