com.creamtec.ajaxswing.examples
Class CustomControlProcessor

java.lang.Object
  extended by com.creamtec.ajaxswing.examples.CustomControlProcessor
All Implemented Interfaces:
ActionEmulator, ComponentUpdater, ComponentRenderer

public class CustomControlProcessor
extends java.lang.Object
implements ComponentRenderer, ComponentUpdater, ActionEmulator

Example of implementing a custom renderer, custom updater and action emulator See AjaxSwing documentation and javadoc for more information.


Constructor Summary
CustomControlProcessor()
           
 
Method Summary
 boolean emulateAction(Document document, ActionData actionData)
          Called by AjaxSwing to emulate a standard or custom action
 void initializeDocument(Document document)
          Called by to provide a one-time initialization of the page after the page has been created
 void postUpdateComponent(java.awt.Component comp, HttpRequestData data, ActionData actionData)
          Called by AjaxSwing after the component and it's subtree of children has been updated
 void renderComponent(Document document, java.lang.Object component)
          The implementation must add code to the document that represents the component.
 boolean updateComponent(java.awt.Component comp, HttpRequestData data, ActionData actionData)
          Called by AjaxSwing to apply the data from HTML page to the GUI component
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomControlProcessor

public CustomControlProcessor()
Method Detail

renderComponent

public void renderComponent(Document document,
                            java.lang.Object component)
                     throws java.lang.Exception
Description copied from interface: ComponentRenderer
The implementation must add code to the document that represents the component. For example, if rendering a JLabel into an HTML page then something like text should be added

Specified by:
renderComponent in interface ComponentRenderer
Parameters:
document - such as HTML page that is being rendered
component - GUI component that needs to be rendered. Can be subclasses of java.awt.Component or other components such as JMenuItem
Throws:
java.lang.Exception

updateComponent

public boolean updateComponent(java.awt.Component comp,
                               HttpRequestData data,
                               ActionData actionData)
                        throws java.lang.Exception
Called by AjaxSwing to apply the data from HTML page to the GUI component

Specified by:
updateComponent in interface ComponentUpdater
Parameters:
comp - component that should be updated
data - data submitted by the browser. The data for each component depends on how it was represeted in HTML by ComponentRenderer
actionData - data structure that controls how the action will be emulated
Returns:
if component is a container, returning true will instruct the engine to continue processing container's children; returning false will instruct it to go to the next sibling
Throws:
java.lang.Exception

emulateAction

public boolean emulateAction(Document document,
                             ActionData actionData)
                      throws java.lang.Exception
Called by AjaxSwing to emulate a standard or custom action

Specified by:
emulateAction in interface ActionEmulator
Returns:
true, if the action has been emulated and no further processing is necessary, false, if the action should be passed to other emulators or default processing
Throws:
java.lang.Exception

postUpdateComponent

public void postUpdateComponent(java.awt.Component comp,
                                HttpRequestData data,
                                ActionData actionData)
Description copied from interface: ComponentUpdater
Called by AjaxSwing after the component and it's subtree of children has been updated

Specified by:
postUpdateComponent in interface ComponentUpdater

initializeDocument

public void initializeDocument(Document document)
Description copied from interface: ComponentRenderer
Called by to provide a one-time initialization of the page after the page has been created

Specified by:
initializeDocument in interface ComponentRenderer


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