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

## org.directwebremoting.proxy.dwr
Class Util

    java.lang.Object
      org.directwebremoting.proxy.ScriptProxy
          org.directwebremoting.proxy.dwr.Util

    public class Util

extends ScriptProxy

Util is a server-side proxy that allows Java programmers to call client side Javascript from Java.

Each Util object is associated with a list of ScriptSessions and the proxy code is creates will be dynamically forwarded to all those browsers.

Currently this class contains only the write-only DOM manipulation functions from Util. It is possible that we could add the read methods, however the complexity in the callback and the fact that you are probably not going to need it means that we'll leave it for another day. Specifically, `getValue`, `getValues` and `getText` have been left out as being read functions and `useLoadingMessage` etc have been left out as not being DOM related.

Author:
  Joe Walker [joe at getahead dot ltd dot uk], Jorge Martin Cuervo [darthkorr at gmail dot com]

Constructor Summary
`Util()` Http thread constructor, that affects no browsers.
`Util(java.util.Collection scriptSessions)` Http thread constructor that alters a number of browsers
`Util(ScriptSession scriptSession)` Http thread constructor that alters a single browser

Method Summary
`void` | `addClassName(java.lang.String elementId, java.lang.String className)` $(ele).className += "X", that we can call from Java easily.
`void` | `addOptions(java.lang.String elementId, java.util.Collection array, java.lang.String property)` Add options to a list from an array or map.
`void` | `addOptions(java.lang.String elementId, java.util.Collection array, java.lang.String valueProperty, java.lang.String textProperty)` Add options to a list from an array or map.
`void` | `addOptions(java.lang.String elementId, java.lang.String[] array)` Add options to a list from an array or map.
`void` | `addRows(java.lang.String elementId, java.lang.String[][] data)` Create rows inside a the table, tbody, thead or tfoot element (given by id).
`void` | `addRows(java.lang.String elementId, java.lang.String[][] data, java.lang.String options)` Create rows inside a the table, tbody, thead or tfoot element (given by id).
`void` | `cloneNode(java.lang.String elementId)` Clone a given node.
`void` | `cloneNode(java.lang.String elementId, java.lang.String idPrefix, java.lang.String idSuffix)` Clone a given node.
`void` | `removeAllOptions(java.lang.String elementId)` Remove all the options from a select list (specified by id)
`void` | `removeAllRows(java.lang.String elementId)` Remove all the children of a given node.
`void` | `removeClassName(java.lang.String elementId, java.lang.String className)` $(ele).className -= "X", that we can call from Java easily From code originally by Gavin Kistner
`void` | `removeNode(java.lang.String elementId)` Sets a CSS style on an element
`void` | `setClassName(java.lang.String elementId, java.lang.String className)` $(ele).className = "X", that we can call from Java easily
`void` | `setStyle(java.lang.String elementId, java.lang.String selector, java.lang.String value)` Sets a CSS style on an element
`void` | `setValue(java.lang.String elementId, java.lang.String value)` Set the value an HTML element to the specified value.
`void` | `setValue(java.lang.String elementId, java.lang.String value, boolean escapeHtml)` Set the value an HTML element to the specified value.
`void` | `setValues(java.util.Map values, boolean escapeHtml)` Given a map, call setValue() for all the entries in the map using the entry key as an element id.
`void` | `toggleClassName(java.lang.String elementId, java.lang.String className)` $(ele).className |= "X", that we can call from Java easily.

Methods inherited from class org.directwebremoting.proxy.ScriptProxy
`addFunctionCall, addFunctionCall, addFunctionCall, addFunctionCall, addFunctionCall, addFunctionCall, addScript, addScriptSession, addScriptSessions`

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

Constructor Detail

### Util

    public Util()

  Http thread constructor, that affects no browsers. Calls to `ScriptProxy.addScriptSession(ScriptSession)` or to `ScriptProxy.addScriptSessions(Collection)` will be needed

### Util

    public Util(ScriptSession scriptSession)

  Http thread constructor that alters a single browser

  Parameters:
    `scriptSession` - The browser to alter

### Util

    public Util(java.util.Collection scriptSessions)

  Http thread constructor that alters a number of browsers

  Parameters:
    `scriptSessions` - A collection of ScriptSessions that we should act on.

