Class UFSFormInterface

java.lang.Object
com.ebasetech.ufs.kernel.UFSFormInterface
All Implemented Interfaces:
java.io.Serializable

public class UFSFormInterface
extends java.lang.Object
implements java.io.Serializable
This class represents the external interface to a running Ebase form. It allows information to be extracted from the form for use by other programs or Java Server Pages (JSPs) running within the same web application. It also allows form field values to be changed.

Example of instantiating UFSFormInterface from a JSP is :

<%@ page language="java" import="com.ebasetech.ufs.kernel.*"%>
<% UFSFormInterface form = UFSFormInterface.getFormInterface(); %>

Information can then be extracted from the form and presented on the page. For example, to display the current page name :

Page name: <%=form.getCurrentPage()%>

Version:
2.4
Author:
Jon Rickard 30 Jan 2002
See Also:
Serialized Form
  • Constructor Summary

    Constructors
    Constructor Description
    UFSFormInterface​(com.ebasetech.ufs.runtime.HeadlessUserState headlessUserState)
    UFSFormInterface constructor - internal use only
  • Method Summary

    Modifier and Type Method Description
    void addScratchPadObject​(java.lang.String name, java.lang.Object obj)
    Add an object to the scratchpad area
    java.lang.String calculateFontSize​(java.lang.String sizeString)
    Deprecated.
    from V4.0 with no replacement.
    void commitTransaction()
    Commits the current transaction and starts a new transaction.
    void deleteAllRows​(java.lang.String tableFieldName)
    Delete all rows from a table
    com.ebasetech.xi.api.Client getClientApi()
    Returns the Api Client object that provides information about the browser client.
    java.lang.String getCurrentPage()  
    java.lang.String getFieldValue​(java.lang.String fieldName)
    Returns the string value of the field requested, or null if the field does not exist in the form.
    com.ebasetech.ufs.beans.FormBean getForm()  
    com.ebasetech.xi.api.WebForm getFormApi()
    Returns the Api WebForm object that provides access to the form Api.
    static UFSFormInterface getFormInterface()
    Returns the current UFSFormInterface object to external callers.
    java.lang.String getFormName()
    returns the name of the form
    com.ebasetech.ufs.kernel.FormSession getFormSessionContext()
    Returns the FormSession context object for the user session.
    com.ebasetech.xi.api.Gateway getGateway()
    Returns the Api System object that provides access to common services and information.
    com.ebasetech.ufs.runtime.HeadlessUserState getHeadlessUserState()  
    com.ebasetech.ufs.kernel.FormInterfaceLogger getLogger()  
    java.lang.String getMessageText​(java.lang.String project, int messageId, java.util.Vector parms)
    Deprecated.
    from V5.0 use getMessageText(String, List) instead
    java.lang.String getMessageText​(java.lang.String messageId, java.util.List<java.lang.Object> parms)
    Returns a message text.
    java.lang.Object[] getPages​(boolean allPages)
    Returns a list of the form's pages - in order as much as possible
    com.ebasetech.xi.api.Project getProject()
    Returns the Api Project object that provides access to the project functions.
    java.lang.String getRelativeFieldName​(java.lang.String fieldName)  
    java.lang.String getRelativePageName​(java.lang.String pageName)  
    java.lang.String getRelativeTextId​(java.lang.String textId)  
    java.lang.Object getScratchPadObject​(java.lang.String name)
    Get an object from the scratchpad area
    com.ebasetech.ufs.scripts.ScriptContext getScriptContext()  
    com.ebasetech.xi.api.Services getServicesApi()
    Returns the Api Services object that provides access to various services such as FileServices.
    javax.servlet.http.HttpSession getSessionContext()
    Returns the HttpSession context object for the user session.
    com.ebasetech.xi.api.EbaseSystem getSystem()
    Returns the Api System object that provides access to common services and information.
    TableDataInterface getTableData​(java.lang.String tableFieldName)  
    java.lang.String getText​(int textId)
    Deprecated.
    getText(textId, namespace) should be used.
    java.lang.String getText​(java.lang.String textId, java.lang.String namespace)
    returns the text for the corresponding textid in the form's language
    int getZoomAmount()
    Deprecated.
    from V4.0 with no replacement.
    void insertRow​(java.lang.String tableFieldName, boolean empty)
    Insert a new row to a table.
    boolean isBatchMode()
    Returns true if the system is operating in batch mode.
    boolean isDisplayInColour()
    Deprecated.
    from V4.0 with no replacement.
    boolean isJavascriptEnabled()
    can Javascript be used with this browser connection
    boolean isUseStylesheets()
    Deprecated.
    from V4.0 with no replacement.
    void logFormError​(java.lang.String errorMsg)
    Log an error message.
    void logFormInfo​(java.lang.String infoMsg)
    Log an information message.
    void removeScratchPadObject​(java.lang.String name)
    Remove an object from the scratchpad area
    void rollbackTransaction()
    Rolls back the current transaction and starts a new transaction.
    void setErrorMessage​(int messageNo, java.util.Vector messageParameters)
    Deprecated.
    void setErrorMessage​(java.lang.String messageText)
    Add a simple error message to the current control where the error message text is supplied as messageText.
    void setErrorMessageText​(java.lang.String textId, java.util.List<java.lang.String> messageParameters)
    Add an error message to the current control.
    void setFieldList​(java.lang.String fieldName, java.util.Vector values)
    Use this method to dynamically add a list to a form field.
    void setFieldValue​(java.lang.String fieldName, java.lang.Object value)
    Sets a new value for the specified type.
    void setHeadlessUserState​(com.ebasetech.ufs.runtime.HeadlessUserState hadlessUserState)  
    void setScriptContext​(com.ebasetech.ufs.runtime.EventScriptContext scriptContext)  
    void setTableData​(java.lang.String tableFieldName, TableDataInterface tableData)  
    void setWarningMessage​(int messageNo, java.util.Vector messageParameters)
    Add an warning message to the current control.
    void setWarningMessageText​(java.lang.String textId, java.util.List<java.lang.String> messageParameters)
    Add an warning message to the current control.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UFSFormInterface

      public UFSFormInterface​(com.ebasetech.ufs.runtime.HeadlessUserState headlessUserState)
      UFSFormInterface constructor - internal use only
  • Method Details

    • getHeadlessUserState

      public com.ebasetech.ufs.runtime.HeadlessUserState getHeadlessUserState()
    • getCurrentPage

      public java.lang.String getCurrentPage()
    • getFieldValue

      public java.lang.String getFieldValue​(java.lang.String fieldName)
      Returns the string value of the field requested, or null if the field does not exist in the form.
    • getFormName

      public java.lang.String getFormName()
      returns the name of the form
    • getPages

      public java.lang.Object[] getPages​(boolean allPages)
      Returns a list of the form's pages - in order as much as possible
    • getText

      public java.lang.String getText​(int textId)
      Deprecated.
      getText(textId, namespace) should be used.
      returns the text for the corresponding textid in the form's language
      Parameters:
      textId - is the unique text id number
    • getText

      public java.lang.String getText​(java.lang.String textId, java.lang.String namespace)
      returns the text for the corresponding textid in the form's language
      Parameters:
      textId - is the unique text id string
      namespace - is the text namespace and should be one of 'Local', 'Shared' or 'System'
    • setErrorMessage

      public void setErrorMessage​(int messageNo, java.util.Vector messageParameters) throws com.ebasetech.ufs.kernel.FormException
      Deprecated.
      Add an error message to the current control. This method supports multi-lingual messages, and substitution of values into the message text. messageNo - is a pre-defined message number within the same project as the form messageParameters - is a vector of Strings containing the same number of values as the number of replaceable variables within the message. e.g. Message : "Value && invalid for customer &&" requires a vector of two values. Calling this method stops form processing and returns the form page to the user displaying the error. No further FPL script commands will be executed.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • setErrorMessageText

      public void setErrorMessageText​(java.lang.String textId, java.util.List<java.lang.String> messageParameters) throws com.ebasetech.ufs.kernel.FormException
      Add an error message to the current control. This method supports multi-lingual messages, and substitution of values into the message text. Calling this method stops form processing and returns the form page to the user displaying the error. No further script commands will be executed.
      Parameters:
      textId - the text id of the text to be added as a message, texts can be defined in form/component texts or in linked texts files
      messageParameters - a list of Strings containing the same number of values as the number of replaceable variables within the message. e.g. Message : "Value && invalid for customer &&" requires a list of two values.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • setErrorMessage

      public void setErrorMessage​(java.lang.String messageText) throws com.ebasetech.ufs.kernel.FormException
      Add a simple error message to the current control where the error message text is supplied as messageText. This method does not support warning messages, multi-lingual messages, or substitution of field values into messages. To use any of these options, use the alternative setErrorMessage and setWarningMessage methods. Calling this method stops form processing and returns the form page to the user displaying the error. No further FPL script commands will be executed.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • setFieldList

      public void setFieldList​(java.lang.String fieldName, java.util.Vector values) throws com.ebasetech.ufs.kernel.FormException
      Use this method to dynamically add a list to a form field. The values vector contains a list of com.ebasetech.ufs.kernel.SelectValue objects each one of which contains a display value, a return value, and optionally a display sequence. See SelectValue javadoc. If a list already exists for the field, it will be replaced.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • setFieldValue

      public void setFieldValue​(java.lang.String fieldName, java.lang.Object value) throws com.ebasetech.ufs.kernel.FormException
      Sets a new value for the specified type. Will throw FormException if the field type is not compatible with the object type.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • setWarningMessage

      public void setWarningMessage​(int messageNo, java.util.Vector messageParameters) throws com.ebasetech.ufs.kernel.FormException
      Add an warning message to the current control. This method supports multi-lingual messages, and substitution of values into the message text. messageNo - is a pre-defined message number within the same project as the form messageParameters - is a vector of Strings containing the same number of values as the number of replaceable variables within the message. e.g. Message : "Value && invalid for customer &&" requires a vector of two values.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • setWarningMessageText

      public void setWarningMessageText​(java.lang.String textId, java.util.List<java.lang.String> messageParameters) throws com.ebasetech.ufs.kernel.FormException
      Add an warning message to the current control. This method supports multi-lingual messages, and substitution of values into the message text.
      Parameters:
      textId - the text id of the text to be added as a message, texts can be defined in form/component texts or in linked texts files
      messageParameters - a list of Strings containing the same number of values as the number of replaceable variables within the message. e.g. Message : "Value && invalid for customer &&" requires a list of two values.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • addScratchPadObject

      public void addScratchPadObject​(java.lang.String name, java.lang.Object obj)
      Add an object to the scratchpad area
    • getScratchPadObject

      public java.lang.Object getScratchPadObject​(java.lang.String name)
      Get an object from the scratchpad area
    • removeScratchPadObject

      public void removeScratchPadObject​(java.lang.String name)
      Remove an object from the scratchpad area
    • setScriptContext

      public void setScriptContext​(com.ebasetech.ufs.runtime.EventScriptContext scriptContext)
    • getRelativeFieldName

      public java.lang.String getRelativeFieldName​(java.lang.String fieldName)
    • getRelativePageName

      public java.lang.String getRelativePageName​(java.lang.String pageName)
    • getRelativeTextId

      public java.lang.String getRelativeTextId​(java.lang.String textId)
    • getTableData

      public TableDataInterface getTableData​(java.lang.String tableFieldName) throws com.ebasetech.ufs.kernel.FormException
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • setTableData

      public void setTableData​(java.lang.String tableFieldName, TableDataInterface tableData) throws com.ebasetech.ufs.kernel.FormException
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • insertRow

      public void insertRow​(java.lang.String tableFieldName, boolean empty) throws com.ebasetech.ufs.kernel.FormException
      Insert a new row to a table.
      Parameters:
      tableFieldName - field name for an existing table
      empty - true if the row should be marked as empty. see documentation for insertRow FPL command.
      Throws:
      com.ebasetech.ufs.kernel.FormException - will throw a FormException if tableFieldName is not a table
    • deleteAllRows

      public void deleteAllRows​(java.lang.String tableFieldName) throws com.ebasetech.ufs.kernel.FormException
      Delete all rows from a table
      Parameters:
      tableFieldName - field name for an existing table
      Throws:
      com.ebasetech.ufs.kernel.FormException - will throw a FormException if tableFieldName is not a table
    • isJavascriptEnabled

      public boolean isJavascriptEnabled()
      can Javascript be used with this browser connection
    • getZoomAmount

      public int getZoomAmount()
      Deprecated.
      from V4.0 with no replacement. The zoom facility is no longer supported.
    • isDisplayInColour

      public boolean isDisplayInColour()
      Deprecated.
      from V4.0 with no replacement. The ability to suppress colour is no longer supported.
    • isUseStylesheets

      public boolean isUseStylesheets()
      Deprecated.
      from V4.0 with no replacement. Output is always rendered using CSS regardless of whether this is supported by the browser.
    • calculateFontSize

      public java.lang.String calculateFontSize​(java.lang.String sizeString)
      Deprecated.
      from V4.0 with no replacement. Zoom options are not applicable in V4.0. Returns the value of sizeString
      Adjusts the font size passed by incrementing it by the zoom amount and converting it to the appropriate units depending on whether or not the client browser supports style sheets. This allows the font size to react to dynamic changes such as the user clicking accessibility buttons The algorithms used in this calculation are the same as those used to adjust font sizes specified in the presentation template. sizeString can be a number ending in 'px', 'em' or '%'. e.g. '12px', '0.9em', '110%' Any other formats are returned unadjusted.
    • getSessionContext

      public javax.servlet.http.HttpSession getSessionContext()
      Returns the HttpSession context object for the user session. This can be used to store and retrieve user-related parameters and data. Note that the HttpSession context and all attributes it contains are automatically released when the session expires.
    • getFormSessionContext

      public com.ebasetech.ufs.kernel.FormSession getFormSessionContext()
      Returns the FormSession context object for the user session. There is one FormSession object for each end-user browser window. This can be used to store and retrieve parameters and data that relate to one specific execution of a form. This is in contrast to method getSessionContext() that returns the HttpSession object that applies to the entire session.
    • logFormError

      public void logFormError​(java.lang.String errorMsg)
      Log an error message. The message will appear on the server log and will also be visible to the designer using View --> execution log.
    • logFormInfo

      public void logFormInfo​(java.lang.String infoMsg)
      Log an information message. The message will appear on the server log and will also be visible to the designer using View --> execution log.
    • isBatchMode

      public boolean isBatchMode()
      Returns true if the system is operating in batch mode. i.e. no browser client exists.
    • rollbackTransaction

      public void rollbackTransaction() throws com.ebasetech.ufs.kernel.FormTransactionException
      Rolls back the current transaction and starts a new transaction.
      Throws:
      com.ebasetech.ufs.kernel.FormTransactionException
    • commitTransaction

      public void commitTransaction() throws com.ebasetech.ufs.kernel.FormTransactionException
      Commits the current transaction and starts a new transaction.
      Throws:
      com.ebasetech.ufs.kernel.FormTransactionException
    • getMessageText

      public java.lang.String getMessageText​(java.lang.String project, int messageId, java.util.Vector parms) throws com.ebasetech.ufs.kernel.FormException
      Deprecated.
      from V5.0 use getMessageText(String, List) instead
      Returns a message text. In a multi-lingual system, the same rules are applied to select the language as are used to display a text using the FPL message command. Parameters: project - the project name messageId - the message number parms - a Vector of String objects which will be substituted into && variables in the message text.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • getMessageText

      public java.lang.String getMessageText​(java.lang.String messageId, java.util.List<java.lang.Object> parms) throws com.ebasetech.ufs.kernel.FormException
      Returns a message text. In a multi-lingual system, the same rules are applied to select the language as are used to display a text using the FPL message command or one of the Javascript API addXxxMessage() methods.
      Parameters:
      messageId - text id of the text to be added as a message, texts can be defined in form/component texts or in linked texts files
      parms - a list of String objects which will be substituted into && variables in the message text.
      Throws:
      com.ebasetech.ufs.kernel.FormException
    • getForm

      public com.ebasetech.ufs.beans.FormBean getForm()
    • getFormApi

      public com.ebasetech.xi.api.WebForm getFormApi()
      Returns the Api WebForm object that provides access to the form Api.
      Returns:
      WebForm
      Since:
      V4.4
    • getClientApi

      public com.ebasetech.xi.api.Client getClientApi()
      Returns the Api Client object that provides information about the browser client.
      Returns:
      Client
      Since:
      V4.4
    • getServicesApi

      public com.ebasetech.xi.api.Services getServicesApi()
      Returns the Api Services object that provides access to various services such as FileServices.
      Returns:
      Services
      Since:
      V5.1
    • getSystem

      public com.ebasetech.xi.api.EbaseSystem getSystem()
      Returns the Api System object that provides access to common services and information.
      Returns:
      System
      Since:
      V4.4
    • getProject

      public com.ebasetech.xi.api.Project getProject()
      Returns the Api Project object that provides access to the project functions.
      Returns:
      project
      Since:
      V5.13
    • getGateway

      public com.ebasetech.xi.api.Gateway getGateway()
      Returns the Api System object that provides access to common services and information.
      Returns:
      System
      Since:
      V4.4
    • getLogger

      public com.ebasetech.ufs.kernel.FormInterfaceLogger getLogger()
    • getFormInterface

      public static UFSFormInterface getFormInterface()
      Returns the current UFSFormInterface object to external callers. This method is intended for use with JSP's to gain access to form information. Object is constructed on demand;
    • setHeadlessUserState

      public void setHeadlessUserState​(com.ebasetech.ufs.runtime.HeadlessUserState hadlessUserState)
    • getScriptContext

      public com.ebasetech.ufs.scripts.ScriptContext getScriptContext()