NextApp Echo3
v3.0.b4

nextapp.echo.webcontainer
Class AbstractComponentSynchronizePeer

java.lang.Object
  extended by nextapp.echo.webcontainer.AbstractComponentSynchronizePeer
All Implemented Interfaces:
ComponentSynchronizePeer
Direct Known Subclasses:
AbstractButtonPeer, AbstractListComponentPeer, ColumnPeer, ComponentPeer, CompositePeer, ContentPanePeer, GridPeer, LabelPeer, RowPeer, SplitPanePeer, TablePeer, TextComponentPeer, WindowPanePeer, WindowPeer

public abstract class AbstractComponentSynchronizePeer
extends java.lang.Object
implements ComponentSynchronizePeer

Default abstract implementation of ComponentSynchronizePeer. Provides implementations of all methods less getComponentClass(). Determines properties to render to client by querying a Component's local style and using a ComponentIntrospector to determine whether those properties


Nested Class Summary
static class AbstractComponentSynchronizePeer.EventPeer
          Peer for synchronizing events between client and server.
 
Constructor Summary
AbstractComponentSynchronizePeer()
          Default constructor.
 
Method Summary
 void addEvent(AbstractComponentSynchronizePeer.EventPeer eventPeer)
          Adds an EventPeer to process client-side events.
 void addOutputProperty(java.lang.String propertyName)
          Adds a non-indexed output property.
 void addOutputProperty(java.lang.String propertyName, boolean indexed)
          Adds an output property.
 void addRequiredComponentClass(java.lang.Class componentClass)
          Adds a required component class that must also be initialized before this component can be rendered.
abstract  java.lang.Class getComponentClass()
          Returns the (most basic) supported component class.
 java.lang.Class getEventDataClass(java.lang.String eventType)
          Returns null.
 java.util.Iterator getEventTypes(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component)
          Returns an iterator of Strings containing all event types registered using addEvent().
 java.lang.Class getInputPropertyClass(java.lang.String propertyName)
          Returns null.
 java.lang.Object getOutputProperty(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, java.lang.String propertyName, int propertyIndex)
          Returns any property from the local style of the Component.
 java.util.Iterator getOutputPropertyIndices(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, java.lang.String propertyName)
          Returns the indices of any indexed property from the local style of the Component.
 java.lang.String getOutputPropertyMethodName(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, java.lang.String propertyName)
          Returns null.
 java.util.Iterator getOutputPropertyNames(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component)
          Returns the names of all properties currently set in the component's local Style, in addition to any properties added by invoking addOutputProperty().
 java.util.Iterator getUpdatedOutputPropertyNames(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, nextapp.echo.app.update.ServerComponentUpdate update)
          Returns property names that have been updated in the specified ServerComponentUpdate that are either part of the local style or have been added via the addOutputProperty() method.
 boolean hasListeners(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, java.lang.String eventType)
          Determines if the specified component has any listeners registered of the specified event type.
 boolean hasUpdatedListeners(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, nextapp.echo.app.update.ServerComponentUpdate update, java.lang.String eventType)
          Determines if any server-side listeners for a specific client-side event type have been added or removed in the specified ServerComponentUpdate.
 void init(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component)
          Invokes the init() methods of peers of required component classes (added via addRequiredComponentClass()).
 boolean isOutputPropertyIndexed(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, java.lang.String propertyName)
          Determines if a local style property or additional property (added via addOutputProperty()) is indexed.
 boolean isOutputPropertyReferenced(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, java.lang.String propertyName)
          Returns true for any property set as rendered-by-reference via the setOutputPropertyReferenced() method.
 void processEvent(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, java.lang.String eventType, java.lang.Object eventData)
          Does nothing.
 void setOutputPropertyReferenced(java.lang.String propertyName, boolean newValue)
          Sets the rendered-by-reference state of a property.
 void storeInputProperty(nextapp.echo.app.util.Context context, nextapp.echo.app.Component component, java.lang.String propertyName, int index, java.lang.Object newValue)
          Does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nextapp.echo.webcontainer.ComponentSynchronizePeer
getClientComponentType
 

Constructor Detail

AbstractComponentSynchronizePeer

public AbstractComponentSynchronizePeer()
Default constructor.

Method Detail

addEvent

public void addEvent(AbstractComponentSynchronizePeer.EventPeer eventPeer)
Adds an EventPeer to process client-side events.

Parameters:
eventPeer - the EventPeer to add

addOutputProperty

public void addOutputProperty(java.lang.String propertyName)
Adds a non-indexed output property.

See Also:
addOutputProperty(java.lang.String, boolean)

addOutputProperty

public void addOutputProperty(java.lang.String propertyName,
                              boolean indexed)
