DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.autoform
Class RendererImpl

java.lang.Object
  extended by org.dlese.dpc.schemedit.autoform.Renderer
      extended by org.dlese.dpc.schemedit.autoform.RendererImpl
Direct Known Subclasses:
EditorRenderer, ViewerRenderer

public class RendererImpl
extends Renderer

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
static String DISPLAY_MODE
          NOT YET DOCUMENTED
static String EDIT_MODE
           
 
Fields inherited from class org.dlese.dpc.schemedit.autoform.Renderer
df, formBeanName, normalizedXPath, parent, repeatingComplexSingletonChildPath, rhelper, root, schemaNode, sh, typeDef, typeName, xpath
 
Constructor Summary
RendererImpl()
          Constructor for the Renderer object
 
Method Summary
 Element bestPracticesLink(String xpath)
          Render a Best Practices link for the specified xpath
protected  void doInit(String xpath, Element parent, GlobalDef typeDef, RendererHelper rhelper)
          NOT YET DOCUMENTED
protected  Element getBooleanInput(String xpath)
          Boolean input elements are rendered with a tag that implements an select input with options for true and false.
protected  Element getComboUnionInput(String xpath)
          comboUnionInput allows user to select from enumerated list (supplied by schema) or enter in an arbitray value if desired.
 ComplexTypeLabel getComplexTypeLabel(String xpath)
          Gets the complexTypeLabel attribute of the RendererImpl object
 ComplexTypeLabel getComplexTypeLabel(String xpath, String siblingPath, String indexId)
          Gets the complexTypeLabel attribute of the RendererImpl object
 Element getDeleteController(String itemPath, String elementName)
          Gets the deleteController attribute of the RendererImpl object
 Element getInputElement(String xpath, SchemaNode schemaNode, GlobalDef typeDef)
          Gets the inputElement attribute of the RendererImpl object
 Element getInputHelperElement(String xpath)
          Creates the JSP element to render an input helper for the specified path
 String getLabelText(String xpath, String siblingPath, String indexId)
          Label text is indexed if siblingPath and indexId provided, otherwise based on xpath
 Element getLanguageInput(String xpath)
          Gets the languageSelectInput attribute of the RendererImpl object
protected  Element getMultiBoxInput(String xpath)
          Renders a MultiBoxInput (a set of checkboxes) for the current element.
 Label getMultiBoxLabel(String xpath)
          Gets the multiBoxLabel attribute of the RendererImpl object
 Element getMultiSelectInput(String xpath)
          Renders a multiSelect input (a set of of checkboxes) as an Element.
 Element getOptionalItemControl(String xpath)
          Creates an optionalItemControl Element that allows user to add or delete an optional Element to/from the instance document
