myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r488405 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/taglib/component/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ tobago-tool/gendoc/src/main/java/org/apach...
Date Mon, 18 Dec 2006 20:21:49 GMT
Author: bommel
Date: Mon Dec 18 12:21:48 2006
New Revision: 488405

URL: http://svn.apache.org/viewvc?view=rev&rev=488405
Log:
(TOBAGO-220) Add complete facet for a UICommand to tc:progress

Added:
    myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/Progress.java
Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ProgressTagDeclaration.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
    myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/tobago-config.xml
    myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/progress.jsp

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ProgressTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ProgressTagDeclaration.java?view=diff&rev=488405&r1=488404&r2=488405
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ProgressTagDeclaration.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ProgressTagDeclaration.java
Mon Dec 18 12:21:48 2006
@@ -33,7 +33,7 @@
 /**
  * Renders a progressbar.
  */
-@Tag(name = "progress", bodyContent = BodyContent.EMPTY)
+@Tag(name = "progress")
 @UIComponentTag(
     uiComponent = "javax.faces.component.UIOutput",
     rendererType = "Progress", isComponentAlreadyDefined = true)

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java?view=diff&rev=488405&r1=488404&r2=488405
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
(original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
Mon Dec 18 12:21:48 2006
@@ -29,7 +29,9 @@
 import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.apache.myfaces.tobago.component.UICommand;
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIOutput;
@@ -92,6 +94,13 @@
     writer.endElement(HtmlConstants.IMG);
 
     writer.endElement(HtmlConstants.SPAN);
+    UIComponent facet = component.getFacet("complete");
+    if (model.getValue() == model.getMaximum() && facet != null
+        && facet instanceof UICommand) {
+      UICommand command = (UICommand) facet;
+      HtmlRendererUtil.writeJavascript(writer, "Tobago.submitAction('" + command.getClientId(facesContext)
+ "');");
+    }
+
   }
 
 }

Added: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/Progress.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/Progress.java?view=auto&rev=488405
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/Progress.java
(added)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/Progress.java
Mon Dec 18 12:21:48 2006
@@ -0,0 +1,45 @@
+package org.apache.myfaces.tobago.example.reference;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.swing.DefaultBoundedRangeModel;
+import javax.swing.BoundedRangeModel;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: Dec 18, 2006
+ * Time: 7:54:19 PM
+ */
+public class Progress {
+  private DefaultBoundedRangeModel progress = new DefaultBoundedRangeModel(0, 0, 0, 100);
+
+  public BoundedRangeModel getProgress() {
+    int value = progress.getValue();
+    if (value < progress.getMaximum()) {
+      value = value+10;
+      progress.setValue(value);
+    }
+    return progress;
+  }
+
+  public String reset() {
+    progress.setValue(0);
+    return "reset";
+  }
+}

Modified: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=488405&r1=488404&r2=488405
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml Mon Dec
18 12:21:48 2006
@@ -55,9 +55,22 @@
   </managed-bean>
 
   <managed-bean>
+    <managed-bean-name>progress</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.reference.Progress</managed-bean-class>
+    <managed-bean-scope>session</managed-bean-scope>
+  </managed-bean>
+
+  <managed-bean>
     <managed-bean-name>selectBooleanCheckboxController</managed-bean-name>
     <managed-bean-class>org.apache.myfaces.tobago.example.reference.SelectBooleanCheckboxController</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>
   </managed-bean>
+
+  <navigation-rule>
+    <navigation-case>
+      <from-outcome>reset</from-outcome>
+      <to-view-id>/screenshot/progress.jsp</to-view-id>
+    </navigation-case>
+  </navigation-rule>
 
 </faces-config>

Modified: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/tobago-config.xml?view=diff&rev=488405&r1=488404&r2=488405
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/tobago-config.xml Mon
Dec 18 12:21:48 2006
@@ -28,5 +28,5 @@
 
   <resource-dir>tobago-resource</resource-dir>
   <resource-dir>org/apache/myfaces/tobago/renderkit</resource-dir>
-
+  <ajax-enabled>true</ajax-enabled>
 </tobago-config>

Modified: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/progress.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/progress.jsp?view=diff&rev=488405&r1=488404&r2=488405
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/progress.jsp (original)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/progress.jsp Mon Dec
18 12:21:48 2006
@@ -14,30 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 --%>
-<%@ page
-    errorPage="/errorPage.jsp"
-    import="javax.swing.DefaultBoundedRangeModel"
-    %>
 <%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
 <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
 <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
 <%-- Progress --%>
 
-<%
-  DefaultBoundedRangeModel progress = new DefaultBoundedRangeModel(75, 0, 0, 100);
-  pageContext.setAttribute("progress", progress, PageContext.REQUEST_SCOPE);
-%>
-
 <layout:screenshot>
   <f:subview id="progress">
     <jsp:body>
       <tc:panel>
+        <f:facet name="reload">
+          <tc:reload frequency="5000" />
+        </f:facet>
         <f:facet name="layout">
           <tc:gridLayout rows="fixed;1*" columns="100px;1* "/>
         </f:facet>
-          <tc:label value="Progress: " inline="true"/>
+          <tc:label value="Progress:" />
           <%-- code-sniplet-start id="progress" --%>
-          <tc:progress value="#{progress}"/>
+          <tc:progress value="#{progress.progress}" >
+            <f:facet name="complete">
+              <tc:command action="#{progress.reset}" />
+            </f:facet>
+          </tc:progress>
           <%-- code-sniplet-end id="progress" --%>
         <tc:cell/>
       </tc:panel>



Mime
View raw message