org.das2.graph
Class Renderer

java.lang.Object
  extended by org.das2.graph.Renderer
All Implemented Interfaces:
Editable, DataSetConsumer
Direct Known Subclasses:
ContoursRenderer, CurveRenderer, EventsRenderer, GraphicalLogHandler.LogRenderer, ImageVectorDataSetRenderer, PlotSymbolRenderer, SeriesRenderer, SpectrogramRenderer, StackedHistogramRenderer, StippledTableRenderer, SymbolLineRenderer, TickCurveRenderer, ZDeformRenderer

public abstract class Renderer
extends java.lang.Object
implements DataSetConsumer, Editable


Field Summary
protected  DataSet ds
          The dataset that is being plotted by the Renderer.
protected  java.lang.Exception lastException
          When a dataset cannot be loaded, the exception causing the failure will be rendered instead.
protected static java.util.logging.Logger logger
           
protected  java.beans.PropertyChangeSupport propertyChangeSupport
          Utility field used by bound properties.
protected  java.lang.Exception renderException
          This is the exception to be rendered.
 
Constructor Summary
protected Renderer()
           
protected Renderer(DataSet ds)
           
protected Renderer(DataSetDescriptor dsd)
           
 
Method Summary
 boolean acceptContext(int x, int y)
          Returns true if the render thinks it can provide the context for a point.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
protected  java.awt.geom.AffineTransform getAffineTransform(DasAxis xAxis, DasAxis yAxis)
           
 DataSet getConsumedDataSet()
          return the data for DataSetConsumer, which might be rebinned.
 DataLoader getDataLoader()
           
 DataSet getDataSet()
          returns the current dataset being displayed.
 DataSetDescriptor getDataSetDescriptor()
           
 java.lang.String getDataSetID()
           
protected  org.w3c.dom.Element getDOMElement(org.w3c.dom.Document document)
           
 java.lang.Exception getLastException()
           
 DasPlot getParent()
           
protected  void installRenderer()
           
protected  void invalidateParentCacheImage()
           
 boolean isActive()
          Getter for property active.
 boolean isDumpDataSet()
          Getter for property dumpDataSet.
 boolean isOverloading()
           
protected  void refresh()
          recalculate the plot image and repaint.
protected  void refreshImage()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
abstract  void render(java.awt.Graphics g, DasAxis xAxis, DasAxis yAxis, ProgressMonitor mon)
          Render is called whenever the image needs to be refreshed or the content has changed.
protected  void renderException(java.awt.Graphics g, DasAxis xAxis, DasAxis yAxis, java.lang.Exception e)
           
 void setActive(boolean active)
          Setter for property active.
 void setDataSet(DataSet ds)
           
 void setDataSetDescriptor(DataSetDescriptor dsd)
           
 void setDataSetID(java.lang.String id)
           
 void setDataSetLoader(DataLoader loader)
           
 void setDumpDataSet(boolean dumpDataSet)
          Setter for property dumpDataSet setting this to true causes the dataSet to be dumped.
 void setException(java.lang.Exception e)
           
 void setLastException(java.lang.Exception e)
           
 void setOverloading(boolean overloading)
           
protected  void uninstallRenderer()
           
 void update()
          Something has changed with the Render, and the plot should come back to allow this render to repaint.
protected  void updateImmediately()
          updateImmediately is called from DasPlot when it gets an update event from the AWT Event thread.
 void updatePlotImage(DasAxis xAxis, DasAxis yAxis, ProgressMonitor monitor)
          updatePlotImage is called once the expensive operation of loading the data is completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ds

protected DataSet ds
The dataset that is being plotted by the Renderer.


lastException

protected java.lang.Exception lastException
When a dataset cannot be loaded, the exception causing the failure will be rendered instead.


renderException

protected java.lang.Exception renderException
This is the exception to be rendered. This is so if an exception occurs during drawing, then this will be drawn instead.


logger

protected static java.util.logging.Logger logger

propertyChangeSupport

protected java.beans.PropertyChangeSupport propertyChangeSupport
Utility field used by bound properties.

Constructor Detail

Renderer

protected Renderer(DataSetDescriptor dsd)

Renderer

protected Renderer(DataSet ds)

Renderer

protected Renderer()
Method Detail

