DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.autoform.mde
Class MdeNode

java.lang.Object
  extended by org.dlese.dpc.schemedit.autoform.mde.MdeNode
Direct Known Subclasses:
MdeAttribute, MdeComplexType, MdeRepeatingNode, MdeSimpleType

public abstract class MdeNode
extends Object

Base class for rendering the document structure ("nodes") in the Metadata Editor. Subclasses provide concrete render methods for two *modes*:

  1. edit_mode - in which input is accepted, and
  2. display_mode - in which field values are simply displayed
Subclasses implement the logic to render the various schema types (e.g., SimpleType, ComplexType, Choice, Sequence, etc) that define each metadata editor node.

MdeNode instances provide access to the following classes:

Author:
ostwald

Field Summary
protected  DocumentFactory df
          NOT YET DOCUMENTED
protected  String formBeanName
          NOT YET DOCUMENTED
protected  String inputHelperFile
           
protected  String normalizedXPath
          NOT YET DOCUMENTED
protected  Element parent
          NOT YET DOCUMENTED
 RendererImpl renderer
          NOT YET DOCUMENTED
protected  RendererHelper rhelper
          NOT YET DOCUMENTED
protected  SchemaNode schemaNode
          NOT YET DOCUMENTED
protected  SchemaHelper sh
          NOT YET DOCUMENTED
protected  GlobalDef typeDef
          NOT YET DOCUMENTED
protected  String xpath
          NOT YET DOCUMENTED
 
Constructor Summary
MdeNode(RendererImpl renderer)
          Constructor for the MdeNode object
 
Method Summary
protected  void addHtmlComment(Element e, String s)
          Adds a feature to the HtmlComment attribute of the MdeNode object
protected  void attachElementDebugInfo(Element e, String s)
          Attach a debugging message to this element that can be viewed in the editing form.
protected  void attachElementDebugInfo(Element target, String displayText, String borderColor)
          Attaches debugging info to a rendered element in the editor, optionally including a border to outline the element.
protected  void attachElementId(Element e)
          Add an "id" attribute to the provided element, with a value derived from this node's "xpath".
protected  void attachLabelDebugInfo(Element e, String s)
          Description of the Method
protected  void attachLabelDebugInfo(Element e, String s, String borderSpec)
          Description of the Method
protected  void attachLabelDebugInfo(Label labelObj, String s)
          attach debuging information to a label object that is displayed in the editor
protected  Element bestPracticesLink(String xpath)
          Return a Best Practices link represented as an Element.
protected  void embedDebugInfo(Element e, String s)
          Embed a debugging string in the provided element that can be viewed in HTML source.
protected  Element getDiv()
          Gets the div attribute of the MdeNode object
protected  Element getDiv(int level)
          Gets the div attribute of the MdeNode object
protected  Element getInputElement()
          Gets a rendered inputElement for this node from the Renderer instance.
 String getInputHelperFile()
           
protected  Namespace getInstanceSchemaNamespace()
          Gets the schema namespace (associated with "http://www.w3.org/2001/XMLSchema") for the root schema for the metadata framework for this Renderer.
 String getMode()
          Gets the mode attribute of the MdeNode object - used for Debugging
protected  String getQualifiedAttributeName(String name, Element element, GlobalDef typeDef)
          Gets the qualifiedAttributeName attribute of the Renderer object.
protected  String getQualifiedElementName(String name, GlobalDef typeDef)
          Gets the qualifiedName attribute of the Renderer object
