lt.monarch.chart
Class AbstractChart<PaintTags extends AbstractPaintTags,GeneralProjector extends Projector>

java.lang.Object
  extended by lt.monarch.chart.AbstractView<PaintTags>
      extended by lt.monarch.chart.AbstractChart<PaintTags,GeneralProjector>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Chart<GeneralProjector>, ChartEntity, StyleEditorEntity, View
Direct Known Subclasses:
MultiSeriesChartBase

public abstract class AbstractChart<PaintTags extends AbstractPaintTags,GeneralProjector extends Projector>
extends AbstractView<PaintTags>
implements Chart<GeneralProjector>

Default implementation of most utility methods of a Chart

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  boolean draftMode
          Specifies whether chart is in draft mode; the default is false.
protected  java.util.Locale locale
          Specifies a locale for this chart.
protected  java.util.List<ChartPlugin<?>> plugins
          Chart plug-in list
 
Fields inherited from class lt.monarch.chart.AbstractView
layoutInvalid, paintStyle, style
 
Constructor Summary
Constructor and Description
AbstractChart()
          Sole constructor.
 
Method Summary
Modifier and Type Method and Description
 void addPlugin(ChartPlugin plugin)
          Adds and installs the specified chart plug-in to this chart.
protected  void deactivate()
          Deactivates this chart.
 void disableDrafMode()
           
 void dispose()
          Cleans this chart object.
 void enableDraftMode()
           
 void fillEntitySheet(java.util.Properties id)
          Dummy ChartEntity interface fillEntitySheet method implementation.
protected  void finalize()
          Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
 java.lang.String getDescription()
          Dummy ChartEntity interface's getDescription method implementation.
 java.util.Locale getLocale()
          Returns the Locale of this chart.
 ChartEntity getParentEntity()
          Dummy ChartEntity interface's getParentEntity method implementation.
 java.util.List<ChartPlugin<?>> getPlugins()
          Gets the plug-in list
 java.lang.String getShortDescription()
          Dummy ChartEntity interface's getShortDescription method implementation.
 void invalidate()
          Invalidates the view.
 boolean isDraftMode()
          Returns true if the chart is in a draft mode.
protected  void layout(AbstractGraphics g)
          Prepares a chart projector.
protected  void paint(AbstractGraphics g)
          Paints a chart background, chart contents and calls paint method for all chart plug-ins.
protected abstract  void paintChart(AbstractGraphics g)
          Paint chart contents.
 void removePlugin(ChartPlugin plugin)
          Uninstalls and removes the chart plug-in from this chart.
 void removePlugins(java.lang.Class<?> pluginType)
          Uninstalls and removes the chart plug-ins from this chart.
 void setDraftMode(boolean draft)
          Sets/unsets draft mode.
 void setLocale(java.util.Locale locale)
          Sets locale for this chart.
 
Methods inherited from class lt.monarch.chart.AbstractView
activate, addViewListener, clone, container, getAlignmentX, getAlignmentY, getBounds, getChartObjectBounds, getContainer, getGraphicsType, getHeight, getMaximumSize, getMinimumSize, getPaintMode, getPaintStyle, getParent, getPreferredSize, getSize, getSize, getStyle, getStyle, getWidth, getX, getY, isLayoutValid, removeViewListener, render, repaint, repaint, setAlignmentX, setAlignmentY, setBounds, setBounds, setContainer, setLocation, setMaximumSize, setMinimumSize, setPaintMode, setPreferredSize, setSize, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface lt.monarch.chart.engine.Chart
createLegendEntries, projector
 
Methods inherited from interface lt.monarch.chart.engine.View
addViewListener, clone, container, getAlignmentX, getAlignmentY, getBounds, getContainingObjects, getGraphicsType, getHeight, getMaximumSize, getMinimumSize, getPreferredSize, getSize, getSize, getStyle, getWidth, getX, getY, removeViewListener, render, repaint, repaint, setAlignmentX, setAlignmentY, setBounds, setBounds, setContainer, setLocation, setMaximumSize, setMinimumSize, setPreferredSize, setSize, validate
 

Field Detail

plugins

protected final java.util.List<ChartPlugin<?>> plugins
Chart plug-in list


draftMode

protected boolean draftMode
Specifies whether chart is in draft mode; the default is false.


locale

protected java.util.Locale locale
Specifies a locale for this chart.

Constructor Detail

AbstractChart

public AbstractChart()
Sole constructor. (For invocation by subclass constructors).

Method Detail

paintChart

