Package com.adobe.xfa
Class ScriptHandler
java.lang.Object
com.adobe.xfa.ScriptHandler
- Direct Known Subclasses:
FormCalcScriptHandler,RhinoScriptHandler
A 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 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe activity change reason.static final intThe activity click reason.static final intThe activity do close reason.static final intThe activity doc ready reason.static final intThe activity enter reason.static final intThe activity exit reason.static final intThe activity full reason.static final intThe activity index change reason.static final intAn activity initialize script reason.static final intThe activity mouse down reason.static final intThe activity mouse enter reason.static final intThe activity mouse exit reason.static final intThe activity mouse up reason.static final intThe activity post-execute reason.static final intThe activity post-open reason.static final intThe activity post-print reason.static final intThe activity post-save reason.static final intThe activity post-sign reason.static final intThe activity post-submit reason.static final intThe activity pre-execute reason.static final intThe activity pre-open reason.static final intThe activity pre-print reason.static final intAn activity pre-save script reason.static final intThe activity pre-sign reason.static final intThe activity pre-submit reason.static final intThe activity ready reason.static final intThe activity validation state reason.static final intstatic final intstatic final intstatic final intThe calculate script reason.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intThe predicate (when executing a predicate in a SOM expression) reason.static final intstatic final intstatic final intstatic final intThe unspecified script reason.static final intThe validate script reason. -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a script handler.ScriptHandler(ScriptDebugger oDebugger) Instantiates a script handler using the given debugger. -
Method Summary
Modifier and TypeMethodDescriptionabstract ScriptHandlerclone()Clones this script handler.static ScriptHandlercreateScriptHandler(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(List<String> oStack) Get the current stack frame.booleandebugGetVariables(List<String> oVarNames, List<Arg> oVarValues) Retrieve parallel lists of variable names and their values (lists have the same size).voidExecutes the given script.abstract voidexecuteOrSyntaxCheck(String script, Arg oReturnValue, int eReason, boolean bSyntaxCheckOnly) Executes or checks the syntax of the given script.static StringexecuteReasonToString(int eReason) Converts an executeReason into a string.static intexecuteReasonToXFAEnum(int eReason) Converts an executeReason into an XFAEnum.Get the debugger for this script handler.Gets the value of the given option.abstract StringGets 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.voidSets the value of the given option.static intstringToExecuteReason(String sReason) Converts a string into an executeReason.voidsyntaxCheck(String script) Checks the given script for syntax errors.booleanDetermines the severity of an error is returned from execute().
-
Field Details
-
UNSPECIFIED
public static final int UNSPECIFIEDThe unspecified script reason.- See Also:
-
CALCULATE
public static final int CALCULATEThe calculate script reason.- See Also:
-
VALIDATE
public static final int VALIDATEThe validate script reason.- See Also:
-
ACTIVITY_INITIALIZE
public static final int ACTIVITY_INITIALIZEAn activity initialize script reason.- See Also:
-
ACTIVITY_PRESAVE
public static final int ACTIVITY_PRESAVEAn activity pre-save script reason.- See Also:
-
ACTIVITY_POSTSAVE
public static final int ACTIVITY_POSTSAVEThe activity post-save reason.- See Also:
-
ACTIVITY_PREPRINT
public static final int ACTIVITY_PREPRINTThe activity pre-print reason.- See Also:
-
ACTIVITY_POSTPRINT
public static final int ACTIVITY_POSTPRINTThe activity post-print reason.- See Also:
-
ACTIVITY_READY
public static final int ACTIVITY_READYThe activity ready reason.- See Also:
-
ACTIVITY_DOCREADY
public static final int ACTIVITY_DOCREADYThe activity doc ready reason.- See Also:
-
ACTIVITY_DOCCLOSE
public static final int ACTIVITY_DOCCLOSEThe activity do close reason.- See Also:
-
ACTIVITY_PRESUBMIT
public static final int ACTIVITY_PRESUBMITThe activity pre-submit reason.- See Also:
-
ACTIVITY_PREEXECUTE
public static final int ACTIVITY_PREEXECUTEThe activity pre-execute reason.- See Also:
-
ACTIVITY_POSTEXECUTE
public static final int ACTIVITY_POSTEXECUTEThe activity post-execute reason.- See Also:
-
ACTIVITY_PREOPEN
public static final int ACTIVITY_PREOPENThe activity pre-open reason.- See Also:
-
ACTIVITY_INDEXCHANGE
public static final int ACTIVITY_INDEXCHANGEThe activity index change reason.- See Also:
-
PREDICATE
public static final int PREDICATEThe predicate (when executing a predicate in a SOM expression) reason.- See Also:
-
ACTIVITY_PRESIGN
public static final int ACTIVITY_PRESIGNThe activity pre-sign reason.- See Also:
-
ACTIVITY_POSTSIGN
public static final int ACTIVITY_POSTSIGNThe activity post-sign reason.- See Also:
-
ACTIVITY_POSTSUBMIT
public static final int ACTIVITY_POSTSUBMITThe activity post-submit reason.- See Also:
-
ACTIVITY_POSTOPEN
public static final int ACTIVITY_POSTOPENThe activity post-open reason.- See Also:
-
ACTIVITY_VALIDATIONSTATE
public static final int ACTIVITY_VALIDATIONSTATEThe activity validation state reason.- See Also:
-
ObjectInteraction_Start
public static final int ObjectInteraction_Start- See Also:
-
ACTIVITY_ENTER
public static final int ACTIVITY_ENTERThe activity enter reason.- See Also:
-
ACTIVITY_EXIT
public static final int ACTIVITY_EXITThe activity exit reason.- See Also:
-
ACTIVITY_MOUSEENTER
public static final int ACTIVITY_MOUSEENTERThe activity mouse enter reason.- See Also:
-
ACTIVITY_MOUSEEXIT
public static final int ACTIVITY_MOUSEEXITThe activity mouse exit reason.- See Also:
-
ACTIVITY_CHANGE
public static final int ACTIVITY_CHANGEThe activity change reason.- See Also:
-
ACTIVITY_CLICK
public static final int ACTIVITY_CLICKThe activity click reason.- See Also:
-
ACTIVITY_FULL
public static final int ACTIVITY_FULLThe activity full reason.- See Also:
-
ACTIVITY_MOUSEUP
public static final int ACTIVITY_MOUSEUPThe activity mouse up reason.- See Also:
-
ACTIVITY_MOUSEDOWN
public static final int ACTIVITY_MOUSEDOWNThe activity mouse down reason.- See Also:
-
ObjectInteraction_End
public static final int ObjectInteraction_End- See Also:
-
executeReason_LAST
public static final int executeReason_LAST- See Also:
-
ERR_OK
public static final int ERR_OK- See Also:
-
ERR_Syntax
public static final int ERR_Syntax- See Also:
-
ERR_BadBreakContinue
public static final int ERR_BadBreakContinue- See Also:
-
ERR_FuncBuiltIn
public static final int ERR_FuncBuiltIn- See Also:
-
ERR_FuncUnknown
public static final int ERR_FuncUnknown- See Also:
-
STEP_OVER
public static final int STEP_OVER- See Also:
-
STEP_INTO
public static final int STEP_INTO- See Also:
-
STEP_OUT
public static final int STEP_OUT- See Also:
-
BREAK
public static final int BREAK- See Also:
-
HALT
public static final int HALT- See Also:
-
BP_SET
public static final int BP_SET- See Also:
-
BP_CLEAR
public static final int BP_CLEAR- See Also:
-
FEATURE_NONE
public static final int FEATURE_NONE- See Also:
-
FEATURE_IS_REMOTE
public static final int FEATURE_IS_REMOTE- See Also:
-
FEATURE_CAN_SET_BREAKPOINT
public static final int FEATURE_CAN_SET_BREAKPOINT- See Also:
-
FEATURE_CAN_STEP_OVER
public static final int FEATURE_CAN_STEP_OVER- See Also:
-
FEATURE_CAN_STEP_INTO
public static final int FEATURE_CAN_STEP_INTO- See Also:
-
FEATURE_CAN_STEP_OUT
public static final int FEATURE_CAN_STEP_OUT- See Also:
-
FEATURE_CAN_BREAK
public static final int FEATURE_CAN_BREAK- See Also:
-
FEATURE_CAN_HALT
public static final int FEATURE_CAN_HALT- See Also:
-
-
Constructor Details
-
ScriptHandler
public ScriptHandler()Instantiates a script handler. -
ScriptHandler
Instantiates a script handler using the given debugger.- Parameters:
oDebugger- a script debugger.
-
-
Method Details
-
createScriptHandler
public static ScriptHandler createScriptHandler(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
Set the debugger for this script handler. Can also be specified in the constructor. -
executeOrSyntaxCheck
public abstract void executeOrSyntaxCheck(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
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
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
Gets the name of the scripting language supported by this script handler.- Returns:
- the name of the scripting language.
-
setOption
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
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
Clones this script handler.- Returns:
- a copy of this script handler.
-
stringToExecuteReason
Converts a string into an executeReason.- Returns:
- the executeReason representing the string (UNSPECIFIED if not recognized).
-
executeReasonToString
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
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
Get the current stack frame. -
debugGetVariables
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
Removes any script references to the node and the descendants
-