Package com.groiss.xforms
Class XFormImpl
java.lang.Object
com.groiss.xforms.XFormImpl
Wrapper for XForms implementation.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract XFormInstance
getFormInstance
(DMSForm form, FormContext ctx) Get the XForms model from a form and form context.abstract XFormInstance
Get the XForms model and instance from the request.static XFormImpl
Use this method to get the xforms implementation.abstract Page
getResponsePage
(Element res) wrapts the response-element in a suitablePage
that supports streaming outputabstract Element
Normally, the changes of the form are sent back to the browser using the methodsendFormInstance(XFormInstance,HttpServletResponse)
.abstract void
sendFormInstance
(XFormInstance inst, HttpServletResponse res) Send the form instance back to the browser.abstract void
sendFormInstance
(XFormInstance inst, HttpServletResponse res, String[] repeatIds) Send the form instance back to the browser.abstract void
Set the client type from request, called from getInstance.abstract void
setShowInvalid
(boolean val) Highlight the invalid elements on the client.abstract void
setValues
(DMSForm form, HttpServletRequest req) Fill the form with the values from the requestabstract Page
Convert an XHTMLPage with embedded XForms model and controls to a XHTML-Page suitable for the used browser.
-
Field Details
-
xformNS
The XForms namespace.
-
-
Constructor Details
-
XFormImpl
public XFormImpl()
-
-
Method Details
-
getInstance
Use this method to get the xforms implementation.- Parameters:
req
- the HttpServletRequest, used for determining the client type. May be null.
-
setClientType
Set the client type from request, called from getInstance.- Parameters:
req
- servlet request, may be null.
-
showPage
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
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
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 objectctx
-- Returns:
- an object for accessing the model details
- Throws:
Exception
-
sendFormInstance
Send the form instance back to the browser. This is the inverse function togetFormInstance(HttpServletRequest)
.- Parameters:
inst
-res
- method will write to the reponse- Throws:
Exception
-
sendFormInstance
Normally, the changes of the form are sent back to the browser using the methodsendFormInstance(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 tosendFormInstance(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 reponserepeatIds
- 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
Fill the form with the values from the request- Parameters:
form
- a form objectreq
-- Throws:
Exception
-
getResponsePage
wrapts the response-element in a suitablePage
that supports streaming output- Parameters:
res
- the response- Returns:
- a
Page
that wrappsres
-