Class Renderer
- Direct Known Subclasses:
RendererImpl
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
FieldsModifier and TypeFieldDescriptionprotected org.dom4j.DocumentFactoryThe DataType of the element to be rendered.protected StringDescription of the Fieldprotected Stringorg.dom4j.ElementAElementrepresenting the parent of the node being rendered.protected StringPlace holder for a path to a repeating child.Data structure containing global information required by individual Renderer instances.protected org.dom4j.ElementThe root element to be Rendered.TheSchemaNodewhich wraps the schema element (which may represent an Element Attribute) being renderedASchemaHelperinstance that provides schema-related information and services to the Renderer.The XPath corresponding to the SchemaNode.protected StringName of the element-to-be-rendered's DataType.JSP - encoded xpath to the element being rendered. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.dom4j.ElementbestPracticesLink(String xpath) protected voiddoInit(String xpath, org.dom4j.Element parent, RendererHelper rhelper) Constructor for the Renderer objectprotected voiddoInit(String xpath, org.dom4j.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 .abstract ComplexTypeLabelgetComplexTypeLabel(String xpath) abstract ComplexTypeLabelgetComplexTypeLabel(String xpath, String siblingPath, String indexId) abstract org.dom4j.ElementgetDeleteController(String itemPath, String elementName) protected org.dom4j.ElementgetDiv()Gets a DIV element styled for the current level.protected org.dom4j.ElementgetDiv(int level) Gets a DIV element styled for a particular level.abstract org.dom4j.ElementgetInputElement(String xpath, SchemaNode schemaNode, GlobalDef typeDef) final intprotected abstract org.dom4j.ElementgetMultiBoxInput(String xpath) abstract org.dom4j.ElementgetOptionalItemControl(String xpath) abstract org.dom4j.ElementgetRenderedField(String xpath, org.dom4j.Element label, org.dom4j.Element inputField) abstract Stringfinal org.dom4j.NamespaceGets the schema namespace (associated with "http://www.w3.org/2001/XMLSchema") for the root schema for the metadata framework for this Renderer.final StringGets the prefix of the schemaNamespace as defined by the root schema for the metadata framework for this Renderer.abstract SimpleTypeLabelgetSimpleTypeLabel(String xpath) abstract SimpleTypeLabelgetSimpleTypeLabel(String xpath, String siblingPath, String indexId) final StringGets the format (e.g., "adn") of the metadata framework for this Renderer.protected voidinit(String xpath, org.dom4j.Element parent, RendererHelper rhelper) Initialize Renderer attributesabstract booleanabstract booleanstatic Stringreturns the input string surrounded by a string that is replaced with a quotation mark when the rendered Element is writen to disk.abstract voidRender an Attribute Nodeabstract voidrenderChoice(org.dom4j.Element choice) Render a choice node.voidRender an editor for a schemaNode defined asComplexTypeprotected abstract voidImplementation-specific method to render an editor for a schemaNode defined asComplexTypeabstract voidRender a Derived Content Model (ComplexType having ComplexContent element)abstract voidRender a derived Text-Only content model (ComplexType having SimpleContent element)abstract voidrenderModelGroup(org.dom4j.Element group) voidRender an editor for the schemaNode (i.e., a Node of the schema's instanceDocument) specified by the xpath field.abstract voidRender an element having an unbounded sequence of subelementsabstract voidabstract voidrenderSequence(org.dom4j.Element sequence) Render the subelements of a sequence compositorvoidRender an editor for a schemaNode defined asinvalid reference
SimpleTypeabstract voidImplementation-specific method to render an editor for a schemaNode defined asinvalid reference
SimpleTypeabstract voidRender the subitems of the current ComplexType element by walking the children elements of the type definition.abstract voidrenderSubElements(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 Renderer objectabstract voidsetRenderMode(String mode) abstract booleanshowXsdStringElement(String xpath)
-
Field Details
-
sh
ASchemaHelperinstance that provides schema-related information and services to the Renderer. -
xpath
JSP - encoded xpath to the element being rendered. -
parent
public org.dom4j.Element parentAElementrepresenting the parent of the node being rendered. -
schemaNode
TheSchemaNodewhich wraps the schema element (which may represent an Element Attribute) being rendered -
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
Data structure containing global information required by individual Renderer instances. -
normalizedXPath
-
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 org.dom4j.DocumentFactory dfThe DataType of the element to be rendered. -
root
protected org.dom4j.Element rootThe root element to be Rendered. Stored in the RendererHelper instance. -
repeatingComplexSingletonChildPath
Place holder for a path to a repeating child. This field is null for elements that do not contain a repeating child. -
formBeanName
Description of the Field
-
-
Constructor Details
-
Renderer
public Renderer()Constructor for the Renderer object
-
-
Method Details
-
doInit
protected void doInit(String xpath, org.dom4j.Element parent, RendererHelper rhelper) throws Exception Constructor for the Renderer object- Parameters:
xpath- xpath to the Node to be renderedparent- The element to which the rendered Node is attached as a childrhelper- Pointer to the RendererHelper- Throws:
Exception- NOT YET DOCUMENTED
-
doInit
protected void doInit(String xpath, org.dom4j.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 renderedparent- The element to which the rendered Node is attached as a childrhelper- Pointer to the RendererHelperdataTypeName- The name of the dataType as which the node is rendered- Throws:
Exception- NOT YET DOCUMENTED
-
init
Initialize Renderer attributes- Parameters:
xpath- The jsp-encoded xpath to the element to be rendered.parent- TheSchemaNodewhich wraps the schema element (which may represent an Element Attribute) being renderedrhelper- Data structure containing global information required by individual Renderer instances
-
isDisplayMode
public abstract boolean isDisplayMode() -
isEditMode
public abstract boolean isEditMode() -
setRenderMode
-
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 asinvalid reference
SimpleType -
renderSimpleTypeConcrete
public abstract void renderSimpleTypeConcrete()Implementation-specific method to render an editor for a schemaNode defined asinvalid reference
SimpleType -
renderComplexType
public void renderComplexType()Render an editor for a schemaNode defined asComplexType -
renderComplexTypeConcrete
protected abstract void renderComplexTypeConcrete()Implementation-specific method to render an editor for a schemaNode defined asComplexType -
renderDerivedTextOnlyModel
public abstract void renderDerivedTextOnlyModel()Render a derived Text-Only content model (ComplexType having SimpleContent element)An example text-only model definition:
invalid input: '<'xsd:complexType> invalid input: '<'xsd:simpleContent> invalid input: '<'xsd:extension base="xsd:string"> invalid input: '<'xsd:attribute name="URL" type="stringTextType" use="required"/> invalid input: '<'/xsd:extension> invalid input: '<'/xsd:simpleContent> invalid input: '<'/xsd:complexType>
-
renderDerivedContentModel
public abstract void renderDerivedContentModel()Render a Derived Content Model (ComplexType having ComplexContent element) -
renderModelGroup
public abstract void renderModelGroup(org.dom4j.Element group) -
renderAttribute
public abstract void renderAttribute()Render an Attribute Node -
renderChoice
public abstract void renderChoice(org.dom4j.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 (seeComplexType)
-
renderSequence
public abstract void renderSequence(org.dom4j.Element sequence) Render the subelements of a sequence compositor- Parameters:
sequence- the sequence compositorElement
-
renderRepeatingElement
public abstract void renderRepeatingElement()Render an element having an unbounded sequence of subelements -
renderRepeatingSubstitutionGroup
public abstract void renderRepeatingSubstitutionGroup() -
renderSubElements
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
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
Gets the format (e.g., "adn") of the metadata framework for this Renderer. -
getSchemaNSPrefix
Gets the prefix of the schemaNamespace as defined by the root schema for the metadata framework for this Renderer. -
getSchemaNamespace
public final org.dom4j.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
-
getDiv
protected org.dom4j.Element getDiv()Gets a DIV element styled for the current level.- Returns:
- The div value
-
getDiv
protected org.dom4j.Element getDiv(int level) Gets a DIV element styled for a particular level.- Parameters:
level- Description of the Parameter- Returns:
- The div value
-
jspQuotedString
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
-
getInputElement
public abstract org.dom4j.Element getInputElement(String xpath, SchemaNode schemaNode, GlobalDef typeDef) -
getSimpleTypeLabel
-
getSimpleTypeLabel
public abstract SimpleTypeLabel getSimpleTypeLabel(String xpath, String siblingPath, String indexId) -
getComplexTypeLabel
-
getComplexTypeLabel
public abstract ComplexTypeLabel getComplexTypeLabel(String xpath, String siblingPath, String indexId) -
showXsdStringElement
-
getRenderedField
public abstract org.dom4j.Element getRenderedField(String xpath, org.dom4j.Element label, org.dom4j.Element inputField) -
getDeleteController
-
getOptionalItemControl
-
getMultiBoxInput
-
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
-