JIDE 3.5.15

com.jidesoft.chart
Class SingleImageLazyChartRenderer

java.lang.Object
  extended by com.jidesoft.chart.SingleImageLazyChartRenderer
All Implemented Interfaces:
Frontable, ActionListener, EventListener

public class SingleImageLazyChartRenderer
extends Object
implements Frontable, ActionListener

This class maintains a single Image for all the models added to a chart.


Constructor Summary
SingleImageLazyChartRenderer(Chart chart)
          Create a LazyChartRenderer for the supplied chart instance
 
Method Summary
 void actionPerformed(ActionEvent e)
          Called at the end of a delay by a SwingTimer.
 void addImageChangeListener(ImageChangeListener listener)
           
 void cancelDrawing()
          Cancel drawing
 void draw(Graphics g)
          Draw the latest image (if any) into the supplied graphics context
 void drawImmediately()
          Creates a background thread to do the plotting.
protected  void fireImageChange()
           
 Chart getChart()
          Returns the chart used by this lazy chart renderer.
 ChartModel getModel()
          Returns the first model of the list of ChartModels, or null there are no models
 boolean isAtFront()
          Always returns false as the lazy chart renderer is always at the back so it can cast a shadow if shadows are switched on.
 long lastModified()
          A read-only property so that a user can find out how old the current image is
 void removeImage(ChartModel chartModel)
          Removes the image cached for the supplied model
 void removeImageChangeListener(ImageChangeListener listener)
           
 void setAtFront(boolean atFront)
          Specify whether the object should be drawn at the front: setAtFront(true) is like a toFront() request, but conforms to the JavaBean property pattern.
 void updateCharts(boolean clearAll)
          Lodges a request to redraw the plot sometime soon.
 void updateImage(ChartModel chartModel, boolean canUseCache)
          Updates the image in response to a change to an individual model; for example a change to the style for that model.
 void updateImage(Image image, Point2D topLeft, Point2D bottomRight)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleImageLazyChartRenderer

public SingleImageLazyChartRenderer(Chart chart)
Create a LazyChartRenderer for the supplied chart instance

Parameters:
chart - the chart for which we want to prepare the display lazily.
Method Detail

getChart

public Chart getChart()
Returns the chart used by this lazy chart renderer.

Returns:
the chart instance used by this lazy chart renderer.

lastModified

public long lastModified()
A read-only property so that a user can find out how old the current image is


getModel

public ChartModel getModel()
Returns the first model of the list of ChartModels, or null there are no models

Returns:
the first ChartModel or null.

addImageChangeListener

public void addImageChangeListener(ImageChangeListener listener)

removeImageChangeListener

public void removeImageChangeListener(ImageChangeListener listener)

fireImageChange

protected void fireImageChange()

updateImage

public void updateImage(ChartModel chartModel,
                        boolean canUseCache)
Updates the image in response to a change to an individual model; for example a change to the style for that model.

Parameters:
chartModel - the model for which a change occurred
canUseCache - specify whether it is allowed to retrieve the cached Image instead of redrawing

removeImage

public void removeImage(ChartModel chartModel)
Removes the image cached for the supplied model

Parameters:
chartModel - the model whose painted and cached image is to be removed

cancelDrawing

public void cancelDrawing()
Cancel drawing


actionPerformed

public void actionPerformed(ActionEvent e)
Called at the end of a delay by a SwingTimer. Creates a background thread to do the plotting

Specified by:
actionPerformed in interface ActionListener

drawImmediately

public void drawImmediately()
Creates a background thread to do the plotting. Does not delay


updateImage

public void updateImage(Image image,
                        Point2D topLeft,
                        Point2D bottomRight)

updateCharts

public void updateCharts(boolean clearAll)
Lodges a request to redraw the plot sometime soon. However, if there is lots of activity in a short period of time, then multiple requests may be serviced by one response. If the width and height of the chart object is non-zero then create a timer to start the rendering. If the timer is already running then restart it. The plotter starts when the timer reaches the end of its period.

Parameters:
clearAll - if clearAll is set to true then all the previously painted model images are purged from memory

draw

public void draw(Graphics g)
Draw the latest image (if any) into the supplied graphics context

Parameters:
g - the Graphics context

isAtFront

public boolean isAtFront()
Always returns false as the lazy chart renderer is always at the back so it can cast a shadow if shadows are switched on.

Specified by:
isAtFront in interface Frontable
Returns:
false

setAtFront

public void setAtFront(boolean atFront)
Description copied from interface: Frontable
Specify whether the object should be drawn at the front: setAtFront(true) is like a toFront() request, but conforms to the JavaBean property pattern. Similarly, to send an object to the back, call setAtFront(false).

Specified by:
setAtFront in interface Frontable
Parameters:
atFront - whether the object is to be shown in front of ChartModels.
Throws:
UnsupportedOperationException - as the LazyChartRenderer must always appear at the back in case shadows are switched on

JIDE 3.5.15