Author: ishabalov
Date: 2007-08-02 22:13:23 -0400 (Thu, 02 Aug 2007)
New Revision: 2042
Modified:
trunk/samples/local-value-demo/pom.xml
trunk/samples/local-value-demo/src/main/webapp/WEB-INF/web.xml
trunk/samples/local-value-demo/src/main/webapp/css/common.css
trunk/samples/local-value-demo/src/main/webapp/pages/local-value-demo.xhtml
Log:
Final version
Modified: trunk/samples/local-value-demo/pom.xml
===================================================================
--- trunk/samples/local-value-demo/pom.xml 2007-08-03 01:28:53 UTC (rev 2041)
+++ trunk/samples/local-value-demo/pom.xml 2007-08-03 02:13:23 UTC (rev 2042)
@@ -9,7 +9,7 @@
<artifactId>local-value-demo</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>war</packaging>
- <name>local-value-demo Maven Webapp</name>
+ <name>richfaces-local-value-demo Maven Webapp</name>
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
@@ -24,6 +24,6 @@
</dependency>
</dependencies>
<build>
- <finalName>local-value-demo</finalName>
+ <finalName>richfaces-local-value-demo</finalName>
</build>
</project>
Modified: trunk/samples/local-value-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/local-value-demo/src/main/webapp/WEB-INF/web.xml 2007-08-03 01:28:53 UTC
(rev 2041)
+++ trunk/samples/local-value-demo/src/main/webapp/WEB-INF/web.xml 2007-08-03 02:13:23 UTC
(rev 2042)
@@ -2,7 +2,7 @@
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<description>Local Value demo</description>
- <display-name>local-value-demo</display-name>
+ <display-name>richfaces-local-value-demo</display-name>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
Modified: trunk/samples/local-value-demo/src/main/webapp/css/common.css
===================================================================
--- trunk/samples/local-value-demo/src/main/webapp/css/common.css 2007-08-03 01:28:53 UTC
(rev 2041)
+++ trunk/samples/local-value-demo/src/main/webapp/css/common.css 2007-08-03 02:13:23 UTC
(rev 2042)
@@ -1,3 +1,7 @@
+.rich-panel {
+ margin-bottom: 5px;
+ margin-top: 5px;
+}
.samples {
vertical-align: top;
}
@@ -11,7 +15,7 @@
margin-left: 30px;
margin-right: 30px;
padding: 10px;
- background-color: #FFFF92;
+ background-color: #FFFFC5;
border-color: #A7A700;
}
.legend {
Modified: trunk/samples/local-value-demo/src/main/webapp/pages/local-value-demo.xhtml
===================================================================
--- trunk/samples/local-value-demo/src/main/webapp/pages/local-value-demo.xhtml 2007-08-03
01:28:53 UTC (rev 2041)
+++ trunk/samples/local-value-demo/src/main/webapp/pages/local-value-demo.xhtml 2007-08-03
02:13:23 UTC (rev 2042)
@@ -19,7 +19,7 @@
</head>
<body>
<a4j:loadStyle src="/css/common.css" />
-<span style="display:none">${a4j.version}</span>
+<span style="display:none">#{a4j.version}</span>
<h:panelGrid columns="2" columnClasses="samples,legend">
<h:panelGroup>
<rich:panel id="bad" styleClass="sample-panel">
@@ -40,7 +40,6 @@
</h:panelGrid>
</h:form>
</rich:panel>
-<rich:spacer height="5px"/>
<rich:panel id="good" styleClass="sample-panel">
<f:facet name="header">
Example of CORRECT approach to the problem
@@ -59,6 +58,26 @@
</h:panelGrid>
</h:form>
</rich:panel>
+<rich:panel id="good_ii" styleClass="sample-panel">
+ <f:facet name="header">
+ Example of ALTERNATIVE approach to the problem
+ </f:facet>
+ <h:form>
+ <a4j:outputPanel ajaxRendered="true">
+ <h:message for="good_input_ii" />
+ </a4j:outputPanel>
+ <h:panelGrid columns="2" styleClass="grid"
columnClasses="formLeft,formRight">
+ <h:outputText value="Enter credit card number:"/>
+ <h:inputText id="good_input_ii" value="#{data.creditCard}"
styleClass="input"/>
+ <h:outputText value="Or use your pre-defined credit card:"/>
+ <a4j:region>
+ <a4j:commandLink immediate="true"
action="#{data.useMyCreditCard_incorrect}" reRender="good_ii"
styleClass="command" value="#{data.myCreditCardName}"/>
+ </a4j:region>
+ <h:outputText value="Your entered credit card number:"/>
+ <h:outputText value="#{data.creditCard}"
styleClass="output"/>
+ </h:panelGrid>
+ </h:form>
+</rich:panel>
</h:panelGroup>
<h:panelGroup styleClass="legend">
<h3>Use case</h3>
@@ -72,11 +91,11 @@
<h3>Page Sources</h3>
<p class="source">
<h:outputText value="Enter credit card number:"/><br/>
-<h:inputText value="+{data.creditCard}"/><br/>
+<h:inputText
value="<span>#</span>{data.creditCard}"/><br/>
<h:outputText value="Or use your pre-defined credit
card:"/><br/>
-<a4j:commandLink immediate="true"
action="+{data.useMyCreditCard}" reRender="..."
value="+{data.myCreditCardName}"/><br/>
+<a4j:commandLink immediate="true"
action="<span>#</span>{data.useMyCreditCard}"
reRender="..."
value="<span>#</span>{data.myCreditCardName}"/><br/>
<h:outputText value="Your entered credit card
number:"/><br/>
-<h:outputText value="+{data.creditCard}"
styleClass="output"/><br/>
+<h:outputText value="<span>#</span>{data.creditCard}"
styleClass="output"/><br/>
</p>
<h3>Bean Source (getters/setters removed)</h3>
<p class="source">
@@ -97,12 +116,12 @@
</p>
<h3>Valid Page Sources</h3>
<p class="source">
-<h:outputText <b>binding="+{data.component}"</b>
value="Enter credit card number:"/><br/>
-<h:inputText value="+{data.creditCard}"/><br/>
+<h:outputText
<b>binding="<span>#</span>{data.component}"</b>
value="Enter credit card number:"/><br/>
+<h:inputText
value="<span>#</span>{data.creditCard}"/><br/>
<h:outputText value="Or use your pre-defined credit
card:"/><br/>
-<a4j:commandLink immediate="true"
action="+{data.useMyCreditCard}" reRender="..."
value="+{data.myCreditCardName}"/><br/>
+<a4j:commandLink immediate="true"
action="<span>#</span>{data.useMyCreditCard}"
reRender="..."
value="<span>#</span>{data.myCreditCardName}"/><br/>
<h:outputText value="Your entered credit card
number:"/><br/>
-<h:outputText value="+{data.creditCard}"
styleClass="output"/><br/>
+<h:outputText value="<span>#</span>{data.creditCard}"
styleClass="output"/><br/>
</p>
<h3>Valid Bean Source (getters/setters removed)</h3>
<p class="source">
@@ -115,6 +134,28 @@
<rich:spacer width="20px"/>return null;<br/>
}<br/>
</p>
+<h3>Alternative approach</h3>
+<p>
+Alternative approach uses a4j:region component to limit set of processed inputs. As the
result submittedValue is not pushed to the input component (because it is outside of the
a4j:region). Therefore, component will evaluate value binding and use value from the model
for rendering.
+</p>
+<h3>Alternative Page Sources</h3>
+<p class="source">
+<h:outputText value="Enter credit card number:"/><br/>
+<h:inputText
value="<span>#</span>{data.creditCard}"/><br/>
+<h:outputText value="Or use your pre-defined credit
card:"/><br/>
+<b><a4j:region><br/></b>
+<rich:spacer width="20px"/><a4j:commandLink
immediate="true"
action="<span>#</span>{data.useMyCreditCard}"
reRender="..."
value="<span>#</span>{data.myCreditCardName}"/><br/>
+<b></a4j:region><br/></b>
+<h:outputText value="Your entered credit card
number:"/><br/>
+<h:outputText value="<span>#</span>{data.creditCard}"
styleClass="output"/><br/>
+</p>
+<h3>Alternative Bean Source (getters/setters removed)</h3>
+<p class="source">
+public String useMyCreditCard() {<br/>
+<rich:spacer width="20px"/>setCreditCard(getMyCreadtCard());<br/>
+<rich:spacer width="20px"/>return null;<br/>
+}<br/>
+</p>
<h3>Success</h3>
<p>
Hopefully now my solution works!
@@ -124,7 +165,7 @@
You need to be careful with input components. In some cases you have to be aware of their
complex internal structures.
</p>
<p>
-My example is based on <b>JSF 1.2 RI</b> and <b>Facelets</b>. You
can download it from <a href="#">here</a>.
+My example is based on <b>JSF 1.2 RI</b> and <b>Facelets</b>. You
can download it from <a
href="http://anonsvn.jboss.org/repos/richfaces/trunk/samples/local-v...;.
<a
href="http://anonsvn.jboss.org/repos/richfaces/trunk/samples/local-v...
is page source</a>. <a
href="http://anonsvn.jboss.org/repos/richfaces/trunk/samples/local-v...
is bean source</a>.
</p>
</h:panelGroup>
</body>