DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.autoform
Class Renderer

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

public abstract class Renderer
extends Object

Abstract class for rendering an editor for 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 product is a RenderTree is a Element structure that expresses a metadata editor interface. The RenderTree is almost leagal jsp but must still be slightly massaged before it can be processed as jsp (see AutoForm).

All concrete classes render JSP-based editors, but in the future we may want to support other editors. This class contains no JSP-specific methods, but it does enforce a particular style of rendering in which individual schema nodes are rendered and attached to a parent element. The Renderer is called recursively as it traverses the schemaStructure, starting at the root Element of the schema (a SchemaNode) and building the RenderTree as it traverses the schema structure.

Author:
ostwald

Field Summary
protected  DocumentFactory df
          The DataType of the element to be rendered.
protected  String formBeanName
          Description of the Field
protected  String normalizedXPath
           
 Element parent
          A Element representing the parent of the node being rendered.
protected  String repeatingComplexSingletonChildPath
          Place holder for a path to a repeating child.
 RendererHelper rhelper
          Data structure containing global information required by individual Renderer instances.
protected  Element root
          The root element to be Rendered.
 SchemaNode schemaNode
          The SchemaNode which wraps the schema element (which may represent an Element Attribute) being rendered
 SchemaHelper sh
          A SchemaHelper instance that provides schema-related information and services to the Renderer.
 GlobalDef typeDef
          The XPath corresponding to the SchemaNode.
protected  String typeName
          Name of the element-to-be-rendered's DataType.
 String xpath
          JSP - encoded xpath to the element being rendered.
 
Constructor Summary
Renderer()
          Constructor for the Renderer object
 
Method Summary
abstract  Element bestPracticesLink(String xpath)
           
