org.pentaho.chart.core
Class ChartElement

java.lang.Object
  extended by org.pentaho.util.collections.HeirarchicalLinkedListItem
      extended by org.pentaho.chart.core.ChartElement
All Implemented Interfaces:
Cloneable, org.pentaho.reporting.libraries.css.dom.LayoutElement

public class ChartElement
extends HeirarchicalLinkedListItem
implements Cloneable, org.pentaho.reporting.libraries.css.dom.LayoutElement

Defines the element information for the elements in the chart definition file


Field Summary
static String BYROW
          Attribute name for specifying a chart's data should be interpreted "byrow"
static String CATEGORICAL
          Attribute name for specifying a chart's data should be represented categorically
static String COLUMN_NAME
          Attribute name used to refer to a column in the data by column name
static String COLUMN_POSITION
          Attribute name used to refer to a column in the data positionally (starting with column 0)
static String HREF
          Attribute name for making an external reference
static String ID
          Attributes nam for specifying a taq's user specified id (used in referencing one tag from another tag)
static String ID_ATTRIBUTE
          The ID attribute which defines an element's id (in the xml namespace)
static String NAME_ATTRIBUTE
          The name attribute which defines the element name (if specified)
static String NAMESPACE
          The namespace for all the charting items
static String NAMESPACE_ATTRIBUTE
          See XML-Namespaces for the idea of that one ...
static String ROW_POSITION
          Attribute name used to refer to a row in the data positionally (starting with row 0) (Used for Pie Charts)
static String STACKED
          Attribute name used to mark a group as stacked instead of a normal groupingmv
static String TAG_NAME_AXIS
          The name of the XML tag which represents the chart axis
static String TAG_NAME_CHART
          Chart Definition tag for the base chart
static String TAG_NAME_DOMAIN_LABEL
          Chart Definition tag for the range label
static String TAG_NAME_GROUP
          The name of the XML tag which represents a data grouping for the chart
static String TAG_NAME_LABEL
          The name of the XML tag which represents a tick label in the chart
static String TAG_NAME_LEGEND
          The name of the XML tag which represents the chart legend
static String TAG_NAME_PLOT
          The name of the XML tag which represents the chart plot
static String TAG_NAME_RANGE_LABEL
          Chart Definition tag for the range label
static String TAG_NAME_SERIES
          The name of the XML tag which represents a series in the chart
static String TAG_NAME_STYLESHEET
          The name of the XML tag which represents the CSS information
static String TAG_NAME_TICK_LABEL
          The name of the XML tag which represents a label in the chart
static String TAG_NAME_TITLE
          The name of the XML tag which represents the chart title
 
Constructor Summary
ChartElement()
          Constructs an element.
 
Method Summary
 void addChildElement(ChartElement chartElement)
           
 Object clone()
          Clones this object.
 ChartElement[] findChildrenByName(String tagNameToMatch)
          Returns all child ChartElements to this ChartElement which has the specified tagName.
 Object getAttribute(String name)
           
 Object getAttribute(String namespace, String name)
           
 org.pentaho.reporting.libraries.xmlns.common.AttributeMap getAttributeMap()
          Returns a copy of the attributes for this chart element
 String[] getAttributeNameSpaces()
          Returns a set of namespaces used in the attributes for this chart elements
 Map getAttributes(String namespace)
           
 Map getCounters()
           
 ChartElement getFirstChildItem()
          Returns the first ChartElement that is a child of this ChartElement.
 String getId()
          Returns the id for this chart element
 Locale getLanguage()
           
 ChartElement getLastChildItem()
          Returns the last ChartElement that is a child of this ChartElement.
 org.pentaho.reporting.libraries.css.dom.LayoutStyle getLayoutStyle()
           
 String getName()
          Returns the name of the Element.
 String getNamespace()
           
 ChartElement getNextDepthFirstItem()
          Returns the next ChartElement based on a "depth-first" search.
 ChartElement getNextItem()
          Returns the ChartElement this follows this element.
 ChartElement getParentItem()
          Returns the parent ChartElement for the current ChartElement.
 org.pentaho.reporting.libraries.css.dom.LayoutElement getParentLayoutElement()
           
 ChartElement getPreviousItem()
          Returns the ChartElement that is previous to this element.
 org.pentaho.reporting.libraries.css.dom.LayoutElement getPreviousLayoutElement()
           
 String getPseudoElement()
           
 Map getStrings()
           
 org.pentaho.reporting.libraries.css.values.CSSValue getStyle(org.pentaho.reporting.libraries.css.model.StyleKey key)
          Quick accessor method to return the style value for the style key for this chart element
 String getTagName()
          Returns the tag name that this element represents
 String getText()
           
 boolean isPseudoElement()
           
 boolean isStyleResolved()
          Indicates if style information contained in the attributes has been resolved into
 void setAttribute(String name, Object value)
           
 void setAttribute(String namespace, String name, Object value)
           
 void setId(String id)
          Sets the id for this chart elements
 void setName(String name)
          Defines the name for this Element.
 void setNamespace(String id)
           
 void setTagName(String tagName)
          Sets the tagname for this element.
 void setText(String text)
           
 String toString()
          Dumps the content of this ChartElement
 String toString(String prefix)
          Performs a "deep" toString() where this element and all the children of this element are included
 
