Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## nextapp.echo2.webcontainer
Interface ComponentSynchronizePeer

All Known Subinterfaces:
  RootSynchronizePeer

All Known Implementing Classes:
  AbstractEchoPointContainerPeer, AbstractEchoPointPeer, BalloonHelpPeer, ButtonExPeer, ButtonPeer, CalculatorPeer, ChartDisplayPeer, ColorChooserPeer, ColumnPeer, ComboBoxPeer, ContainerExPeer, ContentPanePeer, DateChooserPeer, DirectHtmlPeer, ExpandableSectionPeer, GridPeer, GroupBoxPeer, ImageIconPeer, ImageMapPeer, InvisiblePeer, KeyStrokeListenerPeer, LabelExPeer, LabelPeer, ListComponentPeer, ListSectionPeer, LiveTablePeer, MenuItemPeer, MenuPeer, PopUpPeer, ProgressBarPeer, PushButtonPeer, RichTextAreaPeer, RowPeer, SeparatorPeer, SliderPeer, SplitPanePeer, StrutPeer, TabbedPanePeer, TablePeer, TemplatePanelPeer, TextAreaPeer, TextComponentPeer, TextFieldPeer, TitleBarPeer, TreePeer, TreeTableCellPeer, UploadSelectPeer, WindowPanePeer, WindowPeer

    public interface ComponentSynchronizePeer

A stateless peer object used to synchronize the state of a given type of `nextapp.echo2.app.Component` between the server and client.

A `ComponentSynchronizePeer` may implement optional interfaces such as `DomUpdateSupport` which enables rendering hierarchies of components directly to (X)HTML code. The optional `ActionProcessor` and `InputProcessor` interfaces may be used when the client-side rendering of the component may send back information to the server in response to user input.

A single instance of a given `ComponentSynchronizePeer` will be created to synchronize the state of ALL instances of a particular class of `Component`. Thus, it is not possible to store information about a component's state in this object (in contrast to Echo v1.x, where a peer was created for each component instance). Such rendering state information should now be stored in the `ContainerInstance`, see the `ContainerInstance.setRenderState()` method for details.

Method Summary
`java.lang.String` | `getContainerId(Component child)` Returns the id of the HTML element in which the specified `component` should be rendered.
`void` | `renderAdd(RenderContext rc, ServerComponentUpdate update, java.lang.String targetId, 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, ServerComponentUpdate update, Component component)` Renders a client update to dispose of resources/listeners created for the specified component on the client.
`boolean` | `renderUpdate(RenderContext rc, ServerComponentUpdate update, java.lang.String targetId)` Renders the specified `ServerComponentUpdate` by adding and removing children and updating properties of the specified `component`.

Method Detail

### getContainerId

    java.lang.String getContainerId(Component child)

  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.

  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.

### renderAdd

    void renderAdd(RenderContext rc,
                   ServerComponentUpdate update,
                   java.lang.String targetId,
                   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`.

  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).

### renderDispose

    void renderDispose(RenderContext rc,
                       ServerComponentUpdate update,
                       Component component)

  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.

  Parameters:
    `rc` - the relevant `RenderContext`
    `update` - the `ServerComponentUpdate` for which this operation is being performed

### renderUpdate

    boolean renderUpdate(RenderContext rc,
                         ServerComponentUpdate update,
                         java.lang.String targetId)

  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 `ComponentSynchronizePeer`s 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.

  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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD