Package com.adobe.xfa
Class ScriptHandler
- java.lang.Object
-
- com.adobe.xfa.ScriptHandler
-
- Direct Known Subclasses:
FormCalcScriptHandler,RhinoScriptHandler
public abstract class ScriptHandler extends java.lang.ObjectA base class to handle scripting engines. A script handler is used by an XFA application model to enable scripting support. A script handler provides support for one particular language.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScriptHandler.ScriptException
-
Field Summary
Fields Modifier and Type Field Description static intACTIVITY_CHANGEThe activity change reason.static intACTIVITY_CLICKThe activity click reason.static intACTIVITY_DOCCLOSEThe activity do close reason.static intACTIVITY_DOCREADYThe activity doc ready reason.static intACTIVITY_ENTERThe activity enter reason.static intACTIVITY_EXITThe activity exit reason.static intACTIVITY_FULLThe activity full reason.static intACTIVITY_INDEXCHANGEThe activity index change reason.static intACTIVITY_INITIALIZEAn activity initialize script reason.static intACTIVITY_MOUSEDOWNThe activity mouse down reason.static intACTIVITY_MOUSEENTERThe activity mouse enter reason.static intACTIVITY_MOUSEEXITThe activity mouse exit reason.static intACTIVITY_MOUSEUPThe activity mouse up reason.static intACTIVITY_POSTEXECUTEThe activity post-execute reason.static intACTIVITY_POSTOPENThe activity post-open reason.static intACTIVITY_POSTPRINTThe activity post-print reason.static intACTIVITY_POSTSAVEThe activity post-save reason.static intACTIVITY_POSTSIGNThe activity post-sign reason.static intACTIVITY_POSTSUBMITThe activity post-submit reason.static intACTIVITY_PREEXECUTEThe activity pre-execute reason.static intACTIVITY_PREOPENThe activity pre-open reason.static intACTIVITY_PREPRINTThe activity pre-print reason.static intACTIVITY_PRESAVEAn activity pre-save script reason.static intACTIVITY_PRESIGNThe activity pre-sign reason.static intACTIVITY_PRESUBMITThe activity pre-submit reason.static intACTIVITY_READYThe activity ready reason.static intACTIVITY_VALIDATIONSTATEThe activity validation state reason.static intBP_CLEARstatic intBP_SETstatic intBREAKstatic intCALCULATEThe calculate script reason.static intERR_BadBreakContinuestatic intERR_FuncBuiltInstatic intERR_FuncUnknownstatic intERR_OKstatic intERR_Syntaxstatic intexecuteReason_LASTstatic intFEATURE_CAN_BREAKstatic intFEATURE_CAN_HALTstatic intFEATURE_CAN_SET_BREAKPOINTstatic intFEATURE_CAN_STEP_INTOstatic intFEATURE_CAN_STEP_OUTstatic intFEATURE_CAN_STEP_OVERstatic intFEATURE_IS_REMOTEstatic intFEATURE_NONEstatic intHALTstatic intObjectInteraction_Endstatic intObjectInteraction_Startstatic intPREDICATEThe predicate (when executing a predicate in a SOM expression) reason.static intSTEP_INTOstatic intSTEP_OUTstatic intSTEP_OVERstatic intUNSPECIFIEDThe unspecified script reason.static intVALIDATEThe validate script reason.
-
Constructor Summary
Constructors Constructor Description ScriptHandler()Instantiates a script handler.ScriptHandler(ScriptDebugger oDebugger)Instantiates a script handler using the given debugger.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract ScriptHandlerclone()Clones this script handler.static ScriptHandlercreateScriptHandler(java.lang.String contentType, AppModel appModel, ScriptDebugger debugger)Deprecated.This won't work in client environments.booleandebugBreakPoint(int nScriptID, int nLine, int eSetType)Set or clear a break-point.booleandebugCommand(int eCmd)Set an internal flag in the script handler indicating that, when control is returned to the script handler, it should perform a step-over, step-into or step-out function (calling the stopped callback on the associated debugger).booleandebugGetStack(java.util.List<java.lang.String> oStack)Get the current stack frame.booleandebugGetVariables(java.util.List<java.lang.String> oVarNames, java.util.List<Arg> oVarValues)Retrieve parallel lists of variable names and their values (lists have the same size).voidexecute(java.lang.String script, java.lang.String locale, Arg returnValue, int eReason)Executes the given script.abstract voidexecuteOrSyntaxCheck(java.lang.String script, Arg oReturnValue, int eReason, boolean bSyntaxCheckOnly)Executes or checks the syntax of the given script.static java.lang.StringexecuteReasonToString(int eReason)Converts an executeReason into a string.static intexecuteReasonToXFAEnum(int eReason)Converts an executeReason into an XFAEnum.ScriptDebuggergetDebugger()Get the debugger for this script handler.java.lang.StringgetOption(java.lang.String sOptionName)Gets the value of the given option.abstract java.lang.StringlanguageName()Gets the name of the scripting language supported by this script handler.voidremoveReference(Node oNode)Removes any script references to the node and the descendantsvoidsetDebugger(ScriptDebugger oDebugger)Set the debugger for this script handler.voidsetOption(java.lang.String sOptionName, java.lang.String sOptionValue)Sets the value of the given option.static intstringToExecuteReason(java.lang.String sReason)Converts a string into an executeReason.voidsyntaxCheck(java.lang.String script)Checks the given script for syntax errors.booleanwasFatalError()Determines the severity of an error is returned from execute().
-
-
-
Field Detail
-
UNSPECIFIED
public static final int UNSPECIFIED
The unspecified script reason.- See Also:
- Constant Field Values
-
CALCULATE
public static final int CALCULATE
The calculate script reason.- See Also:
- Constant Field Values
-
VALIDATE
public static final int VALIDATE
The validate script reason.- See Also:
- Constant Field Values
-
ACTIVITY_INITIALIZE
public static final int ACTIVITY_INITIALIZE
An activity initialize script reason.- See Also:
- Constant Field Values
-
ACTIVITY_PRESAVE
public static final int ACTIVITY_PRESAVE
An activity pre-save script reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTSAVE
public static final int ACTIVITY_POSTSAVE
The activity post-save reason.- See Also:
- Constant Field Values
-
ACTIVITY_PREPRINT
public static final int ACTIVITY_PREPRINT
The activity pre-print reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTPRINT
public static final int ACTIVITY_POSTPRINT
The activity post-print reason.- See Also:
- Constant Field Values
-
ACTIVITY_READY
public static final int ACTIVITY_READY
The activity ready reason.- See Also:
- Constant Field Values
-
ACTIVITY_DOCREADY
public static final int ACTIVITY_DOCREADY
The activity doc ready reason.- See Also:
- Constant Field Values
-
ACTIVITY_DOCCLOSE
public static final int ACTIVITY_DOCCLOSE
The activity do close reason.- See Also:
- Constant Field Values
-
ACTIVITY_PRESUBMIT
public static final int ACTIVITY_PRESUBMIT
The activity pre-submit reason.- See Also:
- Constant Field Values
-
ACTIVITY_PREEXECUTE
public static final int ACTIVITY_PREEXECUTE
The activity pre-execute reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTEXECUTE
public static final int ACTIVITY_POSTEXECUTE
The activity post-execute reason.- See Also:
- Constant Field Values
-
ACTIVITY_PREOPEN
public static final int ACTIVITY_PREOPEN
The activity pre-open reason.- See Also:
- Constant Field Values
-
ACTIVITY_INDEXCHANGE
public static final int ACTIVITY_INDEXCHANGE
The activity index change reason.- See Also:
- Constant Field Values
-
PREDICATE
public static final int PREDICATE
The predicate (when executing a predicate in a SOM expression) reason.- See Also:
- Constant Field Values
-
ACTIVITY_PRESIGN
public static final int ACTIVITY_PRESIGN
The activity pre-sign reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTSIGN
public static final int ACTIVITY_POSTSIGN
The activity post-sign reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTSUBMIT
public static final int ACTIVITY_POSTSUBMIT
The activity post-submit reason.- See Also:
- Constant Field Values
-
ACTIVITY_POSTOPEN
public static final int ACTIVITY_POSTOPEN
The activity post-open reason.- See Also:
- Constant Field Values
-
ACTIVITY_VALIDATIONSTATE
public static final int ACTIVITY_VALIDATIONSTATE
The activity validation state reason.- See Also:
- Constant Field Values
-
ObjectInteraction_Start
public static final int ObjectInteraction_Start
- See Also:
- Constant Field Values
-
ACTIVITY_ENTER
public static final int ACTIVITY_ENTER
The activity enter reason.- See Also:
- Constant Field Values
-
ACTIVITY_EXIT
public static final int ACTIVITY_EXIT
The activity exit reason.- See Also:
- Constant Field Values
-
ACTIVITY_MOUSEENTER
public static final int ACTIVITY_MOUSEENTER
The activity mouse enter reason.- See Also:
- Constant Field Values
-
ACTIVITY_MOUSEEXIT
public static final int ACTIVITY_MOUSEEXIT
The activity mouse exit reason.- See Also:
- Constant Field Values
-
ACTIVITY_CHANGE
public static final int ACTIVITY_CHANGE
The activity change reason.- See Also:
- Constant Field Values
-
ACTIVITY_CLICK
public static final int ACTIVITY_CLICK
The activity click reason.- See Also:
- Constant Field Values
-
ACTIVITY_FULL
public static final int ACTIVITY_FULL
The activity full reason.- See Also:
- Constant Field Values
-
ACTIVITY_MOUSEUP
public static final int ACTIVITY_MOUSEUP
The activity mouse up reason.- See Also:
- Constant Field Values
-
ACTIVITY_MOUSEDOWN
public static final int ACTIVITY_MOUSEDOWN
The activity mouse down reason.- See Also:
- Constant Field Values
-
ObjectInteraction_End
public static final int ObjectInteraction_End
- See Also:
- Constant Field Values
-
executeReason_LAST
public static final int executeReason_LAST
- See Also:
- Constant Field Values
-
ERR_OK
public static final int ERR_OK
- See Also:
- Constant Field Values
-
ERR_Syntax
public static final int ERR_Syntax
- See Also:
- Constant Field Values
-
ERR_BadBreakContinue
public static final int ERR_BadBreakContinue
- See Also:
- Constant Field Values
-
ERR_FuncBuiltIn
public static final int ERR_FuncBuiltIn
- See Also:
- Constant Field Values
-
ERR_FuncUnknown
public static final int ERR_FuncUnknown
- See Also:
- Constant Field Values
-
STEP_OVER
public static final int STEP_OVER
- See Also:
- Constant Field Values
-
STEP_INTO
public static final int STEP_INTO
- See Also:
- Constant Field Values
-
STEP_OUT
public static final int STEP_OUT
- See Also:
- Constant Field Values
-
BREAK
public static final int BREAK
- See Also:
- Constant Field Values
-
HALT
public static final int HALT
- See Also:
- Constant Field Values
-
BP_SET
public static final int BP_SET
- See Also:
- Constant Field Values
-
BP_CLEAR
public static final int BP_CLEAR
- See Also:
- Constant Field Values
-
FEATURE_NONE
public static final int FEATURE_NONE
- See Also:
- Constant Field Values
-
FEATURE_IS_REMOTE
public static final int FEATURE_IS_REMOTE
- See Also:
- Constant Field Values
-
FEATURE_CAN_SET_BREAKPOINT
public static final int FEATURE_CAN_SET_BREAKPOINT
- See Also:
- Constant Field Values
-
FEATURE_CAN_STEP_OVER
public static final int FEATURE_CAN_STEP_OVER
- See Also:
- Constant Field Values
-
FEATURE_CAN_STEP_INTO
public static final int FEATURE_CAN_STEP_INTO
- See Also:
- Constant Field Values
-
FEATURE_CAN_STEP_OUT
public static final int FEATURE_CAN_STEP_OUT
- See Also:
- Constant Field Values
-
FEATURE_CAN_BREAK
public static final int FEATURE_CAN_BREAK
- See Also:
- Constant Field Values
-
FEATURE_CAN_HALT
public static final int FEATURE_CAN_HALT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ScriptHandler
public ScriptHandler()
Instantiates a script handler.
-
ScriptHandler
public ScriptHandler(ScriptDebugger oDebugger)
Instantiates a script handler using the given debugger.- Parameters:
oDebugger- a script debugger.
-
-
Method Detail
-
createScriptHandler
public static ScriptHandler createScriptHandler(java.lang.String contentType, AppModel appModel, ScriptDebugger debugger)
Deprecated.This won't work in client environments.Create a new ScriptHandler that can handle a given contentType.- Parameters:
contentType- the contentType of the script.appModel- the AppModel that contains the context for the script.debugger- the ScriptDebugger for debugging the script, or null if debugging is not required.- Returns:
- a new ScriptHandler.
- Throws:
ExFull- if the contentType is not recognized.
-
setDebugger
public void setDebugger(ScriptDebugger oDebugger)
Set the debugger for this script handler. Can also be specified in the constructor.
-
executeOrSyntaxCheck
public abstract void executeOrSyntaxCheck(java.lang.String script, Arg oReturnValue, int eReason, boolean bSyntaxCheckOnly)Executes or checks the syntax of the given script.- Parameters:
script- the script to execute.oReturnValue- the return value of the script.eReason- the reason for the execution of the script.bSyntaxCheckOnly- the flag to only check syntax when set.- Throws:
ExFull- whenever errors are reported.
-
execute
public void execute(java.lang.String script, java.lang.String locale, Arg returnValue, int eReason)Executes the given script.- Parameters:
script- the script to execute.locale- the operating locale.returnValue- the return value of the script.eReason- the reason for the execution of the script.- Throws:
ExFull- whenever errors are reported.
-
syntaxCheck
public void syntaxCheck(java.lang.String script)
Checks the given script for syntax errors. Errors are reported in the form of a scriptException exception (scriptException derives from ExFull).- Parameters:
script- the script to execute.- Throws:
ScriptHandler.ScriptException- upon syntax error. ScriptException derives from ExFull.
-
languageName
public abstract java.lang.String languageName()
Gets the name of the scripting language supported by this script handler.- Returns:
- the name of the scripting language.
-
setOption
public void setOption(java.lang.String sOptionName, java.lang.String sOptionValue)Sets the value of the given option. If the option is unknown, the call is ignored.- Parameters:
sOptionName- the name of the option to set.sOptionValue- the value to set.
-
getOption
public java.lang.String getOption(java.lang.String sOptionName)
Gets the value of the given option. If the option is unknown, the empty string is returned.- Parameters:
sOptionName- the name of the option to get.- Returns:
- the value of the specified option as a string.
-
wasFatalError
public boolean wasFatalError()
Determines the severity of an error is returned from execute().
-
clone
public abstract ScriptHandler clone()
Clones this script handler.- Returns:
- a copy of this script handler.
-
stringToExecuteReason
public static int stringToExecuteReason(java.lang.String sReason)
Converts a string into an executeReason.- Returns:
- the executeReason representing the string (UNSPECIFIED if not recognized).
-
executeReasonToString
public static java.lang.String executeReasonToString(int eReason)
Converts an executeReason into a string.- Returns:
- the string representing the executeReason ("other" if not recognized).
-
executeReasonToXFAEnum
public static int executeReasonToXFAEnum(int eReason)
Converts an executeReason into an XFAEnum.- Returns:
- the XFAEnum corresponding to the executeReason (NULL if not recognized). Note in particular that UNSPECIFIED, CALCULATE, and VALIDATE have no XFAEnum equivalent.
-
getDebugger
public ScriptDebugger getDebugger()
Get the debugger for this script handler.
-
debugCommand
public boolean debugCommand(int eCmd)
Set an internal flag in the script handler indicating that, when control is returned to the script handler, it should perform a step-over, step-into or step-out function (calling the stopped callback on the associated debugger).
-
debugBreakPoint
public boolean debugBreakPoint(int nScriptID, int nLine, int eSetType)Set or clear a break-point.
-
debugGetStack
public boolean debugGetStack(java.util.List<java.lang.String> oStack)
Get the current stack frame.
-
debugGetVariables
public boolean debugGetVariables(java.util.List<java.lang.String> oVarNames, java.util.List<Arg> oVarValues)Retrieve parallel lists of variable names and their values (lists have the same size). Note that this will only give meaningful results when stopped at a break-point.
-
removeReference
public void removeReference(Node oNode)
Removes any script references to the node and the descendants
-
-