Methods inherited from class org.pentaho.util.collections.HeirarchicalLinkedListItem
getChildCount, getModNumber, removeItem
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_ATTRIBUTE

public static final String NAME_ATTRIBUTE
The name attribute which defines the element name (if specified)

See Also:
Constant Field Values

ID_ATTRIBUTE

public static final String ID_ATTRIBUTE
The ID attribute which defines an element's id (in the xml namespace)

See Also:
Constant Field Values

NAMESPACE_ATTRIBUTE

public static final String NAMESPACE_ATTRIBUTE
See XML-Namespaces for the idea of that one ...

See Also:
Constant Field Values

NAMESPACE

public static final String NAMESPACE
The namespace for all the charting items

See Also:
Constant Field Values

TAG_NAME_CHART

public static final String TAG_NAME_CHART
Chart Definition tag for the base chart

See Also:
Constant Field Values

TAG_NAME_RANGE_LABEL

public static final String TAG_NAME_RANGE_LABEL
Chart Definition tag for the range label

See Also:
Constant Field Values

TAG_NAME_DOMAIN_LABEL

public static final String TAG_NAME_DOMAIN_LABEL
Chart Definition tag for the range label

See Also:
Constant Field Values

TAG_NAME_STYLESHEET

public static final String TAG_NAME_STYLESHEET
The name of the XML tag which represents the CSS information

See Also:
Constant Field Values

TAG_NAME_TITLE

public static final String TAG_NAME_TITLE
The name of the XML tag which represents the chart title

See Also:
Constant Field Values

TAG_NAME_LEGEND

public static final String TAG_NAME_LEGEND
The name of the XML tag which represents the chart legend

See Also:
Constant Field Values

TAG_NAME_AXIS

public static final String TAG_NAME_AXIS
The name of the XML tag which represents the chart axis

See Also:
Constant Field Values

TAG_NAME_PLOT

public static final String TAG_NAME_PLOT
The name of the XML tag which represents the chart plot

See Also:
Constant Field Values

TAG_NAME_SERIES

public static final String TAG_NAME_SERIES
The name of the XML tag which represents a series in the chart

See Also:
Constant Field Values

TAG_NAME_GROUP

public static final String TAG_NAME_GROUP
The name of the XML tag which represents a data grouping for the chart

See Also:
Constant Field Values

TAG_NAME_LABEL

public static final String TAG_NAME_LABEL
The name of the XML tag which represents a tick label in the chart

See Also:
Constant Field Values

TAG_NAME_TICK_LABEL

public static final String TAG_NAME_TICK_LABEL
The name of the XML tag which represents a label in the chart

See Also:
Constant Field Values

CATEGORICAL

public static final String CATEGORICAL
Attribute name for specifying a chart's data should be represented categorically

See Also:
Constant Field Values

BYROW

public static final String BYROW
Attribute name for specifying a chart's data should be interpreted "byrow"

See Also:
Constant Field Values

ID

public static final String ID
Attributes nam for specifying a taq's user specified id (used in referencing one tag from another tag)

See Also:
Constant Field Values

HREF

public static final String HREF
Attribute name for making an external reference

See Also:
Constant Field Values

COLUMN_POSITION

public static final String COLUMN_POSITION
Attribute name used to refer to a column in the data positionally (starting with column 0)

See Also:
Constant Field Values

ROW_POSITION

public static final String ROW_POSITION
Attribute name used to refer to a row in the data positionally (starting with row 0) (Used for Pie Charts)

See Also:
Constant Field Values

COLUMN_NAME

public static final String COLUMN_NAME
Attribute name used to refer to a column in the data by column name

See Also:
Constant Field Values

STACKED

public static final String STACKED
Attribute name used to mark a group as stacked instead of a normal groupingmv

See Also:
Constant Field Values
Constructor Detail

ChartElement

public ChartElement()
Constructs an element.

The element inherits the element's defined default ElementStyleSheet to provide reasonable default values for common stylekeys. When the element is added to the band, the bands stylesheet is set as parent to the element's stylesheet.

A datasource is assigned with this element is set to a default source, which always returns null.

Method Detail

isStyleResolved

public boolean isStyleResolved()
Indicates if style information contained in the attributes has been resolved into

Returns:
true if this ChartElement contains style information, false otherwise

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

setNamespace

public void setNamespace(String id)

getId

public String getId()
Returns the id for this chart element


setId

public void setId(String id)
Sets the id for this chart elements


getTagName

public String getTagName()
Returns the tag name that this element represents

Specified by:
getTagName in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

setTagName

public void setTagName(String tagName)
Sets the tagname for this element.


