|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.htmlunit.corejs.javascript.ScriptableObject
com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
public class SimpleScriptable
Base class for Rhino host objects in HtmlUnit.
| Field Summary |
|---|
| Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
|---|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST |
| Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable |
|---|
NOT_FOUND |
| Constructor Summary | |
|---|---|
SimpleScriptable()
|
|
| Method Summary | ||
|---|---|---|
SimpleScriptable |
clone()
|
|
void |
defineFunctionProperties(String[] names,
Class<?> clazz,
int attributes)
Same as base implementation, but includes all methods inherited from super classes as well. |
|
void |
defineProperty(String propertyName,
Class<?> clazz,
int attributes)
Same as base implementation, but includes all methods inherited from super classes as well. |
|
protected Object |
equivalentValues(Object value)
|
|
Object |
get(String name,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Gets a named property from the object. |
|
BrowserVersion |
getBrowserVersion()
Gets the browser version currently used. |
|
String |
getClassName()
Returns the JavaScript class name. |
|
Object |
getDefaultValue(Class<?> hint)
Returns the JavaScript default value of this object. |
|
|
getDomNodeOrDie()
Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found. |
|
|
getDomNodeOrNull()
Returns the DOM node that corresponds to this JavaScript object or null if a node hasn't been set. |
|
protected net.sourceforge.htmlunit.corejs.javascript.Scriptable |
getPrototype(Class<? extends SimpleScriptable> javaScriptClass)
Gets the prototype object for the given host class. |
|
protected SimpleScriptable |
getScriptableFor(Object object)
Returns the JavaScript object that corresponds to the specified object. |
|
protected net.sourceforge.htmlunit.corejs.javascript.Scriptable |
getStartingScope()
Gets the scriptable used at starting scope for the execution of current script. |
|
protected org.apache.commons.collections.Transformer |
getTransformerScriptableFor()
Gets a transformer getting the scriptable element for an HtmlElement. |
|
Window |
getWindow()
Gets the window that is the top scope for this object. |
|
protected static Window |
getWindow(net.sourceforge.htmlunit.corejs.javascript.Scriptable s)
Gets the window that is the top scope for the specified object. |
|
protected Object |
getWithPreemption(String name)
Called by get(String, Scriptable) to allow retrieval of the property before the prototype
chain is searched. |
|
boolean |
hasInstance(net.sourceforge.htmlunit.corejs.javascript.Scriptable instance)
|
|
protected void |
initParentScope(DomNode domNode,
SimpleScriptable scriptable)
Initialize the parent scope of a newly created scriptable. |
|
protected boolean |
isReadOnlySettable(String name,
Object value)
|
|
SimpleScriptable |
makeScriptableFor(DomNode domNode)
Builds a new the JavaScript object that corresponds to the specified object. |
|
void |
setCaseSensitive(boolean caseSensitive)
Sets case sensitivity of all properties of this scriptable. |
|
void |
setDomNode(DomNode domNode)
Sets the DOM node that corresponds to this JavaScript object. |
|
protected void |
setDomNode(DomNode domNode,
boolean assignScriptObject)
Sets the DOM node that corresponds to this JavaScript object. |
|
void |
setHtmlElement(HtmlElement htmlElement)
Sets the HTML element that corresponds to this JavaScript object. |
|
void |
setParentScope(net.sourceforge.htmlunit.corejs.javascript.Scriptable m)
|
|
| Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
|---|
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setPrototype, size |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleScriptable()
| Method Detail |
|---|
public Object get(String name,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
getWithPreemption(String).
For fallback case just implement ScriptableWithFallbackGetter.
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptableget in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObjectprotected Object getWithPreemption(String name)
Called by get(String, Scriptable) to allow retrieval of the property before the prototype
chain is searched.
IMPORTANT: This method is invoked *very* often by Rhino. If you override this method, the implementation needs to be as fast as possible!
name - the property name
Scriptable.NOT_FOUND if not foundpublic String getClassName()
getClassName in interface net.sourceforge.htmlunit.corejs.javascript.ScriptablegetClassName in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
public <N extends DomNode> N getDomNodeOrDie()
throws IllegalStateException
N - the node type
IllegalStateException - If the DOM node could not be found.public <N extends DomNode> N getDomNodeOrNull()
N - the node type
public void setDomNode(DomNode domNode)
domNode - the DOM node
protected void setDomNode(DomNode domNode,
boolean assignScriptObject)
domNode - the DOM nodeassignScriptObject - If true, call setScriptObject on domNodepublic void setHtmlElement(HtmlElement htmlElement)
htmlElement - the HTML elementprotected SimpleScriptable getScriptableFor(Object object)
object - a DomNode or a WebWindow
public SimpleScriptable makeScriptableFor(DomNode domNode)
domNode - the DOM node for which a JS object should be created
protected void initParentScope(DomNode domNode,
SimpleScriptable scriptable)
domNode - the DOM node for the script objectscriptable - the script object to initializeprotected net.sourceforge.htmlunit.corejs.javascript.Scriptable getPrototype(Class<? extends SimpleScriptable> javaScriptClass)
javaScriptClass - the host class
protected org.apache.commons.collections.Transformer getTransformerScriptableFor()
HtmlElement.
public Object getDefaultValue(Class<?> hint)
getDefaultValue in interface net.sourceforge.htmlunit.corejs.javascript.ScriptablegetDefaultValue in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObjecthint - a hint as to the format of the default value (ignored in this case)
public Window getWindow()
throws RuntimeException
RuntimeException - if the window cannot be found, which should never occur
protected static Window getWindow(net.sourceforge.htmlunit.corejs.javascript.Scriptable s)
throws RuntimeException
s - the JavaScript object whose associated window is to be returned
RuntimeException - if the window cannot be found, which should never occurprotected net.sourceforge.htmlunit.corejs.javascript.Scriptable getStartingScope()
JavaScriptEngine.callFunction(com.gargoylesoftware.htmlunit.html.HtmlPage, net.sourceforge.htmlunit.corejs.javascript.Function, net.sourceforge.htmlunit.corejs.javascript.Scriptable, java.lang.Object[], com.gargoylesoftware.htmlunit.html.DomNode)
or JavaScriptEngine.execute(com.gargoylesoftware.htmlunit.html.HtmlPage, java.lang.String, java.lang.String, int).
public void defineProperty(String propertyName,
Class<?> clazz,
int attributes)
defineProperty in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
public void defineFunctionProperties(String[] names,
Class<?> clazz,
int attributes)
defineFunctionProperties in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObjectpublic BrowserVersion getBrowserVersion()
public boolean hasInstance(net.sourceforge.htmlunit.corejs.javascript.Scriptable instance)
hasInstance in interface net.sourceforge.htmlunit.corejs.javascript.ScriptablehasInstance in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObjectprotected Object equivalentValues(Object value)
equivalentValues in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObjectpublic SimpleScriptable clone()
clone in class Objectpublic void setCaseSensitive(boolean caseSensitive)
caseSensitive - case sensitive or no
protected boolean isReadOnlySettable(String name,
Object value)
isReadOnlySettable in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObjectpublic void setParentScope(net.sourceforge.htmlunit.corejs.javascript.Scriptable m)
setParentScope in interface net.sourceforge.htmlunit.corejs.javascript.ScriptablesetParentScope in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||