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

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

public abstract class GraphicDocumentGenerator
extends java.lang.Object
implements IGraphicDocumentGenerator, java.io.Serializable

GraphicDocumentGenerator is an abstract base class for classes which take content data input as Document Object Model (DOM) objects and then generate DOM objects which represent graphic visualizations of that content data.

See Also:
Serialized Form

Field Summary
protected  org.w3c.dom.Document configDocument
          Configuration document
protected  org.w3c.dom.Document dataDocument
          Data document
protected  org.w3c.dom.Document generatedDocument
          Graphic document
protected  java.util.Hashtable graphicColourPalette
          Default set of available colour palettes
protected  java.lang.String graphicColourPaletteName
          Default colour palette
protected  java.lang.String graphicFont
          Graphic font
protected  short graphicHeight
          Graphic height
protected  java.lang.String graphicLegendTitle
          Legend title
protected  java.lang.String graphicTimestampPrefix
          Timestamp prefix
protected  java.lang.String graphicTitle
          Graphic title
protected  java.lang.String graphicType
          Graphic type
protected  short graphicWidth
          Graphic width
protected  java.lang.String preferencesPage
          User preference page
protected  java.lang.String preferencesPageHeight
          User preference page pixel height, resolvable to int.
protected  java.lang.String preferencesPageWidth
          User preference page pixel width, resolvable to int.
protected  java.lang.String resourcesFolder
          Resource folder location
protected  boolean suppressLegend
          Legend display indicator
 
Constructor Summary
GraphicDocumentGenerator()
           
 
Method Summary
 boolean addGraphicColourPalette(java.lang.String paletteName, java.lang.String[] palette)
          Adds the specified colour palette to the set of colour palettes which are available for the graphic generated by this object.
 java.lang.String generateAndSerialize()
          Generates a graphic Document object based on the input data and returns it XML-serialized to a String.
 boolean generateAndSerializeTo(java.lang.String uri)
          Generates a graphic Document object by based on the input data and then XML-serializes it to the specified filename on the local machine where this object is executing.
 org.w3c.dom.Document generateGraphicDocument()
          Generates and returns a graphic Document object based on input data
 org.w3c.dom.Document getConfigDocument()
          Returns the Document object which provides the configuration data for the graphic generated by this object or null if none has been set.
 org.w3c.dom.Document getDataDocument()
          Returns the Document object which provides the content data for the graphic generated by this object or null if none has been set.
 org.w3c.dom.Document getGeneratedDocument()
          Returns the Document object generated by this object or null if none has been generated.
 java.lang.String[] getGraphicColourPalette()
          Returns the set of colours belonging to the default colour palette used by the graphic generated by this object.
 java.lang.String getGraphicColourPaletteName()
          Returns the name of the default colour palette used by the graphic generated by this object.
 java.lang.String getGraphicFont()
          Returns the font used by the graphic generated by this object.
 java.lang.String getGraphicHeight()
          Returns the height of the graphic generated by this object.
 java.lang.String getGraphicLegendTitle()
          Returns the legend title of the graphic generated by this object or null if the graphic does not support a legend or no title has been specified.
 java.lang.String getGraphicTimestampPrefix()
          Returns the timestamp prefix of the graphic generated by this object or null if none has been specified.
 java.lang.String getGraphicTitle()
          Returns the title of the graphic generated by this object or null if none has been specified.
 java.lang.String getGraphicType()
          Returns the type indicator for the graphic generated by this object.
 java.lang.String getGraphicWidth()
          Returns the width of the graphic generated by this object.
 java.lang.String getResourcesFolder()
          Returns the folder location for any resources needed by the generated graphic or null if none has been specified .
 boolean isLegendSuppressed()
          Returns the legend suppression indicator for the graphic generated by this object.
 boolean serializeGeneratedDocumentToFile(java.lang.String relativeUri)
          XML-serializes the generated Document object to the specified location on the physical machine where this object is executing.
 byte[] serializeGeneratedDocumentToStream()
          XML-serializes and returns the generated Document object as a byte array.
 java.lang.String serializeGeneratedDocumentToString()
          XML-serializes and returns the generated Document object as a String.
 void setConfigDocument(org.w3c.dom.Document newConfigDocument)
          Specifies the XML document which is to provide the configuration data for the graphic generated by this object.
 void setDataDocument(org.w3c.dom.Document newDataDocument)
          Specifies the XML document which is to provide the content data for the graphic generated by this object.
 boolean setGraphicColourPaletteName(java.lang.String newGraphicColourPaletteName)
          Specifies the name of the default colour palette to be used by the graphic generated by this object.
 void setGraphicFont(java.lang.String newGraphicFont)
          Specifies the font to be used by the graphic generated by this object.
 void setGraphicHeight(java.lang.String newGraphicHeight)
          Specifies the height of the graphic generated by this object.
 void setGraphicLegendTitle(java.lang.String newGraphicLegendTitle)
          Specifies the legend title of the graphic generated by this object.
 void setGraphicTimestampPrefix(java.lang.String newGraphicTimestampPrefix)
          Specifies the prefix for the timestamp of the graphic generated by this object.
 void setGraphicTitle(java.lang.String newGraphicTitle)
          Specifies the title of the graphic generated by this object.
 void setGraphicWidth(java.lang.String newGraphicWidth)
          Specifies the width of the graphic generated by this object.
 void setResourcesFolder(java.lang.String newResourcesFolder)
          Specifies the folder URL on the local machine where this object is executing in which any resources needing to be accessed by the generated graphic are located.
 void setSuppressLegend(java.lang.String newSuppressLegend)
          Specifies whether the legend should be suppressed in the graphic generated by this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.etools.pd.widget.viewer.IGraphicDocumentGenerator
