Eclipse Rich Ajax Platform

## org.eclipse.rwt.lifecycle
Class JSWriter

    java.lang.Object
      org.eclipse.rwt.lifecycle.JSWriter

Deprecated. This class should not be used anymore as it writes JavaScript to the client which is incompatible with clients other than the default RAP webclient. Use `IClientObject` to write changes to the client.

    @Deprecated
    public final class JSWriter

extends java.lang.Object

This class provides helper methods to generate Javascript used to update the client-side state of widgets.

Note that the Javascript code that is rendered relies on the client-side `org.eclipse.swt.WidgetManager` to be present.

Since:
  1.0
See Also:
  `AbstractWidgetLCA`, `ControlLCAUtil`, `WidgetLCAUtil`

Field Summary
`static JSVar` `WIDGET_MANAGER_REF` Deprecated. A reference to the current widget manager on the client side.
`static JSVar` `WIDGET_REF` Deprecated. Reference to the widget of this JSWriter instance.

Method Summary
`void` `addListener(java.lang.String eventType, java.lang.String listener)` Deprecated. This will add a listener to the widget of this `JSWriter`.
`void` `addListener(java.lang.String property, java.lang.String eventType, java.lang.String listener)` Deprecated. This will add a listener to an object specified by the property of the widget.
`void` `call(JSVar target, java.lang.String function, java.lang.Object[] args)` Deprecated. Calls the specific `function` of the widget identified by `target` on the client-side.
`void` `call(java.lang.String function, java.lang.Object[] args)` Deprecated. Calls a specific function of the widget on the client-side.
`void` `call(Widget target, java.lang.String function, java.lang.Object[] args)` Deprecated. Calls the specific `function` of the widget identified by `target` on the client-side.
`void` `callFieldAssignment(JSVar target, java.lang.String field, java.lang.String value)` Deprecated.
`void` `callStatic(java.lang.String function, java.lang.Object[] args)` Deprecated. Calls the specified Javascript function with the given arguments.
`void` `dispose()` Deprecated. Dispose is used to dispose of the widget of this `JSWriter` on the client side.
`void` `endCall(java.lang.Object[] args)` Deprecated.
`static JSWriter` `getWriterFor(Widget widget)` Deprecated. Returns an instance of `JSWriter` for the specified `widget`.
`static JSWriter` `getWriterForResetHandler()` Deprecated. As of 1.3, server-side widget pooling is no longer required. This method should not be used anymore.
`void` `newWidget(java.lang.String className)` Deprecated. Creates a new widget on the client-side by creating an instance of the corresponding javascript class defined by `className`.
`void` `newWidget(java.lang.String className, java.lang.Object[] args)` Deprecated. Creates a new widget on the client-side by creating an instance of the corresponding javascript class definition.
`void` `removeListener(java.lang.String eventType, java.lang.String listener)` Deprecated.
`void` `removeListener(java.lang.String property, java.lang.String eventType, java.lang.String listener)` Deprecated.
`void` `reset(java.lang.String jsProperty)` Deprecated. Resets the specified javascript property to its initial value.
`void` `reset(java.lang.String[] jsPropertyChain)` Deprecated. Resets the specified javascript properties to their initial values.
`void` `set(java.lang.String[] jsPropertyChain, java.lang.Object[] values)` Deprecated. Sets the specified properties of the client-side widget to new values.
`void` `set(java.lang.String jsProperty, boolean value)` Deprecated. Sets the specified property of the client-side widget to a new value.
`void` `set(java.lang.String jsProperty, boolean[] values)` Deprecated. Sets the specified property of the client-side widget to a new value.
`void` `set(java.lang.String jsProperty, float value)` Deprecated. Sets the specified property of the client-side widget to a new value.
`void` `set(java.lang.String jsProperty, float[] values)` Deprecated. Sets the specified property of the client-side widget to a new value.
`void` `set(java.lang.String jsProperty, int value)` Deprecated. Sets the specified property of the client-side widget to a new value.
`void` `set(java.lang.String jsProperty, int[] values)` Deprecated. Sets the specified property of the client-side widget to a new value.
`void` `set(java.lang.String jsProperty, java.lang.Object value)` Deprecated. Sets the specified property of the client-side widget to a new value.
`void` `set(java.lang.String jsProperty, java.lang.Object[] values)` Deprecated. Sets the specified property of the client-side widget to a new value.
`void` `set(java.lang.String jsProperty, java.lang.String value)` Deprecated. Sets the specified property of the client-side widget to a new value.
`boolean` `set(java.lang.String javaProperty, java.lang.String jsProperty, java.lang.Object newValue)` Deprecated. Sets the specified `jsProperty` of the client-side widget to the new value.
`boolean` `set(java.lang.String javaProperty, java.lang.String jsProperty, java.lang.Object newValue, java.lang.Object defValue)` Deprecated. Sets the specified `jsProperty` of the client-side widget to the new value.
`void` `setParent(java.lang.String parentId)` Deprecated. Explicitly sets the parent of the client-side widget.
`void` `startCall(JSVar target, java.lang.String function, java.lang.Object[] args)` Deprecated.
`void` `updateListener(JSListenerInfo info, java.lang.String javaListener, boolean hasListeners)` Deprecated.
`void` `updateListener(java.lang.String property, JSListenerInfo info, java.lang.String javaListener, boolean hasListeners)` Deprecated.
`void` `varAssignment(JSVar var, java.lang.String method)` Deprecated.

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