getParent

public DasPlot getParent()

invalidateParentCacheImage

protected void invalidateParentCacheImage()

getDataSet

public DataSet getDataSet()
returns the current dataset being displayed.


getConsumedDataSet

public DataSet getConsumedDataSet()
return the data for DataSetConsumer, which might be rebinned.

Specified by:
getConsumedDataSet in interface DataSetConsumer

isDumpDataSet

public boolean isDumpDataSet()
Getter for property dumpDataSet.

Returns:
Value of property dumpDataSet.

setDumpDataSet

public void setDumpDataSet(boolean dumpDataSet)
Setter for property dumpDataSet setting this to true causes the dataSet to be dumped.

Parameters:
dumpDataSet - New value of property dumpDataSet.

setLastException

public void setLastException(java.lang.Exception e)

getLastException

public java.lang.Exception getLastException()

setDataSet

public void setDataSet(DataSet ds)

setException

public void setException(java.lang.Exception e)

setDataSetID

public void setDataSetID(java.lang.String id)
                  throws DasException
Throws:
DasException

getDataSetID

public java.lang.String getDataSetID()

getAffineTransform

protected java.awt.geom.AffineTransform getAffineTransform(DasAxis xAxis,
                                                           DasAxis yAxis)

render

public abstract void render(java.awt.Graphics g,
                            DasAxis xAxis,
                            DasAxis yAxis,
                            ProgressMonitor mon)
Render is called whenever the image needs to be refreshed or the content has changed. This operation should occur with an animation-interactive time scale, and an image should be cached when this is not possible. The graphics object will have its origin at the upper-left corner of the screen.


acceptContext

public boolean acceptContext(int x,
                             int y)
Returns true if the render thinks it can provide the context for a point. That is, the renderer affected that point, or nearby points. For example, this is used currently to provide a way for the operator to click on a plot and directly edit the renderer who drew the pixel.

Parameters:
x - the x coordinate in the canvas coordinate system.
y - the y coordinate in the canvas coordinate system.

renderException

protected void renderException(java.awt.Graphics g,
                               DasAxis xAxis,
                               DasAxis yAxis,
                               java.lang.Exception e)

updatePlotImage

public void updatePlotImage(DasAxis xAxis,
                            DasAxis yAxis,
                            ProgressMonitor monitor)
                     throws DasException
updatePlotImage is called once the expensive operation of loading the data is completed. This operation should occur on an interactive time scale. This is an opportunity to create a cache image of the data with the current axis state, when the render operation cannot operate on an animation interactive time scale. Codes can no longer assume that the xAxis sent to render will be in the same state as it was when updatePlotImage was called, so use the getAffineTransform method. Only Renderer should call this method!

Throws:
DasException

refreshImage

protected void refreshImage()

update

public void update()
Something has changed with the Render, and the plot should come back to allow this render to repaint. Its cacheImage is invalidated and a repaint is posted on the event thread.


updateImmediately

protected void updateImmediately()
updateImmediately is called from DasPlot when it gets an update event from the AWT Event thread. This should trigger a data load and eventually a refresh to render the dataset.


refresh

protected void refresh()
recalculate the plot image and repaint. The dataset or exception have been updated, or the axes have changed, so we need to perform updatePlotImage to do the expensive parts of rendering.


setDataSetDescriptor

public void setDataSetDescriptor(DataSetDescriptor dsd)

getDataLoader

public DataLoader getDataLoader()

setDataSetLoader

public void setDataSetLoader(DataLoader loader)

getDataSetDescriptor

public DataSetDescriptor getDataSetDescriptor()

installRenderer

protected void installRenderer()

uninstallRenderer

protected void uninstallRenderer()

getDOMElement

protected org.w3c.dom.Element getDOMElement(org.w3c.dom.Document document)

isOverloading

public boolean isOverloading()

setOverloading

public void setOverloading(boolean overloading)

isActive

public boolean isActive()
Getter for property active.

Returns:
Value of property active.

setActive

public void setActive(boolean active)
Setter for property active.

Parameters:
active - New value of property active.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a PropertyChangeListener to the listener list.

Parameters:
l - The listener to add.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a PropertyChangeListener from the listener list.

Parameters:
l - The listener to remove.

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)