getPreferencesPage, getPreferencesPageHeight, getPreferencesPageWidth, setPreferencesPage, setPreferencesPageHeight, setPreferencesPageWidth
 

Field Detail

configDocument

protected org.w3c.dom.Document configDocument
Configuration document


dataDocument

protected org.w3c.dom.Document dataDocument
Data document


graphicType

protected java.lang.String graphicType
Graphic type


generatedDocument

protected org.w3c.dom.Document generatedDocument
Graphic document


resourcesFolder

protected java.lang.String resourcesFolder
Resource folder location


graphicTitle

protected java.lang.String graphicTitle
Graphic title


graphicTimestampPrefix

protected java.lang.String graphicTimestampPrefix
Timestamp prefix


suppressLegend

protected boolean suppressLegend
Legend display indicator


graphicLegendTitle

protected java.lang.String graphicLegendTitle
Legend title


graphicFont

protected java.lang.String graphicFont
Graphic font


graphicColourPaletteName

protected java.lang.String graphicColourPaletteName
Default colour palette


graphicColourPalette

protected java.util.Hashtable graphicColourPalette
Default set of available colour palettes


graphicWidth

protected short graphicWidth
Graphic width


graphicHeight

protected short graphicHeight
Graphic height


preferencesPage

protected java.lang.String preferencesPage
User preference page


preferencesPageWidth

protected java.lang.String preferencesPageWidth
User preference page pixel width, resolvable to int. Specific to the preference page.


preferencesPageHeight

protected java.lang.String preferencesPageHeight
User preference page pixel height, resolvable to int. Specific to the preference page.

Constructor Detail

GraphicDocumentGenerator

public GraphicDocumentGenerator()
Method Detail

getGeneratedDocument

public org.w3c.dom.Document getGeneratedDocument()
Description copied from interface: IGraphicDocumentGenerator
Returns the Document object generated by this object or null if none has been generated.

Specified by:
getGeneratedDocument in interface IGraphicDocumentGenerator
Returns:
Document an object, which implements org.w3c.dom.Document
See Also:
IGraphicDocumentGenerator.getGeneratedDocument()

getConfigDocument

public org.w3c.dom.Document getConfigDocument()
Description copied from interface: IGraphicDocumentGenerator
Returns the Document object which provides the configuration data for the graphic generated by this object or null if none has been set.

Specified by:
getConfigDocument in interface IGraphicDocumentGenerator
Returns:
Document an object, which implements org.w3c.dom.Document and conforms to the configuration schema for the generator.
See Also:
IGraphicDocumentGenerator.getConfigDocument()

getDataDocument

public org.w3c.dom.Document getDataDocument()
Description copied from interface: IGraphicDocumentGenerator
Returns the Document object which provides the content data for the graphic generated by this object or null if none has been set.

Specified by:
getDataDocument in interface IGraphicDocumentGenerator
Returns:
Document an object, which implements org.w3c.dom.Document and conforms to the data schema for the generator.
See Also:
IGraphicDocumentGenerator.getDataDocument()

getGraphicType

public java.lang.String getGraphicType()
Description copied from interface: IGraphicDocumentGenerator
Returns the type indicator for the graphic generated by this object.

Specified by:
getGraphicType in interface IGraphicDocumentGenerator
Returns:
String a type indicator
See Also:
IGraphicDocumentGenerator.getGraphicType()