Adds an output property. Property names added via this method will be returned by the getOutputPropertyName() method of this class. If the indexed flag is set, the isOutputPropertyIndexed method will also return true for this property name

Parameters:
propertyName - the property name to add
indexed - a flag indicating whether the property is indexed

addRequiredComponentClass

public void addRequiredComponentClass(java.lang.Class componentClass)
Adds a required component class that must also be initialized before this component can be rendered.

Parameters:
componentClass -

getComponentClass

public abstract java.lang.Class getComponentClass()
Returns the (most basic) supported component class.

Specified by:
getComponentClass in interface ComponentSynchronizePeer
Returns:
the (most basic) supported component class

getEventDataClass

public java.lang.Class getEventDataClass(java.lang.String eventType)
Returns null. Implementations should override if they wish to provide event data.

Specified by:
getEventDataClass in interface ComponentSynchronizePeer
Parameters:
eventType - the type of the event
Returns:
the event data Class
See Also:
ComponentSynchronizePeer.getEventDataClass(java.lang.String)

getEventTypes

public java.util.Iterator getEventTypes(nextapp.echo.app.util.Context context,
                                        nextapp.echo.app.Component component)
Returns an iterator of Strings containing all event types registered using addEvent().

Specified by:
getEventTypes in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the Component being rendered
Returns:
an Iterator over a collection of Strings of the remote client event type names
See Also:
ComponentSynchronizePeer.getEventTypes(Context, Component)

getOutputProperty

public java.lang.Object getOutputProperty(nextapp.echo.app.util.Context context,
                                          nextapp.echo.app.Component component,
                                          java.lang.String propertyName,
                                          int propertyIndex)
Returns any property from the local style of the Component. Implementations should override if they wish to support additional properties.

Specified by:
getOutputProperty in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the Component being rendered
propertyName - the name of the property being rendered
propertyIndex - the property index (only relevant for indexed properties, -1 will be provided for non-indexed properties)
Returns:
the property value
See Also:
ComponentSynchronizePeer.getOutputProperty(nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String, int)

getOutputPropertyIndices

public java.util.Iterator getOutputPropertyIndices(nextapp.echo.app.util.Context context,
                                                   nextapp.echo.app.Component component,
                                                   java.lang.String propertyName)
Returns the indices of any indexed property from the local style of the Component. Implementations should override if they wish to support additional properties.

Specified by:
getOutputPropertyIndices in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component
propertyName - the property name
Returns:
an Iterator that returns the set indices in incrementing order as Integers
See Also:
ComponentSynchronizePeer.getOutputPropertyIndices(nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String)

getOutputPropertyMethodName

public java.lang.String getOutputPropertyMethodName(nextapp.echo.app.util.Context context,
                                                    nextapp.echo.app.Component component,
                                                    java.lang.String propertyName)
Returns null. Implementations should override if they wish to set properties on the client by invoking specific methods other than setProperty()/setIndexedProperty().

Specified by:
getOutputPropertyMethodName in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component
propertyName - the property name
Returns:
the property name
See Also:
ComponentSynchronizePeer.getOutputPropertyMethodName( nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String)

getOutputPropertyNames

public java.util.Iterator getOutputPropertyNames(nextapp.echo.app.util.Context context,
                                                 nextapp.echo.app.Component component)
Returns the names of all properties currently set in the component's local Style, in addition to any properties added by invoking addOutputProperty().

Specified by:
getOutputPropertyNames in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component
Returns:
an Iterator of property names
See Also:
ComponentSynchronizePeer.getOutputPropertyNames(Context, nextapp.echo.app.Component)

getInputPropertyClass

public java.lang.Class getInputPropertyClass(java.lang.String propertyName)
Returns null. Implementations receiving input properties should override.

Specified by:
getInputPropertyClass in interface ComponentSynchronizePeer
Parameters:
propertyName - the name of the property
Returns:
the property Class
See Also:
ComponentSynchronizePeer.getInputPropertyClass(java.lang.String)

getUpdatedOutputPropertyNames

public java.util.Iterator getUpdatedOutputPropertyNames(nextapp.echo.app.util.Context context,
                                                        nextapp.echo.app.Component component,
                                                        nextapp.echo.app.update.ServerComponentUpdate update)
Returns property names that have been updated in the specified ServerComponentUpdate that are either part of the local style or have been added via the addOutputProperty() method.

Specified by:
getUpdatedOutputPropertyNames in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component
update - the ServerComponentUpdate being rendered
Returns:
an Iterator of property names to update on the client
See Also:
ComponentSynchronizePeer.getUpdatedOutputPropertyNames(nextapp.echo.app.util.Context, nextapp.echo.app.Component, nextapp.echo.app.update.ServerComponentUpdate)

