Author: ilya_shaikovsky
Date: 2011-02-28 10:12:19 -0500 (Mon, 28 Feb 2011)
New Revision: 21988
Added:
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/togglepanel/
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/togglepanel/Profile.java
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/finalStep.xhtml
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wizard-sample.xhtml
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wizard.xhtml
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wstep1.xhtml
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wstep2.xhtml
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/wizard.xhtml
Removed:
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/DayStatistics.java
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/PassTime.java
Modified:
branches/4.0.X/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
Log:
added new "wizard" togglePanel demo.
clean-up for unused DayStatistic class from old graphValidator demo.
Added:
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/togglepanel/Profile.java
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/togglepanel/Profile.java
(rev 0)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/togglepanel/Profile.java 2011-02-28
15:12:19 UTC (rev 21988)
@@ -0,0 +1,47 @@
+package org.richfaces.demo.togglepanel;
+
+import java.io.Serializable;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+@ManagedBean
+@ViewScoped
+public class Profile implements Serializable{
+ private String firstName;
+ private String lastName;
+ private String company;
+ private String notes;
+
+ public String getCompany() {
+ return company;
+ }
+
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String notes) {
+ this.notes = notes;
+ }
+}
Deleted:
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/DayStatistics.java
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/DayStatistics.java 2011-02-28
15:05:14 UTC (rev 21987)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/DayStatistics.java 2011-02-28
15:12:19 UTC (rev 21988)
@@ -1,59 +0,0 @@
-/**
- *
- */
-package org.richfaces.demo.validation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.RequestScoped;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-/**
- * @author Ilya Shaikovsky
- *
- */
-@ManagedBean
-@RequestScoped
-public class DayStatistics {
-
- private List<PassTime> dayPasstimes = new ArrayList<PassTime>();
-
- public DayStatistics() {
- dayPasstimes.add(new PassTime("Sport", 0));
- dayPasstimes.add(new PassTime("Entertainment", 0));
- dayPasstimes.add(new PassTime("Sleeping", 0));
- dayPasstimes.add(new PassTime("Games", 0));
- }
-
- public List<PassTime> getDayPasstimes() {
- return dayPasstimes;
- }
-
- public void setDayPasstimes(List<PassTime> dayPasstimes) {
- this.dayPasstimes = dayPasstimes;
- }
-
- @NotNull
- @Min(value = 1, message = "Please fill at list one entry")
- @Max(value = 24, message = "Only 24h in a day!")
- public Integer getTotalTime() {
- Integer result = new Integer(0);
- for (PassTime passtime : dayPasstimes) {
- result += passtime.getTime();
- }
- return result;
- }
-
- public void store(ActionEvent event) {
- FacesContext.getCurrentInstance().addMessage(
- event.getComponent().getClientId(FacesContext.getCurrentInstance()),
- new FacesMessage(FacesMessage.SEVERITY_INFO, "Changes Stored
Successfully", "Changes Stored Successfully"));
- }
-}
Deleted:
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/PassTime.java
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/PassTime.java 2011-02-28
15:05:14 UTC (rev 21987)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/PassTime.java 2011-02-28
15:12:19 UTC (rev 21988)
@@ -1,41 +0,0 @@
-package org.richfaces.demo.validation;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-import org.hibernate.validator.constraints.Length;
-import org.hibernate.validator.constraints.NotEmpty;
-
-public class PassTime {
-
- @NotEmpty
- @Length(max = 15, min = 3)
- private String title;
- @NotNull
- @Min(0)
- @Max(12)
- private Integer time;
-
- public PassTime(String title, Integer time) {
- setTitle(title);
- setTime(time);
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public Integer getTime() {
- return time;
- }
-
- public void setTime(Integer time) {
- this.time = time;
- }
-
-}
Modified:
branches/4.0.X/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2011-02-28
15:05:14 UTC (rev 21987)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2011-02-28
15:12:19 UTC (rev 21988)
@@ -193,14 +193,10 @@
<id>graphValidator</id>
<name>rich:graphValidator</name>
<samples>
- <sample>
+ <sample new="true">
<id>passwordValidation</id>
<name>Password Validation</name>
</sample>
- <sample>
- <id>dayStatisticValidation</id>
- <name>Day pass-times validation</name>
- </sample>
</samples>
</demo>
<demo>
@@ -381,6 +377,10 @@
<id>simple</id>
<name>Simple Toggle Panel</name>
</sample>
+ <sample new="true">
+ <id>wizard</id>
+ <name>Wizard creation</name>
+ </sample>
</samples>
</demo>
<demo>
Added:
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/finalStep.xhtml
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/finalStep.xhtml
(rev 0)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/finalStep.xhtml 2011-02-28
15:12:19 UTC (rev 21988)
@@ -0,0 +1,27 @@
+<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:rich="http://richfaces.org/rich">
+
+ <div style="position:relative;height:140px">
+ <h:panelGrid
+ columns="2" columnClasses="wfcol1">
+ <h:outputText value="First Name:" />
+ <h:outputText value="#{profile.firstName}" />
+ <h:outputText value="Last Name:" />
+ <h:outputText value="#{profile.lastName}" />
+ <h:outputText value="Company:" />
+ <h:outputText value="#{profile.company}" />
+ <h:outputText value="Notes:" />
+ <h:outputText value="#{profile.notes}" />
+ </h:panelGrid>
+ <div class="navPanel">
+ <a4j:commandButton value="<<Previous"
style="float:left">
+ <rich:toggleControl targetItem="@prev" event="click"/>
+ </a4j:commandButton>
+ </div>
+ </div>
+
+</ui:composition>
Added:
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wizard-sample.xhtml
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wizard-sample.xhtml
(rev 0)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wizard-sample.xhtml 2011-02-28
15:12:19 UTC (rev 21988)
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ <style type="text/css">
+ .col1 { vertical-align:top; }
+ .col2 { vertical-align:top; width:450px; }
+ .wizard { width:400px; }
+ .wform td { vertical-align:top; }
+ .wfcol1 { text-align: right; white-space:nowrap;}
+ .wfcol2 { }
+ .wfcol3 { }
+ .s1row td { height:30px; }
+ .rich-message { color:red; }
+
+ .navPanel {
+ position:absolute;
+ bottom:0;
+ height:23px;
+ margin:0;
+ padding:2px;
+ }
+
+ </style>
+ <br/>
+ <h:panelGrid width="100%" columns="2"
columnClasses="col1,col2">
+ <rich:panel styleClass="wizard">
+ <f:facet name="header">
+ <h:outputText value="Using rich:togglePanel for Wizard-like behaviour"
/>
+ </f:facet>
+ <h:form>
+ <rich:togglePanel switchType="ajax">
+ <rich:togglePanelItem>
+ <ui:include src="/richfaces/togglePanel/samples/wstep1.xhtml" />
+ </rich:togglePanelItem>
+ <rich:togglePanelItem>
+ <ui:include src="/richfaces/togglePanel/samples/wstep2.xhtml" />
+ </rich:togglePanelItem>
+ <rich:togglePanelItem>
+ <ui:include src="/richfaces/togglePanel/samples/finalStep.xhtml"
/>
+ </rich:togglePanelItem>
+ </rich:togglePanel>
+ </h:form>
+ </rich:panel>
+
+ </h:panelGrid>
+ <br/>
+</ui:composition>
\ No newline at end of file
Added:
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wizard.xhtml
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wizard.xhtml
(rev 0)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wizard.xhtml 2011-02-28
15:12:19 UTC (rev 21988)
@@ -0,0 +1,43 @@
+<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:rich="http://richfaces.org/rich">
+
+ <style type="text/css">
+ .col1 { vertical-align:top; }
+ .col2 { vertical-align:top; width:450px; }
+ .wizard { width:400px; }
+ .wform td { vertical-align:top; }
+ .wfcol1 { text-align: right; white-space:nowrap;}
+ .wfcol2 { }
+ .wfcol3 { }
+ .s1row td { height:30px; }
+ .rich-message { color:red; }
+
+ .navPanel {
+ position:absolute;
+ bottom:0;
+ height:23px;
+ margin:0;
+ padding:2px;
+ }
+
+ </style>
+ <br/>
+ <h:panelGrid width="100%" columns="2"
columnClasses="col1,col2">
+ <a4j:keepAlive beanName="profile" />
+ <rich:panel styleClass="wizard">
+ <f:facet name="header">
+ <h:outputText value="Using a4j:include for Wizard-like behaviour" />
+ </f:facet>
+ <h:form>
+ <a4j:include viewId="/richfaces/include/examples/wstep1.xhtml" />
+ </h:form>
+ </rich:panel>
+
+ </h:panelGrid>
+ <br/>
+
+</ui:composition>
\ No newline at end of file
Added:
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wstep1.xhtml
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wstep1.xhtml
(rev 0)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wstep1.xhtml 2011-02-28
15:12:19 UTC (rev 21988)
@@ -0,0 +1,28 @@
+<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:rich="http://richfaces.org/rich">
+
+ <div style="position:relative;height:140px">
+ <h:panelGrid rowClasses="s1row" columns="3"
columnClasses="wfcol1,wfcol2,wfcol3">
+ <h:outputText value="First Name:" />
+ <h:inputText id="fn" value="#{profile.firstName}"
label="First Name" required="true" />
+ <rich:message for="fn" />
+
+ <h:outputText value="Last Name:" />
+ <h:inputText id="ln" value="#{profile.lastName}"
label="Last Name" required="true" />
+ <rich:message for="ln" />
+
+ <h:outputText value="Company:" />
+ <h:inputText id="comp" value="#{profile.company}"
label="Company" required="true" />
+ <rich:message for="comp"/>
+ </h:panelGrid>
+ <div class="navPanel" style="width:100%;">
+ <a4j:commandButton style="float:right" value="Next
>>">
+ <rich:toggleControl targetItem="@next" event="click"/>
+ </a4j:commandButton>
+ </div>
+ </div>
+</ui:composition>
\ No newline at end of file
Added:
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wstep2.xhtml
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wstep2.xhtml
(rev 0)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/wstep2.xhtml 2011-02-28
15:12:19 UTC (rev 21988)
@@ -0,0 +1,25 @@
+<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:rich="http://richfaces.org/rich">
+
+ <div style="position:relative;height:140px">
+ <h:panelGrid columns="3"
columnClasses="wfcol1,wfcol2,wfcol3">
+ <h:outputText value="Notes:" />
+ <h:inputTextarea cols="20" rows="4" id="notes"
value="#{profile.notes}" label="Notes" required="true"
/>
+ <rich:message for="notes" />
+ </h:panelGrid>
+ <div class="navPanel" style="width:100%;">
+ <a4j:commandButton value="<<Previous"
style="float:left">
+ <rich:toggleControl targetItem="@prev" event="click"/>
+ </a4j:commandButton>
+ <a4j:commandButton value="Next >>"
style="float:right">
+ <rich:toggleControl targetItem="@next" event="click"/>
+ </a4j:commandButton>
+ </div>
+
+
+ </div>
+</ui:composition>
\ No newline at end of file
Added:
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/wizard.xhtml
===================================================================
---
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/wizard.xhtml
(rev 0)
+++
branches/4.0.X/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/wizard.xhtml 2011-02-28
15:12:19 UTC (rev 21988)
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition>
+ <p>And here is simple wizard example constructed using
<b>rich:togglePanel</b>
+ component.</p>
+ <p>Main advantages of using that component for wizard creation:</p>
+ <ul>
+ <li>You're not defining any navigation rules and not managing
+ current page shown in your code. You just inserting
+ <b>rich:togglePanelItem</b> components in needed order and switching
between
+ them. Current page could be stored using activeItem additionally.</li>
+ <li>You not bound anywhere in controls to which panel you need to
+ switch. Just the <b>@next</b> and <b>@prev</b> shortcuts used.
In that case you
+ could easilly add/remove additional panels without making changes in
+ switching code. Though you still could use names in targetItem in case
+ really need to perform switch to any concrete one. or could use two
+ more shortcuts - <b>@first</b>, <b>(a)last</b>.</li>
+ <li>Opposite to 3.3.x where toggle controls were encoded as links
+ - in RF 4.x <b>rich:toggleControl</b> is just a behavior so any control
could
+ be used for switching.</li>
+ </ul>
+
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}"
/>
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src"
+ value="/richfaces/togglePanel/samples/wstep1.xhtml" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="Show Step 1 Source" />
+ <ui:param name="hideLabel" value="Hide Step 1 Source" />
+ </ui:include>
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src"
+ value="/richfaces/togglePanel/samples/wstep2.xhtml" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Step 2 Source" />
+ <ui:param name="hideLabel" value="Hide Step 2 Source" />
+ </ui:include>
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src"
+ value="/richfaces/togglePanel/samples/finalStep.xhtml" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Final Step Source" />
+ <ui:param name="hideLabel" value="Hide Final Step Source" />
+ </ui:include>
+</ui:composition>
+
+</html>
\ No newline at end of file