getGraphicHeight

public java.lang.String getGraphicHeight()
Description copied from interface: IGraphicDocumentGenerator
Returns the height of the graphic generated by this object.

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

getGraphicWidth

public java.lang.String getGraphicWidth()
Description copied from interface: IGraphicDocumentGenerator
Returns the width of the graphic generated by this object.

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

getGraphicFont

public java.lang.String getGraphicFont()
Description copied from interface: IGraphicDocumentGenerator
Returns the font used by the graphic generated by this object.

Specified by:
getGraphicFont in interface IGraphicDocumentGenerator
Returns:
String the font family name
See Also:
IGraphicDocumentGenerator.getGraphicFont()

getGraphicColourPaletteName

public java.lang.String getGraphicColourPaletteName()
Description copied from interface: IGraphicDocumentGenerator
Returns the name of the default colour palette used by the graphic generated by this object.

Specified by:
getGraphicColourPaletteName in interface IGraphicDocumentGenerator
Returns:
String the name of the default colour palette
See Also:
IGraphicDocumentGenerator.getGraphicColourPaletteName()

getGraphicColourPalette

public java.lang.String[] getGraphicColourPalette()
Description copied from interface: IGraphicDocumentGenerator
Returns the set of colours belonging to the default colour palette used by the graphic generated by this object.

Specified by:
getGraphicColourPalette in interface IGraphicDocumentGenerator
Returns:
String [] the String array of hexadecimal colours
See Also:
IGraphicDocumentGenerator.getGraphicColourPalette()

getGraphicTitle

public java.lang.String getGraphicTitle()
Description copied from interface: IGraphicDocumentGenerator
Returns the title of the graphic generated by this object or null if none has been specified.

Specified by:
getGraphicTitle in interface IGraphicDocumentGenerator
Returns:
String the display title of the graphic
See Also:
IGraphicDocumentGenerator.getGraphicTitle()

isLegendSuppressed

public boolean isLegendSuppressed()
Description copied from interface: IGraphicDocumentGenerator
Returns the legend suppression indicator for the graphic generated by this object.

Specified by:
isLegendSuppressed in interface IGraphicDocumentGenerator
Returns:
boolean false, if legend is to be displayed or is not supported by the graphic type.
See Also:
IGraphicDocumentGenerator.isLegendSuppressed()

getGraphicTimestampPrefix

public java.lang.String getGraphicTimestampPrefix()
Description copied from interface: IGraphicDocumentGenerator
Returns the timestamp prefix of the graphic generated by this object or null if none has been specified.

Specified by:
getGraphicTimestampPrefix in interface IGraphicDocumentGenerator
Returns:
String the prefix which is prepended to the timestamp
See Also:
IGraphicDocumentGenerator.getGraphicTimestampPrefix()

getGraphicLegendTitle

public java.lang.String getGraphicLegendTitle()
Description copied from interface: IGraphicDocumentGenerator
Returns the legend title of the graphic generated by this object or null if the graphic does not support a legend or no title has been specified.

Specified by:
getGraphicLegendTitle in interface IGraphicDocumentGenerator
Returns:
String the legend title
See Also:
IGraphicDocumentGenerator.getGraphicLegendTitle()

getResourcesFolder

public java.lang.String getResourcesFolder()
Description copied from interface: IGraphicDocumentGenerator
Returns the folder location for any resources needed by the generated graphic or null if none has been specified .

Specified by:
getResourcesFolder in interface IGraphicDocumentGenerator
Returns:
String the folder location on the local machine
See Also:
IGraphicDocumentGenerator.getResourcesFolder()

setConfigDocument

public void setConfigDocument(org.w3c.dom.Document newConfigDocument)
                       throws DataInputProcessingException
Description copied from interface: IGraphicDocumentGenerator
Specifies the XML document which is to provide the configuration data for the graphic generated by this object. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setConfigDocument in interface IGraphicDocumentGenerator
Parameters:
newConfigDocument - an object, which implements org.w3c.dom.Document and conforms to the configuration schema for the generator.
DataInputProcessingException
See Also:
IGraphicDocumentGenerator.setConfigDocument(Document)

setDataDocument

public void setDataDocument(org.w3c.dom.Document newDataDocument)
                     throws DataInputProcessingException
Description copied from interface: IGraphicDocumentGenerator
Specifies the XML document which is to provide the content data for the graphic generated by this object. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setDataDocument in interface IGraphicDocumentGenerator
Parameters:
newDataDocument - an object, which implements org.w3c.dom.Document and conforms to the content data schema for the generator.
DataInputProcessingException
See Also:
IGraphicDocumentGenerator.setDataDocument(Document)

