NextApp Echo2
v2.1.1

nextapp.echo2.webcontainer.syncpeer
Class ButtonPeer

java.lang.Object
  extended by nextapp.echo2.webcontainer.syncpeer.ButtonPeer
All Implemented Interfaces:
ActionProcessor, ComponentSynchronizePeer, DomUpdateSupport, ImageRenderSupport, PropertyUpdateProcessor

public class ButtonPeer
extends java.lang.Object
implements ActionProcessor, DomUpdateSupport, ImageRenderSupport, PropertyUpdateProcessor, ComponentSynchronizePeer

Synchronization peer for nextapp.echo2.app.AbstractButton-derived components.

This class should not be extended or used by classes outside of the Echo framework.


Field Summary
 
Fields inherited from interface nextapp.echo2.webcontainer.ActionProcessor
ACTION_NAME, ACTION_VALUE
 
Fields inherited from interface nextapp.echo2.webcontainer.PropertyUpdateProcessor
PROPERTY_NAME, PROPERTY_VALUE
 
Constructor Summary
ButtonPeer()
           
 
Method Summary
 java.lang.String getContainerId(nextapp.echo2.app.Component child)
          Returns the id of the HTML element in which the specified component should be rendered.
 nextapp.echo2.app.ImageReference getImage(nextapp.echo2.app.Component component, java.lang.String imageId)
          Retrieves the image identified by the given imageId value for the given Component.
 void processAction(ContainerInstance ci, nextapp.echo2.app.Component component, org.w3c.dom.Element actionElement)
          Notifies the ComponentSynchronizePeer that a client action has occurred.
 void processPropertyUpdate(ContainerInstance ci, nextapp.echo2.app.Component component, org.w3c.dom.Element propertyElement)
          Notifies the ComponentSynchronizePeer that a client property update has occurred.
 void renderAdd(RenderContext rc, nextapp.echo2.app.update.ServerComponentUpdate update, java.lang.String targetId, nextapp.echo2.app.Component component)
          Renders a client update which adds an HTML representation of the provided component to the client DOM as a child of the HTML element identified by targetId.
 void renderDispose(RenderContext rc, nextapp.echo2.app.update.ServerComponentUpdate update, nextapp.echo2.app.Component component)
          Renders a client update to dispose of resources/listeners created for the specified component on the client.
 void renderHtml(RenderContext rc, nextapp.echo2.app.update.ServerComponentUpdate update, org.w3c.dom.Node parentNode, nextapp.echo2.app.Component component)
          Renders the component in its entirety as a child of the provided parent Element.
 boolean renderUpdate(RenderContext rc, nextapp.echo2.app.update.ServerComponentUpdate update, java.lang.String targetId)
          Renders the specified ServerComponentUpdate by adding and removing children and updating properties of the specified component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonPeer

public ButtonPeer()
Method Detail

getContainerId

public java.lang.String getContainerId(nextapp.echo2.app.Component child)
Description copied from interface: ComponentSynchronizePeer
Returns the id of the HTML element in which the specified component should be rendered. The specified component must be an immediate child of an instance of the class of component that this peer supports. A child component's renderer may invoke this method to determine where it should place its rendered content.

Specified by:
getContainerId in interface ComponentSynchronizePeer
Parameters:
child - a Component whose parent is of the type synchronized by this peer object.
Returns:
the id of the element which should contain the child component's rendered HTML.
See Also:
ComponentSynchronizePeer.getContainerId(nextapp.echo2.app.Component)

getImage

public nextapp.echo2.app.ImageReference getImage(nextapp.echo2.app.Component component,
                                                 java.lang.String imageId)
Description copied from interface: ImageRenderSupport
Retrieves the image identified by the given imageId value for the given Component.

Note: A reference to any images to be rendered must be maintained throughout the rendering process, due to the fact that the image rendering subsystem creates a weak-keyed cache of images to be rendered. This method therefore may not simply return a new, otherwise-unreferenced image. In the event that this presents a problem, the recommended workaround is to simply store such otherwise unreferenced ImageReferences using a RenderState object.

Specified by:
getImage in interface ImageRenderSupport
Parameters:
component - the component
imageId - the id of the image
Returns:
the target image
See Also:
ImageRenderSupport.getImage(nextapp.echo2.app.Component, java.lang.String)

processAction

public void processAction(ContainerInstance ci,
                          nextapp.echo2.app.Component component,
                          org.w3c.dom.Element actionElement)
Description copied from interface: ActionProcessor
Notifies the ComponentSynchronizePeer that a client action has occurred.

