com.ge.research.acuity.ui.renderers
Class HTMLRenderer

java.lang.Object
  extended bycom.ge.research.acuity.ui.renderers.HTMLRenderer
All Implemented Interfaces:
Renderer

public class HTMLRenderer
extends java.lang.Object
implements Renderer

Renderer for an HTML client. Converts PresentationObjects into objects whose Object.toString() method produce HTML tags, representing the original presentation object.

Version:
$Revision: 1.5 $ $Date: 2007/05/19 13:50:32 $
Author:
garbiras
Created on:
Feb 17, 2005

Field Summary
static int ERROR_WINDOW
          Window type identifier to create an error message window frame
static java.lang.String FORM_SUBMIT
          HTML form submit method
protected  java.util.logging.Logger logger
          The logging utility for this class
static int MISSING_PROPERTY_WINDOW
          Window type identifier to create a missing property window frame
static int PRESENTATION_OBJECT_WINDOW
          Window type identifier to create a presentation object window frame
static java.lang.String SCRIPT_PREFIX
          HTML javascript prefix
static java.lang.String SUBMIT_TEXT
          HTML submit button text
 
Constructor Summary
HTMLRenderer(java.util.Properties props)
          Calls the default constructor with second argument null
HTMLRenderer(java.util.Properties props, java.lang.String contextPath)
          Default constructor.
 
Method Summary
static java.lang.String constructPath(java.lang.String contextPath, java.lang.String deploymentStructure, java.lang.String resourceURI)
           
 java.lang.Object importClientScripts(java.util.List scripts)
          Creates the script import references described by the list of script map information
 java.lang.Object render(PresentationObject po)
          Produces the HTML representation of the PresentationObject with no explicit styleClass or submitStyleClass information
 java.lang.Object render(PresentationObject po, java.lang.String styleClass)
          Produces the HTML representation of the PresentationObject with explicit styleClass information but no explicit submitStyleClass information
 java.lang.Object render(PresentationObject po, java.lang.String styleClass, java.lang.String submitStyleClass)
          Produces the HTML representation of the PresentationObject with explicit styleClass and submitStyleClass information.
 java.lang.Object renderEditableProperties(java.lang.String id, IndependentDisplayPO po)
          Creates the presentation object properties edit pane for a PresentationObject
static java.lang.String replaceHTMLCharacters(java.lang.String string)
          Replaces any invalid or troublesome HTML characters with their ascii equivalents
 void setContextPath(java.lang.String contextPath)
          Sets the client application server context path.
 void setProperties(java.util.Properties props)
          Sets the locale specific properties to use.
 java.lang.Object wrapInsideFrame(java.lang.String id, IndependentDisplayPO po, java.lang.Object renderedPO)
          Constructs the "window style" layer surrounding a rendered PresentationObject making the ACUITy customizations possible within a web browser.
 java.lang.Object wrapInsideFrame(java.lang.String id, IndependentDisplayPO po, java.lang.Object renderedPO, int windowType)
          Constructs the "window style" layer surrounding a rendered PresentationObject making the ACUITy customizations possible within a web browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCRIPT_PREFIX

public static final java.lang.String SCRIPT_PREFIX
HTML javascript prefix

See Also:
Constant Field Values

SUBMIT_TEXT

public static final java.lang.String SUBMIT_TEXT
HTML submit button text

See Also:
Constant Field Values

FORM_SUBMIT

public static final java.lang.String FORM_SUBMIT
HTML form submit method

See Also:
Constant Field Values

PRESENTATION_OBJECT_WINDOW

public static final int PRESENTATION_OBJECT_WINDOW
Window type identifier to create a presentation object window frame

See Also:
Constant Field Values

MISSING_PROPERTY_WINDOW

public static final int MISSING_PROPERTY_WINDOW
Window type identifier to create a missing property window frame

See Also:
Constant Field Values

ERROR_WINDOW

public static final int ERROR_WINDOW
Window type identifier to create an error message window frame

See Also:
Constant Field Values

logger

protected final java.util.logging.Logger logger
The logging utility for this class

Constructor Detail

HTMLRenderer

public HTMLRenderer(java.util.Properties props)
Calls the default constructor with second argument null

Parameters:
props - the localized property values to use

HTMLRenderer

public HTMLRenderer(java.util.Properties props,
                    java.lang.String contextPath)
Default constructor. Sets the localized property values to use as well as the context path for this HTMLRenderer

Parameters:
props - the localized property values to use
contextPath - the client application server context path
See Also:
setProperties(java.util.Properties), setContextPath(java.lang.String)
Method Detail

