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.webrender
Class ServerMessage

    java.lang.Object
      nextapp.echo2.webrender.output.XmlDocument
          nextapp.echo2.webrender.ServerMessage

    public class ServerMessage

extends XmlDocument

The outgoing XML message which synchronizes the state of the client to that of the server.

Field Summary
`static java.lang.String` | `GROUP_ID_INIT` Constant for the "init" message part group.
`static java.lang.String` | `GROUP_ID_POSTUPDATE` Constant for the "postupdate" message part group.
`static java.lang.String` | `GROUP_ID_PREREMOVE` Constant for the "preremove" message part group.
`static java.lang.String` | `GROUP_ID_REMOVE` Constant for the "remove" message part group.
`static java.lang.String` | `GROUP_ID_UPDATE` Constant for the "update" message part group.
`static int` | `LEFT_TO_RIGHT` Constant for the use with `setRootLayoutDirection()` indicating a left-to-right layout direction.
`static int` | `RIGHT_TO_LEFT` Constant for the use with `setRootLayoutDirection()` indicating a right-to-left layout direction.

Constructor Summary
`ServerMessage()` Creates a new `ServerMessage`.

Method Summary
`void` | `addLibrary(java.lang.String serviceId)` Adds a JavaScript library service to be dynamically loaded.
`org.w3c.dom.Element` | `addPart(java.lang.String groupId, java.lang.String processor)` Adds a "message-part" to the document that will be processed by the specified client-side processor object.
`org.w3c.dom.Element` | `addPartGroup(java.lang.String groupId)` Adds a "group" to the document.
`org.w3c.dom.Element` | `appendPartDirective(java.lang.String groupId, java.lang.String processor, java.lang.String directiveName)` Creates and appends a directive element beneath to a message part.
`org.w3c.dom.Element` | `getItemizedDirective(java.lang.String groupId, java.lang.String processor, java.lang.String directiveName, java.lang.String[] keyAttributeNames, java.lang.String[] keyAttributeValues)` Creates or retrieves a suitable "Itemized Directive" element.
`org.w3c.dom.Element` | `getPartGroup(java.lang.String groupId)` Retrieves the "message-part-group" element pertaining to a specific group.
`void` | `setAsynchronousMonitorInterval(int newValue)` Sets the interval between asynchronous requests to the server to check for server-pushed updates.
`void` | `setModalContextRootId(java.lang.String id)` Sets the element id of the root of the modal context.
`void` | `setRootLayoutDirection(int layoutDirection)` Sets the root layout direction of the application, i.e., either `LEFT_TO_RIGHT` or `RIGHT_TO_LEFT`.

Methods inherited from class nextapp.echo2.webrender.output.XmlDocument
`getDocument, render, setOutputProperties`

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

Field Detail

### LEFT_TO_RIGHT

    public static final int LEFT_TO_RIGHT

  Constant for the use with `setRootLayoutDirection()` indicating a left-to-right layout direction.

  See Also:
    Constant Field Values

### RIGHT_TO_LEFT

    public static final int RIGHT_TO_LEFT

  Constant for the use with `setRootLayoutDirection()` indicating a right-to-left layout direction.

  See Also:
    Constant Field Values

### GROUP_ID_INIT

    public static final java.lang.String GROUP_ID_INIT

  Constant for the "init" message part group. Message parts in this group are processed before the "preremove", "remove" "update", and "postupdate" groups.

  See Also:
    Constant Field Values

### GROUP_ID_PREREMOVE

    public static final java.lang.String GROUP_ID_PREREMOVE

  Constant for the "preremove" message part group. Message parts in this group are processed after the "init" group. Message parts in this group are processed before the "remove", "update" and "postupdate" groups.

  See Also:
    Constant Field Values

### GROUP_ID_REMOVE

    public static final java.lang.String GROUP_ID_REMOVE

  Constant for the "remove" message part group. Message parts in this group are processed after the "init" and "preremove" groups. Message parts in this group are processed before the "update" and "postupdate" groups. This group is used for removing elements from the DOM.

  See Also:
    Constant Field Values

### GROUP_ID_UPDATE

    public static final java.lang.String GROUP_ID_UPDATE

  Constant for the "update" message part group. Message parts in this group are processed after the "init", "preremove" and "remove" groups. Message parts in this group are processed before the "postupdate" group. This group is used for adding elements to the DOM.

  See Also:
    Constant Field Values

