Eclipse Rich Ajax Platform

org.eclipse.rwt.lifecycle
Class WidgetLCAUtil

java.lang.Object
  extended by org.eclipse.rwt.lifecycle.WidgetLCAUtil

public final class WidgetLCAUtil
extends java.lang.Object

Utility class that provides a number of useful static methods to support the implementation of widget life cycle adapters.

Since:
1.0
See Also:
ControlLCAUtil

Method Summary
static java.lang.String escapeText(java.lang.String text, boolean mnemonics)
          Replaces all occurrences of the characters <, >, &, and " with their corresponding HTML entities.
static java.lang.String getColorValue(RGB rgb)
           
static java.lang.String[] getStyles(Widget widget)
           
static boolean hasChanged(Widget widget, java.lang.String property, java.lang.Object newValue)
          Determines whether the property of the given widget has changed during the processing of the current request and thus the changes must be rendered in the response.
static boolean hasChanged(Widget widget, java.lang.String property, java.lang.Object newValue, java.lang.Object defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and thus the changes must be rendered in the response.
static java.lang.String[] parseFontName(java.lang.String name)
           
static void preserveBackground(Widget widget, Color background)
          Preserves the value of the property background of the specified widget.
static void preserveBackground(Widget widget, Color background, boolean transparency)
          Preserves the value of the property background of the specified widget.
static void preserveBackgroundGradient(Widget widget)
          Preserves the background gradient properties of the specified widget.
static void preserveBounds(Widget widget, Rectangle bounds)
          Preserves the value of the property bounds of the specified widget.
static void preserveCustomVariant(Widget widget)
          Preserves the value of the custom variant of the specified widget.
static void preserveEnabled(Widget widget, boolean enabled)
          Preserves the value of the property enabled of the specified widget.
static void preserveFont(Widget widget, Font font)
          Preserves the value of the property font of the specified widget.
static void preserveForeground(Widget widget, Color foreground)
          Preserves the value of the property foreground of the specified widget.
static void preserveHelpListener(Widget widget)
          Preserves whether the given widget has one or more HelpListeners attached.
static void preserveListener(Widget widget, java.lang.String listener, boolean value)
          Preserves the value of the listener of the specified widget.
static void preserveProperty(Widget widget, java.lang.String property, boolean value)
          Preserves the value of the property of the specified widget.
static void preserveProperty(Widget widget, java.lang.String property, int value)
          Preserves the value of the property of the specified widget.
static void preserveProperty(Widget widget, java.lang.String property, java.lang.Object value)
          Preserves the value of the property of the specified widget.
static void preserveRoundedBorder(Widget widget)
          Preserves the rounded border properties of the specified widget.
static void preserveToolTipText(Widget widget, java.lang.String toolTip)
          Preserves the value of the property toolTipText of the specified widget.
static void processHelp(Widget widget)
          Process a HelpEvent if the current request specifies that there occured a help event for the given widget.
static Rectangle readBounds(java.lang.String widgetId, Rectangle defValue)
          Reads the bounds of the widget specified by its id from the current request.
static Rectangle readBounds(Widget widget, Rectangle defValue)
          Reads the bounds of the specified widget from the current request.
static java.lang.String readPropertyValue(Widget widget, java.lang.String propertyName)
          Reads the value of the specified property for the specified widget from the request that is currently processed.
static void renderBackground(Widget widget, Color newColor)
          Determines whether the property background of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side background property of the specified widget.
static void renderBackground(Widget widget, Color background, boolean transparency)
          Determines whether the property background of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side background property of the specified widget.
static void renderBackgroundGradient(Widget widget)
          Determines whether the background gradient properties of the given widget have changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side background gradient properties of the specified widget.
static void renderBounds(Widget widget, Control parent, Rectangle bounds)
          Determines whether the bounds of the given widget have changed during the processing of the current request and if so, writes a set opration the response that updates the client-side bounds of the specified widget.
static void renderCustomVariant(Widget widget)
          Determines whether the custom variant of the given widget has changed during the processing of the current request and if so, writes a protocol Message to the response that updates the client-side variant.
static void renderEnabled(Widget widget, boolean enabled)
          Determines whether the property enabled of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side enabled property of the specified widget.
static void renderFont(Widget widget, Font font)
          Determines whether the property font of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side font property of the specified widget.
static void renderForeground(Widget widget, Color newColor)
          Determines whether the property foreground of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side foreground property of the specified widget.
static void renderListener(Widget widget, java.lang.String listener, boolean newValue, boolean defaultValue)
          Determines whether the listener of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side listener of the specified widget.
static void renderListenHelp(Widget widget)
          Adds or removes client-side help listeners for the the given widget as necessary.
static void renderMenu(Widget widget, Menu menu)
          Determines whether the property menu of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side menu property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, boolean newValue, boolean defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, Color[] newValue, Color[] defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, Color newValue, Color defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, Font[] newValue, Font[] defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, Image[] newValue, Image[] defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, Image newValue, Image defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, int newValue, int defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, java.lang.Object newValue, java.lang.Object defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, Point newValue, Point defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, Rectangle newValue, Rectangle defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderProperty(Widget widget, java.lang.String property, Widget newValue, Widget defaultValue)
          Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.
static void renderRoundedBorder(Widget widget)
          Determines whether the rounded border properties of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side rounded border of the specified widget.
static void renderToolTip(Widget widget, java.lang.String toolTip)
          Determines whether the property toolTip of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side toolTip property of the specified widget.
static java.lang.String replaceNewLines(java.lang.String input, java.lang.String replacement)
          Replaces all newline characters in the specified input string with the given replacement string.
static boolean wasEventSent(Widget widget, java.lang.String eventName)
          Determines whether an event with the specified name was submitted for the specified widget within the current request.
static void writeBackground(Widget widget, Color newColor)
          Determines whether the property background of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side background property of the specified widget.
static void writeBackground(Widget widget, Color background, boolean transparency)
          Determines whether the property background of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side background property of the specified widget.
static void writeBackgroundGradient(Widget widget)
          Determines whether the background gradient properties of the given widget have changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side background gradient properties of the specified widget.
static void writeBounds(Widget widget, Control parent, Rectangle bounds)
          Determines whether the bounds of the given widget have changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side bounds of the specified widget.
static void writeCustomVariant(Widget widget)
          Determines whether the custom variant of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side variant.
static void writeEnabled(Widget widget, boolean enabled)
          Determines whether the property enabled of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side enabled property of the specified widget.
static void writeFont(Widget widget, Font font)
          Determines whether the property font of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side font property of the specified widget.
static void writeForeground(Widget widget, Color newColor)
          Determines whether the property foreground of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side foreground property of the specified widget.
static void writeHelpListener(Widget widget)
          Adds or removes client-side help listeners for the the given widget as necessary.
static void writeImage(Widget widget, Image image)
          Determines whether the property image of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side image property of the specified widget.
static void writeImage(Widget widget, java.lang.String jsProperty, Image image)
          Writes JavaScript code to the response that sets the specified JavaScript property of the specified widget to the specified image.
static void writeImage(Widget widget, java.lang.String javaProperty, java.lang.String jsProperty, Image image)
          Determines whether the specified image property of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the specified client-side property of the specified widget.
static void writeMenu(Widget widget, Menu menu)
          Determines whether the property menu of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side menu property of the specified widget.
static void writeRoundedBorder(Widget widget)
          Determines whether the rounded border properties of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side rounded border of the specified widget.
static void writeStyleFlag(Widget widget, int style, java.lang.String styleName)
          Checks whether a certain style flag is set on the specified widget and if so, writes code to set the according state on the client-side widget.
static void writeToolTip(Widget widget, java.lang.String toolTip)
          Determines whether the property toolTip of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side toolTip property of the specified widget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

preserveProperty

public static void preserveProperty(Widget widget,
                                    java.lang.String property,
                                    java.lang.Object value)
Preserves the value of the property of the specified widget.

Parameters:
widget - the widget whose property to preserve
property - the name of the property
value - the value to preserve
Since:
1.5

preserveProperty

public static void preserveProperty(Widget widget,
                                    java.lang.String property,
                                    int value)
Preserves the value of the property of the specified widget.

Parameters:
widget - the widget whose property to preserve
property - the name of the property
value - the value to preserve
Since:
1.5

preserveProperty

public static void preserveProperty(Widget widget,
                                    java.lang.String property,
                                    boolean value)
Preserves the value of the property of the specified widget.

Parameters:
widget - the widget whose property to preserve
property - the name of the property
value - the value to preserve
Since:
1.5

preserveListener

public static void preserveListener(Widget widget,
                                    java.lang.String listener,
                                    boolean value)
Preserves the value of the listener of the specified widget.

Parameters:
widget - the widget whose listener to preserve
listener - the type of the listener
value - the value to preserve
Since:
1.5

preserveBounds

public static void preserveBounds(Widget widget,
                                  Rectangle bounds)
Preserves the value of the property bounds of the specified widget.

Parameters:
widget - the widget whose bounds property to preserve
bounds - the value to preserve
See Also:
writeBounds(Widget, Control, Rectangle)

preserveToolTipText

public static void preserveToolTipText(Widget widget,
                                       java.lang.String toolTip)
Preserves the value of the property toolTipText of the specified widget.

Parameters:
widget - the widget whose toolTip property to preserve
toolTip - the value to preserve
See Also:
writeToolTip(Widget, String)

preserveFont

public static void preserveFont(Widget widget,
                                Font font)
Preserves the value of the property font of the specified widget.

Parameters:
widget - the widget whose font property to preserve
font - the value to preserve
See Also:
writeFont(Widget, Font)

preserveForeground

public static void preserveForeground(Widget widget,
                                      Color foreground)
Preserves the value of the property foreground of the specified widget.

Parameters:
widget - the widget whose foreground property to preserve
foreground - the value to preserve
See Also:
writeForeground(Widget, Color)

preserveBackground

public static void preserveBackground(Widget widget,
                                      Color background)
Preserves the value of the property background of the specified widget.

Parameters:
widget - the widget whose background property to preserve
background - the value to preserve
See Also:
writeBackground(Widget, Color)

preserveBackground

public static void preserveBackground(Widget widget,
                                      Color background,
                                      boolean transparency)
Preserves the value of the property background of the specified widget.

Parameters:
widget - the widget whose background property to preserve
background - the background color to preserve
transparency - the background transparency to preserve
See Also:
writeBackground(Widget, Color, boolean)

preserveBackgroundGradient

public static void preserveBackgroundGradient(Widget widget)
Preserves the background gradient properties of the specified widget.

Parameters:
widget - the widget whose background gradient properties to preserve
Since:
1.3
See Also:
writeBackgroundGradient(Widget)

preserveRoundedBorder

public static void preserveRoundedBorder(Widget widget)
Preserves the rounded border properties of the specified widget.

Parameters:
widget - the widget whose rounded border properties to preserve
Since:
1.3
See Also:
writeRoundedBorder(Widget)

preserveEnabled

public static void preserveEnabled(Widget widget,
                                   boolean enabled)
Preserves the value of the property enabled of the specified widget.

Parameters:
widget - the widget whose enabled property to preserve
enabled - the value to preserve
See Also:
writeEnabled(Widget, boolean)

preserveCustomVariant

public static void preserveCustomVariant(Widget widget)
Preserves the value of the custom variant of the specified widget.

Parameters:
widget - the widget whose custom variant to preserve
See Also:
writeCustomVariant(Widget)

hasChanged

public static boolean hasChanged(Widget widget,
                                 java.lang.String property,
                                 java.lang.Object newValue)
Determines whether the property of the given widget has changed during the processing of the current request and thus the changes must be rendered in the response. This is done by comparing the current value with the preserved value.

If there is no preserved value, null is assumed.

Parameters:
widget - the widget whose property is to be compared, must not be null.
property - the name of the property under which the preserved value can be looked up. Must not be null.
newValue - the value to compare the preserved value with
Returns:
true if the property has changed, false otherwise

hasChanged

public static boolean hasChanged(Widget widget,
                                 java.lang.String property,
                                 java.lang.Object newValue,
                                 java.lang.Object defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and thus the changes must be rendered in the response. This is done by comparing the current value with the preserved value.

In case it is the first time that the widget is rendered (it is not yet present on the client side) true is only returned if the newValue differs from the defaultValue. Otherwise the decision is delegated to hasChanged(Widget,String,Object).

Parameters:
widget - the widget whose property is to be compared, must not be null.
property - the name of the property under which the preserved value can be looked up. Must not be null.
newValue - the value that is compared to the preserved value
defaultValue - the default value
Returns:
true if the property has changed or if the widget is not yet initialized and the property is at its default value, false otherwise

readPropertyValue

public static java.lang.String readPropertyValue(Widget widget,
                                                 java.lang.String propertyName)
Reads the value of the specified property for the specified widget from the request that is currently processed. If this property is not submitted for the given widget, null is returned.

Parameters:
widget - the widget whose property to read
propertyName - the name of the property to read
Returns:
the value read from the request or null if no value was submitted for the given property

wasEventSent

public static boolean wasEventSent(Widget widget,
                                   java.lang.String eventName)
Determines whether an event with the specified name was submitted for the specified widget within the current request.

Parameters:
widget - the widget that should receive the event
eventName - the name of the event to check for
Returns:
true if the event was sent for the widget, false otherwise.

readBounds

public static Rectangle readBounds(Widget widget,
                                   Rectangle defValue)
Reads the bounds of the specified widget from the current request. If the bounds of this widget was not sent with the current request, the specified default is returned.

Parameters:
widget - the widget whose bounds to read
defValue - the default bounds
Returns:
the bounds as read from the request or the default bounds if no bounds were passed within the current request

readBounds

public static Rectangle readBounds(java.lang.String widgetId,
                                   Rectangle defValue)
Reads the bounds of the widget specified by its id from the current request. If the bounds of this widget was not sent with the current request, the specified default is returned.

Parameters:
widgetId - the widget id of the widget whose bounds to read
defValue - the default bounds
Returns:
the bounds as read from the request or the default bounds if no bounds were passed within the current request

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  java.lang.Object newValue,
                                  java.lang.Object defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  int newValue,
                                  int defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  boolean newValue,
                                  boolean defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  Image newValue,
                                  Image defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  Image[] newValue,
                                  Image[] defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  Color newValue,
                                  Color defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  Color[] newValue,
                                  Color[] defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  Font[] newValue,
                                  Font[] defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  Point newValue,
                                  Point defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  Rectangle newValue,
                                  Rectangle defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderProperty

public static void renderProperty(Widget widget,
                                  java.lang.String property,
                                  Widget newValue,
                                  Widget defaultValue)
Determines whether the property of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
property - the property name
newValue - the new value of the property
defaultValue - the default value of the property
Since:
1.5

renderListener

public static void renderListener(Widget widget,
                                  java.lang.String listener,
                                  boolean newValue,
                                  boolean defaultValue)
Determines whether the listener of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side listener of the specified widget.

Parameters:
widget - the widget whose property to set
listener - the listener type
newValue - the new value of the listener (true if listener is attached, false otherwise)
defaultValue - the default value of the listener
Since:
1.5

writeBounds

public static void writeBounds(Widget widget,
                               Control parent,
                               Rectangle bounds)
                        throws java.io.IOException
Determines whether the bounds of the given widget have changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side bounds of the specified widget. For instances of Control, use the method ControlLCAUtil.writeBounds(Control) instead.

Parameters:
widget - the widget whose bounds to write
parent - the parent of the widget or null if the widget does not have a parent
bounds - the new bounds of the widget
Throws:
java.io.IOException

renderBounds

public static void renderBounds(Widget widget,
                                Control parent,
                                Rectangle bounds)
                         throws java.io.IOException
Determines whether the bounds of the given widget have changed during the processing of the current request and if so, writes a set opration the response that updates the client-side bounds of the specified widget. For instances of Control, use the method ControlLCAUtil.renderBounds(Control) instead.

Parameters:
widget - the widget whose bounds to write
parent - the parent of the widget or null if the widget does not have a parent
bounds - the new bounds of the widget
Throws:
java.io.IOException

writeMenu

public static void writeMenu(Widget widget,
                             Menu menu)
                      throws java.io.IOException
Determines whether the property menu of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side menu property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeMenu(Control) instead.

Parameters:
widget - the widget whose menu property to set
menu - the new value of the property
Throws:
java.io.IOException

renderMenu

public static void renderMenu(Widget widget,
                              Menu menu)
                       throws java.io.IOException
Determines whether the property menu of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side menu property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeMenu(Control) instead.

Parameters:
widget - the widget whose menu property to set
menu - the new value of the property
Throws:
java.io.IOException

writeToolTip

public static void writeToolTip(Widget widget,
                                java.lang.String toolTip)
                         throws java.io.IOException
Determines whether the property toolTip of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side toolTip property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeToolTip(Control) instead.

Parameters:
widget - the widget whose toolTip property to set
toolTip - the new value of the property
Throws:
java.io.IOException
See Also:
preserveToolTipText(Widget, String)

renderToolTip

public static void renderToolTip(Widget widget,
                                 java.lang.String toolTip)
                          throws java.io.IOException
Determines whether the property toolTip of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side toolTip property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeToolTip(Control) instead.

Parameters:
widget - the widget whose toolTip property to set
toolTip - the new value of the property
Throws:
java.io.IOException
See Also:
preserveToolTipText(Widget, String)

writeImage

public static void writeImage(Widget widget,
                              Image image)
                       throws java.io.IOException
Determines whether the property image of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side image property of the specified widget.

Parameters:
widget - the widget whose image property to set
image - the new value of the property
Throws:
java.io.IOException

writeImage

public static void writeImage(Widget widget,
                              java.lang.String javaProperty,
                              java.lang.String jsProperty,
                              Image image)
                       throws java.io.IOException
Determines whether the specified image property of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the specified client-side property of the specified widget.

Parameters:
widget - the widget whose property to set
javaProperty - the key of the preserved value to compare the new value with
jsProperty - the name of the JavaScript property to set
image - the new value of the property
Throws:
java.io.IOException

writeImage

public static void writeImage(Widget widget,
                              java.lang.String jsProperty,
                              Image image)
                       throws java.io.IOException
Writes JavaScript code to the response that sets the specified JavaScript property of the specified widget to the specified image.

Parameters:
widget - the widget whose property to set
jsProperty - the name of the JavaScript property to set
image - the new value of the property
Throws:
java.io.IOException

writeFont

public static void writeFont(Widget widget,
                             Font font)
                      throws java.io.IOException
Determines whether the property font of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side font property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeFont(Control) instead.

Parameters:
widget - the widget whose font property to set
font - the new value of the property
Throws:
java.io.IOException
See Also:
preserveFont(Widget, Font)

renderFont

public static void renderFont(Widget widget,
                              Font font)
                       throws java.io.IOException
Determines whether the property font of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side font property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeFont(Control) instead.

Parameters:
widget - the widget whose font property to set
font - the new value of the property
Throws:
java.io.IOException
See Also:
preserveFont(Widget, Font)

parseFontName

public static java.lang.String[] parseFontName(java.lang.String name)

writeForeground

public static void writeForeground(Widget widget,
                                   Color newColor)
                            throws java.io.IOException
Determines whether the property foreground of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side foreground property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeForeground(Control) instead.

Parameters:
widget - the widget whose foreground property to set
newColor - the new value of the property
Throws:
java.io.IOException
See Also:
preserveForeground(Widget, Color)

renderForeground

public static void renderForeground(Widget widget,
                                    Color newColor)
                             throws java.io.IOException
Determines whether the property foreground of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side foreground property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeForeground(Control) instead.

Parameters:
widget - the widget whose foreground property to set
newColor - the new value of the property
Throws:
java.io.IOException
See Also:
preserveForeground(Widget, Color)

getColorValue

public static java.lang.String getColorValue(RGB rgb)

writeBackground

public static void writeBackground(Widget widget,
                                   Color newColor)
                            throws java.io.IOException
Determines whether the property background of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side background property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeBackground(Control) instead.

Parameters:
widget - the widget whose background property to set
newColor - the new value of the property
Throws:
java.io.IOException
See Also:
preserveBackground(Widget, Color)

writeBackground

public static void writeBackground(Widget widget,
                                   Color background,
                                   boolean transparency)
                            throws java.io.IOException
Determines whether the property background of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side background property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeBackground(Control) instead.

Parameters:
widget - the widget whose background property to set
background - the new background color
transparency - the new background transparency, if true, the background parameter is ignored
Throws:
java.io.IOException
See Also:
preserveBackground(Widget, Color, boolean)

renderBackground

public static void renderBackground(Widget widget,
                                    Color newColor)
                             throws java.io.IOException
Determines whether the property background of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side background property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeBackground(Control) instead.

Parameters:
widget - the widget whose background property to set
newColor - the new value of the property
Throws:
java.io.IOException
See Also:
preserveBackground(Widget, Color)

renderBackground

public static void renderBackground(Widget widget,
                                    Color background,
                                    boolean transparency)
                             throws java.io.IOException
Determines whether the property background of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side background property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeBackground(Control) instead.

Parameters:
widget - the widget whose background property to set
background - the new background color
transparency - the new background transparency, if true, the background parameter is ignored
Throws:
java.io.IOException
See Also:
preserveBackground(Widget, Color, boolean)

writeBackgroundGradient

public static void writeBackgroundGradient(Widget widget)
                                    throws java.io.IOException
Determines whether the background gradient properties of the given widget have changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side background gradient properties of the specified widget.

Parameters:
widget - the widget whose background gradient properties to set
Throws:
java.io.IOException
Since:
1.3
See Also:
preserveBackgroundGradient(Widget)

renderBackgroundGradient

public static void renderBackgroundGradient(Widget widget)
                                     throws java.io.IOException
Determines whether the background gradient properties of the given widget have changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side background gradient properties of the specified widget.

Parameters:
widget - the widget whose background gradient properties to set
Throws:
java.io.IOException
Since:
1.5
See Also:
preserveBackgroundGradient(Widget)

writeRoundedBorder

public static void writeRoundedBorder(Widget widget)
                               throws java.io.IOException
Determines whether the rounded border properties of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side rounded border of the specified widget.

Parameters:
widget - the widget whose rounded border properties to set
Throws:
java.io.IOException
Since:
1.3
See Also:
preserveRoundedBorder(Widget)

renderRoundedBorder

public static void renderRoundedBorder(Widget widget)
                                throws java.io.IOException
Determines whether the rounded border properties of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side rounded border of the specified widget.

Parameters:
widget - the widget whose rounded border properties to set
Throws:
java.io.IOException
Since:
1.5
See Also:
preserveRoundedBorder(Widget)

writeEnabled

public static void writeEnabled(Widget widget,
                                boolean enabled)
                         throws java.io.IOException
Determines whether the property enabled of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side enabled property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeEnabled(Control) instead.

Parameters:
widget - the widget whose enabled property to set
enabled - the new value of the property
Throws:
java.io.IOException
See Also:
preserveEnabled(Widget, boolean)

renderEnabled

public static void renderEnabled(Widget widget,
                                 boolean enabled)
                          throws java.io.IOException
Determines whether the property enabled of the given widget has changed during the processing of the current request and if so, writes a protocol message to the response that updates the client-side enabled property of the specified widget. For instances of Control, use the method ControlLCAUtil.writeEnabled(Control) instead.

Parameters:
widget - the widget whose enabled property to set
enabled - the new value of the property
Throws:
java.io.IOException
See Also:
preserveEnabled(Widget, boolean)

replaceNewLines

public static java.lang.String replaceNewLines(java.lang.String input,
                                               java.lang.String replacement)
Replaces all newline characters in the specified input string with the given replacement string.

Parameters:
input - the string to process
replacement - the string to replace line feeds with
Returns:
a new string with all line feeds replaced
Since:
1.1

writeCustomVariant

public static void writeCustomVariant(Widget widget)
                               throws java.io.IOException
Determines whether the custom variant of the given widget has changed during the processing of the current request and if so, writes JavaScript code to the response that updates the client-side variant.

Parameters:
widget - the widget whose custom variant to write
Throws:
java.io.IOException

renderCustomVariant

public static void renderCustomVariant(Widget widget)
                                throws java.io.IOException
Determines whether the custom variant of the given widget has changed during the processing of the current request and if so, writes a protocol Message to the response that updates the client-side variant.

Parameters:
widget - the widget whose custom variant to write
Throws:
java.io.IOException

writeStyleFlag

public static void writeStyleFlag(Widget widget,
                                  int style,
                                  java.lang.String styleName)
                           throws java.io.IOException
Checks whether a certain style flag is set on the specified widget and if so, writes code to set the according state on the client-side widget.

Parameters:
widget - the widget whose style to write
style - the SWT style flag in question
styleName - the uppercase name of the style
Throws:
java.io.IOException
Since:
1.2

preserveHelpListener

public static void preserveHelpListener(Widget widget)
Preserves whether the given widget has one or more HelpListeners attached.

Parameters:
widget - the widget to preserve
Since:
1.3

writeHelpListener

public static void writeHelpListener(Widget widget)
                              throws java.io.IOException
Adds or removes client-side help listeners for the the given widget as necessary.

Parameters:
widget -
Throws:
java.io.IOException
Since:
1.3

renderListenHelp

public static void renderListenHelp(Widget widget)
Adds or removes client-side help listeners for the the given widget as necessary.

Parameters:
widget -
Since:
1.3

processHelp

public static void processHelp(Widget widget)
Process a HelpEvent if the current request specifies that there occured a help event for the given widget.

Parameters:
widget - the widget to process
Since:
1.3

getStyles

public static java.lang.String[] getStyles(Widget widget)

escapeText

public static java.lang.String escapeText(java.lang.String text,
                                          boolean mnemonics)
Replaces all occurrences of the characters <, >, &, and " with their corresponding HTML entities. This function is used for rendering texts to the client. When the parameter mnemonic is set to true, this method handles ampersand characters in the text as mnemonics in the same manner as SWT does.

Note: In contrast to SWT, the characters following an ampersand are currently not underlined, as RAP doesn't support key events yet.

Parameters:
text - the input text
mnemonics - if true, the function is mnemonic aware, otherwise all ampersand characters are directly rendered.
Returns:
the resulting text

Eclipse Rich Ajax Platform

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