Class MdeNode

java.lang.Object
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:

  • Renderers - implement the recursive process of implenting MetdataEditor Nodes, including methods to render input fields,
  • RendererHelper - provides state information for the rendering process, as well as a Factory for obtaining new renderers, and
  • SchemaHelper - provides utility methods for obtaining schema-based information.
Author:
ostwald
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.dom4j.DocumentFactory
    NOT YET DOCUMENTED
    protected String
    NOT YET DOCUMENTED
    protected String
     
    protected String
    NOT YET DOCUMENTED
    protected org.dom4j.Element
    NOT YET DOCUMENTED
    NOT YET DOCUMENTED
    protected RendererHelper
    NOT YET DOCUMENTED
    protected SchemaNode
    NOT YET DOCUMENTED
    protected SchemaHelper
    NOT YET DOCUMENTED
    protected GlobalDef
    NOT YET DOCUMENTED
    protected String
    NOT YET DOCUMENTED
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the MdeNode object
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addHtmlComment(org.dom4j.Element e, String s)
    Adds a feature to the HtmlComment attribute of the MdeNode object
    protected void
    attachElementDebugInfo(org.dom4j.Element e, String s)
    Attach a debugging message to this element that can be viewed in the editing form.
    protected void
    attachElementDebugInfo(org.dom4j.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(org.dom4j.Element e)
    Add an "id" attribute to the provided element, with a value derived from this node's "xpath".
    protected void
    attach debuging information to a label object that is displayed in the editor
    protected void
    attachLabelDebugInfo(org.dom4j.Element e, String s)
    Description of the Method
    protected void
    attachLabelDebugInfo(org.dom4j.Element e, String s, String borderSpec)
    Description of the Method
    protected org.dom4j.Element
    Return a Best Practices link represented as an Element.
    protected void
    embedDebugInfo(org.dom4j.Element e, String s)
    Embed a debugging string in the provided element that can be viewed in HTML source.
    protected org.dom4j.Element
    Gets the div attribute of the MdeNode object
    protected org.dom4j.Element
    getDiv(int level)
    Gets the div attribute of the MdeNode object
    protected org.dom4j.Element
    Gets a rendered inputElement for this node from the Renderer instance.
     
    protected org.dom4j.Namespace
    Gets the schema namespace (associated with "http://www.w3.org/2001/XMLSchema") for the root schema for the metadata framework for this Renderer.
    Gets the mode attribute of the MdeNode object - used for Debugging
    protected String
    getQualifiedAttributeName(String name, org.dom4j.Element element, GlobalDef typeDef)
    Gets the qualifiedAttributeName attribute of the Renderer object.
    protected String
    Gets the qualifiedName attribute of the Renderer object
    protected org.dom4j.Element
    getRenderedField(Label label, org.dom4j.Element inputField)
    Renders a Labelled input field (for a Simple or Built-in schema dataType.
    protected org.dom4j.Element
    Displaying labels for elements that have no input field
    protected org.dom4j.Element
    getRenderedNoInputField(Label label, org.dom4j.Element action)
     
    protected org.dom4j.Element
    getRenderedNoInputField(Label label, org.dom4j.Element action, org.dom4j.Element inputHelper)
    Creates Element for displaying labels, action controllers and collapseWidgets for elements that have no input field.
    protected String
    Attempts to return a metadata vocab field definition for the input string assuming it is an xpath.
    protected void
    insertDisplaySetup(org.dom4j.Element baseDiv)
    Creates element representing a mousable field label that will open or close its contents.
    protected void
    insertHtmlComment(org.dom4j.Element e, String s)
    Insert an HTML comment into the html source.
    protected boolean
    Gets the displayMode attribute of the MdeNode object (KEEP)
    protected boolean
    Gets the editMode attribute of the MdeNode object
    newRenderer(String xpath, org.dom4j.Element parent)
    Gets a new renderer for the specified xpath and parent element.
    newRenderer(String xpath, org.dom4j.Element parent, GlobalDef typeDef)
    Gets a new renderer for the specified xpath and parent element and typeDef.
    protected void
    Description of the Method
    abstract void
    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 Details

    • sh

      protected SchemaHelper sh
      NOT YET DOCUMENTED
    • xpath

      protected String xpath
      NOT YET DOCUMENTED
    • parent

      protected org.dom4j.Element parent
      NOT YET DOCUMENTED
    • schemaNode

      protected SchemaNode schemaNode
      NOT YET DOCUMENTED
    • typeDef

      protected GlobalDef typeDef
      NOT YET DOCUMENTED
    • df

      protected org.dom4j.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 Details

    • MdeNode

      public MdeNode(RendererImpl renderer)
      Constructor for the MdeNode object
      Parameters:
      renderer - NOT YET DOCUMENTED
  • Method Details

    • render

      public abstract void render()
      NOT YET DOCUMENTED
    • newRenderer

      public Renderer newRenderer(String xpath, org.dom4j.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, org.dom4j.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 org.dom4j.Element getInputElement()
      Gets a rendered inputElement for this node from the Renderer instance.
      Returns:
      The inputElement value
    • bestPracticesLink

      protected org.dom4j.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 org.dom4j.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, org.dom4j.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
      element - NOT YET DOCUMENTED
      typeDef - NOT YET DOCUMENTED
      Returns:
      The qualifiedAttributeName value
    • getRenderedField

      protected org.dom4j.Element getRenderedField(Label label, org.dom4j.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 org.dom4j.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 org.dom4j.Element getRenderedNoInputField(Label label, org.dom4j.Element action)
    • getRenderedNoInputField

      protected org.dom4j.Element getRenderedNoInputField(Label label, org.dom4j.Element action, org.dom4j.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 org.dom4j.Element getDiv()
      Gets the div attribute of the MdeNode object
      Returns:
      The div value
    • getDiv

      protected org.dom4j.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(org.dom4j.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(org.dom4j.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(org.dom4j.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(org.dom4j.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(org.dom4j.Element e, String s)
      Description of the Method
      Parameters:
      e - Description of the Parameter
      s - Description of the Parameter
    • insertHtmlComment

      protected void insertHtmlComment(org.dom4j.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(org.dom4j.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(org.dom4j.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(org.dom4j.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