NextApp Echo
App Container 1.0.5

nextapp.echoservlet
Class ComponentPeer

java.lang.Object
  extended bynextapp.echoservlet.ComponentPeer
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbstractButtonUI, ContainerPaneUI, ContainerUI, ContentPaneUI, FillerUI, GridCellUI, GridUI, HttpPaneUI, LabelUI, ListBoxUI, PanelUI, SelectFieldUI, TableHeaderUI, TableUI, TextComponentUI, WindowUI

public abstract class ComponentPeer
extends java.lang.Object
implements java.io.Serializable

The base class from which all component peers are derived.

See Also:
Serialized Form

Field Summary
private  java.util.Set ancillaryServices
          A container of this peers ancillary services.
private  nextapp.echo.Component component
          The Component that this peer represents.
private  Id id
          The Id of the component peer.
private  InstancePeer instancePeer
          The InstancePeer of the application.
 
Constructor Summary
ComponentPeer()
          Creates a new ComponentPeer.
 
Method Summary
 void addAncillaryService(Service service)
          Adds an ancillary service to this ComponentPeer.
 Id generateId()
           
private  java.lang.String getAncillaryServiceAlias()
          Returns a unique identifier for an ancillary service.
 nextapp.echo.Color getBackground()
          Returns the background color in which the component will be rendered.
protected  int getChildCount()
          Returns the number of visible child components contained in this component.
protected  ComponentPeer[] getChildren()
          Returns the peers for all of the referenced component's visible children.
 nextapp.echo.Component getComponent()
          Returns the component that is handled by this peer.
 nextapp.echo.Font getFont()
          Returns the font in which the component will be rendered.
 nextapp.echo.Color getForeground()
          Returns the foreground color in which the component will be rendered.
 Id getId()
          Returns the Id by which this peer is identified on the client.
 InstancePeer getInstancePeer()
          Returns the InstancePeer with which this peer is associated.
protected  ComponentPeer getParent()
          Returns the peer of the associated component's component.
protected  ComponentPeer getPeer(nextapp.echo.Component component)
          Returns the peer of the specified component.
 void redraw()
          Requests that the component be redrawn on the client.
(package private)  void registerAncillaryServices()
          Registers all ancillary services used by this component peer with the application container's service registry.
protected  void registered()
          Called when the component is registered.
 void removeAncillaryService(Service service)
          Removes an ancillary service from this ComponentPeer.
 void render(RenderingContext rc, Element parent)
          A method that should be overridden for the ComponentPeer to produce HTML output.
(package private)  void setComponent(nextapp.echo.Component component)
          Sets the component with which the peer will be associated.
(package private)  void setId(Id id)
          Sets the Id of the component.
(package private)  void setInstancePeer(InstancePeer instancePeer)
          Sets the instance (peer) with which the peer will be associated.
(package private)  void unregisterAncillaryServices()
          Unregisters all ancillary services used by this component peer from the application container's service registry.
protected  void unregistered()
          Called when the component is unregistered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private Id id
The Id of the component peer.


component

private nextapp.echo.Component component
The Component that this peer represents.


instancePeer

private InstancePeer instancePeer
The InstancePeer of the application.


ancillaryServices

private java.util.Set ancillaryServices
A container of this peers ancillary services.

Constructor Detail

ComponentPeer

public ComponentPeer()
Creates a new ComponentPeer.

Method Detail

addAncillaryService

public void addAncillaryService(Service service)
Adds an ancillary service to this ComponentPeer. Ancillary services will be registered for the life of the ComponentPeer and automatically removed when it is unregistered. An ancillary service should be used by ONLY one peer, as the peer will register and unregister it from the ServiceRegistry as required.

Parameters:
service - The ancillary service to be added.

getAncillaryServiceAlias

private java.lang.String getAncillaryServiceAlias()
Returns a unique identifier for an ancillary service.

Returns:
The alias that should be used for the ancillary service.

getBackground

public nextapp.echo.Color getBackground()
Returns the background color in which the component will be rendered. The color will be determined by examining the represented component and then its ancestors until a background color can be determined.

Returns:
The background color in which the component will be rendered.

generateId

public Id generateId()

getChildCount

protected int getChildCount()
Returns the number of visible child components contained in this component.

Returns:
The number of visible child components.

getChildren

protected ComponentPeer[] getChildren()
Returns the peers for all of the referenced component's visible children.

Returns:
The peers of all visible child components of this peer's represented component.

getComponent

public nextapp.echo.Component getComponent()
Returns the component that is handled by this peer.

Returns:
The component that is handled by this peer.

getFont

public nextapp.echo.Font getFont()
Returns the font in which the component will be rendered. The font will be determined by examining the represented component and then its ancestors until a font can be determined.

Returns:
The font in which the component will be rendered.

getForeground

public nextapp.echo.Color getForeground()
Returns the foreground color in which the component will be rendered. The color will be determined by examining the represented component and then its ancestors until a foreground color can be determined.

Returns:
The foreground color in which the component will be rendered.

getId

public Id getId()
Returns the Id by which this peer is identified on the client.

Returns:
The Id by which this peer is identified on the client.

getInstancePeer

public InstancePeer getInstancePeer()
Returns the InstancePeer with which this peer is associated. If the peer is unregistered, null will be returned.

Returns:
The InstancePeer with which this peer is associated.

getParent

protected ComponentPeer getParent()
Returns the peer of the associated component's component.

Returns:
The peer of the associated component's component.

getPeer

protected ComponentPeer getPeer(nextapp.echo.Component component)
Returns the peer of the specified component.

Parameters:
component - The component whose peer is to be returned.
Returns:
The peer of the specified component.

redraw

public void redraw()
Requests that the component be redrawn on the client.


registerAncillaryServices

void registerAncillaryServices()
Registers all ancillary services used by this component peer with the application container's service registry.


registered

protected void registered()
Called when the component is registered. This method should be overridden if necessary.


removeAncillaryService

public void removeAncillaryService(Service service)
Removes an ancillary service from this ComponentPeer. Ancillary services will be registered for the life of the ComponentPeer and automatically removed when it is unregistered. An ancillary service should be used by ONLY one peer, as the peer will register and unregister it from the ServiceRegistry as required.

Parameters:
service - The ancillary service to be removed.

render

public void render(RenderingContext rc,
                   Element parent)
A method that should be overridden for the ComponentPeer to produce HTML output.

Parameters:
rc - A rendering context provided by the Connection.
parent - The element that will contain content rendered by this ComponentPeer.

setComponent

void setComponent(nextapp.echo.Component component)
Sets the component with which the peer will be associated. This method is only called once, by the ComponentPeerFactory object.

Parameters:
component - The Component that this peer represents.

setId

void setId(Id id)
Sets the Id of the component. This method is only called once, by the ComponentPeerFactory.

Parameters:
id - The Id of the peer.

setInstancePeer

void setInstancePeer(InstancePeer instancePeer)
Sets the instance (peer) with which the peer will be associated.

Parameters:
instancePeer - The InstancePeer with which this ComponentPeer will be associated.

unregisterAncillaryServices

void unregisterAncillaryServices()
Unregisters all ancillary services used by this component peer from the application container's service registry.


unregistered

protected void unregistered()
Called when the component is unregistered. This method should be overridden if necessary.


NextApp Echo
App Container 1.0.5