Package com.adobe.xfa
Class HostPseudoModel
java.lang.Object
com.adobe.xfa.Obj
com.adobe.xfa.PseudoModel
com.adobe.xfa.HostPseudoModel
- All Implemented Interfaces:
Peer
This is the base class for the host pseudo model ($host).
Each execution environment (server and client) needs to provide
an implementation appropriate for their context.
-
Field Summary
Fields inherited from interface com.adobe.xfa.ut.Peer
ATTR_CHANGED, CHILD_ADDED, CHILD_REMOVED, DESCENDENT_ADDED, DESCENDENT_ATTR_CHANGED, DESCENDENT_REMOVED, DESCENDENT_VALUE_CHANGED, PARENT_CHANGED, PERMS_LOCK_CLEARED, PERMS_LOCK_SET, PROTO_ATTR_CHANGED, PROTO_CHILD_ADDED, PROTO_CHILD_REMOVED, PROTO_DESCENDENT_ADDED, PROTO_DESCENDENT_ATTR_CHANGED, PROTO_DESCENDENT_REMOVED, PROTO_DESCENDENT_VALUE_CHANGED, PROTO_VALUE_CHANGED, UPDATED, VALUE_CHANGED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeep(int nBeep) Causes the system to play a sound.voidexportData(String sFilename, boolean bXDP) Exports the data from the current form in either XDP or XML format to a file.Returns the name of the client application in which this application is currently running.booleanDetermines whether calculate scripts will execute.Returns the current local time expressed as an ISO 8601 string using the format YYYYMMDDTHHMMSS.intGets the currently active page of a document at run time.intReturns the number of documents in the current batch.intReturns the ordinal number of the current document within the batch.getFocus()Returns the form object that currently has the input focus.Gets the language of the running host application.getName()Gets the name of the running host application.intGets the number of pages in the current document.Gets the platform of the machine running the script.getTitle()Gets the title of the document.booleanDetermines whether validations will execute.Gets the packaging of the application that is running the script.Gets the version number of the current application.voidRetrieves the specified URL.voidimportData(String sFilename) Imports data to the current form from a specified file.booleanThis method is called before any attempt to call the$host.importData()scripting method.intmessageBox(String sMessage, String sTitle, int nIcon, int nType) Displays a dialog box on the screen.metaData(int nOutputType) voidOpens the drop-down list specified by the parameter This method is only available for client applications.voidOpens the drop-down list specified by the reference syntax expression.voidpageDown()Moves to the next page of a form.voidpageUp()Moves to the next previous of a form.voidprint(boolean bUI, int nStart, int nEnd, boolean bSilent, boolean bShrinkToFit, boolean bPrintAsImage, boolean bReverse, boolean bAnnotation) Prints a specific number of pages from a document.voidResets the fields to their default values within the document.booleanresetDataPermsCheck(List<String> nodes) This method is called before any attempt to call the$host.resetData()scripting method.Displays a dialog box containing a question and an entry field for the user to reply to the question.voidsetCalculationsEnabled(boolean bEnabled) Determines whether calculate scripts will execute.voidsetCurrentPage(int nPage) Sets the currently active page of a document at run time.voidSets the focus to the form object specified by the parameter This method is only available for client applications.voidSets the focus to the form object specified by the reference syntax expression.voidSets the title of the document.voidsetValidationsEnabled(boolean bEnabled) Determines whether validations will execute.Methods inherited from class com.adobe.xfa.PseudoModel
getAliasObject, getClassName, getEventTableMethods inherited from class com.adobe.xfa.Obj
addPeer, addPeeredNode, clearPeers, deafen, getClassAtom, getClassTag, getPeer, getScriptMethodInfo, getScriptProperty, getScriptThis, invokeFunction, isDeaf, isMute, isSameClass, isSameClass, isSameClass, mute, notifyPeers, peerRemoved, removePeer, removePeeredNode, sendMessenge, setClass, setClassTag, setScriptProperty, unDeafen, unMute, updateFromPeer, validateUsage, validateUsageFailedIsFatal
-
Constructor Details
-
HostPseudoModel
public HostPseudoModel()Instantiates a HostPseudoModel.
-
-
Method Details
-
getScriptTable
- Overrides:
getScriptTablein classPseudoModel
-
getAppType
Returns the name of the client application in which this application is currently running. For example, in the context of a PDF form viewed in Adobe Reader, this property returns "Reader". This method must be overridden in derived classes if the$host.appTypescripting property is to be supported.- Returns:
- the name of the client application in which this application is currently running.
-
getCurrentPage
public int getCurrentPage()Gets the currently active page of a document at run time. Page values are 0-based, so the first page of a document returns a value of 0. This method must be overridden in derived classes if the$host.currentPagescripting property is to be supported.- Returns:
- the currently active page as a 0-based number
-
setCurrentPage
public void setCurrentPage(int nPage) Sets the currently active page of a document at run time. This method must be overridden in derived classes if the$host.currentPagescripting property is to be supported.- Parameters:
nPage- the 0-based page number to make active
-
getCurrentDateTime
Returns the current local time expressed as an ISO 8601 string using the format YYYYMMDDTHHMMSS. This class provides a default implementation for the$host.currentDateTime()scripting method, and derived classes do not normally need to override this implementation.- Returns:
- the current local time, expressed as an ISO 8601 string
-
getDocumentInBatch
public int getDocumentInBatch()Returns the ordinal number of the current document within the batch. Hosts which do not support batching will always return 0. The default implementation always returns 0. Derived classes can override this method to change the behavior of the$host.documentInBatch()scripting method.- Returns:
- the ordinal number of the current document within the batch
-
getDocumentCountInBatch
public int getDocumentCountInBatch()Returns the number of documents in the current batch. Hosts which do not support batching will always return 1. The default implementation always returns 1. Derived classes can override this method to change the behavior of the$host.documentCountInBatch()scripting method.- Returns:
- the number of documents in the current batch
-
getLanguage
Gets the language of the running host application. This method must be overridden in derived classes if the$host.languagescripting property is to be supported.- Returns:
- the language of the running host application
-
getName
Gets the name of the running host application. This method must be overridden in derived classes if the$host.namescripting property is to be supported.- Returns:
- the name of the running host application
-
getNumPages
public int getNumPages()Gets the number of pages in the current document. This method must be overridden in derived classes if the$host.numPagesscripting property is to be supported.- Returns:
- the number of pages in the current document
-
getPlatform
Gets the platform of the machine running the script. This method must be overridden in derived classes if the$host.platformscripting property is to be supported.- Returns:
- the platform of the machine running the script
-
getTitle
Gets the title of the document. This method must be overridden in derived classes if the$host.titlescripting property is to be supported.- Returns:
- the title of the document
-
setTitle
Sets the title of the document. This method must be overridden in derived classes if the$host.titlescripting property is to be supported.- Parameters:
sTitle- the title of the document
-
getVariation
Gets the packaging of the application that is running the script. This method must be overridden in derived classes if the$host.variationscripting property is to be supported.- Returns:
- the packaging of the application that is running the script
-
getVersion
Gets the version number of the current application. This method must be overridden in derived classes if the$host.versionscripting property is to be supported.- Returns:
- the version number of the current application
-
getCalculationsEnabled
public boolean getCalculationsEnabled()Determines whether calculate scripts will execute. The default implementation always returnstrue. This method must be overridden in derived classes ifsetCalculationsEnabled(boolean)is overridden.- Returns:
trueif calculate scripts are enabled.
-
setCalculationsEnabled
public void setCalculationsEnabled(boolean bEnabled) Determines whether calculate scripts will execute. This method must be overridden in derived classes if the$host.calculationsEnabledscripting property is to be supported.- Parameters:
bEnabled-trueif calculation scripts are enabled
-
getValidationsEnabled
public boolean getValidationsEnabled()Determines whether validations will execute. The default implementation always returnstrue. This method must be overridden in derived classes ifsetValidationsEnabled(boolean)is overridden.- Returns:
trueif validations are enabled.
-
setValidationsEnabled
public void setValidationsEnabled(boolean bEnabled) Determines whether validations will execute. This method must be overridden in derived classes if the$host.calculationsEnabledscripting property is to be supported.- Parameters:
bEnabled-trueif validations are enabled
-
beep
public void beep(int nBeep) Causes the system to play a sound. An implementation for a non-client application may do nothing. This method must be overridden in derived classes if the$host.beep()scripting function is to be supported.- Parameters:
nBeep- a system code for the appropriate sound
-
exportData
Exports the data from the current form in either XDP or XML format to a file. This method must be overridden in derived classes if the$host.exportData()scripting function is to be supported.- Parameters:
sFilename- the location and file name of the file where the data will export. In a client application, omitting this parameter causes a dialog box to open to let the user select the file manually.bXDP- iftrue, the data is exported in XDP format; iffalse, the data is exported as plain XML data.
-
importData
Imports data to the current form from a specified file. This method must be overridden in derived classes if the$host.importData()scripting function is to be supported.- Parameters:
sFilename- the location and name of the file from which the data will be imported. In a client application, if this parameter is an empty string, a dialog box opens to let the user select the file manually.- See Also:
-
gotoURL
Retrieves the specified URL. It is available only for client applications. This method must be overridden in derived classes if the$host.gotoURL()scripting function is to be supported.- Parameters:
sURL- a string representing a fully qualified or relative URL. The URL may contain a query string.bNewInstance- iftrue, the resulting pages are appended to the current document.
-
messageBox
Displays a dialog box on the screen. It is available only for client applications. This method must be overridden in derived classes if the$host.messageBox()scripting function is to be supported.- Parameters:
sMessage- the message to displaysTitle- the title to appear in the title bar of the dialog windownIcon- the icon to display in the dialog boxnType- the buttons to display- Returns:
- a value representing the button pressed by the user
-
resetData
Resets the fields to their default values within the document. This method must be overridden in derived classes if the$host.resetData()scripting function is to be supported.- Parameters:
oNodes- a comma-delimited list of SOM expressions of the fields to reset to their default values. If empty, all fields in the form are reset to their default values.- See Also:
-
print
public void print(boolean bUI, int nStart, int nEnd, boolean bSilent, boolean bShrinkToFit, boolean bPrintAsImage, boolean bReverse, boolean bAnnotation) Prints a specific number of pages from a document. This method is only available for client applications. This method must be overridden in derived classes if the$host.print()scripting function is to be supported.- Parameters:
bUI- iftrue, displays a print dialog box and prompts the user for printing setup information and confirmation of the actionnStart- the 0-based page number of the start page to printnEnd- the 0-based page number of the end page to printbSilent- iftrue, does not display the cancel dialog during the printing processbShrinkToFit- iftrue, shrinks the page (if necessary) to fit within the imageable area of the printed pagebPrintAsImage- iftrue, prints each page as an imagebReverse- iftrue, prints the pages in reverse orderbAnnotation- iftrue, prints all annotations
-
response
Displays a dialog box containing a question and an entry field for the user to reply to the question. This method is only available for client applications. This method must be overridden in derived classes if the$host.response()scripting function is to be supported.- Parameters:
sQuestion- a string representing a question for the usersTitle- a string representing the title that appears in the title bar of the dialog boxsDefault- a string representing the default vlaue for the answer to the questionbPassword- iftrue, masks the user's password with asterisks- Returns:
- a string representing the user's answer. If the user presses the cancel button on
the dialog box, the answer is
null
-
getFocus
Returns the form object that currently has the input focus. The method is only available for client applications. This method must be overridden in derived classes if the$host.getFocus()scripting function is to be supported.- Returns:
- the form object that currently has the input focus, or
nullif no form object has the input focus
-
setFocus
Sets the focus to the form object specified by the reference syntax expression. This method is only available for client applications. WhensSOMExpris null or empty,setFocusperforms a clear focus operation. This method must be overridden in derived classes if the$host.setFocus()scripting function is to be supported.- Parameters:
sSOMExpr- a fully qualified reference syntax expression for the form object
-
setFocus
Sets the focus to the form object specified by the parameter This method is only available for client applications. Whennodeis null or empty,setFocusperforms a clear focus operation. This method must be overridden in derived classes if the$host.setFocus()scripting function is to be supported.- Parameters:
node- the form node to set focus to
-
pageDown
public void pageDown()Moves to the next page of a form. This method must be overridden in derived classes if the$host.pageDown()scripting function is to be supported. -
pageUp
public void pageUp()Moves to the next previous of a form. This method must be overridden in derived classes if the$host.pageUp()scripting function is to be supported. -
openList
Opens the drop-down list specified by the reference syntax expression. This method is only available for client applications. This method must be overridden in derived classes if the$host.openList()scripting function is to be supported.- Parameters:
sSOMExpr- a fully qualified reference syntax expression that specifies a drop-down list
-
openList
Opens the drop-down list specified by the parameter This method is only available for client applications. This method must be overridden in derived classes if the$host.openList()scripting function is to be supported.- Parameters:
node- the drop-down list form object to open
-
metaData
-
importDataPermsCheck
public boolean importDataPermsCheck()This method is called before any attempt to call the$host.importData()scripting method. The implementation should check the that allDataModelnodes (excluding any data description nodes) are not locked. This method must be overridden in derived classes if the$host.importData()scripting function is to be supported.- Returns:
trueif the call to theimportData()scripting method should be allowed to proceed.- See Also:
-
resetDataPermsCheck
This method is called before any attempt to call the$host.resetData()scripting method. Ifnodesis empty, all nodes inFormModelderived fromContainer(as well asFormModel) should be checked to ensure that neither they nor any of their children have an ancestor that is locked. Ifnodesis not empty, the same test is applied to the nodes identified by the fully qualified reference expressions innodesThis method must be overridden in derived classes if the$host.resetData()scripting function is to be supported.- Parameters:
nodes- a list of fully qualified reference expressions of nodes to check- Returns:
trueif the call to theresetData()scripting method should be allowed to proceed.- See Also:
-