Field Detail

### WIDGET_MANAGER_REF

    public static JSVar WIDGET_MANAGER_REF

  Deprecated.
  A reference to the current widget manager on the client side.

  IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.

### WIDGET_REF

    public static JSVar WIDGET_REF

  Deprecated.
  Reference to the widget of this JSWriter instance.

  IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.

Method Detail

### getWriterFor

    public static JSWriter getWriterFor(Widget widget)

  Deprecated.
  Returns an instance of `JSWriter` for the specified `widget`. Only this writer can modify attributes and call methods on the client-side representation of the widget.

  Parameters:
    `widget` - the widget for the requested `JSWriter`
  Returns:
    the corresponding `JSWriter`

### getWriterForResetHandler

    @Deprecated
    public static JSWriter getWriterForResetHandler()

  Deprecated. As of 1.3, server-side widget pooling is no longer required. This method should not be used anymore.

  Returns the `JSWriter` instance used to reset a widgets attributes in order to take part in the pooling mechanism.

  Returns:
    the `JSWriter` instance

### newWidget

    public void newWidget(java.lang.String className)
                   throws java.io.IOException

  Deprecated.
  Creates a new widget on the client-side by creating an instance of the corresponding javascript class defined by `className`. This is normally done in the `renderInitialization` method of the widgets life-cycle adapter (LCA).

  Parameters:
    `className` - the javascript class to initiate
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA.renderInitialization(org.eclipse.swt.widgets.Widget)`

### newWidget

    public void newWidget(java.lang.String className,
                          java.lang.Object[] args)
                   throws java.io.IOException

  Deprecated.
  Creates a new widget on the client-side by creating an instance of the corresponding javascript class definition. This is normally done in the `renderInitialization` method of the widgets life-cycle adapter (LCA). All arguments passed to this function will be transmitted to the client and used to call the constructor of the javascript widget.

  Parameters:
    `className` - the javascript class to initiate
    `args` - the arguments for the widgets constructor on the client-side
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA.renderInitialization(org.eclipse.swt.widgets.Widget)`

### setParent

    public void setParent(java.lang.String parentId)
                   throws java.io.IOException

  Deprecated.
  Explicitly sets the parent of the client-side widget.

  Parameters:
    `parentId` - the widget id of the parent
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `WidgetUtil`

### set

    public void set(java.lang.String jsProperty,
                    java.lang.String value)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `value` - the new value
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String jsProperty,
                    int value)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `value` - the new value
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String jsProperty,
                    float value)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `value` - the new value
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String jsProperty,
                    boolean value)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `value` - the new value
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String jsProperty,
                    int[] values)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `values` - the new values
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String jsProperty,
                    float[] values)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `values` - the new values
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String jsProperty,
                    boolean[] values)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `values` - the new values
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String jsProperty,
                    java.lang.Object value)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `value` - the new value
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String jsProperty,
                    java.lang.Object[] values)
             throws java.io.IOException

  Deprecated.
  Sets the specified property of the client-side widget to a new value.

  Parameters:
    `jsProperty` - the attribute to change
    `values` - the new values
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public void set(java.lang.String[] jsPropertyChain,
                    java.lang.Object[] values)
             throws java.io.IOException

  Deprecated.
  Sets the specified properties of the client-side widget to new values.

  Parameters:
    `jsPropertyChain` - the attributes to change
    `values` - the new values
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA`

### set

    public boolean set(java.lang.String javaProperty,
                       java.lang.String jsProperty,
                       java.lang.Object newValue)
                throws java.io.IOException

  Deprecated.
  Sets the specified `jsProperty` of the client-side widget to the new value. Uses the specified `javaProperty` as a key to obtain the preserved value and only sets the new value if it has changed since it was preserved.

  Parameters:
    `javaProperty` - the key used to obtain the preserved value
    `jsProperty` - the client-side attribute to change
    `newValue` - the new values
  Returns:
    `true` if the new value differs from the preserved value (meaning that JavaScript was written); `false` otherwise
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA.preserveValues(Widget)`

### set

    public boolean set(java.lang.String javaProperty,
                       java.lang.String jsProperty,
                       java.lang.Object newValue,
                       java.lang.Object defValue)
                throws java.io.IOException

  Deprecated.
  Sets the specified `jsProperty` of the client-side widget to the new value. Uses the specified `javaProperty` as a key to obtain the preserved value and only sets the new value if it has changed since it was preserved.

  If the widget is rendered for the first time, there is no preserved value present. In this case the `defValue` is taken into account instead of the preserved value of the `javaProperty`. Therefore, the default value must match the initial value of the attribute of the client-side widget. If there is no constant initial client-side value, resort the `set(String,String,Object)`.

  Parameters:
    `javaProperty` - the key used to obtain the preserved value
    `jsProperty` - the client-side attribute to change
    `newValue` - the new values
    `defValue` - the default value
  Returns:
    `true` if the new value differs from the preserved value (meaning that JavaScript was written); `false` otherwise
  Throws:
    `java.io.IOException` - if an I/O error occurs
  See Also:
    `AbstractWidgetLCA.preserveValues(Widget)`

