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

## echopointng.ui.util
Class RenderingContext

    java.lang.Object
      echopointng.ui.util.RenderingContext

All Implemented Interfaces:
  RenderContext

    public class RenderingContext

extends java.lang.Object
implements RenderContext

`RenderingContext` is useful as a wrapper inside a DomUpdateSupport or SynchronizePeer implementation to hold important context such as the component being rendered or the ServerComponentUpdate in use.

This allows you to have sub methods that take a RenderingContext as a parameter and yet contain most of the context information you will require.

Remember that SynchronizePeer's are component static, ie. they are not meant to contain state information as member variables for a given component.

This class helps during the lifetime of a given "render invocation".

It also provides a number of helper methods to make writing UI Peer easier and to make the code cleaner.

Constructor Summary
`RenderingContext(RenderContext rc, ServerComponentUpdate serverComponentUpdate, Component component)` Constructs a `RenderingContext` that wraps the original RenderContext as well as contains references to the ServerComponentUpdate and Component being rendered.

Method Summary
`void` | `addAccessKeySupport(Component component, org.w3c.dom.Element element)` This will add "access key" attributes to an Element if the specified component in facts implements AccessKeyable.
`void` | `addAccessKeySupport(org.w3c.dom.Element element)` This will add "access key" attributes to an Element if the specified component in facts implements AccessKeyable
`void` | `addAttributeableSupport(Component component, org.w3c.dom.Element element)` This will add "custom" attributes to an Element from the iif the component implements the `Attributeable` interface
`void` | `addDisabledSupport(Component component, org.w3c.dom.Element element)` This will add "disabled" attributes to an Element if the specified component is not enabled.
`void` | `addDisabledSupport(org.w3c.dom.Element element)` This will add "disabled" attributes to an Element if the current component is not enabled.
`void` | `addLibrary(Service service)` Adds a library and caused the client to wait for it to be loaded.
`void` | `addStandardWebSupport(Component component, org.w3c.dom.Element element)` This is a shortcut method for for the addXXXSupport methods
`void` | `addStandardWebSupport(org.w3c.dom.Element element)`
`void` | `addTabIndexSupport(Component component, org.w3c.dom.Element element)` This method will add tab traversal code into the specified element, if the component is in fact a focus tab participant and implements TabStop.
`void` | `addTabIndexSupport(org.w3c.dom.Element element)` This method will add tab traversal code into the specified element, if the current component is in fact a focus tab participant.
`void` | `addToolTipSupport(Component component, org.w3c.dom.Element element)` This will add "title" attributes to an Element if the specified component in facts implements `ToolTipable`.
`org.w3c.dom.Element` | `createE(java.lang.String elementName)` Creates a DOM element based on the current Document in the RenderContext's server message.
`org.w3c.dom.Text` | `createText(java.lang.String text)` Creates a `Text` node given the specified string.
`Component` | `getComponent()`
`Connection` | `getConnection()` Returns the `Connection` to which the `ServerMessage` is being rendered.
`ContainerInstance` | `getContainerInstance()` Returns the `ContainerInstance` for which the rendering is being performed.
`org.w3c.dom.Document` | `getDocument()`
`java.lang.String` | `getElementId()` Returns the magic Echo component identifier for the current component.
`RenderState` | `getRenderState()` Returns the RenderState associated with this RenderingContext if there is any.
`java.lang.Object` | `getRP(java.lang.String propertyName)` A short hand method for getting rendered property values from the current Component.
`boolean` | `getRP(java.lang.String propertyName, boolean defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`byte` | `getRP(java.lang.String propertyName, byte defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`char` | `getRP(java.lang.String propertyName, char defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`double` | `getRP(java.lang.String propertyName, double defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`float` | `getRP(java.lang.String propertyName, float defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`int` | `getRP(java.lang.String propertyName, int defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`long` | `getRP(java.lang.String propertyName, long defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`java.lang.Object` | `getRP(java.lang.String propertyName, java.lang.Object defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`short` | `getRP(java.lang.String propertyName, short defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`java.lang.Object` | `getRP(java.lang.String propertyName, Style defaultStyle)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`boolean` | `getRP(java.lang.String propertyName, Style defaultStyle, boolean defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`double` | `getRP(java.lang.String propertyName, Style defaultStyle, double defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`int` | `getRP(java.lang.String propertyName, Style defaultStyle, int defaultValue)` A short hand method for getting rendered property values from the current Component, with a default if it is not set.
`ServerComponentUpdate` | `getServerComponentUpdate()`
`ServerMessage` | `getServerMessage()` Returns the `ServerMessage` to which output should be rendered.
`void` | `renderEventAdd(java.lang.String eventType, java.lang.String elementId, java.lang.String eventHandler)` Creates an `eventadd` operation to register a client event listener of a particular type on an HTML element.
`void` | `renderEventRemove(java.lang.String eventType, java.lang.String elementId)` Creates an `eventremove` operation to unregister a client event listener of a particular type on an HTML element.
`void` | `renderSetProperty(java.lang.String elementId, java.lang.String propertyName, java.lang.String propertyValue)` Creates a `storeproperty` operation to store a non-rendered named property in an HTMLElement of the client DOM.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RenderingContext

    public RenderingContext(RenderContext rc,
                            ServerComponentUpdate serverComponentUpdate,
                            Component component)

  Constructs a `RenderingContext` that wraps the original RenderContext as well as contains references to the ServerComponentUpdate and Component being rendered.

  Parameters:
    `rc` - - the RenderContext in use at this time.
    `serverComponentUpdate` - - the ServerComponentUpdate in use at this time
    `component` - - the Component being rendered

Method Detail

### addAccessKeySupport

    public void addAccessKeySupport(Component component,
                                    org.w3c.dom.Element element)

  This will add "access key" attributes to an Element if the specified component in facts implements AccessKeyable.

  Parameters:
    `component` - - the Component to check for AccessKeyable
    `element` - - the Element to add the access key support to

### addToolTipSupport

    public void addToolTipSupport(Component component,
                                  org.w3c.dom.Element element)

  This will add "title" attributes to an Element if the specified component in facts implements `ToolTipable`.

  Parameters:
    `component` - - the Component to check for `ToolTipable`
    `element` - - the Element to add the tool tip title support to

### addAccessKeySupport

    public void addAccessKeySupport(org.w3c.dom.Element element)

  This will add "access key" attributes to an Element if the specified component in facts implements AccessKeyable

  Parameters:
    `element` - - the Element to add the access key support to

### addDisabledSupport

    public void addDisabledSupport(Component component,
                                   org.w3c.dom.Element element)

  This will add "disabled" attributes to an Element if the specified component is not enabled.

  Parameters:
    `component` - - the Component to check for enabledness
    `element` - - the Element to add the disabled attribute to

### addDisabledSupport

    public void addDisabledSupport(org.w3c.dom.Element element)

  This will add "disabled" attributes to an Element if the current component is not enabled.

  Parameters:
    `element` - - the Element to add the disabled attribute to

### addAttributeableSupport

    public void addAttributeableSupport(Component component,
                                        org.w3c.dom.Element element)

  This will add "custom" attributes to an Element from the iif the component implements the `Attributeable` interface

  Parameters:
    `component` - - the Component to check for `Attributeable` interface
    `element` - - the element to add the attributes to

### addLibrary

    public void addLibrary(Service service)

  Adds a library and caused the client to wait for it to be loaded.

  See Also:
    `ServerMessage.addLibrary(String)`

### addStandardWebSupport

    public void addStandardWebSupport(Component component,
                                      org.w3c.dom.Element element)

  This is a shortcut method for for the addXXXSupport methods

  See Also:
    `addAccessKeySupport(Component, Element)`, `addDisabledSupport(Component, Element)`, `addTabIndexSupport(Component, Element)`

### addStandardWebSupport

    public void addStandardWebSupport(org.w3c.dom.Element element)

  See Also:
    `addStandardWebSupport(Component, Element)`

### addTabIndexSupport

    public void addTabIndexSupport(Component component,
                                   org.w3c.dom.Element element)

  This method will add tab traversal code into the specified element, if the component is in fact a focus tab participant and implements TabStop.

  Parameters:
    `component` - the component in question
    `element` - the element to add a a tabindex to, typically the highest level element.

### addTabIndexSupport

    public void addTabIndexSupport(org.w3c.dom.Element element)

  This method will add tab traversal code into the specified element, if the current component is in fact a focus tab participant.

  Parameters:
    `element` - the element to add a a tabindex to, typically the highest level element.

### createE

    public org.w3c.dom.Element createE(java.lang.String elementName)

  Creates a DOM element based on the current Document in the RenderContext's server message. The element is not attached to any parent Elements after creation.

  Parameters:
    `elementName` - - the tag name of the element to create
  Returns:
    - the newly created DOM element.

### createText

    public org.w3c.dom.Text createText(java.lang.String text)

  Creates a `Text` node given the specified string.

  Parameters:
    `data` - The data for the node.
  Returns:
    The new `Text` object.

### getComponent

    public Component getComponent()

  Returns:
    Returns the Component associated with this RenderContext.

### getConnection

    public Connection getConnection()

  Description copied from interface: `RenderContext`
  Returns the `Connection` to which the `ServerMessage` is being rendered.

  Specified by:
    `getConnection` in interface `RenderContext`
  Returns:
    the connection
  See Also:
    `RenderContext.getConnection()`

### getContainerInstance

    public ContainerInstance getContainerInstance()

  Description copied from interface: `RenderContext`
  Returns the `ContainerInstance` for which the rendering is being performed.

  Specified by:
    `getContainerInstance` in interface `RenderContext`
  Returns:
    the `ContainerInstance`
  See Also:
    `RenderContext.getContainerInstance()`

### getDocument

    public org.w3c.dom.Document getDocument()

  Returns:
    - the Document associated with this the underlying ServerMessage.

### getElementId

    public java.lang.String getElementId()

  Returns the magic Echo component identifier for the current component.

### getRenderState

    public RenderState getRenderState()

  Returns the RenderState associated with this RenderingContext if there is any.

  Returns:
    the RenderState associated with this RenderingContext if there is any.

### getRP

    public java.lang.Object getRP(java.lang.String propertyName)

  A short hand method for getting rendered property values from the current Component. This is intended to make rendering code more readable through brevity.

### getRP

    public boolean getRP(java.lang.String propertyName,
                         boolean defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public boolean getRP(java.lang.String propertyName,
                         Style defaultStyle,
                         boolean defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public byte getRP(java.lang.String propertyName,
                      byte defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public char getRP(java.lang.String propertyName,
                      char defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public double getRP(java.lang.String propertyName,
                        double defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public double getRP(java.lang.String propertyName,
                        Style defaultStyle,
                        double defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public float getRP(java.lang.String propertyName,
                       float defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public int getRP(java.lang.String propertyName,
                     int defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public int getRP(java.lang.String propertyName,
                     Style defaultStyle,
                     int defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public long getRP(java.lang.String propertyName,
                      long defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public java.lang.Object getRP(java.lang.String propertyName,
                                  java.lang.Object defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public short getRP(java.lang.String propertyName,
                       short defaultValue)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getRP

    public java.lang.Object getRP(java.lang.String propertyName,
                                  Style defaultStyle)

  A short hand method for getting rendered property values from the current Component, with a default if it is not set. This is intended to make rendering code more readable through brevity.

### getServerComponentUpdate

    public ServerComponentUpdate getServerComponentUpdate()

  Returns:
    Returns the ServerComponentUpdate associated with this RenderContext.

### getServerMessage

    public ServerMessage getServerMessage()

  Description copied from interface: `RenderContext`
  Returns the `ServerMessage` to which output should be rendered.

  Specified by:
    `getServerMessage` in interface `RenderContext`
  Returns:
    the `ServerMessage`
  See Also:
    `RenderContext.getServerMessage()`

### renderEventAdd

    public void renderEventAdd(java.lang.String eventType,
                               java.lang.String elementId,
                               java.lang.String eventHandler)

  Creates an `eventadd` operation to register a client event listener of a particular type on an HTML element.

  Parameters:
    `eventType` - the type of event (the "on" prefix should be omitted, e.g., "onmousedown" would be expressed as "mousedown")
    `elementId` - the id of the listened-to DOM element
    `eventHandler` - the name of the handler method to be invoked when the event occurs, e.g., "EchoButton.processAction"
  See Also:
    `EventUpdate#createEventAdd(ServerMessage, String, String, String)`

### renderEventRemove

    public void renderEventRemove(java.lang.String eventType,
                                  java.lang.String elementId)

  Creates an `eventremove` operation to unregister a client event listener of a particular type on an HTML element.

  Parameters:
    `eventType` - the type of event (the "on" prefix should be omitted, e.g., "onmousedown" would be expressed as "mousedown")
    `elementId` - the id of the listened-to DOM element
  See Also:
    `EventUpdate#createEventRemove(ServerMessage, String, String)`

### renderSetProperty

    public void renderSetProperty(java.lang.String elementId,
                                  java.lang.String propertyName,
                                  java.lang.String propertyValue)

  Creates a `storeproperty` operation to store a non-rendered named property in an HTMLElement of the client DOM.

  Parameters:
    `elementId` - the id of the element on which to set the non-rendered property
    `propertyName` - the name of the property
    `propertyValue` - the value of the property

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