setGraphicHeight

public void setGraphicHeight(java.lang.String newGraphicHeight)
Description copied from interface: IGraphicDocumentGenerator
Specifies the height of the graphic generated by this object. If the value cannot be resolved to an int zero will be substituted. Extending classes should override this behaviour and provide a default value in this case. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setGraphicHeight in interface IGraphicDocumentGenerator
Parameters:
newGraphicHeight - the pixel height of the generated graphic
See Also:
IGraphicDocumentGenerator.setGraphicHeight(String)

setGraphicWidth

public void setGraphicWidth(java.lang.String newGraphicWidth)
Description copied from interface: IGraphicDocumentGenerator
Specifies the width of the graphic generated by this object. If the value cannot be resolved to an int zero will be substituted. Extending classes should override this behaviour and provide a default value in this case. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setGraphicWidth in interface IGraphicDocumentGenerator
Parameters:
newGraphicWidth - the pixel width of the generated graphic
See Also:
IGraphicDocumentGenerator.setGraphicWidth(String)

setGraphicTitle

public void setGraphicTitle(java.lang.String newGraphicTitle)
Description copied from interface: IGraphicDocumentGenerator
Specifies the title of the graphic generated by this object. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setGraphicTitle in interface IGraphicDocumentGenerator
Parameters:
newGraphicTitle - the title, which will be trimmed.
See Also:
IGraphicDocumentGenerator.setGraphicTitle(String)

setSuppressLegend

public void setSuppressLegend(java.lang.String newSuppressLegend)
Description copied from interface: IGraphicDocumentGenerator
Specifies whether the legend should be suppressed in the graphic generated by this object. If the value passed is invalid, false will be substituted. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setSuppressLegend in interface IGraphicDocumentGenerator
Parameters:
newSuppressLegend - must be one of {"true", "false", "1", "0"}.
See Also:
IGraphicDocumentGenerator.setSuppressLegend(String)

setGraphicTimestampPrefix

public void setGraphicTimestampPrefix(java.lang.String newGraphicTimestampPrefix)
Description copied from interface: IGraphicDocumentGenerator
Specifies the prefix for the timestamp of the graphic generated by this object. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setGraphicTimestampPrefix in interface IGraphicDocumentGenerator
Parameters:
newGraphicTimestampPrefix - the prefix, which will be trimmed and prepended to the timestamp.
See Also:
IGraphicDocumentGenerator.setGraphicTimestampPrefix(String)

setGraphicLegendTitle

public void setGraphicLegendTitle(java.lang.String newGraphicLegendTitle)
Description copied from interface: IGraphicDocumentGenerator
Specifies the legend title of the graphic generated by this object. Will be ignored if a legend is not supported for the graphic. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setGraphicLegendTitle in interface IGraphicDocumentGenerator
Parameters:
newGraphicLegendTitle - the title, which will be trimmed and displayed over the legend
See Also:
IGraphicDocumentGenerator.setGraphicLegendTitle(String)

setGraphicFont

public void setGraphicFont(java.lang.String newGraphicFont)
Description copied from interface: IGraphicDocumentGenerator
Specifies the font to be used by the graphic generated by this object. If the value is not a supported font, the resulting behaviour is dictated by the browser (plugin) in which the graphic is being rendered. Extending classes should override this behaviour and provide a default value in this case. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setGraphicFont in interface IGraphicDocumentGenerator
Parameters:
newGraphicFont - the font family name
See Also:
IGraphicDocumentGenerator.setGraphicFont(String)

setGraphicColourPaletteName

public boolean setGraphicColourPaletteName(java.lang.String newGraphicColourPaletteName)
Description copied from interface: IGraphicDocumentGenerator
Specifies the name of the default colour palette to be used by the graphic generated by this object. If the name is not recognized, it is not used. Extending classes should provide a set of documented, named, default palettes from which to choose. Note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
setGraphicColourPaletteName in interface IGraphicDocumentGenerator
Parameters:
newGraphicColourPaletteName - one of the documented or user-supplied names
Returns:
boolean true, if the supplied name is recognized
See Also:
IGraphicDocumentGenerator.setGraphicColourPaletteName(String)

setResourcesFolder

