Class RendererHelper

java.lang.Object
org.dlese.dpc.schemedit.autoform.RendererHelper

public class RendererHelper extends Object
Manages global rhelper information for a Renderer Instance as well as providing a renderer factory for instantiating new renderer objects.

See Renderer and it's concrete subclasses.

Author:
ostwald

  • Field Details

    • DEFAULT_TEXT_INPUT_SIZE

      public static final int DEFAULT_TEXT_INPUT_SIZE
      See Also:
    • showElementDebugInfo

      public boolean showElementDebugInfo
      Causes debugging information about each element to be shown in editor
    • showLabelDebugInfo

      public boolean showLabelDebugInfo
      Causes debugging information about the element labels to be shown in editor
    • counter

      public int counter
      Keeps track of number of Renderer instantiations to guard against infinite loops
  • Constructor Details

    • RendererHelper

      public RendererHelper(org.dom4j.Element root, MetaDataFramework framework, String formBeanName, String renderer)
      Constructor for the RendererHelper object with renderer class name explicitly specified. Used by View Renders, such as EditorViewerRenderer, for which the renderer cannot be obtained from the MetaDataFramework.
      Parameters:
      root - Description of the Parameter
      framework - Description of the Parameter
      formBeanName - Description of the Parameter
      renderer - Description of the Parameter
    • RendererHelper

      public RendererHelper(org.dom4j.Element root, MetaDataFramework framework, String formBeanName)
      Constructor for the RendererHelper object
      Parameters:
      root - root Element to be rendered
      framework - MetaDataFramework representing the XML Schema to be used
      formBeanName - Description of the Parameter
  • Method Details

    • attachElementDebugInfo

      public void attachElementDebugInfo(org.dom4j.Element target, String displayText, String borderColor)
      NOT YET DOCUMENTED
      Parameters:
      target - NOT YET DOCUMENTED
      displayText - NOT YET DOCUMENTED
      borderColor - NOT YET DOCUMENTED
    • embedDebugInfo

      public void embedDebugInfo(org.dom4j.Element e, String s)
      NOT YET DOCUMENTED
      Parameters:
      e - NOT YET DOCUMENTED
      s - NOT YET DOCUMENTED
    • getRenderer

      public final RendererImpl getRenderer(String xpath, org.dom4j.Element parent)
      Renderer factory returns a Renderer instance for the schemaNode at xpath.
      Parameters:
      xpath - xpath for node to be rendered
      parent - parent element to which to attach rendered node
      Returns:
      The renderer value
    • getRenderer

      public final RendererImpl getRenderer(String xpath, org.dom4j.Element parent, GlobalDef typeDef)
      Renderer factory returns a Renderer instance for the schemaNode at xpath, possibly with a "proxy dataType" (if provided) that will override the dataType associated with the schemaNode.
      Parameters:
      xpath - xpath for node to be rendered
      parent - parent element to which to attach rendered node
      typeDef - NOT YET DOCUMENTED
      Returns:
      The renderer value
    • normalizeXPath

      public static String normalizeXPath(String encodedXPpath)
      Removes any and all indexing information from an XPath. In particular, cleans up any JSP-encoding, including curly bracketed indexing (e.g., ${indexId+1}). This form of XPath is necessary for accessing schemaNodes, which contain no indexing.
      Parameters:
      encodedXPpath - Description of the Parameter
      Returns:
      Xpath duitable for finding a SchemaNode
    • getRendererClassName

      public String getRendererClassName()
      Gets the rendererClassName attribute of the RendererHelper object
      Returns:
      The rendererClassName value
    • getMaxLen

      public int getMaxLen(String xpath)
      Gets the maxLen attribute of the RendererHelper object
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      The maxLen value
    • getFormBeanName

      public String getFormBeanName()
      Gets the formBeanName attribute of the RendererHelper object
      Returns:
      The formBeanName value
    • setFormBeanName

      public void setFormBeanName(String beanName)
      Sets the formBeanName attribute of the RendererHelper object
      Parameters:
      beanName - The new formBeanName value
    • getSchemaHelper

      public SchemaHelper getSchemaHelper()
      Gets the schemaHelper attribute of the RendererHelper object
      Returns:
      The schemaHelper value
    • getFramework

      public MetaDataFramework getFramework()
      Gets the framework attribute of the RendererHelper object
      Returns:
      The framework value
    • getRoot

      public org.dom4j.Element getRoot()
      Gets the root attribute of the RendererHelper object
      Returns:
      The root value
    • hasMuiGroupInfo

      public boolean hasMuiGroupInfo(String xpath)
      Return if there is Mui Grouping Information available for this field. Mui Group Information is specified in the groups files of the MetadataVocab object, and stored in the MetaDataFramework object.
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • hasVocabLayout

      public boolean hasVocabLayout(String xpath)
      NOT YET DOCUMENTED
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • hasFieldInfo

      public boolean hasFieldInfo(String xpath)
      Description of the Method
      Parameters:
      xpath - Description of the Parameter
      Returns:
      Description of the Return Value
    • getFieldInfo

      public FieldInfoReader getFieldInfo(String xpath)
      returns the FieldInfoReader for the given xpath, or null if one does not exist
      Parameters:
      xpath - Description of the Parameter
      Returns:
      The fieldInfo value
    • hasInputHelper

      public boolean hasInputHelper(String xpath)
      Returns true if the provided path is configured with an inputHelper
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • getInputHelperFile

      public String getInputHelperFile(String xpath)
      Returns the configured inputHelper value for the provided xpath (inputHelper value is relative to the /editor/input_helper directory in the deployed app
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      The inputHelperFile value
    • getBaseLevel

      public int getBaseLevel()
      Gets the baseLevel attribute of the RendererHelper object. The baseLevel determines at which level in the schema we are rendering for the individual pages.
      Returns:
      The baseLevel value
    • encodeIndexId

      public static final String encodeIndexId(String xpath)
      Given a "siblingPath" (xpath with no indexing on leaf node), create a javascript variable to use for indexed elements. Replace colons in index id with underscore to avoid javascript problems with qualified names. Then add a string ("Index") and indexId index, if required, to avoid name collisions.
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • jspQuotedString

      public static final 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
    • jspInclude

      public static org.dom4j.Element jspInclude(String page)
      NOT YET DOCUMENTED
      Parameters:
      page - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • parentNodeExistsTest

      public org.dom4j.Element parentNodeExistsTest(String xpath)
      Creates a test for the existance of the parentNode of the node being rendered
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      An Element representing the test for the existance of a parent node
    • parentNodeNotExistsTest

      public org.dom4j.Element parentNodeNotExistsTest(String xpath)
      NOT YET DOCUMENTED
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • nodeExistsTest

      public org.dom4j.Element nodeExistsTest(String path)
      Creates a test for the existence of a node in the instance document at the given path
      Parameters:
      path - Description of the Parameter
      Returns:
      Element that performs test when embedded in JSP
    • nodeHasChildrenTest

      public org.dom4j.Element nodeHasChildrenTest(String path)
      NOT YET DOCUMENTED
      Parameters:
      path - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • nodeHasMembersTest

      public org.dom4j.Element nodeHasMembersTest(String path)
      NOT YET DOCUMENTED
      Parameters:
      path - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • nodeHasNoMembersTest

      public org.dom4j.Element nodeHasNoMembersTest(String path)
      NOT YET DOCUMENTED
      Parameters:
      path - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • acceptsNewSiblingTest

      public org.dom4j.Element acceptsNewSiblingTest(String path)
      NOT YET DOCUMENTED
      Parameters:
      path - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • acceptsNewChioceTest

      public org.dom4j.Element acceptsNewChioceTest(String path)
      NOT YET DOCUMENTED
      Parameters:
      path - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • nodeNotExistsTest

      public org.dom4j.Element nodeNotExistsTest(String path)
      Creates an element that tests for the NON-existence of an instance document node at the given path
      Parameters:
      path - Description of the Parameter
      Returns:
      Element that performs test when embedded in JSP
    • viewNodeTest

      public org.dom4j.Element viewNodeTest(String xpath)
      Used by the viewing classes (not the editing classes) to test that a node exists and has content.

      NOTE: should this method be ABSTRACT here, and only instantiated in DcsView utils?? (it must be at least declared here, since it is referenced from the renderer, which has obtained utils as RenderUtils.

      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • attachMessages

      public void attachMessages(org.dom4j.Element container, String xpath)
      Description of the Method
      Parameters:
      container - Description of the Parameter
      xpath - NOT YET DOCUMENTED
    • attachToolHelp

      public void attachToolHelp(org.dom4j.Element e, String helpMsg)
      Attach a pop-up tool help message to an element
      Parameters:
      e - The element to recieve the tool help
      helpMsg - Description of the Parameter
    • 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.
    • setLogging

      public static void setLogging(boolean verbose)
      Sets the logging attribute of the RendererHelper class
      Parameters:
      verbose - The new logging value
    • destroy

      public void destroy()
      NOT YET DOCUMENTED
    • setDebug

      public static void setDebug(boolean bool)
      Sets the debug attribute of the RendererHelper class
      Parameters:
      bool - The new debug value