Author: amarkhel
Date: 2010-10-18 06:30:07 -0400 (Mon, 18 Oct 2010)
New Revision: 19592
Added:
trunk/examples/output-demo/src/main/java/org/richfaces/ModalPanel.java
trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java
trunk/examples/output-demo/src/main/webapp/examples/panel.xhtml
trunk/examples/output-demo/src/main/webapp/examples/popupPanel.xhtml
trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
Modified:
trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
Log:
RF-8927, RF-8929
Added: trunk/examples/output-demo/src/main/java/org/richfaces/ModalPanel.java
===================================================================
--- trunk/examples/output-demo/src/main/java/org/richfaces/ModalPanel.java
(rev 0)
+++ trunk/examples/output-demo/src/main/java/org/richfaces/ModalPanel.java 2010-10-18
10:30:07 UTC (rev 19592)
@@ -0,0 +1,196 @@
+package org.richfaces;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+@ManagedBean
+@RequestScoped
+public class ModalPanel {
+ private boolean autosized;
+ private boolean keepVisualState;
+ private String left;
+ private String top;
+ private boolean rendered;
+ private String shadowDepth;
+ private String shadowOpacity;
+ private boolean show;
+ private int zindex;
+ private int minHeight;
+ private int minWidth;
+ private int maxHeight;
+ private int maxWidth;
+ private int height;
+ private int width;
+ private boolean moveable;
+ private boolean resizeable;
+ private String inputTextTest;
+ private String domElementAttachment;
+
+
+ public String getInputTextTest() {
+ return inputTextTest;
+ }
+
+ public void setInputTextTest(String inputTextTest) {
+ this.inputTextTest = inputTextTest;
+ }
+
+ public ModalPanel() {
+ this.inputTextTest = "text";
+ this.minHeight = 100;
+ this.minWidth = 100;
+ this.height = 300;
+ this.width = 300;
+ this.maxWidth = -1;
+ this.maxHeight = -1;
+ this.moveable=true;
+ this.resizeable=true;
+ this.autosized = false;
+ this.keepVisualState = false;
+ this.left = "auto";
+ this.top = "auto";
+ this.rendered = true;
+ this.shadowDepth = "3";
+ this.shadowOpacity = "3";
+ this.show = false;
+ this.domElementAttachment = "body";
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public int getMinHeight() {
+ return minHeight;
+ }
+
+ public void setMinHeight(int minHeight) {
+ this.minHeight = minHeight;
+ }
+
+ public int getMaxWidth() {
+ return maxWidth;
+ }
+
+ public void setMaxWidth(int maxWidth) {
+ this.maxWidth = minWidth;
+ }
+
+ public int getMaxHeight() {
+ return maxHeight;
+ }
+
+ public void setMaxHeight(int maxHeight) {
+ this.maxHeight = maxHeight;
+ }
+
+ public int getMinWidth() {
+ return minWidth;
+ }
+
+ public void setMinWidth(int minWidth) {
+ this.minWidth = minWidth;
+ }
+
+ public boolean isMoveable() {
+ return moveable;
+ }
+
+ public void setMoveable(boolean moveable) {
+ this.moveable = moveable;
+ }
+
+ public boolean isResizeable() {
+ return resizeable;
+ }
+
+ public void setResizeable(boolean resizeable) {
+ this.resizeable = resizeable;
+ }
+
+ public void setAutosized(boolean autosized) {
+ this.autosized = autosized;
+ }
+
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public boolean isAutosized() {
+ return autosized;
+ }
+
+ public boolean isKeepVisualState() {
+ return keepVisualState;
+ }
+
+ public void setKeepVisualState(boolean keepVisualState) {
+ this.keepVisualState = keepVisualState;
+ }
+
+ public String getLeft() {
+ return left;
+ }
+
+ public void setLeft(String left) {
+ this.left = left;
+ }
+
+ public String getTop() {
+ return top;
+ }
+
+ public void setTop(String top) {
+ this.top = top;
+ }
+
+ public boolean getRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public String getShadowDepth() {
+ return shadowDepth;
+ }
+
+ public void setShadowDepth(String shadowDepth) {
+ this.shadowDepth = shadowDepth;
+ }
+
+ public String getShadowOpacity() {
+ return shadowOpacity;
+ }
+
+ public void setShadowOpacity(String shadowOpacity) {
+ this.shadowOpacity = shadowOpacity;
+ }
+
+ public boolean isShow() {
+ return show;
+ }
+
+ public void setShow(boolean show) {
+ this.show = show;
+ }
+
+ public String getDomElementAttachment() {
+ return domElementAttachment;
+ }
+
+ public void setDomElementAttachment(String domElementAttachment) {
+ this.domElementAttachment = domElementAttachment;
+ }
+}
\ No newline at end of file
Added: trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java
===================================================================
--- trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java
(rev 0)
+++ trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java 2010-10-18
10:30:07 UTC (rev 19592)
@@ -0,0 +1,71 @@
+/**
+ *
+ */
+package org.richfaces;
+
+import java.util.Date;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+@ManagedBean
+@ViewScoped
+public class ProgressBarBean {
+
+ private boolean buttonRendered = true;
+ private boolean enabled=false;
+ private Long startTime;
+
+ public String startProcess() {
+ setEnabled(true);
+ setButtonRendered(false);
+ setStartTime(new Date().getTime());
+ return null;
+ }
+
+ public Long getCurrentValue(){
+ if (isEnabled()) {
+ Long current = (new Date().getTime() - startTime)/1000;
+ if (current>100){
+ setButtonRendered(true);
+ } else if (current.equals(0)) {
+ return new Long(1);
+ }
+ return (new Date().getTime() - startTime)/1000;
+ }
+ if (startTime == null) {
+ return Long.valueOf(-1);
+ } else {
+ return Long.valueOf(101);
+ }
+
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public Long getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(Long startTime) {
+ this.startTime = startTime;
+ }
+
+ public boolean isButtonRendered() {
+ return buttonRendered;
+ }
+
+ public void setButtonRendered(boolean buttonRendered) {
+ this.buttonRendered = buttonRendered;
+ }
+}
\ No newline at end of file
Modified: trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-10-18
06:53:34 UTC (rev 19591)
+++ trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-10-18
10:30:07 UTC (rev 19592)
@@ -42,6 +42,18 @@
<from-outcome>tabPanel</from-outcome>
<to-view-id>/examples/tabPanel.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>panel</from-outcome>
+ <to-view-id>/examples/panel.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>popup</from-outcome>
+ <to-view-id>/examples/popupPanel.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>progressbar</from-outcome>
+ <to-view-id>/examples/progressbar.xhtml</to-view-id>
+ </navigation-case>
<!-- QUnit -->
<navigation-case>
Added: trunk/examples/output-demo/src/main/webapp/examples/panel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/panel.xhtml
(rev 0)
+++ trunk/examples/output-demo/src/main/webapp/examples/panel.xhtml 2010-10-18 10:30:07
UTC (rev 19592)
@@ -0,0 +1,44 @@
+
+<!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"
+
xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+<ui:define name="body">
+ <pn:panel>
+ <f:facet name="header">
+ Test
+ </f:facet>
+ <pn:panel>
+ <f:facet name="header">
+ Test
+ </f:facet>
+ <pn:panel>
+ <f:facet name="header">
+ Test
+ </f:facet>
+ Body text
+ </pn:panel>
+ </pn:panel>
+ </pn:panel>
+ <br/>
+ <pn:panel>
+ <f:facet name="header">
+ Test<br/>
+ Test<br/>
+ Test<br/>
+ Test<br/>
+ Test<br/>
+ </f:facet>
+ <h:form>
+ <h:outputText value="inside the form"/>
+ </h:form>
+ </pn:panel>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file
Added: trunk/examples/output-demo/src/main/webapp/examples/popupPanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/popupPanel.xhtml
(rev 0)
+++ trunk/examples/output-demo/src/main/webapp/examples/popupPanel.xhtml 2010-10-18
10:30:07 UTC (rev 19592)
@@ -0,0 +1,75 @@
+<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/output"
template="/templates/template.xhtml">
+
+ <ui:define name="body">
+
+<h:form id="form">
+<h:outputLink value="#"
+ onclick="RichFaces.$('form:popup').show(); return
false;">
+ Open popup
+ </h:outputLink>
+<rich:popupPanel id="popup" left="#{modalPanel.left}"
+ top="#{modalPanel.top}" height="#{modalPanel.height}"
+ width="#{modalPanel.width}"
+ minHeight="#{modalPanel.minHeight}"
+ minWidth="#{modalPanel.minWidth}"
+ maxHeight="#{modalPanel.maxHeight}"
+ maxWidth="#{modalPanel.maxWidth}"
+ moveable="#{modalPanel.moveable}"
+ resizeable="#{modalPanel.resizeable}"
+ keepVisualState="#{modalPanel.keepVisualState}"
+ rendered="#{modalPanel.rendered}"
+ autosized="#{modalPanel.autosized}"
+ shadowDepth="#{modalPanel.shadowDepth}"
+ shadowOpacity="#{modalPanel.shadowOpacity}"
+ show="#{modalPanel.show}"
+ domElementAttachment="#{modalPanel.domElementAttachment}"
+ >
+ <f:facet name="header">
+ <h:outputText value="HEADER for popup" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:outputLink value="#"
+ onclick="RichFaces.$('form:popup').hide(); return
false;">
+ X
+ </h:outputLink>
+ </f:facet>
+ <p>Any content might be inside the panel.</p>
+ <p>Consider inclusion of the form elements into the popup or
+ redefinition of <b>domElementAttachment</b> attribute.</p>
+ <p>The popup panel is open and closed from the javascript function
+ of component client side object. The following code <a href="#"
+ onclick="RichFaces.$('form:popup').hide()">hide this
panel</a>:
<f:verbatim>#</f:verbatim>RichFaces.$('form:popup').hide()</p>
+
+ <h:inputText value="#{modalPanel.inputTextTest}" />
+
+ </rich:popupPanel>
+
+ <h:panelGrid columns="2">
+ <h:outputText value="Left: "/><h:inputText
value="#{modalPanel.left}"/>
+ <h:outputText value="Top: "/><h:inputText
value="#{modalPanel.top}"/>
+ <h:outputText value="Height: "/><h:inputText
value="#{modalPanel.height}"/>
+ <h:outputText value="Width: "/><h:inputText
value="#{modalPanel.width}"/>
+ <h:outputText value="MinHeight: "/><h:inputText
value="#{modalPanel.minHeight}"/>
+ <h:outputText value="MinWidth: "/><h:inputText
value="#{modalPanel.minWidth}"/>
+ <h:outputText value="MaxHeight: "/><h:inputText
value="#{modalPanel.maxHeight}"/>
+ <h:outputText value="MaxWidth: "/><h:inputText
value="#{modalPanel.maxWidth}"/>
+ <h:outputText value="Shadow depth: "/><h:inputText
value="#{modalPanel.shadowDepth}"/>
+ <h:outputText value="Shadow opacity: "/><h:inputText
value="#{modalPanel.shadowOpacity}"/>
+ <h:outputText value="Rendered: "/><h:selectBooleanCheckbox
value="#{modalPanel.rendered}"/>
+ <h:outputText value="Moveable: "/><h:selectBooleanCheckbox
value="#{modalPanel.moveable}"/>
+ <h:outputText value="Resizeable: "/><h:selectBooleanCheckbox
value="#{modalPanel.resizeable}"/>
+ <h:outputText value="Autosized: "/><h:selectBooleanCheckbox
value="#{modalPanel.autosized}"/>
+ <h:outputText value="Show: "/><h:selectBooleanCheckbox
value="#{modalPanel.show}"/>
+ <h:outputText value="keepVisualState: "/><h:selectBooleanCheckbox
value="#{modalPanel.keepVisualState}"/>
+ </h:panelGrid>
+ <h:commandButton value="Apply changes"/>
+</h:form>
+</ui:define>
+</ui:composition>
+
+
Added: trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
(rev 0)
+++ trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml 2010-10-18
10:30:07 UTC (rev 19592)
@@ -0,0 +1,79 @@
+<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/output"
template="/templates/template.xhtml">
+
+ <ui:define name="body">
+ <script>
+//<![CDATA[
+ var counter = 1;
+ var intervalID;
+ function updateProgress(i) {
+ RichFaces.$('form2:progressBar').setValue(counter*5);
+ if ((counter++)>20){
+ clearInterval(intervalID);
+ document.getElementById('button').disabled=false;
+ }
+ }
+
+ function startProgress(){
+ counter=1;
+ document.getElementById('button').disabled=true;
+ RichFaces.$('form2:progressBar').enable();
+ RichFaces.$('form2:progressBar').setValue(1);
+ intervalID = setInterval(updateProgress,5000);
+ }
+//]]>
+ </script>
+ <h:form id="form">
+ Ajax mode:
+ <rich:progressBar mode="ajax"
value="#{progressBarBean.currentValue}"
+ interval="2000"
+ enabled="#{progressBarBean.enabled}" minValue="-1"
maxValue="100"
+ reRenderAfterComplete="progressPanel">
+ <f:facet name="initial">
+ <br />
+ <h:outputText value="Process doesn't started yet"
/>
+ <a4j:commandButton
action="#{progressBarBean.startProcess}"
+ value="Start Process"
+ render="form"
+ style="margin: 9px 0px 5px;" />
+ </f:facet>
+ <f:facet name="complete">
+ <br />
+ <h:outputText value="Process Done" />
+ <a4j:commandButton
action="#{progressBarBean.startProcess}"
+ value="Restart Process" execute="@form"
+ rendered="#{progressBarBean.buttonRendered}"
+ style="margin: 9px 0px 5px;" />
+ </f:facet>
+ <h:outputText value="#{progressBarBean.currentValue}
%"/>
+ </rich:progressBar>
+ <h:panelGroup id="progressPanel">
+ <h:outputText value="#{progressBarBean.currentValue}"/>
+ </h:panelGroup>
+ </h:form>
+
+
+
+ Client mode:
+
+
+ <h:form id="form2">
+ <rich:progressBar mode="client" id="progressBar">
+ <f:facet name="initial">
+ <h:outputText value="Process doesn't started yet"/>
+ </f:facet>
+ <f:facet name="complete">
+ <h:outputText value="Process Done"/>
+ </f:facet>
+ </rich:progressBar>
+ <button type="button" onclick="startProgress();"
style="margin: 9px 0px 5px;" id="button">Start
Progress</button>
+ </h:form>
+ </ui:define>
+</ui:composition>
+
+
+
Modified: trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-10-18
06:53:34 UTC (rev 19591)
+++ trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-10-18
10:30:07 UTC (rev 19592)
@@ -16,19 +16,6 @@
<ui:insert name="scripts" ></ui:insert>
-
- <h:form>
- <h:commandButton value="Classic">
- <f:setPropertyActionListener target="#{skinBean.skin}"
value="classic"/>
- </h:commandButton>
- <h:commandButton value="BlueSky">
- <f:setPropertyActionListener target="#{skinBean.skin}"
value="blueSky"/>
- </h:commandButton>
- <h:commandButton value="DeepMarine">
- <f:setPropertyActionListener target="#{skinBean.skin}"
value="deepMarine"/>
- </h:commandButton>
- </h:form>
-
<table width="100%">
<thead>
<tr>
@@ -60,6 +47,24 @@
<li><h:commandLink
value="accordion" action="accordion" /></li>
</ul>
</li>
+ <li>
+ <p>Panel</p>
+ <ul>
+ <li><h:commandLink value="panel"
action="panel" /></li>
+ </ul>
+ </li>
+ <li>
+ <p>Popup panel</p>
+ <ul>
+ <li><h:commandLink value="popup"
action="popup" /></li>
+ </ul>
+ </li>
+ <li>
+ <p>ProgressBar</p>
+ <ul>
+ <li><h:commandLink
value="progressbar" action="progressbar" /></li>
+ </ul>
+ </li>
<li>
<p>Collapsible Panel</p>
<ul>