### reset

    public void reset(java.lang.String jsProperty)
               throws java.io.IOException

  Deprecated.
  Resets the specified javascript property to its initial value.

  Parameters:
    `jsProperty` - the javascript property to reset
  Throws:
    `java.io.IOException` - if an I/O error occurs

### reset

    public void reset(java.lang.String[] jsPropertyChain)
               throws java.io.IOException

  Deprecated.
  Resets the specified javascript properties to their initial values.

  Parameters:
    `jsPropertyChain` - the javascript properties to reset
  Throws:
    `java.io.IOException` - if an I/O error occurs

### addListener

    public void addListener(java.lang.String property,
                            java.lang.String eventType,
                            java.lang.String listener)
                     throws java.io.IOException

  Deprecated.
  This will add a listener to an object specified by the property of the widget. The listener has to be a javascript function which accepts exact one parameter - an `qx.event.type.Event` object.

  Parameters:
    `property` - the property of the widget to what the listener should be added
    `eventType` - the type of the event
    `listener` - reference to the listener function
  Throws:
    `java.io.IOException` - if an I/O error occurs

### addListener

    public void addListener(java.lang.String eventType,
                            java.lang.String listener)
                     throws java.io.IOException

  Deprecated.
  This will add a listener to the widget of this `JSWriter`. The listener has to be a javascript function which accepts exact one parameter - an `qx.event.type.Event` object.

  Parameters:
    `eventType` - the type of the event
    `listener` - reference to the listener function
  Throws:
    `java.io.IOException` - if an I/O error occurs

### updateListener

    public void updateListener(java.lang.String property,
                               JSListenerInfo info,
                               java.lang.String javaListener,
                               boolean hasListeners)
                        throws java.io.IOException

  Deprecated.
  Throws:
    `java.io.IOException`

### updateListener

    public void updateListener(JSListenerInfo info,
                               java.lang.String javaListener,
                               boolean hasListeners)
                        throws java.io.IOException

  Deprecated.
  Throws:
    `java.io.IOException`

### removeListener

    public void removeListener(java.lang.String eventType,
                               java.lang.String listener)

  Deprecated.

### removeListener

    public void removeListener(java.lang.String property,
                               java.lang.String eventType,
                               java.lang.String listener)

  Deprecated.

### call

    public void call(java.lang.String function,
                     java.lang.Object[] args)
              throws java.io.IOException

  Deprecated.
  Calls a specific function of the widget on the client-side.

  Parameters:
    `function` - the function name
    `args` - the arguments for the function
  Throws:
    `java.io.IOException` - if an I/O error occurs

### call

    public void call(Widget target,
                     java.lang.String function,
                     java.lang.Object[] args)
              throws java.io.IOException

  Deprecated.
  Calls the specific `function` of the widget identified by `target` on the client-side.

  Parameters:
    `target` - the widget on which the function should be called
    `function` - the function to be called
    `args` - the arguments for the function
  Throws:
    `java.io.IOException` - if an I/O error occurs

### call

    public void call(JSVar target,
                     java.lang.String function,
                     java.lang.Object[] args)
              throws java.io.IOException

  Deprecated.
  Calls the specific `function` of the widget identified by `target` on the client-side.

  Parameters:
    `target` - the widget on which the function should be called
    `function` - the function name
    `args` - the arguments for the function
  Throws:
    `java.io.IOException` - if an I/O error occurs

### startCall

    public void startCall(JSVar target,
                          java.lang.String function,
                          java.lang.Object[] args)

  Deprecated.

### endCall

    public void endCall(java.lang.Object[] args)

  Deprecated.

### callStatic

    public void callStatic(java.lang.String function,
                           java.lang.Object[] args)
                    throws java.io.IOException

  Deprecated.
  Calls the specified Javascript function with the given arguments.

  Parameters:
    `function` - the function name
    `args` - the arguments for the function
  Throws:
    `java.io.IOException` - if an I/O error occurs

### callFieldAssignment

    public void callFieldAssignment(JSVar target,
                                    java.lang.String field,
                                    java.lang.String value)

  Deprecated.

### varAssignment

    public void varAssignment(JSVar var,
                              java.lang.String method)

  Deprecated.

### dispose

    public void dispose()
                 throws java.io.IOException

  Deprecated.
  Dispose is used to dispose of the widget of this `JSWriter` on the client side.

  Throws:
    `java.io.IOException` - if an I/O error occurs

Eclipse Rich Ajax Platform

Copyright (c) EclipseSource and others 2002, 2012. All rights reserved.