protected abstract void paintChart(AbstractGraphics g)
Paint chart contents. This method is called automatically by paint method after setting required Graphics entityStyle and erasing background.

Parameters:
g - Graphics context

setDraftMode

public void setDraftMode(boolean draft)
Sets/unsets draft mode. When chart is in a draft mode it is painted faster but with a lower quality. For example, chart is in draft mode when it's rotated or scrolled.

Specified by:
setDraftMode in interface Chart<GeneralProjector extends Projector>
Parameters:
draft - true, if chart is in draft mode; false otherwise.

isDraftMode

public boolean isDraftMode()
Returns true if the chart is in a draft mode.

Specified by:
isDraftMode in interface Chart<GeneralProjector extends Projector>
Returns:
true if the chart is in a draft mode.

addPlugin

public void addPlugin(ChartPlugin plugin)
Adds and installs the specified chart plug-in to this chart.

Specified by:
addPlugin in interface Chart<GeneralProjector extends Projector>
Parameters:
plugin - the chart plug-in
See Also:
ChartPlugin

removePlugin

public void removePlugin(ChartPlugin plugin)
Uninstalls and removes the chart plug-in from this chart.

Specified by:
removePlugin in interface Chart<GeneralProjector extends Projector>
Parameters:
plugin - the chart plug-in.
See Also:
ChartPlugin

removePlugins

public void removePlugins(java.lang.Class<?> pluginType)
Uninstalls and removes the chart plug-ins from this chart.

Parameters:
pluginType - the chart plug-in type.
See Also:
ChartPlugin

layout

protected void layout(AbstractGraphics g)
Prepares a chart projector.

Overrides:
layout in class AbstractView<PaintTags extends AbstractPaintTags>
Parameters:
g - the Graphics context in which a chart will be painted

invalidate

public void invalidate()
Description copied from class: AbstractView
Invalidates the view.

Specified by:
invalidate in interface View
Overrides:
invalidate in class AbstractView<PaintTags extends AbstractPaintTags>

paint

protected final void paint(AbstractGraphics g)
Paints a chart background, chart contents and calls paint method for all chart plug-ins.

Specified by:
paint in class AbstractView<PaintTags extends AbstractPaintTags>
Parameters:
g - the Graphics context in which to paint chart

deactivate

protected void deactivate()
Deactivates this chart. deactivate method of super class is called and this chart is cleared from HotSpotMap.

Overrides:
deactivate in class AbstractView<PaintTags extends AbstractPaintTags>
See Also:
AbstractView.deactivate(), HotSpotMap

getDescription

public java.lang.String getDescription()
Dummy ChartEntity interface's getDescription method implementation.

Specified by:
getDescription in interface ChartEntity
Returns:
null
See Also:
ChartEntity.getDescription()

getShortDescription

public java.lang.String getShortDescription()
Dummy ChartEntity interface's getShortDescription method implementation.

Specified by:
getShortDescription in interface ChartEntity
Returns:
null
See Also:
ChartEntity.getShortDescription()

getParentEntity

public ChartEntity getParentEntity()
Dummy ChartEntity interface's getParentEntity method implementation.

Specified by:
getParentEntity in interface ChartEntity
Returns:
null
See Also:
ChartEntity.getParentEntity()

fillEntitySheet

public void fillEntitySheet(java.util.Properties id)
Dummy ChartEntity interface fillEntitySheet method implementation.

Specified by:
fillEntitySheet in interface ChartEntity
Parameters:
id - property sheet

setLocale

public void setLocale(java.util.Locale locale)
Sets locale for this chart. Locale will be used to create default number and date formats.

Specified by:
setLocale in interface Chart<GeneralProjector extends Projector>
Parameters:
locale - the locale

getLocale

public java.util.Locale getLocale()
Returns the Locale of this chart.

Specified by:
getLocale in interface Chart<GeneralProjector extends Projector>
Returns:
the locale object

dispose

public void dispose()
Cleans this chart object. After this chart object is unusable and can be garbage collected.

Specified by:
dispose in interface View
Overrides:
dispose in class AbstractView<PaintTags extends AbstractPaintTags>

finalize

protected void finalize()
                 throws java.lang.Throwable
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. Calls cleanup method if it isn't called yet.

Overrides:
finalize in class AbstractView<PaintTags extends AbstractPaintTags>
Throws:
java.lang.Throwable - the Exception raised by this method

getPlugins

public java.util.List<ChartPlugin<?>> getPlugins()
Gets the plug-in list

Returns:
Returns the plug-ins.

enableDraftMode

public void enableDraftMode()

disableDrafMode

public void disableDrafMode()