XFA4J

com.adobe.xfa
Class HostPseudoModel

java.lang.Object
  extended by com.adobe.xfa.Obj
      extended by com.adobe.xfa.PseudoModel
          extended by com.adobe.xfa.HostPseudoModel

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.


Constructor Summary
HostPseudoModel()
          Instantiates a HostPseudoModel.
 
Method Summary
 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.
 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.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HostPseudoModel

public HostPseudoModel()
Instantiates a HostPseudoModel.

Method Detail

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 returns true. This method must be overridden in derived classes if HostPseudoModel.setCalculationsEnabled(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 returns true. This method must be overridden in derived classes if HostPseudoModel.setValidationsEnabled(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 - if true, the data is exported in XDP format; if false, 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:
HostPseudoModel.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 - if true, 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 display
sTitle - the title to appear in the title bar of the dialog window
nIcon - the icon to display in the dialog box
nType - 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:
HostPseudoModel.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 - if true, displays a print dialog box and prompts the user for printing setup information and confirmation of the action
nStart - the 0-based page number of the start page to print
nEnd - the 0-based page number of the end page to print
bSilent - if true, does not display the cancel dialog during the printing process
bShrinkToFit - if true, shrinks the page (if necessary) to fit within the imageable area of the printed page
bPrintAsImage - if true, prints each page as an image
bReverse - if true, prints the pages in reverse order
bAnnotation - if true, 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 user
sTitle - a string representing the title that appears in the title bar of the dialog box
sDefault - a string representing the default vlaue for the answer to the question
bPassword - if true, 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. When sSOMExpr 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. When node 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

importDataPermsCheck

public boolean importDataPermsCheck()
This method is called before any attempt to call the $host.importData() scripting method. The implementation should check the that all DataModel 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 the importData() scripting method should be allowed to proceed.
See Also:
HostPseudoModel.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. If nodes is empty, all nodes in FormModel derived from Container (as well as FormModel) should be checked to ensure that neither they nor any of their children have an ancestor that is locked. If nodes is not empty, the same test is applied to the nodes identified by the fully qualified reference expressions in nodes

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 the resetData() scripting method should be allowed to proceed.
See Also:
HostPseudoModel.resetData(List)

XFA4J

© 2005 Adobe Systems Incorporated. All Rights Reserved.