tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andy...@apache.org
Subject svn commit: r525790 - in /tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib: Contrib.library ajax/AjaxStatus.java ajax/AjaxStatus.jwc ajax/AjaxStatus.script
Date Thu, 05 Apr 2007 10:33:28 GMT
Author: andyhot
Date: Thu Apr  5 03:33:23 2007
New Revision: 525790

URL: http://svn.apache.org/viewvc?view=rev&rev=525790
Log:
Ajax status component for easy displaying loading messages, e.t.c. when on ajax requests

Added:
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.java
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.jwc
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.script
Modified:
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/Contrib.library

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/Contrib.library
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/Contrib.library?view=diff&rev=525790&r1=525789&r2=525790
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/Contrib.library
(original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/Contrib.library
Thu Apr  5 03:33:23 2007
@@ -73,4 +73,5 @@
   <component-type type="ControlledCheckbox" specification-path="form/checkboxes/ControlledCheckbox.jwc"/>
   <component-type type="XTile" specification-path="ajax/XTile.jwc"/>
   <component-type type="Timeout" specification-path="ajax/Timeout.jwc"/>
+  <component-type type="AjaxStatus" specification-path="ajax/AjaxStatus.jwc"/>
 </library-specification>

Added: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.java?view=auto&rev=525790
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.java
(added)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.java
Thu Apr  5 03:33:23 2007
@@ -0,0 +1,45 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed 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.tapestry.contrib.ajax;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.IScript;
+import org.apache.tapestry.PageRenderSupport;
+import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.components.Any;
+
+/**
+ * @since 4.1.2
+ */
+public abstract class AjaxStatus extends Any
+{
+    public abstract IScript getScript();
+    
+    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
+    {
+        // render as if an Any component
+        super.renderComponent(writer, cycle);
+        // then add the script
+        if(!cycle.isRewinding()) {
+            PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle,
this);
+            Map symbols = new HashMap();
+            symbols.put("id", getClientId());
+            getScript().execute(this, cycle, pageRenderSupport, symbols);
+        }
+    }
+}

Added: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.jwc?view=auto&rev=525790
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.jwc
(added)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.jwc
Thu Apr  5 03:33:23 2007
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+   Copyright 2007 The Apache Software Foundation
+
+   Licensed 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.
+-->
+<!DOCTYPE component-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification
4.0//EN" 
+    "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
+<component-specification class="org.apache.tapestry.contrib.ajax.AjaxStatus">
+    <description>
+        An extension of the Any component that defines an html node that will be shown 
+        when ajax requests are in progress, and hidden when those requests end.
+    </description>
+    
+    <parameter name="element" default-value="ognl:templateTagName" >
+        <description>
+        The element to emulate.
+        </description>
+    </parameter>    
+    
+    <inject property="script" type="script" object="AjaxStatus.script"/>    
+</component-specification>

Added: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.script?view=auto&rev=525790
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.script
(added)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/ajax/AjaxStatus.script
Thu Apr  5 03:33:23 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script PUBLIC
+  "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN" 
+  "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
+
+<script>
+    <input-symbol key="id" required="yes" />
+    <body>
+        <unique>
+            dojo.require("tapestry.fx");
+        </unique>
+    </body>
+    <initialization>
+if(tapestry.fx) tapestry.fx.attachAjaxStatus("${id}");
+    </initialization>
+</script>
\ No newline at end of file



Mime
View raw message