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:
java.io.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.ScriptableObjectThe 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAFTER_DATA_SET_FILLEDstatic java.lang.StringAFTER_GENERATIONstatic java.lang.StringAFTER_RENDERINGstatic java.lang.StringBEFORE_DATA_SET_FILLEDstatic java.lang.StringBEFORE_GENERATIONstatic java.lang.StringBEFORE_RENDERING
-
Constructor Summary
Constructors Constructor Description AbstractScriptHandler()The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.ObjectcallFunction(AbstractScriptHandler<?> sh, java.lang.String sFunction, java.lang.Object oArg1)Call JavaScript functions with one argument.static java.lang.ObjectcallFunction(AbstractScriptHandler<?> sh, java.lang.String sFunction, java.lang.Object oArg1, java.lang.Object oArg2)Call JavaScript functions with two arguments.static java.lang.ObjectcallFunction(AbstractScriptHandler<?> sh, java.lang.String sFunction, java.lang.Object oArg1, java.lang.Object oArg2, java.lang.Object oArg3)Call JavaScript functions with three arguments.java.lang.Objectevaluate(java.lang.String sScriptContent)Evaluates the given expression and returns the value.java.lang.StringgetClassName()org.mozilla.javascript.ScriptablegetScope()voidinit(org.mozilla.javascript.Scriptable scPrototype)Initialize the JavaScript context using given parent scope.voidregister(java.lang.String sScriptName, java.lang.String sScriptContent)Register the script content for current script handler.voidregisterExistingScriptableObject(org.mozilla.javascript.ScriptableObject so, java.lang.String sVarName)Registers an existing scriptable object into current JavaScript context.voidregisterNewScriptableObject(java.lang.Class<? extends org.mozilla.javascript.Scriptable> clsScriptable, java.lang.String sVarName)Registers a new scriptable object into current JavaScript context.voidregisterVariable(java.lang.String sVarName, java.lang.Object var)Registers a new variable to current JavaScript context.voidsetLocale(com.ibm.icu.util.ULocale lcl)Deprecated.Not used anymore.voidsetScriptClassLoader(IScriptClassLoader value)Sets the script class loader.voidsetScriptContext(IScriptContext csc)Sets the context object of current script handler.voidunregisterVariable(java.lang.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, delete, delete, delete, deleteProperty, deleteProperty, get, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, 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 Detail
-
BEFORE_DATA_SET_FILLED
public static final java.lang.String BEFORE_DATA_SET_FILLED
- See Also:
- Constant Field Values
-
AFTER_DATA_SET_FILLED
public static final java.lang.String AFTER_DATA_SET_FILLED
- See Also:
- Constant Field Values
-
BEFORE_GENERATION
public static final java.lang.String BEFORE_GENERATION
- See Also:
- Constant Field Values
-
AFTER_GENERATION
public static final java.lang.String AFTER_GENERATION
- See Also:
- Constant Field Values
-
BEFORE_RENDERING
public static final java.lang.String BEFORE_RENDERING
- See Also:
- Constant Field Values
-
AFTER_RENDERING
public static final java.lang.String AFTER_RENDERING
- See Also:
- Constant Field Values
-
-
Method Detail
-
getClassName
public final java.lang.String getClassName()
- Specified by:
getClassNamein interfaceorg.mozilla.javascript.Scriptable- Specified by:
getClassNamein classorg.mozilla.javascript.ScriptableObject
-
getScope
public final org.mozilla.javascript.Scriptable getScope()
- Returns:
- returns the scope of current JavaScript context.
-
setLocale
@Deprecated public final void setLocale(com.ibm.icu.util.ULocale lcl)
Deprecated.Not used anymore. Use IChartScriptContext to store the locale now. This is kept for backward compatibility only.- Parameters:
lcl-
-
setScriptClassLoader
public final void setScriptClassLoader(IScriptClassLoader value)
Sets the script class loader. This loader is responsible to load all user defined script class.- Parameters:
value-
-
init
public final void init(org.mozilla.javascript.Scriptable scPrototype) throws ChartExceptionInitialize 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, java.lang.String sVarName) throws ChartExceptionRegisters 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(java.lang.Class<? extends org.mozilla.javascript.Scriptable> clsScriptable, java.lang.String sVarName) throws ChartExceptionRegisters 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
public final void registerVariable(java.lang.String sVarName, java.lang.Object var) throws ChartExceptionRegisters a new variable to current JavaScript context. If the name already exists, it'll be overwritten.- Parameters:
sVarName-- Throws:
ChartException
-
unregisterVariable
public final void unregisterVariable(java.lang.String sVarName) throws ChartExceptionUnregister a variable from current JavaScript context.- Parameters:
sVarName-- Throws:
ChartException
-
callFunction
public static final java.lang.Object callFunction(AbstractScriptHandler<?> sh, java.lang.String sFunction, java.lang.Object oArg1) throws ChartException
Call JavaScript functions with one argument.- Parameters:
sh-sFunction-oArg1-- Throws:
ChartException
-
callFunction
public static final java.lang.Object callFunction(AbstractScriptHandler<?> sh, java.lang.String sFunction, java.lang.Object oArg1, java.lang.Object oArg2) throws ChartException
Call JavaScript functions with two arguments.- Parameters:
sh-sFunction-oArg1-oArg2-- Throws:
ChartException
-
callFunction
public static final java.lang.Object callFunction(AbstractScriptHandler<?> sh, java.lang.String sFunction, java.lang.Object oArg1, java.lang.Object oArg2, java.lang.Object oArg3) throws ChartException
Call JavaScript functions with three arguments.- Parameters:
sh-sFunction-oArg1-oArg2-oArg3-- Throws:
ChartException
-
evaluate
public final java.lang.Object evaluate(java.lang.String sScriptContent) throws ChartExceptionEvaluates the given expression and returns the value.- Parameters:
sScriptContent-- Throws:
ChartException
-
register
public final void register(java.lang.String sScriptName, java.lang.String sScriptContent) throws ChartExceptionRegister 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
public void setScriptContext(IScriptContext csc)
Sets the context object of current script handler.- Parameters:
csc-
-
-