com.ibm.etools.pd.widget.viewer
Class SVGDocumentGenerator

java.lang.Object
  |
  +--com.ibm.etools.pd.widget.viewer.GraphicDocumentGenerator
        |
        +--com.ibm.etools.pd.widget.viewer.SVGDocumentGenerator
All Implemented Interfaces:
IGraphicDocumentGenerator, IGraphicDocumentStyle, java.io.Serializable
Direct Known Subclasses:
SVGMeter, SVGPieChart, SVGXYChart

public abstract class SVGDocumentGenerator
extends GraphicDocumentGenerator
implements IGraphicDocumentStyle, java.io.Serializable

Abstract base class SVGDocumentGenerator implements document-building methods which are common to SVG document-based charts.

See Also:
Serialized Form

Field Summary
protected  org.w3c.dom.Element svgRoot
          generated DOM root element
 
Fields inherited from class com.ibm.etools.pd.widget.viewer.GraphicDocumentGenerator
configDocument, dataDocument, generatedDocument, graphicColourPalette, graphicColourPaletteName, graphicFont, graphicHeight, graphicLegendTitle, graphicTimestampPrefix, graphicTitle, graphicType, graphicWidth, preferencesPage, preferencesPageHeight, preferencesPageWidth, resourcesFolder, suppressLegend
 
Fields inherited from interface com.ibm.etools.pd.widget.viewer.IGraphicDocumentStyle
BAR_PREFS, BAR_PREFS_HEIGHT, BASIC_FONT, BASIC_FONTSIZE, BASIC_FONTSTYLE, BASIC_HEIGHT, BASIC_SHOW_PERCENTS, BASIC_SHOW_SHAPES, BASIC_SHOW_VALUES, BASIC_WIDTH, COMMON_STYLE, EARTH, EARTH_PALETTE, HARVEST, HARVEST_PALETTE, LABEL_FONTSIZE_DELTA, LINE_DEFAULT_WIDTH, LINE_PREFS, LINE_PREFS_HEIGHT, METER_DEFAULT_WIDTH, METER_PREFS, METER_PREFS_HEIGHT, METER_STYLE, NS_BAR_PREFS_HEIGHT, NS_LINE_PREFS_HEIGHT, NS_METER_PREFS_HEIGHT, NS_PIE_PREFS_HEIGHT, NS_PREFS, NS_PREFS_WIDTH, NS_STACKBAR_PREFS_HEIGHT, PASTEL, PASTEL_PALETTE, PIE_DEFAULT_WIDTH, PIE_PREFS, PIE_PREFS_HEIGHT, PIE_STYLE, PREFS, PREFS_WIDTH, SEASIDE, SEASIDE_PALETTE, SPRING, SPRING_PALETTE, STACKBAR_DEFAULT_WIDTH, STACKBAR_PREFS, STACKBAR_PREFS_HEIGHT, SUMMER, SUMMER_PALETTE, TITLE_FONTSIZE_DELTA, XYCHART_STYLE
 
Constructor Summary
SVGDocumentGenerator()
          Sole constructor
 
Method Summary
protected  void addBorder(org.w3c.dom.Element parent)
          Adds a border around this object's graphic and places preference icon.
protected  void addJavaScriptFunctions(org.w3c.dom.Element parent, int numberOfDataSets)
          Adds the JavaScript functions required by this object's graphic.
protected  org.w3c.dom.Element addLabel(org.w3c.dom.Element parent, java.lang.String title, java.lang.String stylesheetClass, double x, double y, int rotation)
          Convenience method for adding text elements to this object's graphic.
protected  void addLegend(org.w3c.dom.Element parent, java.lang.String[] labels, int xOffset, int yOffset)
          Adds the legend to this object's graphic.
protected  void addLegendShapes(org.w3c.dom.Element parent, int index, int fontSize, int x, int y)
          Adds the legend shapes to this object's graphic.
protected  void addPreferenceIcon(org.w3c.dom.Element parent)
          Adds the preferences icon to this object's graphic.
protected  void addTimeStamp(org.w3c.dom.Element parent, java.lang.String timestamp)
          Adds the timestamp to this object's graphic
protected  void addTitle(org.w3c.dom.Element parent)
          Adds the main title to this object's graphic for display in the border region.
protected  org.w3c.dom.Element createDOMTextElement(java.lang.String text, java.lang.String styleClass, java.lang.String x, java.lang.String y, int rotation)
          Convenience method for creating DOM text nodes.
protected  void createGraphicColourPalettes()
          Creates the documented colour palettes for this object's graphic.
