|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.web.forms.xforms.Schema2XForms
public class Schema2XForms
An abstract implementation of the Schema2XForms interface allowing an XForm to be automatically generated for an XML Schema definition. This abstract class implements the buildForm and buildFormAsString methods and associated helper but relies on concrete subclasses to implement other required interface methods (createXXX, startXXX, and endXXX methods).
Nested Class Summary | |
---|---|
static class |
Schema2XForms.SubmitMethod
|
Constructor Summary | |
---|---|
Schema2XForms(java.lang.String action,
Schema2XForms.SubmitMethod submitMethod,
java.lang.String base,
boolean formatCaption)
Creates a new Schema2XForms object. |
Method Summary | |
---|---|
protected void |
addChoicesForSelectControl(org.w3c.dom.Document xForm,
org.w3c.dom.Element choicesElement,
java.util.Map choiceValues,
java.util.ResourceBundle resourceBundle)
_UNDOCUMENTED_ |
protected java.util.Map |
addChoicesForSelectSwitchControl(org.w3c.dom.Document xformsDocument,
org.w3c.dom.Element formSection,
java.util.List choiceValues,
java.lang.String typeBindId)
|
org.alfresco.util.Pair |
buildXForm(org.w3c.dom.Document instanceDocument,
org.w3c.dom.Document schemaDocument,
java.lang.String rootElementName,
java.util.ResourceBundle resourceBundle)
Generate the XForm based on a user supplied XML Schema. |
java.lang.String |
createCaption(java.lang.String text)
Creates a caption for the provided text extracted from the XML Schema. |
java.lang.String |
createCaption(java.lang.String text,
org.apache.xerces.xs.XSAnnotation annotation,
java.util.ResourceBundle resourceBundle)
|
java.lang.String |
createCaption(java.lang.String text,
org.apache.xerces.xs.XSObject o,
java.util.ResourceBundle resourceBundle)
|
java.lang.String |
createCaption(org.apache.xerces.xs.XSAttributeDeclaration attribute,
java.util.ResourceBundle resourceBundle)
Creates a caption for the provided XML Schema attribute. |
java.lang.String |
createCaption(org.apache.xerces.xs.XSAttributeUse attribute,
java.util.ResourceBundle resourceBundle)
|
java.lang.String |
createCaption(org.apache.xerces.xs.XSElementDeclaration element,
java.util.ResourceBundle resourceBundle)
Creates a caption for the provided XML Schema element. |
java.lang.String |
createCaption(org.apache.xerces.xs.XSObject element,
java.util.ResourceBundle resourceBundle)
|
org.w3c.dom.Element |
createControlForAnyType(org.w3c.dom.Document xformsDocument,
java.lang.String caption,
org.apache.xerces.xs.XSTypeDefinition controlType)
Creates a form control for an XML Schema any type. |
org.w3c.dom.Element |
createControlForAtomicType(org.w3c.dom.Document xformsDocument,
org.apache.xerces.xs.XSSimpleTypeDefinition controlType,
org.apache.xerces.xs.XSObject owner,
java.lang.String caption,
java.util.ResourceBundle resourceBundle)
Creates a form control for an XML Schema simple atomic type. |
org.w3c.dom.Element |
createControlForEnumerationType(org.w3c.dom.Document xformsDocument,
org.apache.xerces.xs.XSSimpleTypeDefinition controlType,
org.apache.xerces.xs.XSObject owner,
java.lang.String caption,
org.w3c.dom.Element bindElement,
java.util.ResourceBundle resourceBundle)
Creates a form control for an XML Schema simple type restricted by an enumeration. |
org.w3c.dom.Element |
createControlForListType(org.w3c.dom.Document xformsDocument,
org.apache.xerces.xs.XSSimpleTypeDefinition listType,
org.apache.xerces.xs.XSObject owner,
java.lang.String caption,
org.w3c.dom.Element bindElement,
java.util.ResourceBundle resourceBundle)
Creates a form control for an XML Schema simple list type. |
protected java.lang.String |
getXFormsTypeName(org.w3c.dom.Document xformsDocument,
org.apache.xerces.xs.XSModel schema,
org.apache.xerces.xs.XSTypeDefinition controlType)
used to get the type name that will be used in the XForms document |
static void |
rebuildInstance(org.w3c.dom.Node prototypeNode,
org.w3c.dom.Node oldInstanceNode,
org.w3c.dom.Node newInstanceNode,
java.util.HashMap schemaNamespaces)
|
static void |
removePrototypeNodes(org.w3c.dom.Node instanceDocumentElement)
|
void |
reset()
Reset the Schema2XForms to default values. |
protected java.lang.String |
setXFormsId(org.w3c.dom.Element el)
|
protected java.lang.String |
setXFormsId(org.w3c.dom.Element el,
java.lang.String id)
|
org.w3c.dom.Element |
startBindElement(org.w3c.dom.Element bindElement,
org.apache.xerces.xs.XSModel schema,
org.apache.xerces.xs.XSTypeDefinition controlType,
org.apache.xerces.xs.XSObject owner,
SchemaUtil.Occurrence o)
This method is invoked after an xforms:bind element is created for the specified SimpleType. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Schema2XForms(java.lang.String action, Schema2XForms.SubmitMethod submitMethod, java.lang.String base, boolean formatCaption)
action
- _UNDOCUMENTED_submitMethod
- _UNDOCUMENTED_formatCaption
- Method Detail |
---|
public org.alfresco.util.Pair buildXForm(org.w3c.dom.Document instanceDocument, org.w3c.dom.Document schemaDocument, java.lang.String rootElementName, java.util.ResourceBundle resourceBundle) throws FormBuilderException
instanceDocument
- The document source for the XML Schema.schemaDocument
- Schema documentrootElementName
- Name of the root elementresourceBundle
- Strings to use
org.chiba.tools.schemabuilder.FormBuilderException
- If an error occurs building the XForm.
FormBuilderException
public void reset()
public static void rebuildInstance(org.w3c.dom.Node prototypeNode, org.w3c.dom.Node oldInstanceNode, org.w3c.dom.Node newInstanceNode, java.util.HashMap schemaNamespaces)
public static void removePrototypeNodes(org.w3c.dom.Node instanceDocumentElement)
protected java.lang.String setXFormsId(org.w3c.dom.Element el)
protected java.lang.String setXFormsId(org.w3c.dom.Element el, java.lang.String id)
protected void addChoicesForSelectControl(org.w3c.dom.Document xForm, org.w3c.dom.Element choicesElement, java.util.Map choiceValues, java.util.ResourceBundle resourceBundle)
xForm
- _UNDOCUMENTED_choicesElement
- _UNDOCUMENTED_choiceValues
- _UNDOCUMENTED_protected java.util.Map addChoicesForSelectSwitchControl(org.w3c.dom.Document xformsDocument, org.w3c.dom.Element formSection, java.util.List choiceValues, java.lang.String typeBindId)
protected java.lang.String getXFormsTypeName(org.w3c.dom.Document xformsDocument, org.apache.xerces.xs.XSModel schema, org.apache.xerces.xs.XSTypeDefinition controlType)
xformsDocument
- schema
- controlType
- the type from which we want the name
public java.lang.String createCaption(java.lang.String text, org.apache.xerces.xs.XSObject o, java.util.ResourceBundle resourceBundle)
public java.lang.String createCaption(java.lang.String text, org.apache.xerces.xs.XSAnnotation annotation, java.util.ResourceBundle resourceBundle)
public java.lang.String createCaption(java.lang.String text)
text
- The string value to be reformatted for use as a caption.
public java.lang.String createCaption(org.apache.xerces.xs.XSAttributeDeclaration attribute, java.util.ResourceBundle resourceBundle)
attribute
- The XML schema attribute for which a caption is required.
public java.lang.String createCaption(org.apache.xerces.xs.XSAttributeUse attribute, java.util.ResourceBundle resourceBundle)
public java.lang.String createCaption(org.apache.xerces.xs.XSElementDeclaration element, java.util.ResourceBundle resourceBundle)
element
- The XML schema element for which a caption is required.
public java.lang.String createCaption(org.apache.xerces.xs.XSObject element, java.util.ResourceBundle resourceBundle)
public org.w3c.dom.Element createControlForAnyType(org.w3c.dom.Document xformsDocument, java.lang.String caption, org.apache.xerces.xs.XSTypeDefinition controlType)
xformsDocument
- The XForm document.controlType
- The XML Schema type for which the form control is to be created.
public org.w3c.dom.Element createControlForAtomicType(org.w3c.dom.Document xformsDocument, org.apache.xerces.xs.XSSimpleTypeDefinition controlType, org.apache.xerces.xs.XSObject owner, java.lang.String caption, java.util.ResourceBundle resourceBundle)
xformsDocument
- The XForm document.controlType
- The XML Schema type for which the form control is to be created.
public org.w3c.dom.Element createControlForEnumerationType(org.w3c.dom.Document xformsDocument, org.apache.xerces.xs.XSSimpleTypeDefinition controlType, org.apache.xerces.xs.XSObject owner, java.lang.String caption, org.w3c.dom.Element bindElement, java.util.ResourceBundle resourceBundle)
xformsDocument
- The XForm document.controlType
- The XML Schema type for which the form control is to be created.caption
- The caption for the form control. The caller The purpose of providing the caption
is to permit the implementation to add a [Select1 .... ] message that involves the caption.bindElement
- The bind element for this control. The purpose of providing the bind element
is to permit the implementation to add a isValid attribute to the bind element that prevents
the [Select1 .... ] item from being selected.
public org.w3c.dom.Element createControlForListType(org.w3c.dom.Document xformsDocument, org.apache.xerces.xs.XSSimpleTypeDefinition listType, org.apache.xerces.xs.XSObject owner, java.lang.String caption, org.w3c.dom.Element bindElement, java.util.ResourceBundle resourceBundle)
xformsDocument
- The XForm document.listType
- The XML Schema list type for which the form control is to be created.owner
- caption
- The caption for the form control. The caller The purpose of providing the caption
is to permit the implementation to add a [Select1 .... ] message that involves the caption.bindElement
- The bind element for this control. The purpose of providing the bind element
is to permit the implementation to add a isValid attribute to the bind element that prevents
the [Select1 .... ] item from being selected.resourceBundle
-
public org.w3c.dom.Element startBindElement(org.w3c.dom.Element bindElement, org.apache.xerces.xs.XSModel schema, org.apache.xerces.xs.XSTypeDefinition controlType, org.apache.xerces.xs.XSObject owner, SchemaUtil.Occurrence o)
bindElement
- The bindElement being processed.schema
- XML Schema type of the element/attribute this bind is for.controlType
- owner
- o
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |