[richfaces-svn-commits] JBoss Rich Faces SVN: r6441 - in trunk/samples/progressBarDemo/src/main: webapp and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Feb 29 06:05:41 EST 2008


Author: andrei_exadel
Date: 2008-02-29 06:05:41 -0500 (Fri, 29 Feb 2008)
New Revision: 6441

Added:
   trunk/samples/progressBarDemo/src/main/webapp/pages/index2.jsp
Modified:
   trunk/samples/progressBarDemo/src/main/java/org/richfaces/samples/Bean.java
   trunk/samples/progressBarDemo/src/main/webapp/index.jsp
Log:
update demo

Modified: trunk/samples/progressBarDemo/src/main/java/org/richfaces/samples/Bean.java
===================================================================
--- trunk/samples/progressBarDemo/src/main/java/org/richfaces/samples/Bean.java	2008-02-29 11:05:05 UTC (rev 6440)
+++ trunk/samples/progressBarDemo/src/main/java/org/richfaces/samples/Bean.java	2008-02-29 11:05:41 UTC (rev 6441)
@@ -21,96 +21,154 @@
 
 package org.richfaces.samples;
 
-
 import java.util.Date;
 
+import javax.faces.event.ActionEvent;
+
 /**
  * @author $Autor$
- *
+ * 
  */
 public class Bean {
+
+    private boolean enabled1 = false;
+    private boolean ajaxMode1;
+    private Integer value1 = 0;
+
+    private boolean enabled2 = false;
+    private boolean ajaxMode2;
+    private Integer value2 = 0;
+
+    public String action1() {
+	System.out.println("Bean.action()");
+	return null;
+    }
     
-    private boolean enabled = false;
-    private boolean permanent = false;
-    private boolean determined = true;
-    private boolean ajaxMode;
-    
-    private Integer value = 0;
+    public String action2() {
+	System.out.println("Bean.action()");
+	return null;
+    }
 
-  	public String action () {
-    	System.out.println("Bean.action()");
-    	return null;
+    public void listener1 (ActionEvent event) {
+	System.out.println("Bean.listener1");
     }
     
+    public void listener2 (ActionEvent event) {
+	System.out.println("Bean.listener2");
+    }
+
     public String start() {
-	this.enabled = true;
+	this.enabled1 = true;
+	this.enabled2 = true;
 	return null;
     }
+
+    public String getDate1() {
+	Date date = new Date();
+	return date.toLocaleString();
+    }
     
-    public String getDate() {
+    public String getDate2() {
 	Date date = new Date();
 	return date.toLocaleString();
     }
 
+
     /**
      * @return the value
      */
-    public Integer getValue() {
-	//value = value.add(new BigDecimal(0.6));
-	return value;
+    public Integer getValue1() {
+	// value = value.add(new BigDecimal(0.6));
+	return value1;
     }
 
     /**
-     * @param value the value to set
+     * @param value
+     *                the value to set
      */
-    public void setValue(Integer value) {
-        this.value = value;
+    public void setValue1(Integer value) {
+	this.value1 = value;
     }
+
+    public Integer getIncValue1() {
+	return value1++;
+    }
     
-    public Integer getIncValue() {
-    	return value++;
+    public Integer getIncValue2() {
+	return value2++;
     }
 
     /**
      * @return the enabled
      */
-    public boolean getEnabled() {
-        return enabled;
+    public boolean getEnabled1() {
+	return enabled1;
     }
 
     /**
-     * @param enabled the enabled to set
+     * @param enabled
+     *                the enabled to set
      */
-    public void setEnabled(boolean enabled) {
-        this.enabled = enabled;
+    public void setEnabled1(boolean enabled) {
+	this.enabled1 = enabled;
     }
 
-	public boolean isPermanent() {
-		return permanent;
-	}
+    public boolean isAjaxMode1() {
+	return ajaxMode1;
+    }
 
-	public void setPermanent(boolean permanent) {
-		this.permanent = permanent;
-	}
+    public void setAjaxMode1(boolean ajaxMode) {
+	this.ajaxMode1 = ajaxMode;
+    }
 
-	public boolean isDetermined() {
-		return determined;
-	}
+    public String getModeString1() {
+	return ajaxMode1 ? "ajax" : "client";
+    }
+    
+    public String getModeString2() {
+	return ajaxMode2 ? "ajax" : "client";
+    }
 
-	public void setDetermined(boolean determined) {
-		this.determined = determined;
-	}
+    /**
+     * @return the enabled2
+     */
+    public boolean isEnabled2() {
+        return enabled2;
+    }
 
-	public boolean isAjaxMode() {
-		return ajaxMode;
-	}
+    /**
+     * @param enabled2 the enabled2 to set
+     */
+    public void setEnabled2(boolean enabled2) {
+        this.enabled2 = enabled2;
+    }
 
-	public void setAjaxMode(boolean ajaxMode) {
-		this.ajaxMode = ajaxMode;
-	}
-    
-    public String getModeString() {
-    	return ajaxMode ? "ajax" : "client";
+    /**
+     * @return the ajaxMode2
+     */
+    public boolean isAjaxMode2() {
+        return ajaxMode2;
     }
-    
+
+    /**
+     * @param ajaxMode2 the ajaxMode2 to set
+     */
+    public void setAjaxMode2(boolean ajaxMode2) {
+        this.ajaxMode2 = ajaxMode2;
+    }
+
+    /**
+     * @return the value2
+     */
+    public Integer getValue2() {
+        return value2;
+    }
+
+    /**
+     * @param value2 the value2 to set
+     */
+    public void setValue2(Integer value2) {
+        this.value2 = value2;
+    }
+
 }
\ No newline at end of file

Modified: trunk/samples/progressBarDemo/src/main/webapp/index.jsp
===================================================================
--- trunk/samples/progressBarDemo/src/main/webapp/index.jsp	2008-02-29 11:05:05 UTC (rev 6440)
+++ trunk/samples/progressBarDemo/src/main/webapp/index.jsp	2008-02-29 11:05:41 UTC (rev 6441)
@@ -1,2 +1,2 @@
-<jsp:forward page="faces/pages/index.jsp"/>
+<jsp:forward page="faces/pages/index2.jsp"/>
 

Added: trunk/samples/progressBarDemo/src/main/webapp/pages/index2.jsp
===================================================================
--- trunk/samples/progressBarDemo/src/main/webapp/pages/index2.jsp	                        (rev 0)
+++ trunk/samples/progressBarDemo/src/main/webapp/pages/index2.jsp	2008-02-29 11:05:41 UTC (rev 6441)
@@ -0,0 +1,196 @@
+<%@ 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/progressBar" prefix="progressBar" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/componentControl" prefix="cctrl" %>
+<html>
+	<head>
+		<title></title>
+		<style>
+		body{font-size : 11px}
+			.complete {
+				background-color: green; 
+				color: white;
+				}
+			.remain {
+				background-color: #FCBBCD;
+			}
+			.main {
+				font-size: 12px;
+				font-weight: bold;
+			}
+		</style>
+	</head>
+	<body>
+	<f:view>
+	
+	<h:form>
+           <h:selectOneRadio binding="#{skinBean.component}" />
+           <h:commandLink action="#{skinBean.change}" value="set skin" />
+	</h:form>
+	<br/>
+	
+	<h:form id="_form3">
+	<progressBar:progressBar value="#{bean.incValue1}" enabled="#{bean.enabled1}" id="progrs1"
+			interval="500" 
+			reRender="per11"
+			reRenderAfterComplete="per12"
+			mode="#{bean.modeString1}"
+			progressVar="percent1"
+			parameters="text:'crack'"
+			style="width: 300px; height: 14px;"
+			onclick="alert('');">
+		<f:facet name="initial">
+			<h:outputText value="Process not started"></h:outputText>
+		</f:facet>
+		<f:facet name="complete">
+			<h:outputText value="Process completed"></h:outputText>
+		</f:facet>
+		<h:outputText value="{value}%"></h:outputText>
+	</progressBar:progressBar> 
+	
+	<progressBar:progressBar value="#{bean.incValue2}" enabled="#{bean.enabled2}" id="progrs2"
+			interval="1000" 
+			reRender="per21"
+			reRenderAfterComplete="per22"
+			mode="#{bean.modeString2}"
+			progressVar="percent2"
+			parameters="text:'crack'"
+			style="width: 300px; height: 14px;"
+			actionListener="#{bean.listener2}">
+		<f:facet name="initial">
+			<h:outputText value="Process not started"></h:outputText>
+		</f:facet>
+		<f:facet name="complete">
+			<h:outputText value="Process completed"></h:outputText>
+		</f:facet>
+		<h:outputText value="{value}%"></h:outputText>
+	</progressBar:progressBar>
+	
+	</h:form>
+	
+	
+	<table><tr><td>
+	
+
+	<h:form>
+		<h:panelGrid columns="3">
+			<h:outputText value="Progress1 value: " />
+			<h:inputText value="#{bean.value1}" />
+			
+			<h:commandButton value="Set" />
+		</h:panelGrid>
+	
+	</h:form>
+		
+	<h:form id="_form1">
+	
+		
+	<table><tr>
+	<td>ReRender:</td><td><h:outputText value="#{bean.date1}" id="per11"></h:outputText></td></tr><tr>
+	<td>ReRender after complete:</td><td><h:outputText value="#{bean.date1}" id="per12"></h:outputText></td>
+	</tr></table></h:form>
+	
+	<h:form>
+	Enabled: <h:selectBooleanCheckbox value="#{bean.enabled1}" id="flag">
+		<a4j:support event="onclick" reRender="progrs1"></a4j:support>
+	</h:selectBooleanCheckbox>
+
+	<f:verbatim><br /></f:verbatim>
+
+
+	Ajax mode: <h:selectBooleanCheckbox value="#{bean.ajaxMode1}" id="flag3">
+		<a4j:support event="onclick" reRender="progrs1"></a4j:support>
+	</h:selectBooleanCheckbox>
+	<f:verbatim><br /></f:verbatim>
+	</h:form>
+	<script>
+	var pr = $('_form3:progrs1').component;
+	</script>
+	<input type="button" value="Get value" onclick="alert($('_form3:progrs1').component.getValue());" /><br/>
+	<input type="text" value="" id="percent1"/>
+	<input type="button" value="Set value" onclick="$('_form3:progrs1').component.setValue(document.getElementById('percent1').value);" />
+	<input type="button" id="ctrlValueButton1" value="Set value by componentControl" />
+	<cctrl:componentControl attachTo="ctrlValueButton1" for="progrs1" event="click" disableDefault="true" operation="setValue">
+		<a4j:actionparam name="value" value="$F('percent1')" noEscape="true" />
+	</cctrl:componentControl>
+	<br/>
+
+	<input type="text" value="111" id="label1"/>
+	<input type="button" value="Set label" onclick="$('_form3:progrs1').component.setLabel(document.getElementById('label1').value);" />
+	<input type="button" id="ctrlLabelButton1" value="Set label by componentControl" />
+	<cctrl:componentControl attachTo="ctrlLabelButton1" for="progrs" event="click" disableDefault="true" operation="setLabel">
+		<a4j:actionparam name="label" value="$F('label1')" noEscape="true" />
+	</cctrl:componentControl>
+	<br/>
+	<input type="button" value="Disable" onclick="$('_form3:progrs1').component.disable();" />
+	<br/>
+	<input type="button" value="Enable" onclick="$('_form3:progrs1').component.enable(event);" />
+	<br />
+	</td>
+	<td>
+	
+	
+
+	<h:form>
+		<h:panelGrid columns="3">
+			<h:outputText value="Progress value: " />
+			<h:inputText value="#{bean.value2}" />
+			
+			<h:commandButton value="Set" />
+		</h:panelGrid>
+	
+	</h:form>
+		
+	<h:form id="_form2">
+	
+	<br clear="all"/>
+	<table><tr>
+	<td>ReRender:</td><td><h:outputText value="#{bean.date2}" id="per21"></h:outputText></td></tr><tr>
+	<td>ReRender after complete:</td><td><h:outputText value="#{bean.date2}" id="per22"></h:outputText></td>
+	</tr></table></h:form>
+	
+	<h:form>
+	Enabled: <h:selectBooleanCheckbox value="#{bean.enabled2}" id="flag">
+		<a4j:support event="onclick" reRender="progrs2"></a4j:support>
+	</h:selectBooleanCheckbox>
+
+	<f:verbatim><br /></f:verbatim>
+
+
+	Ajax mode: <h:selectBooleanCheckbox value="#{bean.ajaxMode2}" id="flag3">
+		<a4j:support event="onclick" reRender="progrs2"></a4j:support>
+	</h:selectBooleanCheckbox>
+	<f:verbatim><br /></f:verbatim>
+	</h:form>
+	<script>
+	var pr = $('_form3:progrs2').component;
+	</script>
+	<input type="button" value="Get value" onclick="alert($('_form3:progrs2').component.getValue());" /><br/>
+	<input type="text" value="" id="percent2"/>
+	<input type="button" value="Set value" onclick="$('_form3:progrs2').component.setValue(document.getElementById('percent2').value);" />
+	<input type="button" id="ctrlValueButton2" value="Set value by componentControl" />
+	<cctrl:componentControl attachTo="ctrlValueButton2" for="progrs2" event="click" disableDefault="true" operation="setValue">
+		<a4j:actionparam name="value" value="$F('percent2')" noEscape="true" />
+	</cctrl:componentControl>
+	<br/>
+
+	<input type="text" value="111" id="label2"/>
+	<input type="button" value="Set label" onclick="$('_form3:progrs2').component.setLabel(document.getElementById('label2').value);" />
+	<input type="button" id="ctrlLabelButton2" value="Set label by componentControl" />
+	<cctrl:componentControl attachTo="ctrlLabelButton2" for="progrs2" event="click" disableDefault="true" operation="setLabel">
+		<a4j:actionparam name="label" value="$F('label2')" noEscape="true" />
+	</cctrl:componentControl>
+	<br/>
+	<input type="button" value="Disable" onclick="$('_form3:progrs2').component.disable();" />
+	<br/>
+	<input type="button" value="Enable" onclick="$('_form3:progrs2').component.enable(event);" />
+	<br />
+	
+	</td>
+	</tr></table><br/>
+	
+		
+	</f:view>
+	</body>	
+</html>




More information about the richfaces-svn-commits mailing list