protected  Element getReadOnlyElement(String xpath)
          Gets the readOnlyElement attribute of the RendererImpl object
 Element getRenderedField(String xpath, Element label, Element input)
          Renders a Labelled input field (for a Simple or Built-in schema dataType.
 Element getRenderedField(String xpath, Label label, Element input)
          Gets the renderedField attribute of the RendererImpl object
 String getRenderMode()
           
 Element getSelectInput(String xpath)
          Gets the selectInput attribute of the RendererImpl object
static boolean getShowNSPrefixInLabels()
          Gets the showNSPrefixInLabels attribute of the RendererImpl class
 SimpleTypeLabel getSimpleTypeLabel(String xpath)
          Gets the simpleTypeLabel attribute of the RendererImpl object
 SimpleTypeLabel getSimpleTypeLabel(String xpath, String siblingPath, String indexId)
          Gets the simpleTypeLabel attribute of the RendererImpl object
 Element getTextAreaInput(String xpath)
          Gets the textAreaInput attribute of the RendererImpl object
 Element getTextAreaInput(String xpath, int rows)
          Gets the textAreaInput attribute of the RendererImpl object
protected  Element getTextInput(String xpath, SchemaNode schemaNode, GlobalDef typeDef)
          Gets the textInput attribute of the RendererImpl object
 String getToolHelp(String s)
          Attempts to return a metadata vocab field definition for the input string assuming it is an xpath.
 String getXpath()
          Gets the xpath of the Node to be rendered.
 boolean isDisplayMode()
          Returns true if we are in display mode (not editing)
 boolean isEditMode()
          Returns true if we are editing field contents (as opposed to simply viewing them).
 void renderAttribute()
          Render an Attribute schemaNode
 void renderChoice(Element choiceElement)
          Render a choice compository via either MdeChoice, for simple choices, or MdeMultiChoice for choice compositors that have more than one occurance
 void renderComplexTypeConcrete()
          Renders a complexType element by creating an containerBox and then populating it with a formattedLabel and the complexType element contents (via renderSubElements).
 void renderDerivedContentModel()
          Render a derived content model (complexType).
 void renderDerivedTextOnlyModel()
          Render a Text-only content model, which is a complexType that uses a simpleContent element.
protected  Element renderInputElement(String xpath, SchemaNode schemaNode, GlobalDef typeDef)
          Gets the inputElement attribute of the EditorRenderer object
 void renderModelGroup(Element group)
          called with group element, e.g., <xs:group ref="nameGroup"/>
 void renderRepeatingElement()
          NOT YET DOCUMENTED
 void renderRepeatingSubstitutionGroup()
          NOT YET DOCUMENTED
 void renderSequence(Element sequence)
          NOT YET DOCUMENTED
 void renderSimpleTypeConcrete()
          NOT YET DOCUMENTED
 void renderSubElements()
          NOT YET DOCUMENTED
 void renderSubElements(GlobalDef proxyTypeDef)
          NOT YET DOCUMENTED
 void renderSubElements(List subElements)
          Render the given subElements (or those of the current ComplexType if no subElements are provided).
 String report()
          Description of the Method
static void setDebug(boolean bool)
          Sets the debug attribute of the RendererImpl class
 void setRenderMode(String mode)
          RenderMode determines whether we are editing a record, or simply viewing its contents.
static void setShowNSPrefixInLabels(boolean b)
          Sets the showNSPrefixInLabels attribute of the RendererImpl class
 boolean showXsdStringElement(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDIT_MODE

public static final String EDIT_MODE
See Also:
Constant Field Values

DISPLAY_MODE

public static final String DISPLAY_MODE
NOT YET DOCUMENTED

See Also:
Constant Field Values
Constructor Detail

RendererImpl

public RendererImpl()
Constructor for the Renderer object

Method Detail

setRenderMode

public void setRenderMode(String mode)
RenderMode determines whether we are editing a record, or simply viewing its contents.

Specified by:
setRenderMode in class Renderer

getRenderMode

public String getRenderMode()
Specified by:
getRenderMode in class Renderer

isDisplayMode

public boolean isDisplayMode()
Returns true if we are in display mode (not editing)

Specified by:
isDisplayMode in class Renderer

isEditMode

public boolean isEditMode()
Returns true if we are editing field contents (as opposed to simply viewing them).

Specified by:
isEditMode in class Renderer

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,
                      Element parent,
                      GlobalDef typeDef,
                      RendererHelper rhelper)
               throws Exception
NOT YET DOCUMENTED

Overrides:
doInit in class Renderer
Parameters:
xpath - path to the node to be rendered
parent - element to which the rendered node will be attached
typeDef - schema-defined type definition for the node to be rendered
rhelper - Helper class provided utility functions to aid rendering
Throws:
Exception - NOT YET DOCUMENTED

getXpath

public String getXpath()
Gets the xpath of the Node to be rendered.

Returns:
The xpath value

renderSimpleTypeConcrete

public void renderSimpleTypeConcrete()
NOT YET DOCUMENTED

Specified by:
renderSimpleTypeConcrete in class Renderer

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:
renderComplexTypeConcrete in class Renderer

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:
renderDerivedTextOnlyModel in class Renderer

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:
renderDerivedContentModel in class Renderer

renderModelGroup

public void renderModelGroup(Element group)
called with group element, e.g., <xs:group ref="nameGroup"/>

Specified by:
renderModelGroup in class Renderer
Parameters:
group - NOT YET DOCUMENTED

renderAttribute

public void renderAttribute()
Render an Attribute schemaNode

Specified by:
renderAttribute in class Renderer

renderChoice

public void renderChoice(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:
renderChoice in class Renderer
Parameters:
choiceElement - choice compositor element from the parent node's typeDefinition.

renderSequence

public void renderSequence(Element sequence)
NOT YET DOCUMENTED

Specified by:
renderSequence in class Renderer
Parameters:
sequence - NOT YET DOCUMENTED

renderRepeatingSubstitutionGroup

public void renderRepeatingSubstitutionGroup()
NOT YET DOCUMENTED

Specified by:
renderRepeatingSubstitutionGroup in class Renderer

renderRepeatingElement

public void renderRepeatingElement()
NOT YET DOCUMENTED

Specified by:
renderRepeatingElement in class Renderer

renderSubElements

public void renderSubElements(GlobalDef proxyTypeDef)
NOT YET DOCUMENTED

Overrides:
renderSubElements in class Renderer
Parameters:
proxyTypeDef - NOT YET DOCUMENTED

renderSubElements

public void renderSubElements(List subElements)
Render the given subElements (or those of the current ComplexType if no subElements are provided). This method called by renderComplexTypeConcrete.

Specified by:
renderSubElements in class Renderer
Parameters:
subElements - A list of elements to be rendered.

renderSubElements

public void renderSubElements()
NOT YET DOCUMENTED

Specified by:
renderSubElements in class Renderer

bestPracticesLink

public Element bestPracticesLink(String xpath)
Render a Best Practices link for the specified xpath

Specified by:
bestPracticesLink in class Renderer
Parameters:
xpath - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

getToolHelp

public String getToolHelp(String s)
Attempts to return a metadata vocab field definition for the input string assuming it is an xpath. The field definition is obtained from a FieldInfoReader for 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

public Element getInputHelperElement(String xpath)
Creates the JSP element to render an input helper for the specified path

Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The inputHelper value

renderInputElement

protected Element renderInputElement(String xpath,
                                     SchemaNode schemaNode,
                                     GlobalDef typeDef)
Gets the inputElement attribute of the EditorRenderer object

Parameters:
xpath - NOT YET DOCUMENTED
schemaNode - NOT YET DOCUMENTED
typeDef - NOT YET DOCUMENTED
Returns:
The inputElement value

getInputElement

public Element getInputElement(String xpath,
                               SchemaNode schemaNode,
                               GlobalDef typeDef)
Gets the inputElement attribute of the RendererImpl object

Specified by:
getInputElement in class Renderer
Parameters:
xpath - NOT YET DOCUMENTED
schemaNode - NOT YET DOCUMENTED
typeDef - NOT YET DOCUMENTED
Returns:
The inputElement value

getReadOnlyElement

protected Element getReadOnlyElement(String xpath)
Gets the readOnlyElement attribute of the RendererImpl object

Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The readOnlyElement value

getTextInput

protected Element getTextInput(String xpath,
                               SchemaNode schemaNode,
                               GlobalDef typeDef)
Gets the textInput attribute of the RendererImpl object

Parameters:
xpath - NOT YET DOCUMENTED
schemaNode - NOT YET DOCUMENTED
typeDef - NOT YET DOCUMENTED
Returns:
The textInput value

getBooleanInput

protected Element getBooleanInput(String xpath)
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

public Element getTextAreaInput(String xpath)
Gets the textAreaInput attribute of the RendererImpl object

Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The textAreaInput value

getTextAreaInput

public Element getTextAreaInput(String xpath,
                                int rows)
Gets the textAreaInput attribute of the RendererImpl object

Parameters:
xpath - NOT YET DOCUMENTED
rows - NOT YET DOCUMENTED
Returns:
The textAreaInput value

getSelectInput

public Element getSelectInput(String xpath)
Gets the selectInput attribute of the RendererImpl object

Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The selectInput value

getLanguageInput

public Element getLanguageInput(String xpath)
Gets the languageSelectInput attribute of the RendererImpl object

Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The languageSelectInput value

getMultiSelectInput

public Element getMultiSelectInput(String xpath)
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

protected Element getMultiBoxInput(String xpath)
Renders a MultiBoxInput (a set of checkboxes) for the current element.

Specified by:
getMultiBoxInput in class Renderer
Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The getMultiBoxInput value

getComboUnionInput

protected Element getComboUnionInput(String xpath)
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

public SimpleTypeLabel getSimpleTypeLabel(String xpath)
Gets the simpleTypeLabel attribute of the RendererImpl object

Specified by:
getSimpleTypeLabel in class Renderer
Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The simpleTypeLabel value

getSimpleTypeLabel

public SimpleTypeLabel getSimpleTypeLabel(String xpath,
                                          String siblingPath,
                                          String indexId)
Gets the simpleTypeLabel attribute of the RendererImpl object

Specified by:
getSimpleTypeLabel in class Renderer
Parameters:
xpath - NOT YET DOCUMENTED
siblingPath - NOT YET DOCUMENTED
indexId - NOT YET DOCUMENTED
Returns:
The simpleTypeLabel value

getLabelText

public String getLabelText(String xpath,
                           String siblingPath,
                           String indexId)
Label text is indexed if siblingPath and indexId provided, otherwise based on xpath

Parameters:
xpath - NOT YET DOCUMENTED
siblingPath - NOT YET DOCUMENTED
indexId - NOT YET DOCUMENTED
Returns:
The labelText value

getMultiBoxLabel

public Label getMultiBoxLabel(String xpath)
Gets the multiBoxLabel attribute of the RendererImpl object

Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The multiBoxLabel value

getDeleteController

public Element getDeleteController(String itemPath,
                                   String elementName)
Gets the deleteController attribute of the RendererImpl object

Specified by:
getDeleteController in class Renderer
Parameters:
itemPath - NOT YET DOCUMENTED
elementName - NOT YET DOCUMENTED
Returns:
The deleteController value

getOptionalItemControl

public Element getOptionalItemControl(String xpath)
Creates an optionalItemControl Element that allows user to add or delete an optional Element to/from the instance document

Specified by:
getOptionalItemControl in class Renderer
Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The optionalItemControl Element

getComplexTypeLabel

public ComplexTypeLabel getComplexTypeLabel(String xpath)
Gets the complexTypeLabel attribute of the RendererImpl object

Specified by:
getComplexTypeLabel in class Renderer
Parameters:
xpath - NOT YET DOCUMENTED
Returns:
The complexTypeLabel value

getComplexTypeLabel

public ComplexTypeLabel getComplexTypeLabel(String xpath,
                                            String siblingPath,
                                            String indexId)
Gets the complexTypeLabel attribute of the RendererImpl object

Specified by:
getComplexTypeLabel in class Renderer
Parameters:
xpath - NOT YET DOCUMENTED
siblingPath - NOT YET DOCUMENTED
indexId - NOT YET DOCUMENTED
Returns:
The complexTypeLabel value

showXsdStringElement

public boolean showXsdStringElement(String xpath)
Hook to allow specialized renderers (in particular DleseEditorRenderer) to suppress display of xsd:string elements in certain circumstances by overriding this method.

Specified by:
showXsdStringElement in class Renderer
Parameters:
xpath - The xpath to show
Returns:
hardcoded to true

getRenderedField

public Element getRenderedField(String xpath,
                                Label label,
                                Element input)
Gets the renderedField attribute of the RendererImpl object

Parameters:
xpath - NOT YET DOCUMENTED
label - NOT YET DOCUMENTED
input - NOT YET DOCUMENTED
Returns:
The renderedField value

getRenderedField

public Element getRenderedField(String xpath,
                                Element label,
                                Element input)
Renders a Labelled input field (for a Simple or Built-in schema dataType.

Specified by:
getRenderedField in class Renderer
Parameters:
label - Description of the Parameter
input - Description of the Parameter
xpath - NOT YET DOCUMENTED
Returns:
The labelFieldTable value

report

public String report()
Description of the Method

Overrides:
report in class Renderer
Returns:
Description of the Return Value

setDebug

public static void setDebug(boolean bool)
Sets the debug attribute of the RendererImpl class

Parameters:
bool - The new debug value

DLESE Tools
v1.6.0