myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From proph...@apache.org
Subject svn commit: r326951 - in /myfaces/sandbox/trunk: src/java/org/apache/myfaces/custom/autoupdatedatatable/ tld/
Date Thu, 20 Oct 2005 17:19:48 GMT
Author: prophecy
Date: Thu Oct 20 10:19:45 2005
New Revision: 326951

URL: http://svn.apache.org/viewcvs?rev=326951&view=rev
Log:
added onSuccess parameter for a javascript callback when a successful refresh has completed

Modified:
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTable.java
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableRenderer.java
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableTag.java
    myfaces/sandbox/trunk/tld/myfaces_sandbox.tld

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTable.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTable.java?rev=326951&r1=326950&r2=326951&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTable.java
(original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTable.java
Thu Oct 20 10:19:45 2005
@@ -37,6 +37,7 @@
     public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.AutoUpdateDataTable";
 
     private String _frequency;
+    private String _onSuccess;
 
     public AutoUpdateDataTable()
     {
@@ -68,9 +69,10 @@
      */
     public Object saveState(FacesContext context)
     {
-        Object[] values = new Object[2];
+        Object[] values = new Object[3];
         values[0] = super.saveState(context);
         values[1] = _frequency;
+        values[2] = _onSuccess;
 
         return values;
     }
@@ -84,6 +86,7 @@
         Object values[] = (Object[])state;
         super.restoreState(context, values[0]);
         _frequency = (String) values[1];
+        _onSuccess = (String) values[2];
     }
 
     /**
@@ -104,6 +107,20 @@
      */
     public void setFrequency(String frequency) {
         _frequency = frequency;
+    }
+
+    public String getOnSuccess() {
+         if (_onSuccess!= null)
+            return _onSuccess;
+        ValueBinding vb = getValueBinding("onSuccess");
+        if( vb == null )
+        	return null;
+        Object eval = vb.getValue(getFacesContext());
+        return eval == null ? null : eval.toString();
+    }
+
+    public void setOnSuccess(String _onSuccess) {
+        this._onSuccess = _onSuccess;
     }
 
     /**

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableRenderer.java?rev=326951&r1=326950&r2=326951&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableRenderer.java
(original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableRenderer.java
Thu Oct 20 10:19:45 2005
@@ -97,6 +97,10 @@
                 if (context.getApplication().getStateManager().isSavingStateInClient(context)){
                     script.append(" , parameters: '&jsf_tree_64='+encodeURIComponent(document.getElementById('jsf_tree_64').value)+'&jsf_state_64='+encodeURIComponent(document.getElementById('jsf_state_64').value)+'&jsf_viewid='+encodeURIComponent(document.getElementById('jsf_viewid').value)");
                 }
+        String onSuccess = autoUpdateDataTable.getOnSuccess();
+        if(onSuccess != null){
+            script.append(" , onSuccess: ").append(onSuccess);
+        }
         script.append("    })");
         script.append("\n");
 

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableTag.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableTag.java?rev=326951&r1=326950&r2=326951&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableTag.java
(original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/autoupdatedatatable/AutoUpdateDataTableTag.java
Thu Oct 20 10:19:45 2005
@@ -29,6 +29,7 @@
 public class AutoUpdateDataTableTag extends HtmlDataTableTag{
 
     private String _frequency;
+    private String _onSuccess;
 
 
     /**
@@ -38,6 +39,14 @@
         _frequency = frequency;
     }
 
+    public String getOnSuccess() {
+        return _onSuccess;
+    }
+
+    public void setOnSuccess(String _onSuccess) {
+        this._onSuccess = _onSuccess;
+    }
+
     /**
      * @return the ComponentType String
      */
@@ -55,6 +64,7 @@
     public void release() {
         super.release();
         _frequency = null;
+        _onSuccess = null;
     }
 
     /**
@@ -64,5 +74,6 @@
         super.setProperties(component);
 
         setStringProperty(component, "frequency", _frequency);
+        setStringProperty(component, "onSuccess", _onSuccess);
     }
 }

Modified: myfaces/sandbox/trunk/tld/myfaces_sandbox.tld
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/tld/myfaces_sandbox.tld?rev=326951&r1=326950&r2=326951&view=diff
==============================================================================
--- myfaces/sandbox/trunk/tld/myfaces_sandbox.tld (original)
+++ myfaces/sandbox/trunk/tld/myfaces_sandbox.tld Thu Oct 20 10:19:45 2005
@@ -337,6 +337,15 @@
                 2 seconds will be default.
             </description>
         </attribute>
+        <attribute>
+            <name>onSuccess</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+            <type>java.lang.String</type>
+            <description>
+                Define javascript function to call after successful refresh.
+            </description>
+        </attribute>
      </tag>
 
     <!-- accordionPanel -->



Mime
View raw message