importClientScripts

public java.lang.Object importClientScripts(java.util.List scripts)
Creates the script import references described by the list of script map information

Parameters:
scripts - list of script map information
Returns:
A buffer of script import statements

render

public java.lang.Object render(PresentationObject po)
Produces the HTML representation of the PresentationObject with no explicit styleClass or submitStyleClass information

Specified by:
render in interface Renderer
Parameters:
po - the presentation object to render
Returns:
An Object whose Object.toString() method produces HTML tags representing the presentation object
See Also:
render(com.ge.research.acuity.ui.PresentationObject, java.lang.String, java.lang.String)

render

public java.lang.Object render(PresentationObject po,
                               java.lang.String styleClass)
Produces the HTML representation of the PresentationObject with explicit styleClass information but no explicit submitStyleClass information

Parameters:
po - the presentation object to render
styleClass - the styleClass to apply to the constructed HTML tag(s)
Returns:
An Object whose Object.toString() method produces HTML tags representing the presentation object
See Also:
render(com.ge.research.acuity.ui.PresentationObject, java.lang.String, java.lang.String)

render

public java.lang.Object render(PresentationObject po,
                               java.lang.String styleClass,
                               java.lang.String submitStyleClass)
Produces the HTML representation of the PresentationObject with explicit styleClass and submitStyleClass information. Calls a render method specific to the type of PresentationObject subclass passed in.

Parameters:
po - the presentation object to render
styleClass - the styleClass to apply to the constructed HTML tag(s)
submitStyleClass - the styleClass to apply to any submit buttons that are produced for this presentation object
Returns:
An Object whose Object.toString() method produces HTML tags representing the presentation object

setContextPath

public void setContextPath(java.lang.String contextPath)
Sets the client application server context path. If contextPath is null, the context path is set to the StringUtils.EMPTY_STRING

Parameters:
contextPath - the client application server context path
See Also:
StringUtils.EMPTY_STRING

setProperties

public void setProperties(java.util.Properties props)
Sets the locale specific properties to use. If props is null, an empty set of properties is created and used.

Parameters:
props - the locale specific properties to use

wrapInsideFrame

public java.lang.Object wrapInsideFrame(java.lang.String id,
                                        IndependentDisplayPO po,
                                        java.lang.Object renderedPO)
Constructs the "window style" layer surrounding a rendered PresentationObject making the ACUITy customizations possible within a web browser. This method is used to created the default window style for displayed presentation objects. Specialized styles use the wrapInsideFrame(java.lang.String, com.ge.research.acuity.ui.IndependentDisplayPO, java.lang.Object, int) method

Parameters:
id - the identifier to be given to the windowing layer
po - the PresentationObject which was rendered
renderedPO - the rendered PresentationObject enclosed within the windowing layer
Returns:
An Object whose Object.toString() method produces HTML tags representing the window style layer holding the rendered presentation object
See Also:
wrapInsideFrame(java.lang.String, com.ge.research.acuity.ui.IndependentDisplayPO, java.lang.Object, int)

wrapInsideFrame

public java.lang.Object wrapInsideFrame(java.lang.String id,
                                        IndependentDisplayPO po,
                                        java.lang.Object renderedPO,
                                        int windowType)
Constructs the "window style" layer surrounding a rendered PresentationObject making the ACUITy customizations possible within a web browser.

Parameters:
id - the identifier to be given to the windowing layer
po - the PresentationObject which was rendered
renderedPO - the rendered PresentationObject enclosed within the windowing layer
windowType - the type of acuity window frame to create
Returns:
An Object whose Object.toString() method produces HTML tags representing the window style layer holding the rendered presentation object

renderEditableProperties

public java.lang.Object renderEditableProperties(java.lang.String id,
                                                 IndependentDisplayPO po)
Creates the presentation object properties edit pane for a PresentationObject

Parameters:
id - the unique identifier given to the edit pane
po - the PresentationObject for which the edit pane is to be constructed
Returns:
An Object whose Object.toString() method produces HTML tags representing the list of properties for the presentation object, whose values can be manipulated and customized by a user.

constructPath

public static java.lang.String constructPath(java.lang.String contextPath,
                                             java.lang.String deploymentStructure,
                                             java.lang.String resourceURI)

replaceHTMLCharacters

public static final java.lang.String replaceHTMLCharacters(java.lang.String string)
Replaces any invalid or troublesome HTML characters with their ascii equivalents

Parameters:
string - the string to replace invalid characters for
Returns:
The new string with replacement codes for invalid characters