protected  void createSvgDocument(org.w3c.dom.DOMImplementation dImplement)
          Creates the required document elements for this object's graphic.
 java.lang.String getPreferencesPage()
          Returns the user preferences page name associated with the generated graphic or null if none has been specified.
 java.lang.String getPreferencesPageHeight()
          Returns the height of the window which displays the user preferences page associated with the generated graphic.
 java.lang.String getPreferencesPageWidth()
          Returns the width of the window which displays the user preferences page associated with the generated graphic.
 void setGraphicFont(java.lang.String newGraphicFont)
          Attempts to set the graphic font to the value.
 void setGraphicHeight(java.lang.String newGraphicHeight)
          Attempts to set the graphic height to the value.
 void setGraphicWidth(java.lang.String newGraphicWidth)
          Attempts to set the graphic width to the value.
 void setPreferencesPage(java.lang.String newPreferencesPage)
          Specifies the user preferences page to be used.
 void setPreferencesPageHeight(java.lang.String newPreferencesPageHeight)
          Specifies the height for the window which displays the user preferences page.
 void setPreferencesPageWidth(java.lang.String newPreferencesPageWidth)
          Specifies the width for the window which displays the user preferences page.
 
Methods inherited from class com.ibm.etools.pd.widget.viewer.GraphicDocumentGenerator
addGraphicColourPalette, generateAndSerialize, generateAndSerializeTo, generateGraphicDocument, getConfigDocument, getDataDocument, getGeneratedDocument, getGraphicColourPalette, getGraphicColourPaletteName, getGraphicFont, getGraphicHeight, getGraphicLegendTitle, getGraphicTimestampPrefix, getGraphicTitle, getGraphicType, getGraphicWidth, getResourcesFolder, isLegendSuppressed, serializeGeneratedDocumentToFile, serializeGeneratedDocumentToStream, serializeGeneratedDocumentToString, setConfigDocument, setDataDocument, setGraphicColourPaletteName, setGraphicLegendTitle, setGraphicTimestampPrefix, setGraphicTitle, setResourcesFolder, setSuppressLegend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

svgRoot

protected org.w3c.dom.Element svgRoot
generated DOM root element

Constructor Detail

SVGDocumentGenerator

public SVGDocumentGenerator()
Sole constructor

Method Detail

getPreferencesPage

public java.lang.String getPreferencesPage()
Description copied from interface: IGraphicDocumentGenerator
Returns the user preferences page name associated with the generated graphic or null if none has been specified.

Specified by:
getPreferencesPage in interface IGraphicDocumentGenerator
Returns:
String the name of the user preferences page
See Also:
IGraphicDocumentGenerator.getPreferencesPage()

getPreferencesPageWidth

public java.lang.String getPreferencesPageWidth()
Description copied from interface: IGraphicDocumentGenerator
Returns the width of the window which displays the user preferences page associated with the generated graphic.

Specified by:
getPreferencesPageWidth in interface IGraphicDocumentGenerator
Returns:
String the pixel width
See Also:
IGraphicDocumentGenerator.getPreferencesPageWidth()

getPreferencesPageHeight

public java.lang.String getPreferencesPageHeight()
Description copied from interface: IGraphicDocumentGenerator
Returns the height of the window which displays the user preferences page associated with the generated graphic.

Specified by:
getPreferencesPageHeight in interface IGraphicDocumentGenerator
Returns:
String the pixel height
See Also:
IGraphicDocumentGenerator.getPreferencesPageHeight()

setGraphicHeight

public void setGraphicHeight(java.lang.String newGraphicHeight)
Attempts to set the graphic height to the value. On failure, sets the graphic height to the default height.

Specified by:
setGraphicHeight in interface IGraphicDocumentGenerator
Overrides:
setGraphicHeight in class GraphicDocumentGenerator
See Also:
IGraphicDocumentGenerator.setGraphicHeight(String)

setGraphicWidth

public void setGraphicWidth(java.lang.String newGraphicWidth)
Attempts to set the graphic width to the value. On failure, sets the graphic width to the default width.

Specified by:
setGraphicWidth in interface IGraphicDocumentGenerator
Overrides:
setGraphicWidth in class GraphicDocumentGenerator
See Also:
IGraphicDocumentGenerator.setGraphicWidth(String)

setGraphicFont

public void setGraphicFont(java.lang.String newGraphicFont)
Attempts to set the graphic font to the value. On failure, sets the graphic font to the default font.

Specified by:
setGraphicFont in interface IGraphicDocumentGenerator
Overrides:
setGraphicFont in class GraphicDocumentGenerator
See Also:
IGraphicDocumentGenerator.setGraphicFont(String)