protected  Element getRenderedField(Label label, Element inputField)
          Renders a Labelled input field (for a Simple or Built-in schema dataType.
protected  Element getRenderedNoInputField(Label label)
          Displaying labels for elements that have no input field
protected  Element getRenderedNoInputField(Label label, Element action)
           
protected  Element getRenderedNoInputField(Label label, Element action, Element inputHelper)
          Creates Element for displaying labels, action controllers and collapseWidgets for elements that have no input field.
protected  String getToolHelp(String s)
          Attempts to return a metadata vocab field definition for the input string assuming it is an xpath.
protected  void insertDisplaySetup(Element baseDiv)
          Creates element representing a mousable field label that will open or close its contents.
protected  void insertHtmlComment(Element e, String s)
          Insert an HTML comment into the html source.
protected  boolean isDisplayMode()
          Gets the displayMode attribute of the MdeNode object (KEEP)
protected  boolean isEditMode()
          Gets the editMode attribute of the MdeNode object
 Renderer newRenderer(String xpath, Element parent)
          Gets a new renderer for the specified xpath and parent element.
 Renderer newRenderer(String xpath, Element parent, GlobalDef typeDef)
          Gets a new renderer for the specified xpath and parent element and typeDef.
protected  void prtln(String s)
          Description of the Method
abstract  void render()
          NOT YET DOCUMENTED
static void setDebug(boolean bool)
          Sets the debug attribute of the MdeNode class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sh

protected SchemaHelper sh
NOT YET DOCUMENTED


xpath

protected String xpath
NOT YET DOCUMENTED


parent

protected Element parent
NOT YET DOCUMENTED


schemaNode

protected SchemaNode schemaNode
NOT YET DOCUMENTED


typeDef

protected GlobalDef typeDef
NOT YET DOCUMENTED


df

protected DocumentFactory df
NOT YET DOCUMENTED


rhelper

protected RendererHelper rhelper
NOT YET DOCUMENTED


formBeanName

protected String formBeanName
NOT YET DOCUMENTED


normalizedXPath

protected String normalizedXPath
NOT YET DOCUMENTED


renderer

public RendererImpl renderer
NOT YET DOCUMENTED


inputHelperFile

protected String inputHelperFile
Constructor Detail

MdeNode

public MdeNode(RendererImpl renderer)
Constructor for the MdeNode object

Parameters:
renderer - NOT YET DOCUMENTED
Method Detail

render

public abstract void render()
NOT YET DOCUMENTED


newRenderer

public Renderer newRenderer(String xpath,
                            Element parent)
Gets a new renderer for the specified xpath and parent element.

Parameters:
xpath - xpath for new renderer
parent - parent element for new renderer
Returns:
A new renderer instance.

newRenderer

public Renderer newRenderer(String xpath,
                            Element parent,
                            GlobalDef typeDef)
Gets a new renderer for the specified xpath and parent element and typeDef.

Parameters:
xpath - xpath for new renderer
parent - parent element for new renderer
typeDef - Explicitly specified typeDef for new renderer
Returns:
A new renderer instance.

getInputHelperFile

public String getInputHelperFile()

isEditMode

protected boolean isEditMode()
Gets the editMode attribute of the MdeNode object

Returns:
The editMode value

isDisplayMode

protected boolean isDisplayMode()
Gets the displayMode attribute of the MdeNode object (KEEP)

Returns:
The displayMode value

getMode

public String getMode()
Gets the mode attribute of the MdeNode object - used for Debugging

Returns:
The mode value

getInputElement

protected Element getInputElement()
Gets a rendered inputElement for this node from the Renderer instance.

Returns:
The inputElement value

bestPracticesLink

protected Element bestPracticesLink(String xpath)
Return a Best Practices link represented as an Element.

NOTE: apparently css class ("action-button") must be applyed to both the link and the text within to get consistent results in both IE and FireFox ...

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

getInstanceSchemaNamespace

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


getQualifiedElementName

protected String getQualifiedElementName(String name,
                                         GlobalDef typeDef)
Gets the qualifiedName attribute of the Renderer object

Parameters:
name - NOT YET DOCUMENTED
typeDef - NOT YET DOCUMENTED
Returns:
The qualifiedName value

getQualifiedAttributeName

protected String getQualifiedAttributeName(String name,
                                           Element element,
                                           GlobalDef typeDef)
Gets the qualifiedAttributeName attribute of the Renderer object.

NOTE: i don't think this method is required at all. if the instance document is constructed correctly, the attributes are already qualified as needed and there is no need to mess with it any further ..

Parameters:
name - NOT YET DOCUMENTED
typeDef - NOT YET DOCUMENTED
element - NOT YET DOCUMENTED
Returns:
The qualifiedAttributeName value

getRenderedField

protected Element getRenderedField(Label label,
                                   Element inputField)
Renders a Labelled input field (for a Simple or Built-in schema dataType.

Parameters:
label - Description of the Parameter
inputField - Description of the Parameter
Returns:
The labelFieldTable value

getRenderedNoInputField

protected Element getRenderedNoInputField(Label label)
Displaying labels for elements that have no input field

Parameters:
label - Description of the Parameter
Returns:
The labelActionTable value

getRenderedNoInputField

protected Element getRenderedNoInputField(Label label,
                                          Element action)

getRenderedNoInputField

protected Element getRenderedNoInputField(Label label,
                                          Element action,
                                          Element inputHelper)
Creates Element for displaying labels, action controllers and collapseWidgets for elements that have no input field. Action controllers enable users to perform actions such as deleting a node or adding a new one.

Parameters:
label - Description of the Parameter
action - Description of the Parameter
Returns:
The formattedLabel value

getDiv

protected Element getDiv()
Gets the div attribute of the MdeNode object

Returns:
The div value

getDiv

protected Element getDiv(int level)
Gets the div attribute of the MdeNode object

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

getToolHelp

protected 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.

embedDebugInfo

protected void embedDebugInfo(Element e,
                              String s)
Embed a debugging string in the provided element that can be viewed in HTML source.

Parameters:
e - NOT YET DOCUMENTED
s - NOT YET DOCUMENTED

attachElementDebugInfo

protected void attachElementDebugInfo(Element e,
                                      String s)
Attach a debugging message to this element that can be viewed in the editing form.

Parameters:
e - NOT YET DOCUMENTED
s - NOT YET DOCUMENTED

attachElementDebugInfo

protected void attachElementDebugInfo(Element target,
                                      String displayText,
                                      String borderColor)
Attaches debugging info to a rendered element in the editor, optionally including a border to outline the element. The borderSpec is a string that specifies the border in css: e.g., "thin blue solid"

Parameters:
target - The Element to which the debugging element is attached
displayText - The debugging message
borderColor - NOT YET DOCUMENTED

attachLabelDebugInfo

protected void attachLabelDebugInfo(Element e,
                                    String s,
                                    String borderSpec)
Description of the Method

Parameters:
e - Description of the Parameter
s - Description of the Parameter
borderSpec - NOT YET DOCUMENTED

attachLabelDebugInfo

protected void attachLabelDebugInfo(Element e,
                                    String s)
Description of the Method

Parameters:
e - Description of the Parameter
s - Description of the Parameter

insertHtmlComment

protected void insertHtmlComment(Element e,
                                 String s)
Insert an HTML comment into the html source.

Parameters:
e - NOT YET DOCUMENTED
s - NOT YET DOCUMENTED

addHtmlComment

protected void addHtmlComment(Element e,
                              String s)
Adds a feature to the HtmlComment attribute of the MdeNode object

Parameters:
e - The feature to be added to the HtmlComment attribute
s - The feature to be added to the HtmlComment attribute

attachLabelDebugInfo

protected void attachLabelDebugInfo(Label labelObj,
                                    String s)
attach debuging information to a label object that is displayed in the editor

Parameters:
labelObj - NOT YET DOCUMENTED
s - NOT YET DOCUMENTED

attachElementId

protected void attachElementId(Element e)
Add an "id" attribute to the provided element, with a value derived from this node's "xpath".

Parameters:
e - NOT YET DOCUMENTED

insertDisplaySetup

protected void insertDisplaySetup(Element baseDiv)
Creates element representing a mousable field label that will open or close its contents. Used to expand and collapse the hierarchical strucuture of the xml document

Parameters:
baseDiv - Description of the Parameter

prtln

protected void prtln(String s)
Description of the Method

Parameters:
s - Description of the Parameter

setDebug

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

Parameters:
bool - The new debug value

DLESE Tools
v1.6.0