myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1130179 - in /myfaces/tomahawk/trunk/sandbox/examples20/src/main: java/org/apache/myfaces/examples/jsCallbackFunction/ webapp/ webapp/META-INF/templates/ webapp/WEB-INF/
Date Wed, 01 Jun 2011 15:09:08 GMT
Author: lu4242
Date: Wed Jun  1 15:09:07 2011
New Revision: 1130179

URL: http://svn.apache.org/viewvc?rev=1130179&view=rev
Log:
TOMAHAWK-1593 Add s:jsCallbackFunction and s:jsOnEventAjax tags

Added:
    myfaces/tomahawk/trunk/sandbox/examples20/src/main/java/org/apache/myfaces/examples/jsCallbackFunction/
    myfaces/tomahawk/trunk/sandbox/examples20/src/main/java/org/apache/myfaces/examples/jsCallbackFunction/JsCallbackFunctionBean.java
    myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsCallbackFunction.xhtml
    myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsOnEventAjax.xhtml
Modified:
    myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/META-INF/templates/leftmenu.xhtml
    myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/WEB-INF/examples-config.xml

Added: myfaces/tomahawk/trunk/sandbox/examples20/src/main/java/org/apache/myfaces/examples/jsCallbackFunction/JsCallbackFunctionBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples20/src/main/java/org/apache/myfaces/examples/jsCallbackFunction/JsCallbackFunctionBean.java?rev=1130179&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples20/src/main/java/org/apache/myfaces/examples/jsCallbackFunction/JsCallbackFunctionBean.java
(added)
+++ myfaces/tomahawk/trunk/sandbox/examples20/src/main/java/org/apache/myfaces/examples/jsCallbackFunction/JsCallbackFunctionBean.java
Wed Jun  1 15:09:07 2011
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.examples.jsCallbackFunction;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class JsCallbackFunctionBean
+{
+
+    private List<String> items; 
+    
+    public JsCallbackFunctionBean()
+    {
+        items = new ArrayList<String>();
+        items.add("A");
+        items.add("B");
+        items.add("C");
+    }
+    
+    public List<String> getItems()
+    {
+        return items;
+    }
+    
+}

Modified: myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/META-INF/templates/leftmenu.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/META-INF/templates/leftmenu.xhtml?rev=1130179&r1=1130178&r2=1130179&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/META-INF/templates/leftmenu.xhtml
(original)
+++ myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/META-INF/templates/leftmenu.xhtml
Wed Jun  1 15:09:07 2011
@@ -35,6 +35,8 @@
         <li class="none"><h:link outcome="effectSquish" value="s:effectSquish"></h:link></li>
         <li class="none"><h:link outcome="effectSwitchOff" value="s:effectSwitchOff"></h:link></li>
         <li class="none"><h:link outcome="effectToggle" value="s:effectToggle"></h:link></li>
+        <li class="none"><h:link outcome="jsCallbackFunction" value="s:jsCallbackFunction"></h:link></li>
+        <li class="none"><h:link outcome="jsOnEventAjax" value="s:jsOnEventAjax"></h:link></li>
         <li class="none"><h:link outcome="passwordStrength" value="s:passwordStrength"></h:link></li>
     </ul>
 </ui:composition>

Modified: myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/WEB-INF/examples-config.xml?rev=1130179&r1=1130178&r2=1130179&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/WEB-INF/examples-config.xml
(original)
+++ myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/WEB-INF/examples-config.xml
Wed Jun  1 15:09:07 2011
@@ -27,6 +27,12 @@
           <managed-bean-class>org.apache.myfaces.examples.passwordStrength.PasswordStrengthBean</managed-bean-class>
           <managed-bean-scope>request</managed-bean-scope>
      </managed-bean> 
+     
+    <managed-bean>
+          <managed-bean-name>jsCallbackFunctionBean</managed-bean-name>
+          <managed-bean-class>org.apache.myfaces.examples.jsCallbackFunction.JsCallbackFunctionBean</managed-bean-class>
+          <managed-bean-scope>request</managed-bean-scope>
+     </managed-bean> 
 
 </faces-config>
 

