You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2007/10/07 18:07:44 UTC
svn commit: r582641 - in /myfaces/tobago/trunk/example/demo/src/main:
java/org/apache/myfaces/tobago/example/demo/
java/org/apache/myfaces/tobago/example/reference/ webapp/ webapp/WEB-INF/
webapp/reference/ webapp/tobago-resource/html/standard/standard...
Author: weber
Date: Sun Oct 7 09:07:42 2007
New Revision: 582641
URL: http://svn.apache.org/viewvc?rev=582641&view=rev
Log:
adding partial reload example reference
Added:
myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java
myfaces/tobago/trunk/example/demo/src/main/webapp/reference/partial.jsp
Modified:
myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java
myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml
myfaces/tobago/trunk/example/demo/src/main/webapp/navigation.jsp
myfaces/tobago/trunk/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
Modified: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java?rev=582641&r1=582640&r2=582641&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java (original)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java Sun Oct 7 09:07:42 2007
@@ -86,6 +86,7 @@
reference.add(new DefaultMutableTreeNode(new Node("reference_tab", "reference/tab")));
reference.add(new DefaultMutableTreeNode(new Node("reference_time", "reference/time")));
reference.add(new DefaultMutableTreeNode(new Node("reference_tool", "reference/tool")));
+ reference.add(new DefaultMutableTreeNode(new Node("reference_partial", "reference/partial")));
reference.add(new DefaultMutableTreeNode(new Node("reference_upload", "reference/upload")));
tree.add(reference);
Added: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java?rev=582641&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java (added)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/PartialReloadController.java Sun Oct 7 09:07:42 2007
@@ -0,0 +1,79 @@
+package org.apache.myfaces.tobago.example.reference;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.myfaces.tobago.example.demo.Navigation;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.VariableResolver;
+import java.util.Date;
+/*
+ * 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.
+ */
+
+public class PartialReloadController {
+
+ private final Log LOG = LogFactory.getLog(PartialReloadController.class);
+
+ private String navigateAction;
+
+ public Date getCurrentDate() {
+ return new Date();
+ }
+
+ public String leftAction() {
+ return logAndNavigate(null);
+ }
+
+ public String rightAction() {
+ return logAndNavigate(null);
+ }
+
+ public String navigateAction() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ VariableResolver resolver = facesContext.getApplication().getVariableResolver();
+ Navigation navigation = (Navigation) resolver.resolveVariable(facesContext, "navigation");
+ LOG.info("navigateAction = \"" + navigateAction + "\"");
+ if (navigateAction == null) {
+ return logAndNavigate(null);
+ } else if ("both".equals(navigateAction)) {
+ navigateAction = null;
+ return logAndNavigate(null);
+ } else if ("prev".equals(navigateAction)) {
+ navigateAction = null;
+ return logAndNavigate(navigation.gotoPrevious());
+ } else if ("next".equals(navigateAction)) {
+ navigateAction = null;
+ return logAndNavigate(navigation.gotoNext());
+ }
+ return logAndNavigate(null);
+ }
+
+ private String logAndNavigate(String navValue) {
+ LOG.info("Return navigate value: " + navValue + "");
+ return navValue;
+ }
+
+
+ public String getNavigateAction() {
+ return navigateAction;
+ }
+
+ public void setNavigateAction(String navigateAction) {
+ this.navigateAction = navigateAction;
+ }
+}
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml?rev=582641&r1=582640&r2=582641&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/faces-config.xml Sun Oct 7 09:07:42 2007
@@ -274,6 +274,12 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>partialReloadController</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.reference.PartialReloadController</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>reference/intro</from-outcome>
@@ -334,6 +340,10 @@
<navigation-case>
<from-outcome>reference/upload</from-outcome>
<to-view-id>/reference/upload.jsp</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>reference/partial</from-outcome>
+ <to-view-id>/reference/partial.jsp</to-view-id>
</navigation-case>
</navigation-rule>
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/navigation.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/navigation.jsp?rev=582641&r1=582640&r2=582641&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/navigation.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/navigation.jsp Sun Oct 7 09:07:42 2007
@@ -28,6 +28,7 @@
id="nav"
nameReference="userObject.title"
idReference="userObject.id"
+ tipReference="userObject.title"
state="#{navigation.state}"
showIcons="false"
showJunctions="false"
Added: myfaces/tobago/trunk/example/demo/src/main/webapp/reference/partial.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/reference/partial.jsp?rev=582641&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/reference/partial.jsp (added)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/reference/partial.jsp Sun Oct 7 09:07:42 2007
@@ -0,0 +1,86 @@
+<%--
+ * 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.
+--%>
+<%@ 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" %>
+
+<layout:overview>
+ <jsp:body>
+ <tc:panel id="both">
+ <f:facet name="layout">
+ <tc:gridLayout rows="20px;300px;*;fixed"/>
+ </f:facet>
+
+ <tc:out value="Demonstration and test of partial reload"/>
+
+ <tc:panel>
+ <f:facet name="layout">
+ <tc:gridLayout columns="1*;1*"/>
+ </f:facet>
+ <tc:box label="Left panel" id="left">
+ <tc:out value="#{partialReloadController.currentDate}"/>
+ </tc:box>
+ <tc:box label="Right panel" id="right">
+ <tc:out value="#{partialReloadController.currentDate}"/>
+ </tc:box>
+ </tc:panel>
+
+ <tc:out escape="false" value="
+ <ul>
+ <li> Click on 'Reload Left' button to reload the left panel.</li>
+ <li> Click on 'Reload Right' button to reload the right panel.</li>
+ <li> Or select a option from the selectOneChoise control:
+ <ul>
+ <li>Select 'Reload both' to reload both panels</li>
+ <li>Select 'Goto prev' to navigate to previous page</li>
+ <li>Select 'Goto next' to navigate to next page</li>
+ </ul>
+ </li>
+ </ul>
+ "/>
+
+ <tc:panel>
+ <f:facet name="layout">
+ <tc:gridLayout columns="fixed;1*;140px;1*;fixed"/>
+ </f:facet>
+ <tc:button label="Reload left"
+ tip="Reload left side box"
+ action="#{partialReloadController.leftAction}">
+ <tc:attribute value="page:left" name="renderedPartially"/>
+ </tc:button>
+ <tc:panel/>
+ <tc:selectOneChoice value="#{partialReloadController.navigateAction}">
+ <f:facet name="change">
+ <tc:command action="#{partialReloadController.navigateAction}">
+ <tc:attribute value="page:both" name="renderedPartially"/>
+ </tc:command>
+ </f:facet>
+ <f:selectItem itemLabel="Select action" itemValue=""/>
+ <f:selectItem itemLabel="Reload both" itemValue="both"/>
+ <f:selectItem itemLabel="Goto prev" itemValue="prev"/>
+ <f:selectItem itemLabel="Goto next" itemValue="next"/>
+ </tc:selectOneChoice>
+ <tc:panel/>
+ <tc:button label="Reload right"
+ tip="Reload right side box"
+ action="#{partialReloadController.rightAction}">
+ <tc:attribute value="page:right" name="renderedPartially"/>
+ </tc:button>
+ </tc:panel>
+ </tc:panel>
+ </jsp:body>
+</layout:overview>
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml?rev=582641&r1=582640&r2=582641&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/tobago-resource/html/standard/standard/property/overview.properties.xml Sun Oct 7 09:07:42 2007
@@ -71,6 +71,7 @@
<entry key="reference_tab">Tab</entry>
<entry key="reference_time">Time</entry>
<entry key="reference_tool">Tool Bar</entry>
+ <entry key="reference_partial">Partial</entry>
<entry key="reference_upload">Upload</entry>
<entry key="submit">Submit</entry>