hasListeners

public boolean hasListeners(nextapp.echo.app.util.Context context,
                            nextapp.echo.app.Component component,
                            java.lang.String eventType)
Description copied from interface: ComponentSynchronizePeer
Determines if the specified component has any listeners registered of the specified event type.

Specified by:
hasListeners in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component
eventType - the client-side event type
Returns:
true if the server should be notified when the specified event type is fired on the client
See Also:
ComponentSynchronizePeer.hasListeners(nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String)

hasUpdatedListeners

public boolean hasUpdatedListeners(nextapp.echo.app.util.Context context,
                                   nextapp.echo.app.Component component,
                                   nextapp.echo.app.update.ServerComponentUpdate update,
                                   java.lang.String eventType)
Description copied from interface: ComponentSynchronizePeer
Determines if any server-side listeners for a specific client-side event type have been added or removed in the specified ServerComponentUpdate.

Specified by:
hasUpdatedListeners in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component
update - the ServerComponentUpdate to process
eventType - the client-side event
Returns:
true if any listeners of the specified event type have been added or removed on the server, thus potentially changing whether the client should or should not immediately contact the server when the specified event is fired
See Also:
ComponentSynchronizePeer.hasUpdatedListeners(nextapp.echo.app.util.Context, nextapp.echo.app.Component, nextapp.echo.app.update.ServerComponentUpdate, java.lang.String)

init

public void init(nextapp.echo.app.util.Context context,
                 nextapp.echo.app.Component component)
Invokes the init() methods of peers of required component classes (added via addRequiredComponentClass()). Implementations requiring initialization should override this method and invoke the super-implementation out of convention (even if they do not presently have any dependencies on other components).

Specified by:
init in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component being rendered
See Also:
ComponentSynchronizePeer.init(Context, Component)

isOutputPropertyIndexed

public boolean isOutputPropertyIndexed(nextapp.echo.app.util.Context context,
                                       nextapp.echo.app.Component component,
                                       java.lang.String propertyName)
Determines if a local style property or additional property (added via addOutputProperty()) is indexed.

Specified by:
isOutputPropertyIndexed in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component
propertyName - the property name
Returns:
true if the property is indexed
See Also:
ComponentSynchronizePeer.isOutputPropertyIndexed(nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String)

isOutputPropertyReferenced

public boolean isOutputPropertyReferenced(nextapp.echo.app.util.Context context,
                                          nextapp.echo.app.Component component,
                                          java.lang.String propertyName)
Returns true for any property set as rendered-by-reference via the setOutputPropertyReferenced() method.

Specified by:
isOutputPropertyReferenced in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ServerMessage
component - the component
propertyName - the property name
Returns:
true if the property is rendered-by-reference
See Also:
ComponentSynchronizePeer.isOutputPropertyReferenced( nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String)

processEvent

public void processEvent(nextapp.echo.app.util.Context context,
                         nextapp.echo.app.Component component,
                         java.lang.String eventType,
                         java.lang.Object eventData)
Does nothing. Implementations handling events should overwrite this method.

Specified by:
processEvent in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ClientMessage
  • ClientUpdateManager
component - the updated Component
eventType - the type of the event
eventData - arbitrary component/event-specific event-related data
See Also:
ComponentSynchronizePeer.processEvent(nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String, java.lang.Object)

setOutputPropertyReferenced

public void setOutputPropertyReferenced(java.lang.String propertyName,
                                        boolean newValue)
Sets the rendered-by-reference state of a property. isOutputPropertyReferenced will return true for any property set as referenced using this method.

Parameters:
propertyName - the propertyName
newValue - true if the property should be rendered by reference
See Also:
ComponentSynchronizePeer.isOutputPropertyReferenced( nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String)

storeInputProperty

public void storeInputProperty(nextapp.echo.app.util.Context context,
                               nextapp.echo.app.Component component,
                               java.lang.String propertyName,
                               int index,
                               java.lang.Object newValue)
Does nothing. Implementations that receive input from the client should override this method.

Specified by:
storeInputProperty in interface ComponentSynchronizePeer
Parameters:
context - the relevant Context, provides standard contextual information described in class description, in addition to the following:
  • ClientMessage
  • ClientUpdateManager
component - the updated Component
propertyName - the name of the property
index - the index of the property (or -1 in the typical case of a non-indexed property)
newValue - the new value of the property
See Also:
ComponentSynchronizePeer.storeInputProperty(nextapp.echo.app.util.Context, nextapp.echo.app.Component, java.lang.String, int, java.lang.Object)

NextApp Echo3
v3.0.b4