You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/06/11 00:01:22 UTC

svn commit: r1134457 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main: java/org/apache/myfaces/tobago/example/reference/ webapp/WEB-INF/ webapp/content/50/ webapp/reference/

Author: lofwyr
Date: Fri Jun 10 22:01:21 2011
New Revision: 1134457

URL: http://svn.apache.org/viewvc?rev=1134457&view=rev
Log:
working on demo page for partial rendering (AJAX)

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/50/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/50/partial.xhtml
Removed:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/partial.jsp
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java?rev=1134457&r1=1134456&r2=1134457&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java Fri Jun 10 22:01:21 2011
@@ -17,10 +17,10 @@ package org.apache.myfaces.tobago.exampl
  * limitations under the License.
  */
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.ajax.AjaxUtils;
 import org.apache.myfaces.tobago.example.demo.Navigation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.context.FacesContext;
 import javax.faces.el.VariableResolver;
@@ -36,15 +36,11 @@ public class PartialReloadController {
     return new Date();
   }
 
-  public String leftAction() {
-    return logAndNavigate(null);
-  }
-
-  public String rightAction() {
+  public String reload() {
     return logAndNavigate(null);
   }
 
-  public String bothAction() {
+  public String waitAndReload() {
     synchronized (this) {
       try {
         wait(6000);
@@ -60,7 +56,7 @@ public class PartialReloadController {
     VariableResolver resolver = facesContext.getApplication().getVariableResolver();
     Navigation navigation = (Navigation) resolver.resolveVariable(facesContext, "navigation");
 
-    // in case of both the select controll is not proccessed during lifecycle
+    // in case of both the select control is not processed during lifecycle
     // we need to get the value from the request params
     navigateAction = (String) facesContext.getExternalContext().getRequestParameterMap().get("page:content:navSelect");
 

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml?rev=1134457&r1=1134456&r2=1134457&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml Fri Jun 10 22:01:21 2011
@@ -83,6 +83,13 @@
       </supported-markup>
     </renderer>
 
+    <renderer>
+      <name>Out</name>
+      <supported-markup>
+        <markup>demoSeconds</markup>
+      </supported-markup>
+    </renderer>
+
   </renderers>
 
 </tobago-config>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/50/partial.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/50/partial.xhtml?rev=1134457&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/50/partial.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/50/partial.xhtml Fri Jun 10 22:01:21 2011
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * 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.
+-->
+
+<ui:composition template="/WEB-INF/tags/layout/overview.xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:tx="http://myfaces.apache.org/tobago/extension"
+                xmlns:ui="http://java.sun.com/jsf/facelets"
+                xmlns:f="http://java.sun.com/jsf/core">
+  <ui:param name="title" value="Partial Update (AJAX)"/>
+  <tc:panel id="parent">
+    <f:facet name="layout">
+      <tc:gridLayout rows="20px;200px;*;fixed"/>
+    </f:facet>
+
+    <tc:out value="Demonstration and test of partial reload"/>
+
+    <tc:style>
+      .tobago-out-markup-demoSeconds {
+      font-size: 96px;
+      }
+    </tc:style>
+
+    <tc:panel>
+      <f:facet name="layout">
+        <tc:gridLayout columns="1*;1*"/>
+      </f:facet>
+      <tc:box label="Left panel" id="left">
+        <f:facet name="layout">
+          <tc:gridLayout rows="auto;*"/>
+        </f:facet>
+        <tc:label value="Current seconds on server: "/>
+        <tc:out value="#{partialReloadController.currentDate}" markup="demoSeconds">
+          <f:convertDateTime pattern="ss:SSS"/>
+        </tc:out>
+      </tc:box>
+      <tc:box label="Right panel" id="right">
+        <f:facet name="layout">
+          <tc:gridLayout rows="auto;*"/>
+        </f:facet>
+        <tc:label value="Current seconds on server: "/>
+        <tc:out value="#{partialReloadController.currentDate}" markup="demoSeconds">
+          <f:convertDateTime pattern="ss:SSS"/>
+        </tc:out>
+      </tc:box>
+    </tc:panel>
+
+    <tc:out escape="false" value="
+        &lt;ul>
+          &lt;li> Click on 'Reload Left' button to reload the left panel.&lt;/li>
+          &lt;li> Click on 'Reload Right' button to reload the right panel.&lt;/li>
+          &lt;li> Or select a option from the selectOneChoise control:
+            &lt;ul>
+              &lt;li>Select 'Reload parent' to reload both panels parent container&lt;/li>
+              &lt;li>Select 'Reload both' to reload both panels in one request&lt;/li>
+              &lt;li>Select 'Goto prev' to navigate to previous page&lt;/li>
+              &lt;li>Select 'Goto next' to navigate to next page&lt;/li>
+            &lt;/ul>
+          &lt;/li>
+        &lt;/ul>
+
+        &lt;/p>
+        &lt;b>UNDER CONSTRUCTION! Problems:&lt;/b>
+        &lt;ul>
+          &lt;li>Fast click on 'Reload left': Error 500&lt;/li>
+          &lt;li>Select control doesn't work in the moment&lt;/li>
+        &lt;/ul>
+      "/>
+    <tc:panel>
+      <f:facet name="layout">
+        <tc:gridLayout columns="*;205px;*"/>
+      </f:facet>
+
+      <tc:panel/>
+
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout columns="*;*" rows="auto;auto;auto;auto;auto"/>
+        </f:facet>
+
+        <tc:button label="Reload left"
+                   tip="Reload left side box"
+                   action="#{partialReloadController.reload}">
+          <tc:attribute value="left" name="renderedPartially"/>
+        </tc:button>
+
+        <tc:button label="Reload right"
+                   tip="Reload right side box"
+                   action="#{partialReloadController.reload}">
+          <tc:attribute value="right" name="renderedPartially"/>
+        </tc:button>
+
+        <tc:button label="Reload both"
+                   tip="Reload both boxes"
+                   action="#{partialReloadController.reload}">
+          <tc:attribute value="left,right" name="renderedPartially"/>
+          <tc:gridLayoutConstraint columnSpan="2"/>
+        </tc:button>
+
+        <tc:button label="Wait 6 s and reload both"
+                   tip="Wait 6 seconds and reload both boxes"
+                   action="#{partialReloadController.waitAndReload}">
+          <tc:attribute value="left,right" name="renderedPartially"/>
+          <tc:gridLayoutConstraint columnSpan="2"/>
+        </tc:button>
+
+        <tc:panel>
+          <tc:gridLayoutConstraint columnSpan="2"/>
+
+          <tx:selectOneChoice id="navSelect" value="#{partialReloadController.navigateAction}" label="On Change">
+            <f:facet name="change">
+              <tc:command action="#{partialReloadController.navigateAction}">
+                <tc:attribute value="" name="renderedPartially"/>
+              </tc:command>
+            </f:facet>
+            <f:selectItem itemLabel="Select action" itemValue=""/>
+            <f:selectItem itemLabel="Reload parent" itemValue="parent"/>
+            <f:selectItem itemLabel="Reload both" itemValue="both"/>
+            <f:selectItem itemLabel="Goto prev" itemValue="prev"/>
+            <f:selectItem itemLabel="Goto next" itemValue="next"/>
+          </tx:selectOneChoice>
+
+        </tc:panel>
+
+      </tc:panel>
+
+      <tc:panel/>
+
+    </tc:panel>
+  </tc:panel>
+</ui:composition>