setPreferencesPage

public void setPreferencesPage(java.lang.String newPreferencesPage)
Description copied from interface: IGraphicDocumentGenerator
Specifies the user preferences page to be used. The page is expected to be located in the resources folder; that is, the page name is appended to any non-null value passed using "setResourcesFolder" before being generated into the graphic. Note that the if the composed location of the preferences page is not full-path, then it should be relative to the location of the page which draws in the generated graphic. Note also that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setPreferencesPage in interface IGraphicDocumentGenerator
Parameters:
newPreferencesPage - the folder location of the page which is to replace the existing preferences page. This value will be trimmed.
See Also:
IGraphicDocumentGenerator.setPreferencesPage(String)

setPreferencesPageWidth

public void setPreferencesPageWidth(java.lang.String newPreferencesPageWidth)
Description copied from interface: IGraphicDocumentGenerator
Specifies the width for the window which displays the user preferences page. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setPreferencesPageWidth in interface IGraphicDocumentGenerator
Parameters:
newPreferencesPageWidth - the pixel width
See Also:
IGraphicDocumentGenerator.setPreferencesPageWidth(String)

setPreferencesPageHeight

public void setPreferencesPageHeight(java.lang.String newPreferencesPageHeight)
Description copied from interface: IGraphicDocumentGenerator
Specifies the height for the window which displays the user preferences page. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setPreferencesPageHeight in interface IGraphicDocumentGenerator
Parameters:
newPreferencesPageHeight - the pixel heights
See Also:
IGraphicDocumentGenerator.setPreferencesPageHeight(String)

createGraphicColourPalettes

protected void createGraphicColourPalettes()
Creates the documented colour palettes for this object's graphic.

See Also:
IGraphicDocumentStyle

createSvgDocument

protected void createSvgDocument(org.w3c.dom.DOMImplementation dImplement)
Creates the required document elements for this object's graphic.

Parameters:
dImplement - implementation to use for document creation.

addJavaScriptFunctions

protected void addJavaScriptFunctions(org.w3c.dom.Element parent,
                                      int numberOfDataSets)
Adds the JavaScript functions required by this object's graphic.

Parameters:
parent - element to which the script-related elements are appended
numberOfDataSets - the number of data sets in the input

addBorder

protected void addBorder(org.w3c.dom.Element parent)
Adds a border around this object's graphic and places preference icon.

Parameters:
parent - element to which the border-related elements are appended.

addPreferenceIcon

protected void addPreferenceIcon(org.w3c.dom.Element parent)
Adds the preferences icon to this object's graphic.

Parameters:
parent - element to which the preference icon-related elements are appended

addTitle

protected void addTitle(org.w3c.dom.Element parent)
Adds the main title to this object's graphic for display in the border region.

Parameters:
parent - element to which the title-related elements are appended

addTimeStamp

protected void addTimeStamp(org.w3c.dom.Element parent,
                            java.lang.String timestamp)
Adds the timestamp to this object's graphic

Parameters:
parent - element to which the timestamp-related elements are appended
timestamp - timestamp (includes date)

addLegend

protected void addLegend(org.w3c.dom.Element parent,
                         java.lang.String[] labels,
                         int xOffset,
                         int yOffset)
Adds the legend to this object's graphic.

Parameters:
parent - element to which the legend-related elements are appended
labels - legend text labels
xOffset - starting x position
yOffset - starting y position

addLegendShapes

protected void addLegendShapes(org.w3c.dom.Element parent,
                               int index,
                               int fontSize,
                               int x,
                               int y)
Adds the legend shapes to this object's graphic.

Parameters:
parent - element to which the legend-related elements are appended
index - dataset number
fontSize - y shift factor
x - upper left x
y - upper left y

addLabel

protected org.w3c.dom.Element addLabel(org.w3c.dom.Element parent,
                                       java.lang.String title,
                                       java.lang.String stylesheetClass,
                                       double x,
                                       double y,
                                       int rotation)
Convenience method for adding text elements to this object's graphic.

Parameters:
parent - element to which the label-related elements are appended.
stylesheetClass - CSS rule for this element
x - x location for the label
y - y location for the label
rotation - the rotation value (0 - 360)

createDOMTextElement

protected org.w3c.dom.Element createDOMTextElement(java.lang.String text,
                                                   java.lang.String styleClass,
                                                   java.lang.String x,
                                                   java.lang.String y,
                                                   int rotation)
Convenience method for creating DOM text nodes.

Parameters:
text - text of the element
styleClass - CSS rule for the element
x - The x location for the text
y - The y location for the text
rotation - the rotation value (0 - 360)