public void setResourcesFolder(java.lang.String newResourcesFolder)
Description copied from interface: IGraphicDocumentGenerator
Specifies the folder URL on the local machine where this object is executing in which any resources needing to be accessed by the generated graphic are located. If the full URL is not being specified, then the folder location must be relative to the location of the page which is to draw in the graphic. Note that this information is generated into the graphic, so this method must be called before generating the graphic.

Specified by:
setResourcesFolder in interface IGraphicDocumentGenerator
Parameters:
newResourcesFolder - the folder URL location of the resources, which will be trimmed.
See Also:
IGraphicDocumentGenerator.setResourcesFolder(String)

addGraphicColourPalette

public boolean addGraphicColourPalette(java.lang.String paletteName,
                                       java.lang.String[] palette)
                                throws java.lang.NullPointerException
Description copied from interface: IGraphicDocumentGenerator
Adds the specified colour palette to the set of colour palettes which are available for the graphic generated by this object. If the palette name already exists, the palette is not added. No checking is done to ensure the palette is valid or that the specified colours are supported in the target environment. Note that adding a palette does not select that palette as the default palette. Also note that since this information is generated into the graphic, this method must be called before generating the graphic.

Specified by:
addGraphicColourPalette in interface IGraphicDocumentGenerator
Parameters:
paletteName - the name of the palette
palette - the colours (hexadecimal codes)
Returns:
boolean true, if the operation is successful
java.lang.NullPointerException
See Also:
IGraphicDocumentGenerator.addGraphicColourPalette(String paletteName, String [] palette)

generateGraphicDocument

public org.w3c.dom.Document generateGraphicDocument()
                                             throws DataInputProcessingException
Description copied from interface: IGraphicDocumentGenerator
Generates and returns a graphic Document object based on input data

Specified by:
generateGraphicDocument in interface IGraphicDocumentGenerator
Returns:
Document the generated graphic object
DataInputProcessingException
See Also:
IGraphicDocumentGenerator.generateGraphicDocument()

generateAndSerializeTo

public boolean generateAndSerializeTo(java.lang.String uri)
                               throws DataInputProcessingException,
                                      java.io.IOException
Description copied from interface: IGraphicDocumentGenerator
Generates a graphic Document object by based on the input data and then XML-serializes it to the specified filename on the local machine where this object is executing.

Specified by:
generateAndSerializeTo in interface IGraphicDocumentGenerator
Parameters:
uri - the location to where the generated object is to be XML-serialized.
Returns:
boolean true, if the operation is successful
DataInputProcessingException
java.io.IOException
See Also:
IGraphicDocumentGenerator.generateAndSerializeTo(String)

generateAndSerialize

public java.lang.String generateAndSerialize()
                                      throws DataInputProcessingException,
                                             java.io.IOException
Description copied from interface: IGraphicDocumentGenerator
Generates a graphic Document object based on the input data and returns it XML-serialized to a String.

Specified by:
generateAndSerialize in interface IGraphicDocumentGenerator
Returns:
String the XML-serialized form of the generated object
DataInputProcessingException
java.io.IOException
See Also:
IGraphicDocumentGenerator.generateAndSerialize()

serializeGeneratedDocumentToFile

public boolean serializeGeneratedDocumentToFile(java.lang.String relativeUri)
                                         throws java.io.IOException
Description copied from interface: IGraphicDocumentGenerator
XML-serializes the generated Document object to the specified location on the physical machine where this object is executing.

Specified by:
serializeGeneratedDocumentToFile in interface IGraphicDocumentGenerator
Parameters:
relativeUri - The location to which the object is serialized.
Returns:
boolean true, if the operation is successful.
java.io.IOException
See Also:
IGraphicDocumentGenerator.serializeGeneratedDocumentToFile(String)

serializeGeneratedDocumentToString

public java.lang.String serializeGeneratedDocumentToString()
                                                    throws java.io.IOException
Description copied from interface: IGraphicDocumentGenerator
XML-serializes and returns the generated Document object as a String.

Specified by:
serializeGeneratedDocumentToString in interface IGraphicDocumentGenerator
Returns:
String the XML-serialized form of the Document
java.io.IOException
See Also:
IGraphicDocumentGenerator.serializeGeneratedDocumentToString()

serializeGeneratedDocumentToStream

public byte[] serializeGeneratedDocumentToStream()
Description copied from interface: IGraphicDocumentGenerator
XML-serializes and returns the generated Document object as a byte array.

Specified by:
serializeGeneratedDocumentToStream in interface IGraphicDocumentGenerator
Returns:
byte[] The XML-serialized form of the Document
See Also:
IGraphicDocumentGenerator.serializeGeneratedDocumentToStream()