Class AbstractScriptableObject
java.lang.Object
org.web3d.vrml.scripting.ecmascript.builtin.AbstractScriptableObject
- All Implemented Interfaces:
org.mozilla.javascript.Scriptable
- Direct Known Subclasses:
Browser,ComponentInfo,ComponentInfoArray,ExternProtoDeclaration,ExternProtoDeclarationArray,FieldDefinitionArray,ProfileInfo,ProfileInfoArray,ProtoDeclaration,ProtoDeclarationArray,Route,RouteArray,X3DConstants,X3DExecutionContext,X3DFieldDefinition
public abstract class AbstractScriptableObject
extends Object
implements org.mozilla.javascript.Scriptable
Base representation of all miscellaneous objects in ecmascript scripting.
- Version:
- $Revision: 1.1 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringError message when given a string that you parse for a number and it is not a valid format.protected booleanFlag to be set if the data has changedprotected static final StringError message when a property is being set and it is not a compatible javascript type with what is required.protected static final StringThe prefix of the name for any function call we dynamically look upprotected booleanFlag to say this field is read onlyprotected static final StringError message for when the field is marked readOnlyFields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault public constructor required by Rhino for when created by an Ecmascript call. -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(int index) Delete a property.voidDelete a property.get(int index, org.mozilla.javascript.Scriptable start) Get the variable at the given index.Get the value of the named function.The class name as defined to the Javascript function.getDefaultValue(Class hint) Return a default value for this.Object[]getIds()Get properties.org.mozilla.javascript.ScriptableFetch the parent scope of this context.org.mozilla.javascript.ScriptableGet the prototype used by this context.booleanhas(int index, org.mozilla.javascript.Scriptable start) Check for the indexed property presence.booleanCheck for the named property presence.booleanhasInstance(org.mozilla.javascript.Scriptable value) voidSets a property based on the index.voidSets the named property with a new value.voidsetParentScope(org.mozilla.javascript.Scriptable parent) Set the parent scope of this object.voidsetPrototype(org.mozilla.javascript.Scriptable proto) Ignored.voidSet this field to be read only.
-
Field Details
-
BAD_FORMAT_MSG
Error message when given a string that you parse for a number and it is not a valid format. The message assumes that you will tack on the passed in string as part of the message.- See Also:
-
INVALID_TYPE_MSG
Error message when a property is being set and it is not a compatible javascript type with what is required.- See Also:
-
READONLY_MSG
Error message for when the field is marked readOnly- See Also:
-
JS_FUNCTION_PREFIX
The prefix of the name for any function call we dynamically look up- See Also:
-
dataChanged
protected boolean dataChangedFlag to be set if the data has changed -
readOnly
protected boolean readOnlyFlag to say this field is read only
-
-
Constructor Details
-
AbstractScriptableObject
Default public constructor required by Rhino for when created by an Ecmascript call.- Parameters:
name- the class name of the script
-
-
Method Details
-
getClassName
The class name as defined to the Javascript function.- Specified by:
getClassNamein interfaceorg.mozilla.javascript.Scriptable- Returns:
- the name of this class
-
getDefaultValue
-
has
public boolean has(int index, org.mozilla.javascript.Scriptable start) Check for the indexed property presence. Always returns NOT_FOUND as ECMAScript doesn't support indexed objects.- Specified by:
hasin interfaceorg.mozilla.javascript.Scriptable- Returns:
- false (NOT_FOUND)
-
has
Check for the named property presence.- Specified by:
hasin interfaceorg.mozilla.javascript.Scriptable- Parameters:
name- name of the scriptstart- the script corresponding to the given name- Returns:
- true if it is a defined eventOut or field
-
get
Get the variable at the given index. Since we don't support integer index values for fields of the script, this always returns NOT_FOUND.- Specified by:
getin interfaceorg.mozilla.javascript.Scriptable- Returns:
- NOT_FOUND
-
get
Get the value of the named function. If no function object is registered for this name, the method will return null.- Specified by:
getin interfaceorg.mozilla.javascript.Scriptable- Parameters:
name- The variable namestart- The object where the lookup began- Returns:
- the corresponding function object or null
-
put
Sets a property based on the index. Since we don't support indexes, this is ignored.- Specified by:
putin interfaceorg.mozilla.javascript.Scriptable- Parameters:
index- The index of the property to setstart- The object who's property is being setvalue- The value being requested
-
put
Sets the named property with a new value. A put usually means changing the entire property. So, if the property has changed using an operation likee = new SFVec3f(0, 1, 0);then a whole new object is passed to us.- Specified by:
putin interfaceorg.mozilla.javascript.Scriptable- Parameters:
name- The name of the property to definestart- The object who's property is being setvalue- The value being requested
-
delete
public void delete(int index) Delete a property. There are no dynamic fields, so this does nothing.- Specified by:
deletein interfaceorg.mozilla.javascript.Scriptable- Parameters:
index- The index of the property to delete
-
delete
Delete a property. There are no dynamic fields, so this does nothing.- Specified by:
deletein interfaceorg.mozilla.javascript.Scriptable- Parameters:
name- The name of the property to delete
-
getIds
Get properties. We return an empty array since we define all properties to be DONTENUM.- Specified by:
getIdsin interfaceorg.mozilla.javascript.Scriptable- Returns:
- EMPTY_IDS
-
hasInstance
public boolean hasInstance(org.mozilla.javascript.Scriptable value) - Specified by:
hasInstancein interfaceorg.mozilla.javascript.Scriptable
-
getParentScope
public org.mozilla.javascript.Scriptable getParentScope()Fetch the parent scope of this context.- Specified by:
getParentScopein interfaceorg.mozilla.javascript.Scriptable- Returns:
- parentScope
-
setParentScope
public void setParentScope(org.mozilla.javascript.Scriptable parent) Set the parent scope of this object. Should be the global shared instance.- Specified by:
setParentScopein interfaceorg.mozilla.javascript.Scriptable- Parameters:
parent- new value for parentScope
-
getPrototype
public org.mozilla.javascript.Scriptable getPrototype()Get the prototype used by this context.- Specified by:
getPrototypein interfaceorg.mozilla.javascript.Scriptable- Returns:
- prototype
-
setPrototype
public void setPrototype(org.mozilla.javascript.Scriptable proto) Ignored. Set the prototype for this context. The context does not have a prototype that we want the user to play with.- Specified by:
setPrototypein interfaceorg.mozilla.javascript.Scriptable- Parameters:
proto- The prototype definition to use
-
setReadOnly
public void setReadOnly()Set this field to be read only. Once set, cannot be turned off.
-