com.gwtext.client.core
Class UpdateManager

java.lang.Object
  extended by com.gwtext.client.core.JsObject
      extended by com.gwtext.client.core.UpdateManager

public class UpdateManager
extends JsObject

Provides AJAX-style update for Element object.

Usage :

 ExtElement el = Ext.get("foo");
 UpdateManager mgr = el.getUpdateManager();
 mgr.update("http://myserver.com/index.php", "param1=1¶m2=2");
 

mgr.formUpdate("myFormId", "http://myserver.com/index.php");

// or directly (returns the same UpdateManager instance) UpdateManager mgr2 = new UpdateManager("myElementId"); mgr2.startAutoRefresh(60, "http://myserver.com/index.php"); mgr2.addListener("update", new EventCallback() { public void execute(EventObject e) { // } });


Field Summary
 
Fields inherited from class com.gwtext.client.core.JsObject
jsObj
 
Constructor Summary
UpdateManager(com.google.gwt.user.client.Element element)
          Create new UpdateManager directly.
UpdateManager(ExtElement element)
          Create new UpdateManager directly.
UpdateManager(com.google.gwt.core.client.JavaScriptObject jsObj)
           
UpdateManager(java.lang.String elementID)
          Create new UpdateManager directly.
 
Method Summary
 void abort()
          Aborts the executing transaction.
 void addListener(java.lang.String eventName, EventCallback cb)
          Appends an event handler.
 void formUpdate(java.lang.String formID)
          Performs an async form post, updating this element with the response.
 void formUpdate(java.lang.String formID, java.lang.String url)
          Performs an async form post, updating this element with the response.
 void formUpdate(java.lang.String formID, java.lang.String url, boolean reset, UrlLoadCallback callback)
          Performs an async form post, updating this element with the response.
 ExtElement getEl()
          Get the Element this UpdateManager is bound to.