Added: myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsCallbackFunction.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsCallbackFunction.xhtml?rev=1130179&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsCallbackFunction.xhtml (added)
+++ myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsCallbackFunction.xhtml Wed
Jun  1 15:09:07 2011
@@ -0,0 +1,78 @@
+<?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:f="http://java.sun.com/jsf/core"
+        xmlns:h="http://java.sun.com/jsf/html"
+        xmlns:ui="http://java.sun.com/jsf/facelets"
+        xmlns:t="http://myfaces.apache.org/tomahawk"
+        xmlns:s="http://myfaces.apache.org/sandbox"
+        xmlns:mc="http://myfaces.apache.org/commons/components">
+<!--
+/*
+ * 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.
+ */
+//-->
+<body>
+<ui:composition template="/META-INF/templates/example_template.xhtml">
+    <ui:define name="main_content">
+
+    <!-- 
+    <f:loadBundle basename="org.apache.myfaces.examples.resource.example_messages" var="example_messages"/>
+     -->
+    <h:form id="mainForm">
+        <p>This example uses s:jsCallbackFunction to render a inline function that
fade the image using f:ajax 'onevent' property. 
+        </p>
+        <p>The typical use case is how to hook f:ajax 'onevent' with a function callback.
The param 'e' knows the source
+        of the ajax operation, but doesn't know the target of further operations. In this
case, s:effectFade forId="panel" is
+        used to indicate that a fade operation is required to be applied on the panel with
the image.  
+        </p>
+        <p>To generate the event name there are two options:</p>
+        <ul>
+        <li>mc:findComponentFrom(component,'someId').functionName</li>
+        <li>s:jsCallbackFunctionName(component,'someId')</li>
+        </ul>
+        <br/>
+        
+        <t:dataList id="items" value="#{jsCallbackFunctionBean.items}" var="item" layout="simple">
+          <p>Panel #{item}</p>
+          <p>The generated function name is : <h:outputText value="#{mc:findComponentFrom(component,'jsFC').functionName}"></h:outputText></p>
+          <br/>
+          <t:div id="panel" style="width:210px; height:100px; background:#ffffff; border:1px
solid #333;">
+              <h:graphicImage library="images" name="myfaces_logo.jpg" alt="MyFaces Logo"
/>
+          </t:div>
+          <br/>
+          <s:jsCallbackFunction id="jsFC" eventName="click" arguments="e" jsStartContent="if
(e.status == 'success'){ " jsEndContent="}">
+              <s:effectFade forId="panel"/>
+          </s:jsCallbackFunction>
+          
+          <h:commandButton type="button" value="Click me!">
+              <f:ajax render="panel" onevent="#{mc:findComponentFrom(component,'jsFC').functionName}"/>
+          </h:commandButton>
+          <h:commandButton type="button" value="Click me!">
+              <f:ajax render="panel" onevent="#{s:jsCallbackFunctionName(component,'jsFC')}"/>
+          </h:commandButton>
+          <h:commandButton type="button" value="Reset">
+              <s:effectShow forId="panel"/>
+          </h:commandButton>
+        </t:dataList>
+    </h:form>
+  </ui:define>
+ </ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsOnEventAjax.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsOnEventAjax.xhtml?rev=1130179&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsOnEventAjax.xhtml (added)
+++ myfaces/tomahawk/trunk/sandbox/examples20/src/main/webapp/jsOnEventAjax.xhtml Wed Jun
 1 15:09:07 2011
@@ -0,0 +1,78 @@
+<?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:f="http://java.sun.com/jsf/core"
+        xmlns:h="http://java.sun.com/jsf/html"
+        xmlns:ui="http://java.sun.com/jsf/facelets"
+        xmlns:t="http://myfaces.apache.org/tomahawk"
+        xmlns:s="http://myfaces.apache.org/sandbox"
+        xmlns:mc="http://myfaces.apache.org/commons/components">
+<!--
+/*
+ * 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.
+ */
+//-->
+<body>
+<ui:composition template="/META-INF/templates/example_template.xhtml">
+    <ui:define name="main_content">
+
+    <!-- 
+    <f:loadBundle basename="org.apache.myfaces.examples.resource.example_messages" var="example_messages"/>
+     -->
+    <h:form id="mainForm">
+        <p>This example uses s:onEventAjax to render a inline function that fade the
image using f:ajax 'onevent' property.
+        This is a variant of s:jsCallbackFunction to make easier write this specific callback
 
+        </p>
+        <p>The typical use case is how to hook f:ajax 'onevent' with a function callback.
The param 'e' knows the source
+        of the ajax operation, but doesn't know the target of further operations. In this
case, s:effectFade forId="panel" is
+        used to indicate that a fade operation is required to be applied on the panel with
the image.  
+        </p>
+        <p>To generate the event name there are two options:</p>
+        <ul>
+        <li>mc:findComponentFrom(component,'someId').functionName</li>
+        <li>s:jsCallbackFunctionName(component,'someId')</li>
+        </ul>
+        <br/>
+        
+        <t:dataList id="items" value="#{jsCallbackFunctionBean.items}" var="item" layout="simple">
+          <p>Panel #{item}</p>
+          <p>The generated function name is : <h:outputText value="#{mc:findComponentFrom(component,'jsFC1').functionName}"></h:outputText></p>
+          <br/>
+          <t:div id="panel" style="width:210px; height:100px; background:#ffffff; border:1px
solid #333;">
+              <h:graphicImage library="images" name="myfaces_logo.jpg" alt="MyFaces Logo"
/>
+          </t:div>
+          <br/>
+          <s:jsOnEventAjax id="jsFC1" eventName="action" type="success">
+              <s:effectFade forId="panel"/>
+          </s:jsOnEventAjax>
+          <h:commandButton id="button1" type="button" value="Click me!">
+              <f:ajax render="panel" onevent="#{mc:findComponentFrom(component,'jsFC1').functionName}"
/>
+          </h:commandButton>
+          <h:commandButton id="button2" type="button" value="Click me!">
+              <f:ajax render="panel" onevent="#{s:jsCallbackFunctionName(component,'jsFC1')}"/>
+          </h:commandButton>
+          <h:commandButton type="button" value="Reset">
+              <s:effectShow forId="panel"/>
+          </h:commandButton>
+        </t:dataList>
+    </h:form>
+  </ui:define>
+ </ui:composition>
+</body>
+</html>
\ No newline at end of file



Mime
View raw message