Method Detail

### setValue

    public void setValue(java.lang.String elementId,
                         java.lang.String value)

  Set the value an HTML element to the specified value.

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `value` - The text to insert into the HTML element

### setValue

    public void setValue(java.lang.String elementId,
                         java.lang.String value,
                         boolean escapeHtml)

  Set the value an HTML element to the specified value.

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `value` - The text to insert into the HTML element
    `escapeHtml` - Should we escape HTML characters?

### setValues

    public void setValues(java.util.Map values,
                          boolean escapeHtml)

  Given a map, call setValue() for all the entries in the map using the entry key as an element id.

  More.

  Parameters:
    `values` - The map of elementIds to values to alter
    `escapeHtml` - Should we escape HTML characters?

### addOptions

    public void addOptions(java.lang.String elementId,
                           java.lang.String[] array)

  Add options to a list from an array or map.

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `array` - An array of strings to use as both value and text of options

### addOptions

    public void addOptions(java.lang.String elementId,
                           java.util.Collection array,
                           java.lang.String property)

  Add options to a list from an array or map.

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `array` - And array of objects from which to create options
    `property` - The object property to use for the option value and text

### addOptions

    public void addOptions(java.lang.String elementId,
                           java.util.Collection array,
                           java.lang.String valueProperty,
                           java.lang.String textProperty)

  Add options to a list from an array or map.

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `array` - And array of objects from which to create options
    `valueProperty` - The object property to use for the option value
    `textProperty` - The object property to use for the option text

### removeAllOptions

    public void removeAllOptions(java.lang.String elementId)

  Remove all the options from a select list (specified by id)

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)

### addRows

    public void addRows(java.lang.String elementId,
                        java.lang.String[][] data,
                        java.lang.String options)

  Create rows inside a the table, tbody, thead or tfoot element (given by id).

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `data` - The cells to add to the table
    `options` - See link above for documentation on the options

### addRows

    public void addRows(java.lang.String elementId,
                        java.lang.String[][] data)

  Create rows inside a the table, tbody, thead or tfoot element (given by id).

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `data` - The cells to add to the table

### removeAllRows

    public void removeAllRows(java.lang.String elementId)

  Remove all the children of a given node.

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)

### cloneNode

    public void cloneNode(java.lang.String elementId)

  Clone a given node.

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)

### cloneNode

    public void cloneNode(java.lang.String elementId,
                          java.lang.String idPrefix,
                          java.lang.String idSuffix)

  Clone a given node.

  More.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `idPrefix` - How do we prefix ids in the cloned version of the node tree
    `idSuffix` - How do we suffix ids in the cloned version of the node tree

### removeNode

    public void removeNode(java.lang.String elementId)

  Sets a CSS style on an element

  Parameters:
    `elementId` - The HTML element to update (by id)
    `selector` - The CSS selector to update
    `value` - The new value for the CSS class on the given element

### setClassName

    public void setClassName(java.lang.String elementId,
                             java.lang.String className)

  $(ele).className = "X", that we can call from Java easily

  Parameters:
    `elementId` - The HTML element to update (by id)
    `className` - The CSS class to set for the element

### addClassName

    public void addClassName(java.lang.String elementId,
                             java.lang.String className)

  $(ele).className += "X", that we can call from Java easily.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `className` - The CSS class to add to the element

### removeClassName

    public void removeClassName(java.lang.String elementId,
                                java.lang.String className)

  $(ele).className -= "X", that we can call from Java easily From code originally by Gavin Kistner

  Parameters:
    `elementId` - The HTML element to update (by id)
    `className` - The CSS class to remove from the element

### toggleClassName

    public void toggleClassName(java.lang.String elementId,
                                java.lang.String className)

  $(ele).className |= "X", that we can call from Java easily.

  Parameters:
    `elementId` - The HTML element to update (by id)
    `className` - The CSS class to toggle on/off

### setStyle

    public void setStyle(java.lang.String elementId,
                         java.lang.String selector,
                         java.lang.String value)

  Sets a CSS style on an element

  Parameters:
    `elementId` - The HTML element to update (by id)
    `selector` - The CSS selector to update
    `value` - The new value for the CSS class on the given element

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