DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.autoform
Class RendererHelper

java.lang.Object
  extended by 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 Summary
 int counter
          Keeps track of number of Renderer instantiations to guard against infinite loops
static int DEFAULT_TEXT_INPUT_SIZE
           
 boolean showElementDebugInfo
          Causes debugging information about each element to be shown in editor
 boolean showLabelDebugInfo
          Causes debugging information about the element labels to be shown in editor
 
Constructor Summary
RendererHelper(Element root, MetaDataFramework framework, String formBeanName)
          Constructor for the RendererHelper object
RendererHelper(Element root, MetaDataFramework framework, String formBeanName, String renderer)
          Constructor for the RendererHelper object with renderer class name explicitly specified.
 
Method Summary
 Element acceptsNewChioceTest(String path)
          NOT YET DOCUMENTED
 Element acceptsNewSiblingTest(String path)
          NOT YET DOCUMENTED
 void attachElementDebugInfo(Element target, String displayText, String borderColor)
          NOT YET DOCUMENTED
 void attachMessages(Element container, String xpath)
          Description of the Method
 void attachToolHelp(Element e, String helpMsg)
          Attach a pop-up tool help message to an element
 void destroy()
          NOT YET DOCUMENTED
 void embedDebugInfo(Element e, String s)
          NOT YET DOCUMENTED
static String encodeIndexId(String xpath)
          Given a "siblingPath" (xpath with no indexing on leaf node), create a javascript variable to use for indexed elements.
 int getBaseLevel()
          Gets the baseLevel attribute of the RendererHelper object.
 FieldInfoReader getFieldInfo(String xpath)
          returns the FieldInfoReader for the given xpath, or null if one does not exist
 String getFormBeanName()
          Gets the formBeanName attribute of the RendererHelper object
 MetaDataFramework getFramework()
          Gets the framework attribute of the RendererHelper object
 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
 int getMaxLen(String xpath)
          Gets the maxLen attribute of the RendererHelper object
 RendererImpl getRenderer(String xpath, Element parent)
          Renderer factory returns a Renderer instance for the schemaNode at xpath.
 RendererImpl getRenderer(String xpath, 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.
 String getRendererClassName()
          Gets the rendererClassName attribute of the RendererHelper object
 Element getRoot()
          Gets the root attribute of the RendererHelper object
 SchemaHelper getSchemaHelper()
          Gets the schemaHelper attribute of the RendererHelper object
 String getToolHelp(String s)
          Attempts to return a metadata vocab field definition for the input string assuming it is an xpath.
 boolean hasFieldInfo(String xpath)
          Description of the Method
 boolean hasInputHelper(String xpath)
          Returns true if the provided path is configured with an inputHelper
 boolean hasMuiGroupInfo(String xpath)
          Return if there is Mui Grouping Information available for this field.
 boolean hasVocabLayout(String xpath)
          NOT YET DOCUMENTED
static Element jspInclude(String page)
          NOT YET DOCUMENTED
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.
 Element nodeExistsTest(String path)
          Creates a test for the existence of a node in the instance document at the given path
 Element nodeHasChildrenTest(String path)
          NOT YET DOCUMENTED
 Element nodeHasMembersTest(String path)
          NOT YET DOCUMENTED
 Element nodeHasNoMembersTest(String path)
          NOT YET DOCUMENTED
 Element nodeNotExistsTest(String path)
          Creates an element that tests for the NON-existence of an instance document node at the given path
static String normalizeXPath(String encodedXPpath)
          Removes any and all indexing information from an XPath.
 Element parentNodeExistsTest(String xpath)
          Creates a test for the existance of the parentNode of the node being rendered
 Element parentNodeNotExistsTest(String xpath)
          NOT YET DOCUMENTED
static void setDebug(boolean bool)
          Sets the debug attribute of the RendererHelper class
 void setFormBeanName(String beanName)
          Sets the formBeanName attribute of the RendererHelper object
static void setLogging(boolean verbose)
          Sets the logging attribute of the RendererHelper class
 Element viewNodeTest(String xpath)
          Used by the viewing classes (not the editing classes) to test that a node exists and has content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TEXT_INPUT_SIZE

public static final int DEFAULT_TEXT_INPUT_SIZE
See Also:
Constant Field Values

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 Detail

RendererHelper

public RendererHelper(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(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 Detail

attachElementDebugInfo

public void attachElementDebugInfo(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(Element e,
                           String s)
NOT YET DOCUMENTED

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

getRenderer

public final RendererImpl getRenderer(String xpath,
                                      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,
                                      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 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 Element jspInclude(String page)
NOT YET DOCUMENTED

Parameters:
page - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

parentNodeExistsTest

public 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 Element parentNodeNotExistsTest(String xpath)
NOT YET DOCUMENTED

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

nodeExistsTest

public 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 Element nodeHasChildrenTest(String path)
NOT YET DOCUMENTED

Parameters:
path - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

nodeHasMembersTest

public Element nodeHasMembersTest(String path)
NOT YET DOCUMENTED

Parameters:
path - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

nodeHasNoMembersTest

public Element nodeHasNoMembersTest(String path)
NOT YET DOCUMENTED

Parameters:
path - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

acceptsNewSiblingTest

public Element acceptsNewSiblingTest(String path)
NOT YET DOCUMENTED

Parameters:
path - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

acceptsNewChioceTest

public Element acceptsNewChioceTest(String path)
NOT YET DOCUMENTED

Parameters:
path - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED

nodeNotExistsTest

public 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 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(Element container,
                           String xpath)
Description of the Method

Parameters:
container - Description of the Parameter
xpath - NOT YET DOCUMENTED

attachToolHelp

public void attachToolHelp(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

DLESE Tools
v1.6.0