Specified by:
processAction in interface ActionProcessor
Parameters:
ci - the relevant ContainerInstance
component - the target Component
actionElement - the XML element describing the action (the name and value of the action may be obtained by querying the ACTION_NAME and ACTION_VALUE attribute values.
See Also:
ActionProcessor.processAction(nextapp.echo2.webcontainer.ContainerInstance, nextapp.echo2.app.Component, org.w3c.dom.Element)

processPropertyUpdate

public void processPropertyUpdate(ContainerInstance ci,
                                  nextapp.echo2.app.Component component,
                                  org.w3c.dom.Element propertyElement)
Description copied from interface: PropertyUpdateProcessor
Notifies the ComponentSynchronizePeer that a client property update has occurred.

Specified by:
processPropertyUpdate in interface PropertyUpdateProcessor
Parameters:
ci - the relevant ContainerInstance
component - the target Component
propertyElement - the XML element describing the property update (the name and value of the changed property may be obtained by querying the PROPERTY_NAME and PROPERTY_VALUE attribute values.
See Also:
PropertyUpdateProcessor.processPropertyUpdate( nextapp.echo2.webcontainer.ContainerInstance, nextapp.echo2.app.Component, org.w3c.dom.Element)

renderAdd

public void renderAdd(RenderContext rc,
                      nextapp.echo2.app.update.ServerComponentUpdate update,
                      java.lang.String targetId,
                      nextapp.echo2.app.Component component)
Description copied from interface: ComponentSynchronizePeer
Renders a client update which adds an HTML representation of the provided component to the client DOM as a child of the HTML element identified by targetId.

Specified by:
renderAdd in interface ComponentSynchronizePeer
Parameters:
rc - the relevant RenderContext
update - the ServerComponentUpdate for which this operation is being performed
targetId - the id of the HTML element in which the component's HTML output should be rendered
component - the component to be rendered (this component must be of a type supported by this synchronization peer).
See Also:
ComponentSynchronizePeer.renderAdd(nextapp.echo2.webcontainer.RenderContext, nextapp.echo2.app.update.ServerComponentUpdate, java.lang.String, nextapp.echo2.app.Component)

renderDispose

public void renderDispose(RenderContext rc,
                          nextapp.echo2.app.update.ServerComponentUpdate update,
                          nextapp.echo2.app.Component component)
Description copied from interface: ComponentSynchronizePeer
Renders a client update to dispose of resources/listeners created for the specified component on the client. Operations such as removing event listeners on the client should be performed by the implementation. In cases where no such clean-up work is required, an empty implementation is sufficient. Note that the actual removal of HTML code will be performed by an ancestor component's renderUpdate() method being invoked, and thus implementations SHOULD NOT redundantly attempt to remove the HTML in this method. Implementations must handle the condition where the component to be disposed is not present in the client DOM, as this method may be invoked under such a condition.

Specified by:
renderDispose in interface ComponentSynchronizePeer
Parameters:
rc - the relevant RenderContext
update - the ServerComponentUpdate for which this operation is being performed
See Also:
ComponentSynchronizePeer.renderDispose(nextapp.echo2.webcontainer.RenderContext, nextapp.echo2.app.update.ServerComponentUpdate, nextapp.echo2.app.Component)

renderHtml

public void renderHtml(RenderContext rc,
                       nextapp.echo2.app.update.ServerComponentUpdate update,
                       org.w3c.dom.Node parentNode,
                       nextapp.echo2.app.Component component)
Description copied from interface: DomUpdateSupport
Renders the component in its entirety as a child of the provided parent Element. The implementation should additionally render any child components, either by invoking their renderHtml() methods if their peers also implement DomUpdateSupport or by invoking their ComponentSynchronizePeer.renderAdd() methods if they do not.

The implementation must also perform any non-HTML-rendering operations which are performed in the ComponentSynchronizePeer.renderAdd() method, e.g., adding message parts that registering event listeners on the client.

Specified by:
renderHtml in interface DomUpdateSupport
Parameters:
rc - the relevant RenderContext
update - the ServerComponentUpdate for which this rendering is being performed
parentNode - the parent DOM node to which this child should add HTML code
component - the Component to be rendered
See Also:
DomUpdateSupport.renderHtml(nextapp.echo2.webcontainer.RenderContext, nextapp.echo2.app.update.ServerComponentUpdate, org.w3c.dom.Node, nextapp.echo2.app.Component)

renderUpdate

public boolean renderUpdate(RenderContext rc,
                            nextapp.echo2.app.update.ServerComponentUpdate update,
                            java.lang.String targetId)
Description copied from interface: ComponentSynchronizePeer
Renders the specified ServerComponentUpdate by adding and removing children and updating properties of the specified component.

If the component is not a container, the implementation only needs to analyze the updated properties of the component. If the component is a container, the implementation should additionally query update for information about added children, removed children, and children with updated LayoutData states.

The implementation is responsible for rendering added children by obtaining their ComponentSynchronizePeers and invoking their renderAdd() methods. Alternatively, if a child's ComponentSynchronizePeer implements the DomUpdateSupport interface, the implementation may invoke the child peer's renderHtml() method instead.

This method should return true if, in the course of its rendering operation, it has re-rendered the entire component hierarchy beneath the parent component of the update. Returning true will ensure that updates to descendants are NOT rendered. The method should return false in all cases if the component is not a container.

Specified by:
renderUpdate in interface ComponentSynchronizePeer
Parameters:
rc - the relevant RenderContext
update - the ServerComponentUpdate for which this operation is being performed
targetId - the id of the HTML element inside of which the components HTML code should be rendered.
Returns:
true if updates to descendants should NOT be performed
See Also:
ComponentSynchronizePeer.renderUpdate(nextapp.echo2.webcontainer.RenderContext, nextapp.echo2.app.update.ServerComponentUpdate, java.lang.String)

NextApp Echo2
v2.1.1