static UpdateManager instance(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 boolean isUpdating()
          Returns true if an update is in progress.
 void refresh()
          Refresh the element with the last used url or defaultUrl.
static void setDefaultDisableCaching(boolean disableCaching)
          Whether to append unique parameter on get request to disable caching (Defaults to false).
static void setDefaultIndicatorText(java.lang.String indicatorText)
          Text for loading indicator (Defaults to '<div class="loading-indicator">Loading...</div>').
static void setDefaultLoadScripts(boolean loadScripts)
          True to process scripts in the output (Defaults to false).
static void setDefaultShowLoadIndicator(boolean showLoadIndicator)
          Whether to show indicatorText when loading (Defaults to true).
static void setDefaultSslBlankUrl(java.lang.String sslBlankUrl)
          Blank page URL to use with SSL file uploads (Defaults to "about:blank").
static void setDefaultTimeout(int timeout)
          Timeout for requests or form posts in seconds (Defaults to 30 seconds).
 void setDefaultUrl(java.lang.String url)
          Set the defaultUrl used for updates.
 void setDisableCaching(boolean disableCaching)
          True to disable caching.
 void setIndicatorText(java.lang.String indicatorText)
          Set the loading indicator text.
 void setLoadScripts(boolean loadScripts)
          Wheter to load scripts in the contents.
 void setMethod(Connection.Method method)
          Request method (GET or POST).
 void setShowIndicator(boolean showIndicator)
          Whether to show the loading indicator.
 void setTimeout(int timeout)
          Timeout for the request.
 void startAutoRefresh(int interval)
          Set this element to auto refresh.
 void startAutoRefresh(int interval, java.lang.String url)
          Set this element to auto refresh.
 void startAutoRefresh(int interval, java.lang.String url, java.lang.String params, Function cb, boolean refreshNow)
          Set this element to auto refresh.
 void stopAutoRefresh()
          Stop auto refresh on this element.
 void update(java.lang.String url, java.lang.String params)
          Performs an async request, updating this element with the response.
 void update(java.lang.String url, UrlLoadConfig params, UrlLoadCallback callback, boolean discardUrl)
          Performs an async request, updating this element with the response.
 
Methods inherited from class com.gwtext.client.core.JsObject
getJsObj, getProperties, isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateManager

public UpdateManager(java.lang.String elementID)
Create new UpdateManager directly.

Parameters:
elementID - the elemetn ID

UpdateManager

public UpdateManager(com.google.gwt.user.client.Element element)
Create new UpdateManager directly.

Parameters:
element - the element

UpdateManager

public UpdateManager(ExtElement element)
Create new UpdateManager directly.

Parameters:
element - the element

UpdateManager

public UpdateManager(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

instance

public static UpdateManager instance(com.google.gwt.core.client.JavaScriptObject jsObj)

setDefaultTimeout

public static void setDefaultTimeout(int timeout)
Timeout for requests or form posts in seconds (Defaults to 30 seconds).

Parameters:
timeout - the default timeout

setDefaultLoadScripts

public static void setDefaultLoadScripts(boolean loadScripts)
True to process scripts in the output (Defaults to false).

Parameters:
loadScripts - true to laod scripts

setDefaultSslBlankUrl

public static void setDefaultSslBlankUrl(java.lang.String sslBlankUrl)
Blank page URL to use with SSL file uploads (Defaults to "about:blank").

Parameters:
sslBlankUrl - ssl blank url

setDefaultDisableCaching

public static void setDefaultDisableCaching(boolean disableCaching)
Whether to append unique parameter on get request to disable caching (Defaults to false).

Parameters:
disableCaching - true to disable caching

setDefaultShowLoadIndicator

public static void setDefaultShowLoadIndicator(boolean showLoadIndicator)
Whether to show indicatorText when loading (Defaults to true).

Parameters:
showLoadIndicator - true to show indicator

setDefaultIndicatorText

public static void setDefaultIndicatorText(java.lang.String indicatorText)
Text for loading indicator (Defaults to '<div class="loading-indicator">Loading...</div>').

Parameters:
indicatorText - the indicator text

abort

public void abort()
Aborts the executing transaction.


addListener

public void addListener(java.lang.String eventName,
                        EventCallback cb)
Appends an event handler.

Parameters:
eventName - the type of event to append
cb - the event callback

formUpdate

public void formUpdate(java.lang.String formID)
Performs an async form post, updating this element with the response. If the form has the attribute enctype="multipart/form-data", it assumes it's a file upload. Uses this.sslBlankUrl for SSL file uploads to prevent IE security warning.

Parameters:
formID - the form ID

formUpdate

public void formUpdate(java.lang.String formID,
                       java.lang.String url)
Performs an async form post, updating this element with the response. If the form has the attribute enctype="multipart/form-data", it assumes it's a file upload. Uses this.sslBlankUrl for SSL file uploads to prevent IE security warning.

Parameters:
formID - the form ID
url - The url to pass the form to. If omitted the action attribute on the form will be used.

formUpdate

public void formUpdate(java.lang.String formID,
                       java.lang.String url,
                       boolean reset,
                       UrlLoadCallback callback)
Performs an async form post, updating this element with the response. If the form has the attribute enctype="multipart/form-data", it assumes it's a file upload. Uses this.sslBlankUrl for SSL file uploads to prevent IE security warning.

Parameters:
formID - the form ID
url - The url to pass the form to. If omitted the action attribute on the form will be used.
reset - Whether to try to reset the form after the update
callback - callback when transaction is complete

getEl

public ExtElement getEl()
Get the Element this UpdateManager is bound to.

Returns:
the element

isUpdating

public boolean isUpdating()
Returns true if an update is in progress.

Returns:
true if update in progress

refresh

public void refresh()
Refresh the element with the last used url or defaultUrl. If there is no url, it returns immediately.


setDefaultUrl

public void setDefaultUrl(java.lang.String url)
Set the defaultUrl used for updates.

Parameters:
url - the default url

setDisableCaching

public void setDisableCaching(boolean disableCaching)
True to disable caching.

Parameters:
disableCaching - true to disable caching

setIndicatorText

public void setIndicatorText(java.lang.String indicatorText)
Set the loading indicator text.

Parameters:
indicatorText - the indicator text

setLoadScripts

public void setLoadScripts(boolean loadScripts)
Wheter to load scripts in the contents.

Parameters:
loadScripts - true to laod scripts

setMethod

public void setMethod(Connection.Method method)
Request method (GET or POST).

Parameters:
method - the request method

setShowIndicator

public void setShowIndicator(boolean showIndicator)
Whether to show the loading indicator.

Parameters:
showIndicator - true to show loading indicator

setTimeout

public void setTimeout(int timeout)
Timeout for the request.

Parameters:
timeout - the timeout in seconds

startAutoRefresh

public void startAutoRefresh(int interval)
Set this element to auto refresh.

Parameters:
interval - how often to update in seconds

startAutoRefresh

public void startAutoRefresh(int interval,
                             java.lang.String url)
Set this element to auto refresh.

Parameters:
interval - how often to update in seconds
url - The url for this request or a function to call to get the url (Defaults to the last used url)

startAutoRefresh

public void startAutoRefresh(int interval,
                             java.lang.String url,
                             java.lang.String params,
                             Function cb,
                             boolean refreshNow)
Set this element to auto refresh.

Parameters:
interval - how often to update in seconds
url - The url for this request or a function to call to get the url (Defaults to the last used url)
params - the parameters to pass as a url encoded string "¶m1=1¶m2=2"
cb - callback when the transaction is complete
refreshNow - whether to execute the refresh now, or wait the interval

stopAutoRefresh

public void stopAutoRefresh()
Stop auto refresh on this element.


update

public void update(java.lang.String url,
                   java.lang.String params)
Performs an async request, updating this element with the response. If params are specified it uses POST, otherwise it uses GET.

Parameters:
url - the url for this request
params - the parameters to pass as a url encoded string "param1=1¶m2=2"

update

public void update(java.lang.String url,
                   UrlLoadConfig params,
                   UrlLoadCallback callback,
                   boolean discardUrl)
Performs an async request, updating this element with the response. If params are specified it uses POST, otherwise it uses GET.

Parameters:
url - the url for this request
params - the parameters to pass as a url encoded string "param1=1¶m2=2"
callback - the callback when transaction is complete
discardUrl - by default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url.