com.creamtec.ajaxswing.gui
Class WindowUpdater

java.lang.Object
  extended by com.creamtec.ajaxswing.gui.WindowUpdater
All Implemented Interfaces:
ActionEmulator
Direct Known Subclasses:
HTMLWindowUpdater

public abstract class WindowUpdater
extends java.lang.Object
implements ActionEmulator

Used to update GUI windows with the data, received from HTTP request. If there is an action to be emulated, WindowUpdater handles it


Constructor Summary
WindowUpdater()
           
 
Method Summary
 boolean actionOverridden(AbstractDocument page, ActionData actionData)
          Returns true if this action is overidden by a configuration property
static void checkActionOperation(AbstractDocument page, java.lang.Object actionObject)
          Checks if an operation is configured for this action, and if it is, calls ClientAgent.beginOperation().
 void checkAndUpdateEventComponent(HttpRequestData data, ActionData actionData)
          Checks if there is a component that triggered an event.
 boolean emulateAction(Document document, ActionData actionData)
          Emulates an action such as a button click, menu item selection or tabbed pane selection change.
 void emulateRequest(AbstractDocument page, HttpRequestData data)
          Emulates HTTP request.
 ComponentUpdater getComponentUpdater(java.lang.Class className)
          Returns the component updater for the given class If a custom component updater is not registered for the given class, a default one is returned Checks recursevly for class tree
abstract  ComponentUpdater getDefaultComponentUpdater()
           
static java.lang.String getItemString(java.lang.Object item)
          Converts the item object to the proper stringified representation.
 void initCustomUpdatersAndEmulators(ClientAgent agent)
          Loads custom updaters from the application properties file.
 void registerActionEmulator(ActionEmulator emulator)
          Registers action emulator for all actions
 void registerActionEmulator(ActionEmulator emulator, java.lang.String windowFilter)
          Registers action emulator for windows whose title matches the specified filter string
 void resizeDesktop(ClientAgent agent, java.lang.String resizeString)
          Resize string should follow the format "resize:width,height"
 void unregisterActionEmulator(ActionEmulator emulator)
          Removes the registration of action emulator
 void updateComponentTreeData(java.awt.Component comp, HttpRequestData data, ActionData actionData)
          Updates components of the given window with the data
 void validateWindows(AbstractDocument page, java.util.List windows)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowUpdater

public WindowUpdater()
Method Detail

getComponentUpdater

public ComponentUpdater getComponentUpdater(java.lang.Class className)
Returns the component updater for the given class If a custom component updater is not registered for the given class, a default one is returned Checks recursevly for class tree

Parameters:
className - component class
Returns:
ComponentUpdater

initCustomUpdatersAndEmulators

public void initCustomUpdatersAndEmulators(ClientAgent agent)
Loads custom updaters from the application properties file. Iterates the keys that start with "updater." and tries to load the class given as the key value. If loaded, the class is added to the component renderers map.


getDefaultComponentUpdater

public abstract ComponentUpdater getDefaultComponentUpdater()

registerActionEmulator

public void registerActionEmulator(ActionEmulator emulator)
Registers action emulator for all actions

Parameters:
emulator - ActionEmulator

registerActionEmulator

public void registerActionEmulator(ActionEmulator emulator,
                                   java.lang.String windowFilter)
Registers action emulator for windows whose title matches the specified filter string

Parameters:
emulator - ActionEmulator
windowFilter - the filter string, which can contain text and "*" to specify any text.

unregisterActionEmulator

public void unregisterActionEmulator(ActionEmulator emulator)
Removes the registration of action emulator

Parameters:
emulator - ActionEmulator

emulateRequest

public void emulateRequest(AbstractDocument page,
                           HttpRequestData data)
                    throws java.lang.Exception
Emulates HTTP request. Depending on the type of the request, the window may be updated with data and an action can be processed.

Parameters:
page - HTMLPage
data - HttpRequestData
Throws:
java.lang.Exception

validateWindows

public void validateWindows(AbstractDocument page,
                            java.util.List windows)
                     throws java.lang.Exception
Throws:
java.lang.Exception

emulateAction

public boolean emulateAction(Document document,
                             ActionData actionData)
                      throws java.lang.Exception
Emulates an action such as a button click, menu item selection or tabbed pane selection change.

Specified by:
emulateAction in interface ActionEmulator
Parameters:
page - HTMLPage
actionData - ActionData
Returns:
boolean true if the action has been processed
Throws:
java.lang.Exception

actionOverridden

public boolean actionOverridden(AbstractDocument page,
                                ActionData actionData)
                         throws java.lang.Exception
Returns true if this action is overidden by a configuration property

Parameters:
page - HTMLPage
actionData - ActionData
Returns:
boolean
Throws:
java.lang.Exception

checkActionOperation

public static void checkActionOperation(AbstractDocument page,
                                        java.lang.Object actionObject)
Checks if an operation is configured for this action, and if it is, calls ClientAgent.beginOperation().

Parameters:
page - action key
actionObject - object that the action is being performed on

updateComponentTreeData

public void updateComponentTreeData(java.awt.Component comp,
                                    HttpRequestData data,
                                    ActionData actionData)
                             throws java.lang.Exception
Updates components of the given window with the data

Parameters:
comp - component to be updated
data - request data
actionData - action parameters
Throws:
java.lang.Exception

checkAndUpdateEventComponent

public void checkAndUpdateEventComponent(HttpRequestData data,
                                         ActionData actionData)
                                  throws java.lang.Exception
Checks if there is a component that triggered an event. If so, updates it.

Parameters:
data - HttpRequestData
actionData - ActionData
Throws:
java.lang.Exception

resizeDesktop

public void resizeDesktop(ClientAgent agent,
                          java.lang.String resizeString)
                   throws AjaxSwingException
Resize string should follow the format "resize:width,height"

Throws:
AjaxSwingException

getItemString

public static java.lang.String getItemString(java.lang.Object item)
Converts the item object to the proper stringified representation. For instance, if the object is an instance of File, rather then calling toString() this method uses File.getName()

Parameters:
item - Object
Returns:
String


Copyright © 2000-2009 CreamTec LLC. All Rights Reserved.