### GROUP_ID_POSTUPDATE

    public static final java.lang.String GROUP_ID_POSTUPDATE

  Constant for the "postupdate" message part group. Message parts in this group are processed after the "init", "preremove", "remove" and "update" groups.

  See Also:
    Constant Field Values

Constructor Detail

### ServerMessage

    public ServerMessage()

  Creates a new `ServerMessage`.

Method Detail

### addLibrary

    public void addLibrary(java.lang.String serviceId)

  Adds a JavaScript library service to be dynamically loaded.

  Parameters:
    `serviceId` - the id of the service to load (the service must return JavaScript code with content-type "text/javascript")

### addPartGroup

    public org.w3c.dom.Element addPartGroup(java.lang.String groupId)

  Adds a "group" to the document. Part groups enable certain groups of operations, e.g., remove operations, to be performed before others, e.g., add operations.

  Parameters:
    `groupId` - the identifier of the group
  Returns:
    the created "message-part-group" element.

### getPartGroup

    public org.w3c.dom.Element getPartGroup(java.lang.String groupId)

  Retrieves the "message-part-group" element pertaining to a specific group.

  Parameters:
    `groupId` - the id of the group
  Returns:
    the "message-part-group" element

### addPart

    public org.w3c.dom.Element addPart(java.lang.String groupId,
                                       java.lang.String processor)

  Adds a "message-part" to the document that will be processed by the specified client-side processor object.

  Parameters:
    `groupId` - the id of the group to which the "message-part" element should be added
    `processor` - the name of the client-side processor object which will process the message part, e.g., "EchoEventUpdate", or "EchoDomUpdate"
  Returns:
    the created "message-part" element

### appendPartDirective

    public org.w3c.dom.Element appendPartDirective(java.lang.String groupId,
                                                   java.lang.String processor,
                                                   java.lang.String directiveName)

  Creates and appends a directive element beneath to a message part. Attempts to append the directive to an existing message part if the last message part in the specified group happens to have the same processor as is specified by the `processor` argument. If this is not possible, a new "message-part" element is created and the directive is added to it.

  Parameters:
    `groupId` -
    `processor` - the name of the client-side processor object which will process the message part, e.g., "EchoEventUpdate", or "EchoDomUpdate"
    `directiveName` - the name of the directive, e.g., "event-add" or "dom-remove".
  Returns:
    the directive element

### getItemizedDirective

    public org.w3c.dom.Element getItemizedDirective(java.lang.String groupId,
                                                    java.lang.String processor,
                                                    java.lang.String directiveName,
                                                    java.lang.String[] keyAttributeNames,
                                                    java.lang.String[] keyAttributeValues)

  Creates or retrieves a suitable "Itemized Directive" element. Itemized Directives may be used to create more bandwidth-efficient ServerMessage output in cases where a particular operation may need to be performed on a significant number of targets. In the case that the directive must be created, it will be added to the message. Repeated invocations of this method with equivalent values of all parameters will result in the same directive being returned each time. This method should only be used for adding directives to the `GROUP_ID_PREREMOVE` and `GROUP_ID_POSTUPDATE` groups as itemized directives will not be executed in-order, which will cause problems if they are used for to manipulate the DOM.

  Parameters:
    `groupId` - the identifier of the target message part group, either `GROUP_ID_PREREMOVE` or `GROUP_ID_POSTUPDATE`
    `processor` - the name of the client-side processor object which will process the message part containing the directive, e.g., "EchoEventUpdate", or "EchoDomUpdate"
    `directiveName` - the name of the directive, e.g., "event-add" or "dom-remove"
    `keyAttributeNames` - the names of the key attributes
    `keyAttributeValues` - the values of the key attributes
  Returns:
    the created/retrieved directive element

### setAsynchronousMonitorInterval

    public void setAsynchronousMonitorInterval(int newValue)

  Sets the interval between asynchronous requests to the server to check for server-pushed updates.

  Parameters:
    `newValue` - the new interval in milliseconds (a negative value will disable asynchronous requests)

### setModalContextRootId

    public void setModalContextRootId(java.lang.String id)

  Sets the element id of the root of the modal context. Only elements within the modal context will be enabled. A `id` value of null will disable the modal context, thus allowing ALL elements to be enabled.

  Parameters:
    `id` - the root element id of the modal context

### setRootLayoutDirection

    public void setRootLayoutDirection(int layoutDirection)

  Sets the root layout direction of the application, i.e., either `LEFT_TO_RIGHT` or `RIGHT_TO_LEFT`.

  Parameters:
    `layoutDirection` - the new layout direction

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