Package org.eclipse.birt.chart.script
Class AbstractScriptHandler<T>
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.eclipse.birt.chart.script.AbstractScriptHandler<T>
- All Implemented Interfaces:
Serializable
,org.mozilla.javascript.ConstProperties
,org.mozilla.javascript.debug.DebuggableObject
,org.mozilla.javascript.Scriptable
,org.mozilla.javascript.SymbolScriptable
- Direct Known Subclasses:
ScriptHandler
public abstract class AbstractScriptHandler<T>
extends org.mozilla.javascript.ScriptableObject
The abstract class defines methods to execute java function and java script
functions, it makes the sub-class can execute own regular java functions and
java script functions.
- Since:
- 2.5
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.ScriptableObject.KeyComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final Object
callFunction
(AbstractScriptHandler<?> sh, String sFunction, Object oArg1) Call JavaScript functions with one argument.static final Object
callFunction
(AbstractScriptHandler<?> sh, String sFunction, Object oArg1, Object oArg2) Call JavaScript functions with two arguments.static final Object
callFunction
(AbstractScriptHandler<?> sh, String sFunction, Object oArg1, Object oArg2, Object oArg3) Call JavaScript functions with three arguments.final Object
Evaluates the given expression and returns the value.final String
final org.mozilla.javascript.Scriptable
getScope()
final void
init
(org.mozilla.javascript.Scriptable scPrototype) Initialize the JavaScript context using given parent scope.final void
Register the script content for current script handler.final void
registerExistingScriptableObject
(org.mozilla.javascript.ScriptableObject so, String sVarName) Registers an existing scriptable object into current JavaScript context.final void
registerNewScriptableObject
(Class<? extends org.mozilla.javascript.Scriptable> clsScriptable, String sVarName) Registers a new scriptable object into current JavaScript context.final void
registerVariable
(String sVarName, Object var) Registers a new variable to current JavaScript context.final void
setLocale
(com.ibm.icu.util.ULocale lcl) Deprecated.Not used anymore.final void
Sets the script class loader.void
Sets the context object of current script handler.final void
unregisterVariable
(String sVarName) Unregister a variable from current JavaScript context.Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, get, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isConst, isEmpty, isExtensible, isSealed, preventExtensions, put, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Field Details
-
BEFORE_DATA_SET_FILLED
- See Also:
-
AFTER_DATA_SET_FILLED
- See Also:
-
BEFORE_GENERATION
- See Also:
-
AFTER_GENERATION
- See Also:
-
BEFORE_RENDERING
- See Also:
-
AFTER_RENDERING
- See Also:
-
-
Constructor Details
-
AbstractScriptHandler
public AbstractScriptHandler()The constructor.
-
-
Method Details
-
getClassName
- Specified by:
getClassName
in interfaceorg.mozilla.javascript.Scriptable
- Specified by:
getClassName
in classorg.mozilla.javascript.ScriptableObject
-
getScope
public final org.mozilla.javascript.Scriptable getScope()- Returns:
- returns the scope of current JavaScript context.
-
setLocale
Deprecated.Not used anymore. Use IChartScriptContext to store the locale now. This is kept for backward compatibility only.- Parameters:
lcl
-
-
setScriptClassLoader
Sets the script class loader. This loader is responsible to load all user defined script class.- Parameters:
value
-
-
init
Initialize the JavaScript context using given parent scope.- Parameters:
scPrototype
- Parent scope object. If it's null, use default scope.- Throws:
ChartException
-
registerExistingScriptableObject
public final void registerExistingScriptableObject(org.mozilla.javascript.ScriptableObject so, String sVarName) throws ChartException Registers an existing scriptable object into current JavaScript context.- Parameters:
so
- The existing scriptable object to be registeredsVarName
- The name of the javascript variable associated with the new scriptable object that will be added to the scope- Throws:
ChartException
-
registerNewScriptableObject
public final void registerNewScriptableObject(Class<? extends org.mozilla.javascript.Scriptable> clsScriptable, String sVarName) throws ChartException Registers a new scriptable object into current JavaScript context.- Parameters:
clsScriptable
- The class representing the new scriptable object to be registeredsVarName
- The name of the javascript variable associated with the new scriptable object that will be added to the scope- Throws:
ChartException
-
registerVariable
Registers a new variable to current JavaScript context. If the name already exists, it'll be overwritten.- Parameters:
sVarName
-- Throws:
ChartException
-
unregisterVariable
Unregister a variable from current JavaScript context.- Parameters:
sVarName
-- Throws:
ChartException
-
callFunction
public static final Object callFunction(AbstractScriptHandler<?> sh, String sFunction, Object oArg1) throws ChartException Call JavaScript functions with one argument.- Parameters:
sh
-sFunction
-oArg1
-- Throws:
ChartException
-
callFunction
public static final Object callFunction(AbstractScriptHandler<?> sh, String sFunction, Object oArg1, Object oArg2) throws ChartException Call JavaScript functions with two arguments.- Parameters:
sh
-sFunction
-oArg1
-oArg2
-- Throws:
ChartException
-
callFunction
public static final Object callFunction(AbstractScriptHandler<?> sh, String sFunction, Object oArg1, Object oArg2, Object oArg3) throws ChartException Call JavaScript functions with three arguments.- Parameters:
sh
-sFunction
-oArg1
-oArg2
-oArg3
-- Throws:
ChartException
-
evaluate
Evaluates the given expression and returns the value.- Parameters:
sScriptContent
-- Throws:
ChartException
-
register
Register the script content for current script handler.- Parameters:
sScriptContent
- This is either the JavaSciprt code content or a full class name which has implementedIChartItemScriptHandler
- Throws:
ChartException
-
setScriptContext
Sets the context object of current script handler.- Parameters:
csc
-
-