setName

public void setName(String name)
Defines the name for this Element. The name must not be empty, or a NullPointerException is thrown.

Names can be used to lookup an element. There is no requirement for element names to be unique.

Parameters:
name - the name of this element

getName

public String getName()
Returns the name of the Element. The name of the Element is never null.

Returns:
the name.

setAttribute

public void setAttribute(String name,
                         Object value)
Parameters:
name -
value -

setAttribute

public void setAttribute(String namespace,
                         String name,
                         Object value)
Parameters:
namespace -
name -
value -

getAttribute

public Object getAttribute(String name)
Parameters:
name -
Returns:

getAttribute

public Object getAttribute(String namespace,
                           String name)
Specified by:
getAttribute in interface org.pentaho.reporting.libraries.css.dom.LayoutElement
Parameters:
namespace -
name -
Returns:

getAttributes

public Map getAttributes(String namespace)
Parameters:
namespace -
Returns:

getAttributeMap

public org.pentaho.reporting.libraries.xmlns.common.AttributeMap getAttributeMap()
Returns a copy of the attributes for this chart element


getAttributeNameSpaces

public String[] getAttributeNameSpaces()
Returns a set of namespaces used in the attributes for this chart elements


clone

public Object clone()
             throws CloneNotSupportedException
Description copied from class: HeirarchicalLinkedListItem
Clones this object. This class does not allow cloning of the data, so it will throw a CloneNotSupportedException.

Overrides:
clone in class HeirarchicalLinkedListItem
Throws:
CloneNotSupportedException

getCounters

public Map getCounters()
Specified by:
getCounters in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

getLanguage

public Locale getLanguage()
Specified by:
getLanguage in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

getLayoutStyle

public org.pentaho.reporting.libraries.css.dom.LayoutStyle getLayoutStyle()
Specified by:
getLayoutStyle in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

getPseudoElement

public String getPseudoElement()
Specified by:
getPseudoElement in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

getStrings

public Map getStrings()
Specified by:
getStrings in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

isPseudoElement

public boolean isPseudoElement()
Specified by:
isPseudoElement in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

getPreviousLayoutElement

public org.pentaho.reporting.libraries.css.dom.LayoutElement getPreviousLayoutElement()
Specified by:
getPreviousLayoutElement in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

getParentLayoutElement

public org.pentaho.reporting.libraries.css.dom.LayoutElement getParentLayoutElement()
Specified by:
getParentLayoutElement in interface org.pentaho.reporting.libraries.css.dom.LayoutElement

addChildElement

public void addChildElement(ChartElement chartElement)

getText

public String getText()

setText

public void setText(String text)

toString

public String toString()
Dumps the content of this ChartElement

Overrides:
toString in class Object

toString

public String toString(String prefix)
Performs a "deep" toString() where this element and all the children of this element are included

Parameters:
prefix - used for indenting the output

getParentItem

public ChartElement getParentItem()
Returns the parent ChartElement for the current ChartElement. If this ChartElement is the root element of the document, this method will return null

Overrides:
getParentItem in class HeirarchicalLinkedListItem

getPreviousItem

public ChartElement getPreviousItem()
Returns the ChartElement that is previous to this element. If there is none, this method will return null

Overrides:
getPreviousItem in class HeirarchicalLinkedListItem

getNextItem

public ChartElement getNextItem()
Returns the ChartElement this follows this element. If there is none, this method will return null

Overrides:
getNextItem in class HeirarchicalLinkedListItem

getFirstChildItem

public ChartElement getFirstChildItem()
Returns the first ChartElement that is a child of this ChartElement. If this ChartElement does not have any children, this method will return null.

Overrides:
getFirstChildItem in class HeirarchicalLinkedListItem

getLastChildItem

public ChartElement getLastChildItem()
Returns the last ChartElement that is a child of this ChartElement. If this ChartElement does not have any children, this method will return null.

Overrides:
getLastChildItem in class HeirarchicalLinkedListItem

getNextDepthFirstItem

public ChartElement getNextDepthFirstItem()
Returns the next ChartElement based on a "depth-first" search. This will return (in the following order)
  1. the first child of this ChartElement
  2. the "next" sibling of this ChartElement
  3. the "next" sibling of the closest parent of this ChartElement
  4. null (indicates that this is the last ChartElements from a depth-first point of view

Overrides:
getNextDepthFirstItem in class HeirarchicalLinkedListItem
Returns:
the next depth-first item in the list, or null if this is the last item.

findChildrenByName

public ChartElement[] findChildrenByName(String tagNameToMatch)
Returns all child ChartElements to this ChartElement which has the specified tagName.

Parameters:
tagNameToMatch - the name of the tag used in searching
Returns:
an array of ChartElement objects that match the search criteria

getStyle

public org.pentaho.reporting.libraries.css.values.CSSValue getStyle(org.pentaho.reporting.libraries.css.model.StyleKey key)
Quick accessor method to return the style value for the style key for this chart element