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
public abstract class HostPseudoModel extends PseudoModel
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 Constructor Description HostPseudoModel()
Instantiates a HostPseudoModel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beep(int nBeep)
Causes the system to play a sound.void
exportData(java.lang.String sFilename, boolean bXDP)
Exports the data from the current form in either XDP or XML format to a file.java.lang.String
getAppType()
Returns the name of the client application in which this application is currently running.boolean
getCalculationsEnabled()
Determines whether calculate scripts will execute.java.lang.String
getCurrentDateTime()
Returns the current local time expressed as an ISO 8601 string using the format YYYYMMDDTHHMMSS.int
getCurrentPage()
Gets the currently active page of a document at run time.int
getDocumentCountInBatch()
Returns the number of documents in the current batch.int
getDocumentInBatch()
Returns the ordinal number of the current document within the batch.Obj
getFocus()
Returns the form object that currently has the input focus.java.lang.String
getLanguage()
Gets the language of the running host application.java.lang.String
getName()
Gets the name of the running host application.int
getNumPages()
Gets the number of pages in the current document.java.lang.String
getPlatform()
Gets the platform of the machine running the script.ScriptTable
getScriptTable()
java.lang.String
getTitle()
Gets the title of the document.boolean
getValidationsEnabled()
Determines whether validations will execute.java.lang.String
getVariation()
Gets the packaging of the application that is running the script.java.lang.String
getVersion()
Gets the version number of the current application.void
gotoURL(java.lang.String sURL, boolean bNewInstance)
Retrieves the specified URL.void
importData(java.lang.String sFilename)
Imports data to the current form from a specified file.boolean
importDataPermsCheck()
This method is called before any attempt to call the$host.importData()
scripting method.int
messageBox(java.lang.String sMessage, java.lang.String sTitle, int nIcon, int nType)
Displays a dialog box on the screen.java.lang.String
metaData(int nOutputType)
void
openList(Node node)
Opens the drop-down list specified by the parameter This method is only available for client applications.void
openList(java.lang.String sSOMExpr)
Opens the drop-down list specified by the reference syntax expression.void
pageDown()
Moves to the next page of a form.void
pageUp()
Moves to the next previous of a form.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.void
resetData(java.util.List<java.lang.String> oNodes)
Resets the fields to their default values within the document.boolean
resetDataPermsCheck(java.util.List<java.lang.String> nodes)
This method is called before any attempt to call the$host.resetData()
scripting method.java.lang.String
response(java.lang.String sQuestion, java.lang.String sTitle, java.lang.String sDefault, boolean bPassword)
Displays a dialog box containing a question and an entry field for the user to reply to the question.void
setCalculationsEnabled(boolean bEnabled)
Determines whether calculate scripts will execute.void
setCurrentPage(int nPage)
Sets the currently active page of a document at run time.void
setFocus(Node node)
Sets the focus to the form object specified by the parameter This method is only available for client applications.void
setFocus(java.lang.String sSOMExpr)
Sets the focus to the form object specified by the reference syntax expression.void
setTitle(java.lang.String sTitle)
Sets the title of the document.void
setValidationsEnabled(boolean bEnabled)
Determines whether validations will execute.-
Methods inherited from class com.adobe.xfa.PseudoModel
getAliasObject, getClassName, getEventTable
-
Methods 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
-
-
-
-
Method Detail
-
getScriptTable
public ScriptTable getScriptTable()
- Overrides:
getScriptTable
in classPseudoModel
-
getAppType
public java.lang.String 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.appType
scripting 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.currentPage
scripting 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.currentPage
scripting property is to be supported.- Parameters:
nPage
- the 0-based page number to make active
-
getCurrentDateTime
public java.lang.String 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
public java.lang.String getLanguage()
Gets the language of the running host application. This method must be overridden in derived classes if the$host.language
scripting property is to be supported.- Returns:
- the language of the running host application
-
getName
public java.lang.String getName()
Gets the name of the running host application. This method must be overridden in derived classes if the$host.name
scripting 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.numPages
scripting property is to be supported.- Returns:
- the number of pages in the current document
-
getPlatform
public java.lang.String getPlatform()
Gets the platform of the machine running the script. This method must be overridden in derived classes if the$host.platform
scripting property is to be supported.- Returns:
- the platform of the machine running the script
-
getTitle
public java.lang.String getTitle()
Gets the title of the document. This method must be overridden in derived classes if the$host.title
scripting property is to be supported.- Returns:
- the title of the document
-
setTitle
public void setTitle(java.lang.String sTitle)
Sets the title of the document. This method must be overridden in derived classes if the$host.title
scripting property is to be supported.- Parameters:
sTitle
- the title of the document
-
getVariation
public java.lang.String getVariation()
Gets the packaging of the application that is running the script. This method must be overridden in derived classes if the$host.variation
scripting property is to be supported.- Returns:
- the packaging of the application that is running the script
-
getVersion
public java.lang.String getVersion()
Gets the version number of the current application. This method must be overridden in derived classes if the$host.version
scripting 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:
true
if 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.calculationsEnabled
scripting property is to be supported.- Parameters:
bEnabled
-true
if 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:
true
if 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.calculationsEnabled
scripting property is to be supported.- Parameters:
bEnabled
-true
if 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
public void exportData(java.lang.String sFilename, boolean bXDP)
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
public void importData(java.lang.String sFilename)
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:
importDataPermsCheck()
-
gotoURL
public void gotoURL(java.lang.String sURL, boolean bNewInstance)
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
public int messageBox(java.lang.String sMessage, java.lang.String sTitle, int nIcon, int nType)
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
public void resetData(java.util.List<java.lang.String> oNodes)
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:
resetDataPermsCheck(List)
-
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
public java.lang.String response(java.lang.String sQuestion, java.lang.String sTitle, java.lang.String sDefault, boolean bPassword)
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
public Obj 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
null
if no form object has the input focus
-
setFocus
public void setFocus(java.lang.String sSOMExpr)
Sets the focus to the form object specified by the reference syntax expression. This method is only available for client applications. WhensSOMExpr
is null or empty,setFocus
performs 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
public void setFocus(Node node)
Sets the focus to the form object specified by the parameter This method is only available for client applications. Whennode
is null or empty,setFocus
performs 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
public void openList(java.lang.String sSOMExpr)
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
public void openList(Node node)
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
public java.lang.String metaData(int nOutputType)
-
importDataPermsCheck
public boolean importDataPermsCheck()
This method is called before any attempt to call the$host.importData()
scripting method. The implementation should check the that allDataModel
nodes (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:
true
if the call to theimportData()
scripting method should be allowed to proceed.- See Also:
importData(String)
-
resetDataPermsCheck
public boolean resetDataPermsCheck(java.util.List<java.lang.String> nodes)
This method is called before any attempt to call the$host.resetData()
scripting method. Ifnodes
is empty, all nodes inFormModel
derived fromContainer
(as well asFormModel
) should be checked to ensure that neither they nor any of their children have an ancestor that is locked. Ifnodes
is not empty, the same test is applied to the nodes identified by the fully qualified reference expressions innodes
This 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:
true
if the call to theresetData()
scripting method should be allowed to proceed.- See Also:
resetData(List)
-
-