protected  void doInit(String xpath, Element parent, GlobalDef typeDef, RendererHelper rhelper)
          Constructor for the Renderer object in which the dataType to render is specified (rather than being determined by the schemaNode at xpath .
protected  void doInit(String xpath, Element parent, RendererHelper rhelper)
          Constructor for the Renderer object
abstract  ComplexTypeLabel getComplexTypeLabel(String xpath)
           
abstract  ComplexTypeLabel getComplexTypeLabel(String xpath, String siblingPath, String indexId)
           
abstract  Element getDeleteController(String itemPath, String elementName)
           
protected  Element getDiv()
          Gets a DIV element styled for the current level.
protected  Element getDiv(int level)
          Gets a DIV element styled for a particular level.
abstract  Element getInputElement(String xpath, SchemaNode schemaNode, GlobalDef typeDef)
           
 int getLevel(String xpath)
           
protected abstract  Element getMultiBoxInput(String xpath)
           
abstract  Element getOptionalItemControl(String xpath)
           
abstract  Element getRenderedField(String xpath, Element label, Element inputField)
           
abstract  String getRenderMode()
           
 Namespace getSchemaNamespace()
          Gets the schema namespace (associated with "http://www.w3.org/2001/XMLSchema") for the root schema for the metadata framework for this Renderer.
 String getSchemaNSPrefix()
          Gets the prefix of the schemaNamespace as defined by the root schema for the metadata framework for this Renderer.
abstract  SimpleTypeLabel getSimpleTypeLabel(String xpath)
           
abstract  SimpleTypeLabel getSimpleTypeLabel(String xpath, String siblingPath, String indexId)
           
 String getXmlFormat()
          Gets the format (e.g., "adn") of the metadata framework for this Renderer.
protected  void init(String xpath, Element parent, RendererHelper rhelper)
          Initialize Renderer attributes
abstract  boolean isDisplayMode()
           
abstract  boolean isEditMode()
           
static String jspQuotedString(String s)
          returns the input string surrounded by a string that is replaced with a quotation mark when the rendered Element is writen to disk.
abstract  void renderAttribute()
          Render an Attribute Node
abstract  void renderChoice(Element choice)
          Render a choice node.
 void renderComplexType()
          Render an editor for a schemaNode defined as ComplexType
protected abstract  void renderComplexTypeConcrete()
          Implementation-specific method to render an editor for a schemaNode defined as ComplexType
abstract  void renderDerivedContentModel()
          Render a Derived Content Model (ComplexType having ComplexContent element)
abstract  void renderDerivedTextOnlyModel()
          Render a derived Text-Only content model (ComplexType having SimpleContent element)
abstract  void renderModelGroup(Element group)
           
 void renderNode()
          Render an editor for the schemaNode (i.e., a Node of the schema's instanceDocument) specified by the xpath field.
abstract  void renderRepeatingElement()
          Render an element having an unbounded sequence of subelements
abstract  void renderRepeatingSubstitutionGroup()
           
abstract  void renderSequence(Element sequence)
          Render the subelements of a sequence compositor
 void renderSimpleType()
          Render an editor for a schemaNode defined as SimpleType
abstract  void renderSimpleTypeConcrete()
          Implementation-specific method to render an editor for a schemaNode defined as SimpleType
abstract  void renderSubElements()
          Render the subitems of the current ComplexType element by walking the children elements of the type definition.
 void renderSubElements(GlobalDef proxyTypeDef)
          NOT YET DOCUMENTED
abstract  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 Renderer object
abstract  void setRenderMode(String mode)
           
abstract  boolean showXsdStringElement(String xpath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sh

public SchemaHelper sh
A SchemaHelper instance that provides schema-related information and services to the Renderer.


xpath

public String xpath
JSP - encoded xpath to the element being rendered.


parent

public Element parent
A Element representing the parent of the node being rendered.


schemaNode

public SchemaNode schemaNode
The SchemaNode which wraps the schema element (which may represent an Element Attribute) being rendered


typeDef

public GlobalDef typeDef
The XPath corresponding to the SchemaNode. This path contains no indexing or jsp-encoding since it points to a the schema's instanceDocument.


rhelper

public RendererHelper rhelper
Data structure containing global information required by individual Renderer instances.


normalizedXPath

protected String normalizedXPath

typeName

protected String typeName
Name of the element-to-be-rendered's DataType. This field is required because in some cases the element is rendered as a different type from which it is defined.


df

protected DocumentFactory df
The DataType of the element to be rendered.


root

protected Element root
The root element to be Rendered. Stored in the RendererHelper instance.


repeatingComplexSingletonChildPath

protected String repeatingComplexSingletonChildPath
Place holder for a path to a repeating child. This field is null for elements that do not contain a repeating child.


formBeanName

protected String formBeanName
Description of the Field

Constructor Detail

Renderer

public Renderer()
Constructor for the Renderer object

Method Detail

doInit

protected void doInit(String xpath,
                      Element parent,
                      RendererHelper rhelper)
               throws Exception
Constructor for the Renderer object

Parameters:
xpath - xpath to the Node to be rendered
parent - The element to which the rendered Node is attached as a child
rhelper - Pointer to the RendererHelper
Throws:
Exception - NOT YET DOCUMENTED

doInit

protected void doInit(String xpath,
                      Element parent,
                      GlobalDef typeDef,
                      RendererHelper rhelper)
               throws Exception
Constructor for the Renderer object in which the dataType to render is specified (rather than being determined by the schemaNode at xpath . This constructor is used to render schema nodes that have a derivedModel, which must be rendered using the dataType they extend.

Parameters:
xpath - xpath to the Node to be rendered
parent - The element to which the rendered Node is attached as a child
dataTypeName - The name of the dataType as which the node is rendered
rhelper - Pointer to the RendererHelper
Throws:
Exception - NOT YET DOCUMENTED

init

protected void init(String xpath,
                    Element parent,
                    RendererHelper rhelper)
Initialize Renderer attributes

Parameters:
xpath - The jsp-encoded xpath to the element to be rendered.
parent - The SchemaNode which wraps the schema element (which may represent an Element Attribute) being rendered
rhelper - Data structure containing global information required by individual Renderer instances

isDisplayMode

public abstract boolean isDisplayMode()

isEditMode

public abstract boolean isEditMode()

setRenderMode

public abstract void setRenderMode(String mode)

getRenderMode

public abstract String getRenderMode()

renderNode

public void renderNode()
Render an editor for the schemaNode (i.e., a Node of the schema's instanceDocument) specified by the xpath field.


renderSimpleType

public void renderSimpleType()
Render an editor for a schemaNode defined as SimpleType


renderSimpleTypeConcrete

public abstract void renderSimpleTypeConcrete()
Implementation-specific method to render an editor for a schemaNode defined as SimpleType


renderComplexType

public void renderComplexType()
Render an editor for a schemaNode defined as ComplexType


renderComplexTypeConcrete

protected abstract void renderComplexTypeConcrete()
Implementation-specific method to render an editor for a schemaNode defined as ComplexType


renderDerivedTextOnlyModel

public abstract void renderDerivedTextOnlyModel()
Render a derived Text-Only content model (ComplexType having SimpleContent element)

An example text-only model definition:

  
    
      
        
         


renderDerivedContentModel

public abstract void renderDerivedContentModel()
Render a Derived Content Model (ComplexType having ComplexContent element)


renderModelGroup

public abstract void renderModelGroup(Element group)

renderAttribute

public abstract void renderAttribute()
Render an Attribute Node


renderChoice

public abstract void renderChoice(Element choice)
Render a choice node. Each of the possible choices is tested for existance, and finally a test for an empty choice is included to account for the situation in which a new parent element has been added but the choice has not yet been made.

Parameters:
choice - The choice element of the type definition (see ComplexType)

renderSequence

public abstract void renderSequence(Element sequence)
Render the subelements of a sequence compositor

Parameters:
sequence - the sequence compositor Element

renderRepeatingElement

public abstract void renderRepeatingElement()
Render an element having an unbounded sequence of subelements


renderRepeatingSubstitutionGroup

public abstract void renderRepeatingSubstitutionGroup()

renderSubElements

public void renderSubElements(GlobalDef proxyTypeDef)
NOT YET DOCUMENTED

Parameters:
proxyTypeDef - NOT YET DOCUMENTED

renderSubElements

public abstract void renderSubElements()
Render the subitems of the current ComplexType element by walking the children elements of the type definition.

This method called by renderComplexTypeConcrete.


renderSubElements

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

Parameters:
subElements - A list of elements to be rendered.

getXmlFormat

public final String getXmlFormat()
Gets the format (e.g., "adn") of the metadata framework for this Renderer.


getSchemaNSPrefix

public final String getSchemaNSPrefix()
Gets the prefix of the schemaNamespace as defined by the root schema for the metadata framework for this Renderer.


getSchemaNamespace

public final Namespace getSchemaNamespace()
Gets the schema namespace (associated with "http://www.w3.org/2001/XMLSchema") for the root schema for the metadata framework for this Renderer.


getLevel

public final int getLevel(String xpath)

getDiv

protected Element getDiv()
Gets a DIV element styled for the current level.

Returns:
The div value

getDiv

protected Element getDiv(int level)
Gets a DIV element styled for a particular level.

Parameters:
level - Description of the Parameter
Returns:
The div value

jspQuotedString

public static String jspQuotedString(String s)
returns the input string surrounded by a string that is replaced with a quotation mark when the rendered Element is writen to disk. This is necessary because dom4J turns quotation marks and appostrophies into entities, which then cause the JSP processer to barf when the jsp page is rendered

Parameters:
s - Description of the Parameter
Returns:
Description of the Return Value

bestPracticesLink

public abstract Element bestPracticesLink(String xpath)

getInputElement

public abstract Element getInputElement(String xpath,
                                        SchemaNode schemaNode,
                                        GlobalDef typeDef)

getSimpleTypeLabel

public abstract SimpleTypeLabel getSimpleTypeLabel(String xpath)

getSimpleTypeLabel

public abstract SimpleTypeLabel getSimpleTypeLabel(String xpath,
                                                   String siblingPath,
                                                   String indexId)

getComplexTypeLabel

public abstract ComplexTypeLabel getComplexTypeLabel(String xpath)

getComplexTypeLabel

public abstract ComplexTypeLabel getComplexTypeLabel(String xpath,
                                                     String siblingPath,
                                                     String indexId)

showXsdStringElement

public abstract boolean showXsdStringElement(String xpath)

getRenderedField

public abstract Element getRenderedField(String xpath,
                                         Element label,
                                         Element inputField)

getDeleteController

public abstract Element getDeleteController(String itemPath,
                                            String elementName)

getOptionalItemControl

public abstract Element getOptionalItemControl(String xpath)

getMultiBoxInput

protected abstract Element getMultiBoxInput(String xpath)

report

public String report()
Description of the Method

Returns:
Description of the Return Value

setDebug

public static void setDebug(boolean bool)
Sets the debug attribute of the Renderer object

Parameters:
debug - The new debug value

DLESE Tools
v1.6.0