Author: ppitonak(a)redhat.com
Date: 2010-10-01 11:14:41 -0400 (Fri, 01 Oct 2010)
New Revision: 19414
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/ajaxMode.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/clientMode.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/list.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
https://jira.jboss.org/browse/RFPL-864
* two pages for rich:progressBar added
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-10-01
15:08:51 UTC (rev 19413)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-10-01
15:14:41 UTC (rev 19414)
@@ -128,6 +128,7 @@
components.put("richList", "Rich List");
components.put("richPanel", "Rich Panel");
components.put("richPopupPanel", "Rich Popup Panel");
+ components.put("richProgressBar", "Rich Progress Bar");
components.put("richSubTable", "Rich Subtable");
components.put("richSubTableToggleControl", "Rich Subtable Toggle
Control");
components.put("richToggleControl", "Rich Toggle Control");
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java 2010-10-01
15:14:41 UTC (rev 19414)
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import org.richfaces.component.UIProgressBar;
+
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:progressBar.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richProgressBarBean")
+@SessionScoped
+public class RichProgressBarBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static Logger logger;
+ private Attributes attributes;
+ private boolean buttonRendered = true;
+ private Long startTime;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getUIComponentAttributes(UIProgressBar.class,
getClass());
+
+ attributes.setAttribute("maxValue", 100);
+ attributes.setAttribute("minValue", -1);
+ attributes.setAttribute("interval", 1000);
+ attributes.setAttribute("rendered", true);
+
+ // attributes tested in another way
+ attributes.remove("mode");
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public String startProcess() {
+ attributes.get("enabled").setValue(true);
+ setButtonRendered(false);
+ setStartTime(new Date().getTime());
+ return null;
+ }
+
+ public Long getCurrentValue() {
+ if (Boolean.TRUE.equals(attributes.get("enabled").getValue())) {
+ Long current = (new Date().getTime() - startTime) / 1000;
+ if (current > 100) {
+ setButtonRendered(true);
+ } else if (current.equals(0L)) {
+ return new Long(1);
+ }
+ return (new Date().getTime() - startTime) / 1000;
+ }
+ if (startTime == null) {
+ return Long.valueOf(-1);
+ } else {
+ return Long.valueOf(101);
+ }
+ }
+
+ 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;
+ }
+}
Property changes on:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichProgressBarBean.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/ajaxMode.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/ajaxMode.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/ajaxMode.xhtml 2010-10-01
15:14:41 UTC (rev 19414)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+ <ui:define name="component">
+ <rich:progressBar id="progressBar"
+
comleteClass="#{richProgressBarBean.attributes['completeClass'].value}"
+
data="#{richProgressBarBean.attributes['data'].value}"
+
enabled="#{richProgressBarBean.attributes['enabled'].value}"
+
finishClass="#{richProgressBarBean.attributes['finishClass'].value}"
+
focus="#{richProgressBarBean.attributes['focus'].value}"
+
initialClass="#{richProgressBarBean.attributes['initialClass'].value}"
+
interval="#{richProgressBarBean.attributes['interval'].value}"
+
label="#{richProgressBarBean.attributes['label'].value}"
+
maxValue="#{richProgressBarBean.attributes['maxValue'].value}"
+
minValue="#{richProgressBarBean.attributes['minValue'].value}"
+ mode="ajax"
+
onbeforedomupdate="#{richProgressBarBean.attributes['onbeforedomupdate'].value}"
+
onclick="#{richProgressBarBean.attributes['onclick'].value}"
+
oncomplete="#{richProgressBarBean.attributes['oncomplete'].value}"
+
ondblclick="#{richProgressBarBean.attributes['ondblclick'].value}"
+
onmousedown="#{richProgressBarBean.attributes['onmousedown'].value}"
+
onmousemove="#{richProgressBarBean.attributes['onmousemove'].value}"
+
onmouseout="#{richProgressBarBean.attributes['onmouseout'].value}"
+
onmouseover="#{richProgressBarBean.attributes['onmouseover'].value}"
+
onmouseup="#{richProgressBarBean.attributes['onmouseup'].value}"
+
onsubmit="#{richProgressBarBean.attributes['onsubmit'].value}"
+
parameters="#{richProgressBarBean.attributes['parameters'].value}"
+
reRenderAfterComplete="#{richProgressBarBean.attributes['reRenderAfterComplete'].value}"
+
remainClass="#{richProgressBarBean.attributes['remainClass'].value}"
+
rendered="#{richProgressBarBean.attributes['rendered'].value}"
+ value="#{richProgressBarBean.currentValue}"
+ >
+
+ <f:facet name="initial">
+ <h:outputText id="initialOutput" value="Process
hasn't started yet" />
+ <br/>
+ <a4j:commandButton id="startButton"
+
action="#{richProgressBarBean.startProcess}"
+ value="Start Process"
execute="@form"
+
rendered="#{richProgressBarBean.buttonRendered}"
+ style="margin: 9px 0px 5px;" />
+ </f:facet>
+ <f:facet name="complete">
+ <h:outputText id="completeOutput" value="Process
Done" />
+ <br/>
+ <a4j:commandButton id="restartButton"
+
action="#{richProgressBarBean.startProcess}"
+ value="Restart Process"
execute="@form"
+
rendered="#{richProgressBarBean.buttonRendered}"
+ style="margin: 9px 0px 5px;" />
+ </f:facet>
+ <h:outputText value="#{richProgressBarBean.currentValue}
%"/>
+ </rich:progressBar>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richProgressBarBean.attributes}"
id="attributes" render="log"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/clientMode.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/clientMode.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/clientMode.xhtml 2010-10-01
15:14:41 UTC (rev 19414)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+ <ui:define name="component">
+
+ <script type="text/javascript">
+ //<![CDATA[
+ var counter = 1;
+ var intervalID;
+ function updateProgress(i) {
+
RichFaces.$('#{rich:clientId('progressBar')}').setValue(counter*5);
+ if ((counter++)>20){
+ clearInterval(intervalID);
+ document.getElementById('button').disabled=false;
+ }
+ }
+
+ function startProgress(){
+ counter=1;
+ document.getElementById('button').disabled=true;
+
RichFaces.$('#{rich:clientId('progressBar')}').enable();
+
RichFaces.$('#{rich:clientId('progressBar')}').setValue(1);
+ intervalID = setInterval(updateProgress,1000);
+ }
+ //]]>
+ </script>
+
+ <rich:progressBar id="progressBar"
+
comleteClass="#{richProgressBarBean.attributes['completeClass'].value}"
+
data="#{richProgressBarBean.attributes['data'].value}"
+
enabled="#{richProgressBarBean.attributes['enabled'].value}"
+
finishClass="#{richProgressBarBean.attributes['finishClass'].value}"
+
focus="#{richProgressBarBean.attributes['focus'].value}"
+
initialClass="#{richProgressBarBean.attributes['initialClass'].value}"
+
interval="#{richProgressBarBean.attributes['interval'].value}"
+
label="#{richProgressBarBean.attributes['label'].value}"
+
maxValue="#{richProgressBarBean.attributes['maxValue'].value}"
+
minValue="#{richProgressBarBean.attributes['minValue'].value}"
+ mode="client"
+
onbeforedomupdate="#{richProgressBarBean.attributes['onbeforedomupdate'].value}"
+
onclick="#{richProgressBarBean.attributes['onclick'].value}"
+
oncomplete="#{richProgressBarBean.attributes['oncomplete'].value}"
+
ondblclick="#{richProgressBarBean.attributes['ondblclick'].value}"
+
onmousedown="#{richProgressBarBean.attributes['onmousedown'].value}"
+
onmousemove="#{richProgressBarBean.attributes['onmousemove'].value}"
+
onmouseout="#{richProgressBarBean.attributes['onmouseout'].value}"
+
onmouseover="#{richProgressBarBean.attributes['onmouseover'].value}"
+
onmouseup="#{richProgressBarBean.attributes['onmouseup'].value}"
+
onsubmit="#{richProgressBarBean.attributes['onsubmit'].value}"
+
parameters="#{richProgressBarBean.attributes['parameters'].value}"
+
reRenderAfterComplete="#{richProgressBarBean.attributes['reRenderAfterComplete'].value}"
+
remainClass="#{richProgressBarBean.attributes['remainClass'].value}"
+
rendered="#{richProgressBarBean.attributes['rendered'].value}"
+ value="#{richProgressBarBean.currentValue}"
+ >
+ <f:facet name="initial">
+ <h:outputText id="initialOutput" value="Process
hasn't started yet"/>
+ </f:facet>
+ <f:facet name="complete">
+ <h:outputText id="completeOutput" value="Process
Done"/>
+ </f:facet>
+ </rich:progressBar>
+ <button type="button" onclick="startProgress();"
style="margin: 9px 0px 5px;" id="button">Start
Progress</button>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richProgressBarBean.attributes}"
id="attributes" render="log"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/list.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/list.xhtml 2010-10-01
15:14:41 UTC (rev 19414)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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:ui="http://java.sun.com/jsf/facelets"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Progress Bar</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="ajaxMode" outcome="ajaxMode"
value="Ajax Mode">
+ Simple page containing <b>rich:progressBar</b> in ajax mode
and input boxes for all its attributes.
+ </metamer:testPageLink>
+
+ <metamer:testPageLink id="clientMode"
outcome="clientMode" value="Client Mode">
+ Simple page containing <b>rich:progressBar</b> in client mode
and input boxes for all its attributes.
+ </metamer:testPageLink>
+ </ui:define>
+
+ </ui:composition>
+
+</html>