Class XFormImpl

java.lang.Object
com.groiss.xforms.XFormImpl

public abstract class XFormImpl extends Object
Wrapper for XForms implementation.
  • Field Details

    • xformNS

      public static final Namespace xformNS
      The XForms namespace.
  • Constructor Details

    • XFormImpl

      public XFormImpl()
  • Method Details

    • getInstance

      public static XFormImpl getInstance(HttpServletRequest req)
      Use this method to get the xforms implementation.
      Parameters:
      req - the HttpServletRequest, used for determining the client type. May be null.
    • setClientType

      public abstract void setClientType(HttpServletRequest req)
      Set the client type from request, called from getInstance.
      Parameters:
      req - servlet request, may be null.
    • showPage

      public abstract Page showPage(XHTMLPage p) throws Exception
      Convert an XHTMLPage with embedded XForms model and controls to a XHTML-Page suitable for the used browser.
      Parameters:
      p - the XHTMLPage containing XForms elements
      Returns:
      pure XHTML
      Throws:
      Exception
    • getFormInstance

      public abstract XFormInstance getFormInstance(HttpServletRequest req) throws Exception
      Get the XForms model and instance from the request. This method can be used, if you write an XForms submission.
      Parameters:
      req - the request from the server contains the Xforms model and instance data
      Returns:
      an object for accessing the model details
      Throws:
      Exception
    • getFormInstance

      public abstract XFormInstance getFormInstance(DMSForm form, FormContext ctx) throws Exception
      Get the XForms model from a form and form context. The form is converted to an XML structure, the field modes from the context ist used for creating the bindings.
      Parameters:
      form - a form object
      ctx -
      Returns:
      an object for accessing the model details
      Throws:
      Exception
    • sendFormInstance

      public abstract void sendFormInstance(XFormInstance inst, HttpServletResponse res) throws Exception
      Send the form instance back to the browser. This is the inverse function to getFormInstance(HttpServletRequest).
      Parameters:
      inst -
      res - method will write to the reponse
      Throws:
      Exception
    • sendFormInstance

      public abstract Element sendFormInstance(XFormInstance inst) throws Exception
      Normally, the changes of the form are sent back to the browser using the method sendFormInstance(XFormInstance,HttpServletResponse). This variant gives you the possibility to manipulate the XML, that is sent to the browser.
      Parameters:
      inst -
      Returns:
      Throws:
      Exception
    • sendFormInstance

      public abstract void sendFormInstance(XFormInstance inst, HttpServletResponse res, String[] repeatIds) throws Exception
      Send the form instance back to the browser. This is an extension to sendFormInstance(XFormInstance,HttpServletResponse): If parts of the model are changed, that are used in "repeat" elements, for example for adding or removing subforms, this use this method.
      Parameters:
      inst -
      res - method will write to the reponse
      repeatIds - an array of paths to the changed repeat data, for example "/data/form/subform[@id='1']/form"
      Throws:
      Exception
    • setShowInvalid

      public abstract void setShowInvalid(boolean val)
      Highlight the invalid elements on the client.
      Parameters:
      val - true for highlighting
    • setValues

      public abstract void setValues(DMSForm form, HttpServletRequest req) throws Exception
      Fill the form with the values from the request
      Parameters:
      form - a form object
      req -
      Throws:
      Exception
    • getResponsePage

      public abstract Page getResponsePage(Element res)
      wrapts the response-element in a suitable Page that supports streaming output
      Parameters:
      res - the response
      Returns:
      a Page that wrapps res