Package org.dlese.dpc.schemedit.autoform
Class RendererImpl
java.lang.Object
org.dlese.dpc.schemedit.autoform.Renderer
org.dlese.dpc.schemedit.autoform.RendererImpl
- Direct Known Subclasses:
EditorRenderer,ViewerRenderer
Concrete class for rendering a JSP-based representation of a SchemaNode (an
Element or Attribute defined in an XML Schema). Editor pages are Rendered
via recursive instantiations of Renderers starting with the base element for
that page.
The Renderer is initialized with information from the schema definition for the particular schemaNode (attribute or element) to be rendered, along with access to a RenderHelper, which provides utility functions. Rendered nodes are attached to the parent element (and thus to the Render-tree).
- Author:
- ostwald
-
Field Summary
FieldsFields inherited from class org.dlese.dpc.schemedit.autoform.Renderer
df, formBeanName, normalizedXPath, parent, repeatingComplexSingletonChildPath, rhelper, root, schemaNode, sh, typeDef, typeName, xpath -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.dom4j.ElementbestPracticesLink(String xpath) Render a Best Practices link for the specified xpathprotected voiddoInit(String xpath, org.dom4j.Element parent, GlobalDef typeDef, RendererHelper rhelper) NOT YET DOCUMENTEDprotected org.dom4j.ElementgetBooleanInput(String xpath) Boolean input elements are rendered with a tag that implements an select input with options for true and false.protected org.dom4j.ElementgetComboUnionInput(String xpath) comboUnionInput allows user to select from enumerated list (supplied by schema) or enter in an arbitray value if desired.getComplexTypeLabel(String xpath) Gets the complexTypeLabel attribute of the RendererImpl objectgetComplexTypeLabel(String xpath, String siblingPath, String indexId) Gets the complexTypeLabel attribute of the RendererImpl objectorg.dom4j.ElementgetDeleteController(String itemPath, String elementName) Gets the deleteController attribute of the RendererImpl objectorg.dom4j.ElementgetInputElement(String xpath, SchemaNode schemaNode, GlobalDef typeDef) Gets the inputElement attribute of the RendererImpl objectorg.dom4j.ElementgetInputHelperElement(String xpath) Creates the JSP element to render an input helper for the specified pathgetLabelText(String xpath, String siblingPath, String indexId) Label text is indexed if siblingPath and indexId provided, otherwise based on xpathorg.dom4j.ElementgetLanguageInput(String xpath) Gets the languageSelectInput attribute of the RendererImpl objectprotected org.dom4j.ElementgetMultiBoxInput(String xpath) Renders a MultiBoxInput (a set of checkboxes) for the current element.getMultiBoxLabel(String xpath) Gets the multiBoxLabel attribute of the RendererImpl objectorg.dom4j.ElementgetMultiSelectInput(String xpath) Renders a multiSelect input (a set of of checkboxes) as an Element.org.dom4j.ElementgetOptionalItemControl(String xpath) Creates an optionalItemControl Element that allows user to add or delete an optional Element to/from the instance documentprotected org.dom4j.ElementgetReadOnlyElement(String xpath) Gets the readOnlyElement attribute of the RendererImpl objectorg.dom4j.ElementgetRenderedField(String xpath, Label label, org.dom4j.Element input) Gets the renderedField attribute of the RendererImpl objectorg.dom4j.ElementgetRenderedField(String xpath, org.dom4j.Element label, org.dom4j.Element input) Renders a Labelled input field (for a Simple or Built-in schema dataType.org.dom4j.ElementgetSelectInput(String xpath) Gets the selectInput attribute of the RendererImpl objectstatic booleanGets the showNSPrefixInLabels attribute of the RendererImpl classgetSimpleTypeLabel(String xpath) Gets the simpleTypeLabel attribute of the RendererImpl objectgetSimpleTypeLabel(String xpath, String siblingPath, String indexId) Gets the simpleTypeLabel attribute of the RendererImpl objectorg.dom4j.ElementgetTextAreaInput(String xpath) Gets the textAreaInput attribute of the RendererImpl objectorg.dom4j.ElementgetTextAreaInput(String xpath, int rows) Gets the textAreaInput attribute of the RendererImpl objectprotected org.dom4j.ElementgetTextInput(String xpath, SchemaNode schemaNode, GlobalDef typeDef) Gets the textInput attribute of the RendererImpl objectAttempts to return a metadata vocab field definition for the input string assuming it is an xpath.getXpath()Gets the xpath of the Node to be rendered.booleanReturns true if we are in display mode (not editing)booleanReturns true if we are editing field contents (as opposed to simply viewing them).voidRender an Attribute schemaNodevoidrenderChoice(org.dom4j.Element choiceElement) Render a choice compository via either MdeChoice, for simple choices, or MdeMultiChoice for choice compositors that have more than one occurancevoidRenders a complexType element by creating an containerBox and then populating it with a formattedLabel and the complexType element contents (via renderSubElements).voidRender a derived content model (complexType).voidRender a Text-only content model, which is a complexType that uses a simpleContent element.protected org.dom4j.ElementrenderInputElement(String xpath, SchemaNode schemaNode, GlobalDef typeDef) Gets the inputElement attribute of the EditorRenderer objectvoidrenderModelGroup(org.dom4j.Element group) called with group element, e.g., <xs:group ref="nameGroup"/>voidNOT YET DOCUMENTEDvoidNOT YET DOCUMENTEDvoidrenderSequence(org.dom4j.Element sequence) NOT YET DOCUMENTEDvoidNOT YET DOCUMENTEDvoidNOT YET DOCUMENTEDvoidrenderSubElements(List subElements) Render the given subElements (or those of the current ComplexType if no subElements are provided).voidrenderSubElements(GlobalDef proxyTypeDef) NOT YET DOCUMENTEDreport()Description of the Methodstatic voidsetDebug(boolean bool) Sets the debug attribute of the RendererImpl classvoidsetRenderMode(String mode) RenderMode determines whether we are editing a record, or simply viewing its contents.static voidsetShowNSPrefixInLabels(boolean b) Sets the showNSPrefixInLabels attribute of the RendererImpl classbooleanshowXsdStringElement(String xpath) Hook to allow specialized renderers (in particular DleseEditorRenderer) to suppress display of xsd:string elements in certain circumstances by overriding this method.Methods inherited from class org.dlese.dpc.schemedit.autoform.Renderer
doInit, getDiv, getDiv, getLevel, getSchemaNamespace, getSchemaNSPrefix, getXmlFormat, init, jspQuotedString, renderComplexType, renderNode, renderSimpleType
-
Field Details
-
EDIT_MODE
- See Also:
-
DISPLAY_MODE
NOT YET DOCUMENTED- See Also:
-
-
Constructor Details
-
RendererImpl
public RendererImpl()Constructor for the Renderer object
-
-
Method Details
-
setRenderMode
RenderMode determines whether we are editing a record, or simply viewing its contents.- Specified by:
setRenderModein classRenderer
-
getRenderMode
- Specified by:
getRenderModein classRenderer
-
isDisplayMode
public boolean isDisplayMode()Returns true if we are in display mode (not editing)- Specified by:
isDisplayModein classRenderer
-
isEditMode
public boolean isEditMode()Returns true if we are editing field contents (as opposed to simply viewing them).- Specified by:
isEditModein classRenderer
-
setShowNSPrefixInLabels
public static void setShowNSPrefixInLabels(boolean b) Sets the showNSPrefixInLabels attribute of the RendererImpl class- Parameters:
b- The new showNSPrefixInLabels value
-
getShowNSPrefixInLabels
public static boolean getShowNSPrefixInLabels()Gets the showNSPrefixInLabels attribute of the RendererImpl class- Returns:
- The showNSPrefixInLabels value
-
doInit
protected void doInit(String xpath, org.dom4j.Element parent, GlobalDef typeDef, RendererHelper rhelper) throws Exception NOT YET DOCUMENTED- Overrides:
doInitin classRenderer- Parameters:
xpath- path to the node to be renderedparent- element to which the rendered node will be attachedtypeDef- schema-defined type definition for the node to be renderedrhelper- Helper class provided utility functions to aid rendering- Throws:
Exception- NOT YET DOCUMENTED
-
getXpath
Gets the xpath of the Node to be rendered.- Returns:
- The xpath value
-
renderSimpleTypeConcrete
public void renderSimpleTypeConcrete()NOT YET DOCUMENTED- Specified by:
renderSimpleTypeConcretein classRenderer
-
renderComplexTypeConcrete
public void renderComplexTypeConcrete()Renders a complexType element by creating an containerBox and then populating it with a formattedLabel and the complexType element contents (via renderSubElements).- Specified by:
renderComplexTypeConcretein classRenderer
-
renderDerivedTextOnlyModel
public void renderDerivedTextOnlyModel()Render a Text-only content model, which is a complexType that uses a simpleContent element. SimpleContent elements have base element that is "extended" by adding attributes.- Specified by:
renderDerivedTextOnlyModelin classRenderer
-
renderDerivedContentModel
public void renderDerivedContentModel()Render a derived content model (complexType). Currently only "exensions" are supported. Derivation of ComplexTypes by "restriction" will be supported in a future version.- Specified by:
renderDerivedContentModelin classRenderer
-
renderModelGroup
public void renderModelGroup(org.dom4j.Element group) called with group element, e.g., <xs:group ref="nameGroup"/>- Specified by:
renderModelGroupin classRenderer- Parameters:
group- NOT YET DOCUMENTED
-
renderAttribute
public void renderAttribute()Render an Attribute schemaNode- Specified by:
renderAttributein classRenderer
-
renderChoice
public void renderChoice(org.dom4j.Element choiceElement) Render a choice compository via either MdeChoice, for simple choices, or MdeMultiChoice for choice compositors that have more than one occurance- Specified by:
renderChoicein classRenderer- Parameters:
choiceElement- choice compositor element from the parent node's typeDefinition.
-
renderSequence
public void renderSequence(org.dom4j.Element sequence) NOT YET DOCUMENTED- Specified by:
renderSequencein classRenderer- Parameters:
sequence- NOT YET DOCUMENTED
-
renderRepeatingSubstitutionGroup
public void renderRepeatingSubstitutionGroup()NOT YET DOCUMENTED- Specified by:
renderRepeatingSubstitutionGroupin classRenderer
-
renderRepeatingElement
public void renderRepeatingElement()NOT YET DOCUMENTED- Specified by:
renderRepeatingElementin classRenderer
-
renderSubElements
NOT YET DOCUMENTED- Overrides:
renderSubElementsin classRenderer- Parameters:
proxyTypeDef- NOT YET DOCUMENTED
-
renderSubElements
Render the given subElements (or those of the current ComplexType if no subElements are provided). This method called by renderComplexTypeConcrete.- Specified by:
renderSubElementsin classRenderer- Parameters:
subElements- A list of elements to be rendered.
-
renderSubElements
public void renderSubElements()NOT YET DOCUMENTED- Specified by:
renderSubElementsin classRenderer
-
bestPracticesLink
Render a Best Practices link for the specified xpath- Specified by:
bestPracticesLinkin classRenderer- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
-
getToolHelp
Attempts to return a metadata vocab field definition for the input string assuming it is an xpath. The field definition is obtained from aFieldInfoReaderfor the xpath. If a FieldInfoReader cannot be found, return the input string (encoded so whether an xpath or a regular string, there won't be a javascript error)..- Parameters:
s- A string that may or may not corrrespond to a field that has metadata-vocab definition information- Returns:
- A string to be used as ToolHelp which is the metadata field definition if possible.
-
getInputHelperElement
Creates the JSP element to render an input helper for the specified path- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The inputHelper value
-
renderInputElement
protected org.dom4j.Element renderInputElement(String xpath, SchemaNode schemaNode, GlobalDef typeDef) Gets the inputElement attribute of the EditorRenderer object- Parameters:
xpath- NOT YET DOCUMENTEDschemaNode- NOT YET DOCUMENTEDtypeDef- NOT YET DOCUMENTED- Returns:
- The inputElement value
-
getInputElement
Gets the inputElement attribute of the RendererImpl object- Specified by:
getInputElementin classRenderer- Parameters:
xpath- NOT YET DOCUMENTEDschemaNode- NOT YET DOCUMENTEDtypeDef- NOT YET DOCUMENTED- Returns:
- The inputElement value
-
getReadOnlyElement
Gets the readOnlyElement attribute of the RendererImpl object- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The readOnlyElement value
-
getTextInput
Gets the textInput attribute of the RendererImpl object- Parameters:
xpath- NOT YET DOCUMENTEDschemaNode- NOT YET DOCUMENTEDtypeDef- NOT YET DOCUMENTED- Returns:
- The textInput value
-
getBooleanInput
Boolean input elements are rendered with a tag that implements an select input with options for true and false.- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The booleanInput value
-
getTextAreaInput
Gets the textAreaInput attribute of the RendererImpl object- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The textAreaInput value
-
getTextAreaInput
Gets the textAreaInput attribute of the RendererImpl object- Parameters:
xpath- NOT YET DOCUMENTEDrows- NOT YET DOCUMENTED- Returns:
- The textAreaInput value
-
getSelectInput
Gets the selectInput attribute of the RendererImpl object- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The selectInput value
-
getLanguageInput
Gets the languageSelectInput attribute of the RendererImpl object- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The languageSelectInput value
-
getMultiSelectInput
Renders a multiSelect input (a set of of checkboxes) as an Element. The multiSelect is represented as a HTML table- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The multiSelectInput as an element
-
getMultiBoxInput
Renders a MultiBoxInput (a set of checkboxes) for the current element.- Specified by:
getMultiBoxInputin classRenderer- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The getMultiBoxInput value
-
getComboUnionInput
comboUnionInput allows user to select from enumerated list (supplied by schema) or enter in an arbitray value if desired. This input element is rendered by the "comboInput" tag- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The comboUnionInput value
-
getSimpleTypeLabel
Gets the simpleTypeLabel attribute of the RendererImpl object- Specified by:
getSimpleTypeLabelin classRenderer- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The simpleTypeLabel value
-
getSimpleTypeLabel
Gets the simpleTypeLabel attribute of the RendererImpl object- Specified by:
getSimpleTypeLabelin classRenderer- Parameters:
xpath- NOT YET DOCUMENTEDsiblingPath- NOT YET DOCUMENTEDindexId- NOT YET DOCUMENTED- Returns:
- The simpleTypeLabel value
-
getLabelText
Label text is indexed if siblingPath and indexId provided, otherwise based on xpath- Parameters:
xpath- NOT YET DOCUMENTEDsiblingPath- NOT YET DOCUMENTEDindexId- NOT YET DOCUMENTED- Returns:
- The labelText value
-
getMultiBoxLabel
Gets the multiBoxLabel attribute of the RendererImpl object- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The multiBoxLabel value
-
getDeleteController
Gets the deleteController attribute of the RendererImpl object- Specified by:
getDeleteControllerin classRenderer- Parameters:
itemPath- NOT YET DOCUMENTEDelementName- NOT YET DOCUMENTED- Returns:
- The deleteController value
-
getOptionalItemControl
Creates an optionalItemControl Element that allows user to add or delete an optional Element to/from the instance document- Specified by:
getOptionalItemControlin classRenderer- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The optionalItemControl Element
-
getComplexTypeLabel
Gets the complexTypeLabel attribute of the RendererImpl object- Specified by:
getComplexTypeLabelin classRenderer- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The complexTypeLabel value
-
getComplexTypeLabel
Gets the complexTypeLabel attribute of the RendererImpl object- Specified by:
getComplexTypeLabelin classRenderer- Parameters:
xpath- NOT YET DOCUMENTEDsiblingPath- NOT YET DOCUMENTEDindexId- NOT YET DOCUMENTED- Returns:
- The complexTypeLabel value
-
showXsdStringElement
Hook to allow specialized renderers (in particular DleseEditorRenderer) to suppress display of xsd:string elements in certain circumstances by overriding this method.- Specified by:
showXsdStringElementin classRenderer- Parameters:
xpath- The xpath to show- Returns:
- hardcoded to true
-
getRenderedField
Gets the renderedField attribute of the RendererImpl object- Parameters:
xpath- NOT YET DOCUMENTEDlabel- NOT YET DOCUMENTEDinput- NOT YET DOCUMENTED- Returns:
- The renderedField value
-
getRenderedField
public org.dom4j.Element getRenderedField(String xpath, org.dom4j.Element label, org.dom4j.Element input) Renders a Labelled input field (for a Simple or Built-in schema dataType.- Specified by:
getRenderedFieldin classRenderer- Parameters:
xpath- NOT YET DOCUMENTEDlabel- Description of the Parameterinput- Description of the Parameter- Returns:
- The labelFieldTable value
-
report
Description of the Method -
setDebug
public static void setDebug(boolean bool) Sets the debug attribute of the RendererImpl class- Parameters:
bool- The new debug value
-