org.gwtopenmaps.openlayers.client.util
Class JSObjectHelper
java.lang.Object
org.gwtopenmaps.openlayers.client.util.JSObjectHelper
public class JSObjectHelper
- extends Object
Static methods for working with JSObject
objects.
The getProperty/setProperty methods are convenience methods for reducing
the amount of JSNI code that is necessary for creating JSObject wrappers.
Be aware: getProperty methods can die horribly at runtime if
property does not exist.
ECMA-262 (Ecmascript = Javascript) defines an object as an unordered collection of
properties each of which contains a primitive value, object, or function.
- Author:
- Edwin Commandeur - Atlis EJS, Alexander Solovets
Method Summary |
static JSObject |
createArray()
|
static JSObject |
createFunction()
|
static JSObject |
createObject()
|
static JSObject |
ensureOpaqueArray(JSObject object)
Utility method for creating arguments to functions that take an array of objects. |
static JSObject |
getProperty(JSObject object,
String name)
|
static boolean |
getPropertyAsBoolean(JSObject object,
String name)
|
static com.google.gwt.user.client.Element |
getPropertyAsDomElement(JSObject object,
String name)
|
static double |
getPropertyAsDouble(JSObject object,
String name)
|
static float |
getPropertyAsFloat(JSObject object,
String name)
|
static int |
getPropertyAsInt(JSObject object,
String name)
|
static String |
getPropertyAsString(JSObject object,
String name)
|
static String |
getPropertyNames(JSObject object)
|
static boolean |
hasProperty(JSObject object,
String name)
|
static void |
setProperty(JSObject object,
String name,
boolean value)
|
static void |
setProperty(JSObject object,
String name,
double value)
|
static void |
setProperty(JSObject object,
String name,
com.google.gwt.user.client.Element value)
|
static void |
setProperty(JSObject object,
String name,
float value)
|
static void |
setProperty(JSObject object,
String name,
int value)
|
static void |
setProperty(JSObject object,
String name,
JSObject value)
|
static void |
setProperty(JSObject object,
String name,
String value)
|
static void |
unsetProperty(JSObject object,
String name)
Unset/Clear the property with the given name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JSObjectHelper
public JSObjectHelper()
createObject
public static JSObject createObject()
createFunction
public static JSObject createFunction()
createArray
public static JSObject createArray()
setProperty
public static void setProperty(JSObject object,
String name,
int value)
getPropertyAsInt
public static int getPropertyAsInt(JSObject object,
String name)
setProperty
public static void setProperty(JSObject object,
String name,
String value)
getPropertyAsString
public static String getPropertyAsString(JSObject object,
String name)
setProperty
public static void setProperty(JSObject object,
String name,
boolean value)
getPropertyAsBoolean
public static boolean getPropertyAsBoolean(JSObject object,
String name)
setProperty
public static void setProperty(JSObject object,
String name,
float value)
getPropertyAsFloat
public static float getPropertyAsFloat(JSObject object,
String name)
setProperty
public static void setProperty(JSObject object,
String name,
double value)
getPropertyAsDouble
public static double getPropertyAsDouble(JSObject object,
String name)
setProperty
public static void setProperty(JSObject object,
String name,
JSObject value)
getProperty
public static JSObject getProperty(JSObject object,
String name)
setProperty
public static void setProperty(JSObject object,
String name,
com.google.gwt.user.client.Element value)
getPropertyAsDomElement
public static com.google.gwt.user.client.Element getPropertyAsDomElement(JSObject object,
String name)
getPropertyNames
public static String getPropertyNames(JSObject object)
hasProperty
public static boolean hasProperty(JSObject object,
String name)
unsetProperty
public static void unsetProperty(JSObject object,
String name)
- Unset/Clear the property with the given name. Uses the javascript operator delete
- Parameters:
object
- The object in which the property existsname
- The name of the property
ensureOpaqueArray
public static JSObject ensureOpaqueArray(JSObject object)
- Utility method for creating arguments to functions that take an array of objects.
- Parameters:
object
- - an opaque handle on a JavaScript object
- Returns:
- object - an opaque handle on a JavaScript object that is surely an Array
Copyright © 2011 sourceforge. All Rights Reserved.