[seam-commits] Seam SVN: r14941 - in branches/community/Seam_2_3/examples-ee6/remoting/progressbar: progressbar-ear and 6 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Jun 21 06:32:23 EDT 2012
Author: manaRH
Date: 2012-06-21 06:32:23 -0400 (Thu, 21 Jun 2012)
New Revision: 14941
Added:
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/src/main/application/META-INF/jboss-deployment-structure.xml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/Progress.java
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/ProgressBarAction.java
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/ProgressBarLocal.java
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/resources/META-INF/ejb-jar.xml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/components.xml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/faces-config.xml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/web.xml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/complete.xhtml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/index.html
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/progressbar.xhtml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/slider.js
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/readme.txt
Modified:
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/pom.xml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/pom.xml
Log:
rolled back deletion of files
Modified: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/pom.xml 2012-06-21 07:44:11 UTC (rev 14940)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/pom.xml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -28,8 +28,12 @@
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<type>ejb</type>
- <scope>compile</scope>
+ <scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ </dependency>
</dependencies>
<build>
@@ -41,8 +45,6 @@
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
- <!-- Exclude eclipse generated application.xml and manually modified jboss-app.xml during mvn build -->
- <earSourceExcludes>**/application.xml, **/jboss-app.xml</earSourceExcludes>
<!-- use maven generated application.xml instead -->
<generateApplicationXml>true</generateApplicationXml>
<filtering>true</filtering>
Copied: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/src/main/application/META-INF/jboss-deployment-structure.xml (from rev 14927, branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/src/main/application/META-INF/jboss-deployment-structure.xml)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/src/main/application/META-INF/jboss-deployment-structure.xml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ear/src/main/application/META-INF/jboss-deployment-structure.xml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,13 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
+ <deployment>
+ <dependencies>
+ <module name="org.apache.log4j" export="true"/>
+ <module name="org.apache.commons.logging" export="true"/>
+ <module name="org.apache.commons.collections" export="true"/>
+ <module name="javax.faces.api" export="true"/>
+ <module name="com.sun.jsf-impl" export="true"/>
+ <module name="org.javassist" export="true"/>
+ <module name="org.dom4j" export="true"/>
+ </dependencies>
+ </deployment>
+</jboss-deployment-structure>
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/Progress.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/Progress.java (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/Progress.java 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,39 @@
+package org.jboss.seam.example.remoting;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+/**
+ * Contains progress information.
+ *
+ * @author Shane Bryzak
+ * @version 1.0
+ */
+ at Name("progress")
+ at Scope(ScopeType.SESSION)
+public class Progress {
+
+ private int percentComplete;
+ private String status;
+
+ public int getPercentComplete()
+ {
+ return percentComplete;
+ }
+
+ public void setPercentComplete(int percentComplete)
+ {
+ this.percentComplete = percentComplete;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+}
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/ProgressBarAction.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/ProgressBarAction.java (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/ProgressBarAction.java 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,37 @@
+package org.jboss.seam.example.remoting;
+
+import java.util.Random;
+
+import javax.ejb.Stateless;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+
+ at Stateless
+ at Name("progressBarAction")
+public class ProgressBarAction implements ProgressBarLocal {
+
+ @In(create = true)
+ Progress progress;
+
+ public String doSomething() {
+ Random r = new Random(System.currentTimeMillis());
+ try {
+ for (int i = 1; i <= 100;)
+ {
+ Thread.sleep(r.nextInt(200));
+ progress.setPercentComplete(i);
+ i++;
+ }
+ }
+ catch (InterruptedException ex) {
+ }
+
+ return "/complete.xhtml";
+ }
+
+ public Progress getProgress()
+ {
+ return progress;
+ }
+}
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/ProgressBarLocal.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/ProgressBarLocal.java (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/java/org/jboss/seam/example/remoting/ProgressBarLocal.java 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,12 @@
+package org.jboss.seam.example.remoting;
+
+import javax.ejb.Local;
+
+import org.jboss.seam.annotations.remoting.WebRemote;
+
+ at Local
+public interface ProgressBarLocal {
+ String doSomething();
+ @WebRemote Progress getProgress();
+}
+
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/resources/META-INF/ejb-jar.xml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-ejb/src/main/resources/META-INF/ejb-jar.xml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
Modified: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/pom.xml 2012-06-21 07:44:11 UTC (rev 14940)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/pom.xml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -50,5 +50,4 @@
</plugins>
</build>
-
</project>
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/components.xml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/components.xml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,11 @@
+<components xmlns="http://jboss.org/schema/seam/components">
+
+ <component name="org.jboss.seam.core.init">
+ <property name="jndiPattern">@jndiPattern@</property>
+ </component>
+
+ <component name="org.jboss.seam.core.manager">
+ <property name="conversationTimeout">120000</property>
+ </component>
+
+</components>
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/faces-config.xml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="2.1"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd">
+
+</faces-config>
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/web.xml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
+
+ <filter>
+ <filter-name>Seam Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Seam Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>Seam Resource Servlet</servlet-name>
+ <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Seam Resource Servlet</servlet-name>
+ <url-pattern>/seam/resource/*</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <!-- Faces Servlet Mapping -->
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/complete.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/complete.xhtml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/complete.xhtml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,17 @@
+<!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:h="http://java.sun.com/jsf/html">
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>Seam Remoting Framework</title>
+</head>
+
+<body>
+
+ <h1>Action complete</h1>
+
+</body>
+</html>
+
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/index.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/index.html (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/index.html 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=progressbar.seam">
+</head>
+</html>
\ No newline at end of file
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/progressbar.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/progressbar.xhtml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/progressbar.xhtml 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,96 @@
+<!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:h="http://java.sun.com/jsf/html">
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>Seam Remoting Progress Bar Example</title>
+
+ <style>
+
+ div.slider-box
+ {
+ position: relative;
+ width: 200px;
+ height: 20px;
+ border: 1px solid #cccccc;
+ background-color: white;
+ color: white;
+ margin-bottom: 4px;
+ }
+
+ div.slider-progress
+ {
+ color: black;
+ font-family: helvetica;
+ font-size: 9pt;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ </style>
+</head>
+
+<body>
+
+ <script type="text/javascript" src="seam/resource/remoting/resource/remote.js"></script>
+ <script type="text/javascript" src="seam/resource/remoting/interface.js?progressBarAction"></script>
+ <script type="text/javascript" src="slider.js"></script>
+
+ <script type="text/javascript">
+ //<![CDATA[
+
+ // don't display the loading indicator
+ Seam.Remoting.displayLoadingMessage = function() {};
+ Seam.Remoting.hideLoadingMessage = function() {};
+
+ var progressBarAction = Seam.Component.getInstance("progressBarAction");
+
+ function queryProgress() {
+ setTimeout("getProgress()", 250);
+ }
+
+ function getProgress() {
+ progressBarAction.getProgress(progressCallback);
+ }
+
+ function progressCallback(progress) {
+ progressBar.setPosition(progress.percentComplete);
+ if (progress.percentComplete < 100)
+ queryProgress();
+ }
+
+ // ]]>
+ </script>
+
+ <h1>Seam Progress Bar Demo</h1>
+
+ <p>This small example demonstrates how to implement a progress bar for long-running actions, using Seam Remoting.</p>
+
+ <h:form onsubmit="queryProgress();return true;">
+
+ <h:commandButton style="width:80px" value="Go!" action="#{progressBarAction.doSomething}" styleClass="button"/>
+
+ </h:form>
+
+ <div id="progressBar"></div>
+
+ <script type="text/javascript">
+ //<![CDATA[
+
+ var progressBar = qfSliderFactory.addSlider("progressBar");
+ progressBar.setMaxValue(100);
+ progressBar.setWidth(200);
+ progressBar.setClassName("slider-box");
+ progressBar.setUsedColour("#0000cf");
+ progressBar.setShowProgress(true);
+ progressBar.setProgressClassName("slider-progress");
+ progressBar.repaint();
+
+ // ]]>
+ </script>
+
+</body>
+</html>
+
Added: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/slider.js
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/slider.js (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/slider.js 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,635 @@
+function getObject(objectId)
+{
+ if (document.getElementById && document.getElementById(objectId))
+ return document.getElementById(objectId);
+ else if (document.all && document.all(objectId))
+ return document.all(objectId);
+ else if (document.layers && document.layers[objectId])
+ return document.layers[objectId];
+ else
+ return null;
+};
+
+function getStyleObject(objectId)
+{
+ if(document.getElementById && document.getElementById(objectId))
+ return document.getElementById(objectId).style;
+ else if (document.all && document.all(objectId))
+ return document.all(objectId).style;
+ else if (document.layers && document.layers[objectId])
+ return document.layers[objectId];
+ else
+ return null;
+};
+
+// Returns the location and dimensions of a control
+function __getControlDim(ctl)
+{
+ var width = ctl.offsetWidth;
+ var height = ctl.offsetHeight;
+ for (var lx = 0, ly = 0; ctl != null; lx += ctl.offsetLeft, ly += ctl.offsetTop, ctl = ctl.offsetParent);
+ return {x:lx, y:ly, width:width, height:height};
+};
+
+function inverseRGB(rgbString)
+{
+ if (!rgbString || (rgbString = ""))
+ rgbString = "rgb(0,0,0)";
+
+ var elts = rgbString.slice(4, rgbString.length - 1).split(",");
+ return "rgb(" + (255 - elts[0]) + "," + (255 - elts[1]) + "," + (255 - elts[2]) + ")";
+};
+
+function __TagAttribute(name, value)
+{
+ this.name = name;
+ this.value = value;
+};
+
+function __Tag(name)
+{
+ this.name = name;
+ this.attributes = new Array();
+ this.childTags = new Array();
+ this.text = "";
+
+ __Tag.prototype.addChildTag = function(name)
+ {
+ var childTag = new __Tag(name);
+ this.appendChild(childTag);
+ return childTag;
+ };
+
+ __Tag.prototype.appendChild = function(childTag)
+ {
+ this.childTags[this.childTags.length] = childTag;
+ };
+
+ __Tag.prototype.setAttribute = function(name, value)
+ {
+ this.attributes[this.attributes.length] = new __TagAttribute(name, value);
+ };
+
+ __Tag.prototype.setText = function(text)
+ {
+ this.text = text;
+ };
+
+ __Tag.prototype.getHTML = function()
+ {
+ var html = "<" + this.name;
+ for (var i = 0; i < this.attributes.length; i++)
+ {
+ var tagAttribute = this.attributes[i];
+ html += " " + tagAttribute.name + "=\"" + tagAttribute.value + "\"";
+ }
+ html += ">" + this.text;
+
+ for (var i = 0; i < this.childTags.length; i++)
+ {
+ html += this.childTags[i].getHTML();
+ }
+
+ html += "</" + this.name + ">";
+ return html;
+ };
+};
+
+function __SliderFactory()
+{
+ this.sliders = new Array();
+
+ __SliderFactory.prototype.addSlider = function (divId)
+ {
+ var slider = new __Slider(divId);
+ this.sliders[this.sliders.length] = slider;
+ return slider;
+ };
+
+ __SliderFactory.prototype.getSliderByName = function (name)
+ {
+ for (var i = 0; i < this.sliders.length; i++)
+ {
+ if (this.sliders[i].sliderName == name)
+ return this.sliders[i];
+ }
+ return null;
+ };
+}
+
+
+function qfSliderLimits(top, right, bottom, left)
+{
+ this.top = top;
+ this.right = right;
+ this.bottom = bottom;
+ this.left = left;
+}
+
+// TODO percentage indicator
+// TODO verticial (bottom to top)
+// TODO reverse painting Top to Bottom
+// TODO snap to closest value (multiple of abs(step))
+
+var qfSlider_VERTICAL = "vertical";
+var qfSlider_HORIZONTAL = "horizontal";
+
+function __Slider(divId)
+{
+ this.sliderName = divId;
+ this.divId = "__" + divId;
+ this.divCtl = getObject(divId);
+ this.width = 0;
+ this.height = 0;
+ this.minValue = 0;
+ this.maxValue = 0;
+ this.position = 0;
+ this.stepAmt = 1;
+ this.horizontal = true;
+ this.onChange = null;
+ this.className = "";
+ this.thumbClassName = "";
+ this.showProgress = false;
+ this.progressClassName = "";
+ this.reversePaint = false;
+
+ this.showThumb = false;
+ this.thumbLimits = new qfSliderLimits(0, 0, 0, 0);
+
+ this.showUsed = true;
+ this.usedLimits = new qfSliderLimits(0, 0, 0, 0);
+ this.usedColour = "navy";
+ this.usedClassName = "";
+
+ this.showRemain = false;
+ this.remainLimits = new qfSliderLimits(0, 0, 0, 0);
+ this.remainColour = "white";
+ this.remainClassName = "";
+
+ this.innerDivId = this.divId + "_inner";
+ this.thumbDivId = this.divId + "_thumb";
+ this.usedDivId = this.divId + "_used";
+ this.remainDivId = this.divId + "_rem";
+ this.progressUsedDivId = this.divId + "p_used";
+ this.progressRemainDivId = this.divId + "p_remain";
+
+ __Slider.prototype.setWidth = function(value)
+ {
+ this.width = 1 * value;
+ };
+
+ __Slider.prototype.setHeight = function(value)
+ {
+ this.height = 1 * value;
+ };
+
+ __Slider.prototype.setMinValue = function(value)
+ {
+ this.minValue = 1 * value;
+ };
+
+ __Slider.prototype.setMaxValue = function(value)
+ {
+ this.maxValue = 1 * value;
+ };
+
+ __Slider.prototype.setStep = function(value)
+ {
+ this.stepAmt = 1 * value;
+ };
+
+ __Slider.prototype.setOrientation = function(value)
+ {
+ this.horizontal = (value == qfSlider_HORIZONTAL);
+ };
+
+ __Slider.prototype.setOnChange = function(func)
+ {
+ this.onChange = func;
+ };
+
+ __Slider.prototype.setPosition = function(value)
+ {
+ this.position = 1 * value;
+ this.step(0);
+ };
+
+ __Slider.prototype.setClassName = function(value)
+ {
+ this.className = value;
+ };
+
+ __Slider.prototype.setThumbClassName = function(value)
+ {
+ this.thumbClassName = value;
+ };
+
+ __Slider.prototype.setShowThumb = function(value)
+ {
+ this.showThumb = value;
+ };
+
+ __Slider.prototype.setThumbLimits = function(value)
+ {
+ this.thumbLimits = value;
+ };
+
+ __Slider.prototype.setShowUsed = function(value)
+ {
+ this.showUsed = value;
+ };
+
+ __Slider.prototype.setUsedLimits = function(value)
+ {
+ this.usedLimits = value;
+ };
+
+ __Slider.prototype.setUsedColour = function(value)
+ {
+ this.usedColour = value;
+ };
+
+ __Slider.prototype.setUsedClassName = function(value)
+ {
+ this.usedClassName = value;
+ };
+
+ __Slider.prototype.setShowRemain = function(value)
+ {
+ this.showRemain = value;
+ };
+
+ __Slider.prototype.setRemainLimits = function(value)
+ {
+ this.remainLimits = value;
+ };
+
+ __Slider.prototype.setRemainColour = function(value)
+ {
+ this.remainColour = value;
+ };
+
+ __Slider.prototype.setRemainClassName = function(value)
+ {
+ this.remainClassName = value;
+ };
+
+ __Slider.prototype.setShowProgress = function(value)
+ {
+ this.showProgress = value;
+ };
+
+ __Slider.prototype.setProgressClassName = function(value)
+ {
+ this.progressClassName = value;
+ };
+
+ __Slider.prototype.setReversePaint = function(value)
+ {
+ this.reversePaint = value;
+ };
+
+ __Slider.prototype.getHTML = function()
+ {
+ var html = "";
+
+ // Used for internal sizings of the div (excluding the border).
+ var innerDivTag = new __Tag("div");
+ innerDivTag.setAttribute("id", this.innerDivId);
+ innerDivTag.setAttribute("style", "position:relative;width:100%;height:100%");
+ html += innerDivTag.getHTML();
+
+ // Used Div
+ var usedDivTag = new __Tag("div");
+ usedDivTag.setAttribute("id", this.usedDivId);
+ var usedStyle = "visibility:hidden;position:absolute;";
+
+ if (this.usedClassName != "")
+ usedDivTag.setAttribute("class", this.usedClassName);
+ else if (this.usedColor != "")
+ usedStyle += "background-color:" + this.usedColour;
+
+ usedDivTag.setAttribute("style", usedStyle);
+ html += usedDivTag.getHTML();
+
+ // Remaining Div
+ var remainDivTag = new __Tag("div");
+ remainDivTag.setAttribute("id", this.remainDivId);
+
+ var remainStyle = "visibility:hidden;position:absolute;";
+
+ if (this.remainClassName != "")
+ remainDivTag.setAttribute("class", this.remainClassName);
+ else if (this.remainColor != "")
+ remainStyle += "background-color:" + this.remainColour;
+
+ remainDivTag.setAttribute("style", remainStyle);
+ html += remainDivTag.getHTML();
+
+ // Progress Text
+ var progDivTag = new __Tag("div");
+ progDivTag.setAttribute("id", this.progressUsedDivId);
+ var progStyle = "visibility:hidden;position:absolute;";
+ if (this.progressClassName != "")
+ progDivTag.setAttribute("class", this.progressClassName);
+ progDivTag.setAttribute("style", progStyle);
+ html += progDivTag.getHTML();
+
+ progDivTag = new __Tag("div");
+ progDivTag.setAttribute("id", this.progressRemainDivId);
+ progStyle = "visibility:hidden;position:absolute;";
+ if (this.progressClassName != "")
+ progDivTag.setAttribute("class", this.progressClassName);
+ progDivTag.setAttribute("style", progStyle);
+ html += progDivTag.getHTML();
+
+ // Thumb Div
+ var thumbDivTag = new __Tag("div");
+ thumbDivTag.setAttribute("id", this.thumbDivId);
+ thumbDivTag.setAttribute("class", this.thumbClassName);
+ thumbDivTag.setAttribute("style", "visibility:hidden;position:absolute;");
+ html += thumbDivTag.getHTML();
+
+ return html;
+ };
+
+ __Slider.prototype.getSliderProperties = function(limits)
+ {
+ var population = Math.abs(this.maxValue - this.minValue);
+ var min = Math.min(this.minValue, this.maxValue);
+ var max = Math.max(this.minValue, this.maxValue);
+
+ var percent = (this.position - min)/population;
+
+ var sliderDims = __getControlDim(getObject(this.innerDivId));
+
+ if (limits)
+ {
+ sliderDims.width = sliderDims.width - limits.right - limits.left;
+ sliderDims.height = sliderDims.height - limits.bottom - limits.top;
+ }
+
+ var sliderSize = 0;
+ if (this.horizontal)
+ sliderSize = Math.round(sliderDims.width * percent);
+ else
+ sliderSize = Math.round(sliderDims.height * percent);
+
+ if (this.minValue > this.maxValue)
+ sliderSize = sliderDims.width - sliderSize;
+
+ return ( {dims:sliderDims, size:sliderSize, population:population, percent:percent, min:min, max:max} );
+ };
+
+ __Slider.prototype.repaint = function()
+ {
+ this.divCtl.className = this.className;
+ this.divCtl.innerHTML = this.getHTML();
+
+ this.divCtl.style.width = this.width + "px";
+
+ if (this.showThumb)
+ {
+ // Allow the thumb to be dragged.
+ var thumbObject = getObject(this.thumbDivId);
+ __browser.chainEvent(thumbObject, "mousedown", dragStart);
+
+ var props = this.getSliderProperties(this.thumbLimits);
+ var styleObject = getStyleObject(this.thumbDivId);
+
+ if (this.horizontal)
+ {
+ if (this.reversePaint)
+ styleObject.left = this.thumbLimits.left + (props.dims.width - props.size - (styleObject.width / 2));
+ else
+ styleObject.left = this.thumbLimits.left + (props.size - (styleObject.width / 2));
+
+ styleObject.top = this.thumbLimits.top;
+ }
+ else
+ {
+ if (this.reversePaint)
+ styleObject.top = this.thumbLimits.top + (props.size - (styleObject.height / 2));
+ else
+ styleObject.top = this.thumbLimits.top + (props.dims.height - props.size - (styleObject.height / 2));
+
+ styleObject.left = this.thumbLimits.left;
+ }
+ styleObject.visibility = "visible";
+ }
+
+ if (this.showUsed)
+ {
+ var props = this.getSliderProperties(this.usedLimits);
+ var styleObject = getStyleObject(this.usedDivId);
+
+ if (this.horizontal)
+ {
+ if (this.reversePaint)
+ styleObject.left = this.usedLimits.left + props.dims.width - props.size;
+ else
+ styleObject.left = this.usedLimits.left;
+ styleObject.top = this.usedLimits.top;
+ styleObject.height = props.dims.height + "px";
+ styleObject.fontSize = "1px"; // Hack for IE
+ styleObject.width = props.size + "px";
+ }
+ else
+ {
+ if (this.reversePaint)
+ styleObject.top = this.usedLimits.top;
+ else
+ styleObject.top = this.usedLimits.top + props.dims.height - props.size;
+ styleObject.left = this.usedLimits.left;
+ styleObject.width = props.dims.width + "px";
+ styleObject.fontSize = "1px"; // Hack for IE
+ styleObject.height = props.size + "px";
+ }
+ styleObject.visibility = "visible";
+ }
+
+ if (this.showRemain)
+ {
+ var props = this.getSliderProperties(this.remainLimits);
+ var styleObject = getStyleObject(this.remainDivId);
+
+ if (this.horizontal)
+ {
+ if (this.reversePaint)
+ styleObject.left = this.remainLimits.left;
+ else
+ styleObject.left = this.remainLimits.left + props.size;
+ styleObject.top = this.remainLimits.top;
+ styleObject.height = props.dims.height + "px";
+ styleObject.fontSize = "1px"; // Hack for IE
+ styleObject.width = (props.dims.width - props.size) + "px";
+ }
+ else
+ {
+ if (this.reversePaint)
+ styleObject.top = this.remainLimits.top + props.size;
+ else
+ styleObject.top = this.remainLimits.top;
+ styleObject.left = this.remainLimits.left;
+ styleObject.width = props.dims.width + "px";
+ styleObject.fontSize = "1px"; // Hack for IE
+ styleObject.height = (props.dims.height - props.size) + "px";
+ }
+
+ styleObject.visibility = "visible";
+ }
+
+ if (this.showProgress)
+ {
+ var props = this.getSliderProperties(this.usedLimits);
+ var usedStyleObject = getStyleObject(this.usedDivId);
+ var remainStyleObject = getStyleObject(this.remainDivId);
+ var baseStyleObject = this.divCtl.style;
+
+ // Used side
+ var styleObject = getStyleObject(this.progressUsedDivId);
+
+ styleObject.left = usedStyleObject.left;
+ styleObject.top = usedStyleObject.top;
+ styleObject.height = usedStyleObject.height;
+
+ if (this.showRemain)
+ styleObject.color = remainStyleObject.backgroundColor;
+ else
+ styleObject.color = inverseRGB(baseStyleObject.backgroundColor);
+
+ if (this.horizontal)
+ {
+ styleObject.width = props.dims.width + "px";
+ styleObject.textAlign = "center";
+ styleObject.clip = "rect(0px, " + props.size + "px, " + props.dims.height + "px, 0px)";
+ getObject(this.progressUsedDivId).innerHTML = Math.round(props.percent * 100) + "%";
+ }
+ else
+ {
+ // TODO vertical clipping
+ }
+ styleObject.visibility = "visible";
+
+ // Remain side
+ props = this.getSliderProperties(this.remainsLimits);
+ styleObject = getStyleObject(this.progressRemainDivId);
+
+ if (this.horizontal)
+ {
+ styleObject.left = this.remainLimits.left;
+ styleObject.top = this.remainLimits.top;
+ styleObject.height = props.dims.height + "px";
+ styleObject.width = props.dims.width + "px";
+
+ if (this.showUsed)
+ styleObject.color = usedStyleObject.backgroundColor;
+ else
+ styleObject.color = inverseRGB(baseStyleObject.backgroundColor);
+
+ styleObject.textAlign = "center";
+ styleObject.clip = "rect(0px, " + props.dims.width + "px, " + props.dims.height + "px, " + props.size + "px)";
+ getObject(this.progressRemainDivId).innerHTML = Math.round(props.percent * 100) + "%";
+ }
+ else
+ {
+ // TODO vertical clipping
+ }
+
+ styleObject.visibility = "visible";
+ }
+ };
+
+ __Slider.prototype.step = function(delta)
+ {
+ this.position = this.position + (delta * this.stepAmt);
+
+ var min = Math.min(this.minValue, this.maxValue);
+ var max = Math.max(this.minValue, this.maxValue);
+
+ if (this.position < min)
+ this.position = min;
+
+ if (this.position > max)
+ this.position = max;
+
+ this.repaint();
+
+ if (this.onChange)
+ this.onChange(this);
+ };
+
+ var dragDiv;
+ var dragDivId;
+ var dragStartMousePos;
+ var dragStartSliderPos;
+
+ function dragStart(event)
+ {
+ var thumbDiv = __browser.getEventTarget(event);
+ dragDiv = thumbDiv;
+ dragStartMousePos = __browser.getMousePos(event);
+
+ var slider = qfSliderFactory.getSliderByName(thumbDiv.id.split("_")[2]);
+ dragStartSliderPos = slider.position;
+
+ __browser.chainEvent(document, "mousemove", dragMove);
+ __browser.chainEvent(document, "mouseup", dragDrop);
+ __browser.stopEventBubble(event);
+ }
+
+ function dragMove(event)
+ {
+ var mousePos = __browser.getMousePos(event);
+
+ var thumbDiv = dragDiv;
+ var slider = qfSliderFactory.getSliderByName(thumbDiv.id.split("_")[2]);
+
+ var styleObject = getStyleObject(thumbDiv.id);
+ var thumbDims = __getControlDim(getObject(thumbDiv.id));
+ var props = slider.getSliderProperties(slider.thumbLimits);
+
+ // Limit movement of thumb within boundaries of the containing thumb limits
+ if (slider.horizontal)
+ {
+ var newLeft = mousePos.x - props.dims.x - thumbDims.width / 2;
+
+ if (newLeft < slider.thumbLimits.left)
+ newLeft = slider.thumbLimits.left;
+ if (newLeft > (slider.thumbLimits.left + props.dims.width))
+ newLeft = slider.thumbLimits.left + props.dims.width;
+
+ var percent = (newLeft - slider.thumbLimits.left) / props.dims.width;
+ if (this.reversePaint)
+ percent = 1 - percent;
+
+ var min = Math.min(slider.minValue, slider.maxValue);
+ var max = Math.max(slider.minValue, slider.maxValue);
+
+ var pos = ((max - min) * percent).roundedValue(slider.stepAmt);
+
+ slider.setPosition(pos);
+ slider.repaint();
+ }
+ else
+ {
+ var min = Math.min(slider.minValue, slider.maxValue);
+ var max = Math.max(slider.minValue, slider.maxValue);
+ var pos = (dragStartSliderPos - (mousePos.y - dragStartMousePos.y) / props.dims.height * (max - min)).roundedValue(slider.stepAmt);
+
+ slider.setPosition(pos);
+ slider.repaint();
+ }
+
+ __browser.stopEventBubble(event);
+ };
+
+ function dragDrop(event)
+ {
+ __browser.unchainEvent(document, "mousemove", dragMove);
+ __browser.unchainEvent(document, "mouseup", dragDrop);
+ };
+}
+
+
+var qfSliderFactory = new __SliderFactory();
\ No newline at end of file
Copied: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/readme.txt (from rev 14927, branches/community/Seam_2_3/examples-ee6/remoting/progressbar/readme.txt)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/readme.txt (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/readme.txt 2012-06-21 10:32:23 UTC (rev 14941)
@@ -0,0 +1,19 @@
+Seam Remoting/Progressbar Example
+=================================
+
+This example shows how to create a progress bar using Seam Remoting.
+It runs on JBoss AS as an EAR.
+
+To deploy the example to JBossAS, follow these steps:
+
+* In the example root directory run:
+
+ mvn clean install
+
+* Set JBOSS_HOME environment property.
+
+* In the progressbar-ear directory run:
+
+ mvn jboss-as:deploy
+
+* Open this URL in a web browser: http://localhost:8080/seam-progressbar
More information about the seam-commits
mailing list