nextapp.echoservlet
Class AbstractComponentPeer

java.lang.Object
  extended by nextapp.echoservlet.AbstractComponentPeer
All Implemented Interfaces:
java.io.Serializable, ComponentPeer
Direct Known Subclasses:
AbstractButtonUI, AbstractComponentUI, AbstractPaneUI, AsyncComponentUI, BlackHoleUI, ClientSideComponentSelectorUI, ColumnUI, ContainerUI, CSSButtonUI, CSSLabelUI, CustomComponentUI, CustomRenderingComponentUI, DevNullUI, DownloadUI, DragWrapperUI, DropWrapperUI, DynaHtmlEditorUI, DynaLabelUI, DynaTextFieldUI, EchoPointComponentPeer, FilePaneUI, FillerUI, GridCellUI, GridUI, KeyActionCommandUI, LabelUI, ListBoxUI, NativeCheckBoxUI, OnLoadScriptOnceComponentUI, PanelUI, PdfBookmarkComponentUI, PdfReportComponentUI, PopWrapperUI, RebindableCompoundComponentUI, RowUI, SelectFieldUI, TableHeaderUI, TableUI, TextComponentUI, TimerUI, UploadSelectUI, WindowUI

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

The base class from which all component peers are derived.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface nextapp.echoservlet.ComponentPeer
IGNORE_PROPERTY_CHANGE
 
Constructor Summary
AbstractComponentPeer()
          Creates a new ComponentPeer.
 
Method Summary
 void addAncillaryService(Service service)
          Adds an ancillary service to this ComponentPeer.
 Id generateId()
           
 Color getCalculatedBackground()
          Returns the background color in which the component will be rendered.
 Font getCalculatedFont()
          Returns the font in which the component will be rendered.
 Color getCalculatedForeground()
          Returns the foreground 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.
 Component getComponent()
          Returns the component that is handled by this peer.
 java.lang.String getFocusedElementId()
           
 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.
 ComponentPeer getParentComponentPeer()
          Returns the peer of the associated component's component.
 ComponentPeer getPeer(Component component)
          Returns the peer of the specified component.
 void redraw()
          Requests that the component be redrawn on the client.
 void registerAncillaryServices()
          Registers all ancillary services used by this component peer with the application container's service registry.
 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.
 void setComponent(Component component)
          Sets the component with which the peer will be associated.
 void setId(Id id)
          Sets the Id of the component.
 void setInstancePeer(InstancePeer instancePeer)
          Sets the instance (peer) with which the peer will be associated.
 void unregisterAncillaryServices()
          Unregisters all ancillary services used by this component peer from the application container's service registry.
 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
 

Constructor Detail

AbstractComponentPeer

public AbstractComponentPeer()
Creates a new ComponentPeer.

Method Detail

addAncillaryService

public void addAncillaryService(Service service)
Description copied from interface: ComponentPeer
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.

Specified by:
addAncillaryService in interface ComponentPeer
Parameters:
service - The ancillary service to be added.

getCalculatedBackground

public Color getCalculatedBackground()
Description copied from interface: ComponentPeer
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.

Specified by:
getCalculatedBackground in interface ComponentPeer
Returns:
The background color in which the component will be rendered.

generateId

public Id generateId()
Specified by:
generateId in interface ComponentPeer

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 Component getComponent()
Description copied from interface: ComponentPeer
Returns the component that is handled by this peer.

Specified by:
getComponent in interface ComponentPeer
Returns:
The component that is handled by this peer.

getFocusedElementId

public java.lang.String getFocusedElementId()
Specified by:
getFocusedElementId in interface ComponentPeer

getCalculatedFont

public Font getCalculatedFont()
Description copied from interface: ComponentPeer
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.

Specified by:
getCalculatedFont in interface ComponentPeer
Returns:
The font in which the component will be rendered.

getCalculatedForeground

public Color getCalculatedForeground()
Description copied from interface: ComponentPeer
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.

Specified by:
getCalculatedForeground in interface ComponentPeer
Returns:
The foreground color in which the component will be rendered.

getId

public Id getId()
Description copied from interface: ComponentPeer
Returns the Id by which this peer is identified on the client.

Specified by:
getId in interface ComponentPeer
Returns:
The Id by which this peer is identified on the client.

getInstancePeer

public InstancePeer getInstancePeer()
Description copied from interface: ComponentPeer
Returns the InstancePeer with which this peer is associated. If the peer is unregistered, null will be returned.

Specified by:
getInstancePeer in interface ComponentPeer
Returns:
The InstancePeer with which this peer is associated.

getParentComponentPeer

public ComponentPeer getParentComponentPeer()
Returns the peer of the associated component's component.

Specified by:
getParentComponentPeer in interface ComponentPeer
Returns:
The peer of the associated component's component.

getPeer

public ComponentPeer getPeer(Component component)
Returns the peer of the specified component.

Specified by:
getPeer in interface ComponentPeer
Parameters:
component - The component whose peer is to be returned.
Returns:
The peer of the specified component.

redraw

public void redraw()
Description copied from interface: ComponentPeer
Requests that the component be redrawn on the client.

Specified by:
redraw in interface ComponentPeer

registerAncillaryServices

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

Specified by:
registerAncillaryServices in interface ComponentPeer

registered

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

Specified by:
registered in interface ComponentPeer

removeAncillaryService

public void removeAncillaryService(Service service)
Description copied from interface: ComponentPeer
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.

Specified by:
removeAncillaryService in interface ComponentPeer
Parameters:
service - The ancillary service to be removed.

render

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

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

setComponent

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

Specified by:
setComponent in interface ComponentPeer
Parameters:
component - The Component that this peer represents.

setId

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

Specified by:
setId in interface ComponentPeer
Parameters:
id - The Id of the peer.

setInstancePeer

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

Specified by:
setInstancePeer in interface ComponentPeer
Parameters:
instancePeer - The InstancePeer with which this ComponentPeer will be associated.

unregisterAncillaryServices

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

Specified by:
unregisterAncillaryServices in interface ComponentPeer

unregistered

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

Specified by:
unregistered in interface ComponentPeer