com.gargoylesoftware.htmlunit.javascript
Class ScriptableWrapper

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.ScriptableWrapper
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class ScriptableWrapper
extends org.mozilla.javascript.ScriptableObject

Simple wrapper to make "normal" object scriptable according to specific configuration and allowing use of index properties. TODO: Configuration of the properties and functions should occur from the xml configuration according to the browser to simulate.

Version:
$Revision: 1.3 $
Author:
Marc Guillemot
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
ScriptableWrapper(org.mozilla.javascript.Scriptable scope, java.lang.Object javaObject, java.lang.Class staticType)
 Constructs a wrapper for the java object.
 
Method Summary
 java.lang.Object get(int index, org.mozilla.javascript.Scriptable start)
 
 java.lang.Object get(java.lang.String name, org.mozilla.javascript.Scriptable start)
 
 java.lang.String getClassName()
 
 java.lang.Object getDefaultValue(java.lang.Class hint)
 
 java.lang.Object getWrappedObject()
 Gets the java object made availabe to javascript through this wrapper
 boolean has(java.lang.String name, org.mozilla.javascript.Scriptable start)
 
 java.lang.String jsToString()
 To use as "toString" function in javascript
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptableWrapper

public ScriptableWrapper(org.mozilla.javascript.Scriptable scope,
                         java.lang.Object javaObject,
                         java.lang.Class staticType)
Constructs a wrapper for the java object.

Parameters:
scope - the scope of the executing script
javaObject - the javaObject to wrap
staticType - the static type of the object
Method Detail

get

public java.lang.Object get(int index,
                            org.mozilla.javascript.Scriptable start)

Specified by:
get in interface org.mozilla.javascript.Scriptable
Overrides:
get in class org.mozilla.javascript.ScriptableObject
See Also:
ScriptableObject.get(int, org.mozilla.javascript.Scriptable)

get

public java.lang.Object get(java.lang.String name,
                            org.mozilla.javascript.Scriptable start)

Specified by:
get in interface org.mozilla.javascript.Scriptable
Overrides:
get in class org.mozilla.javascript.ScriptableObject
See Also:
ScriptableObject.get(java.lang.String, org.mozilla.javascript.Scriptable)

getClassName

public java.lang.String getClassName()

Specified by:
getClassName in interface org.mozilla.javascript.Scriptable
Specified by:
getClassName in class org.mozilla.javascript.ScriptableObject
See Also:
ScriptableObject.getClassName()

getDefaultValue

public java.lang.Object getDefaultValue(java.lang.Class hint)

Specified by:
getDefaultValue in interface org.mozilla.javascript.Scriptable
Overrides:
getDefaultValue in class org.mozilla.javascript.ScriptableObject
See Also:
ScriptableObject.getDefaultValue(java.lang.Class)

getWrappedObject

public java.lang.Object getWrappedObject()
Gets the java object made availabe to javascript through this wrapper

Returns:
the wrapped object

has

public boolean has(java.lang.String name,
                   org.mozilla.javascript.Scriptable start)

Specified by:
has in interface org.mozilla.javascript.Scriptable
Overrides:
has in class org.mozilla.javascript.ScriptableObject
See Also:
ScriptableObject.has(java.lang.String, org.mozilla.javascript.Scriptable)

jsToString

public java.lang.String jsToString()
To use as "toString" function in javascript

Returns:
the string representation


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.