public abstract class MultiPlot extends java.lang.Object implements IPlot
Composite
s simply via the methods provided by the IPlot
interface.
For client code that will be drawing these plots, do the following:
draw(String, String, Composite)
with a Composite
and any category and type. This renders (if possible) a plot inside the
specified Composite
based on the specified plot category and type.draw(String, String, Composite)
with the same
Composite
but different category and type. The plot rendered by
the previous call will have its plot category and type changed.draw(String, String, Composite)
with a Composite
and any category and type. This renders (if possible) a plot inside the
Composite
based on the specified plot category and type. You now
have two separate renderings based on the same IPlot
.
Sub-classes should override the following methods so that the correct
PlotRender
is created and updated properly:
Constructor and Description |
---|
MultiPlot(IVizService vizService)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
org.eclipse.swt.widgets.Composite |
draw(java.lang.String category,
java.lang.String plotType,
org.eclipse.swt.widgets.Composite parent)
This operation directs the IPlot to draw itself in its parent as the
specified plot type.
|
java.net.URI |
getDataSource()
This operation returns the data source that is plotted/drawn by this
IPlot.
|
int |
getNumberOfAxes()
This operation returns the number of axes of the plot.
|
java.util.Map<java.lang.String,java.lang.String[]> |
getPlotTypes()
This operation returns a simple map of plot types that can be created by
the IPlot using its data source.
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
This operation returns properties of this IPlot that can be safely
modified and/or tuned by the client.
|
java.lang.String |
getSourceHost()
This operation retrieves the hostname for this IPlot's data source.
|
IVizService |
getVizService()
Gets the visualization service responsible for this plot.
|
boolean |
isSourceRemote()
This operation signifies whether or not the IPlot's host is local or
remote.
|
void |
setDataSource(java.net.URI file)
Sets the data source (which is currently rendered if the plot is drawn).
|
void |
setProperties(java.util.Map<java.lang.String,java.lang.String> props)
This operation updates the properties of the plot based on client-side
modifications.
|
public MultiPlot(IVizService vizService)
vizService
- The visualization service responsible for this plot.public org.eclipse.swt.widgets.Composite draw(java.lang.String category, java.lang.String plotType, org.eclipse.swt.widgets.Composite parent) throws java.lang.Exception
IPlot
This operation may be called multiple types to change its type. It is expected that the implementation will know how to clear the parent, if necessary, or to otherwise manage its own drawing service. There is no guarantee that the caller will clear the parent.
draw
in interface IPlot
category
- The category of the plot to create. That is, the key in the
map; something "line" or "scatter" using the example from
getPlotTypes();plotType
- The type of plot that this IPlot should showparent
- The composite in which the plot should be drawn.java.lang.Exception
- This exception indicates that they IPlot could not be drawn
with either the given type or parent and explains why.public java.util.Map<java.lang.String,java.lang.String[]> getPlotTypes() throws java.lang.Exception
IPlot
key | value
line | "x vs y1", "x vs y2", "x vs y3"
scatter | "x vs y1", "x vs y2", "x vs y3"
contour | "x vs y1", "x vs y2", "x vs y3"
getPlotTypes
in interface IPlot
java.lang.Exception
- This exception indicates that the IPlot was not able to
retrieve the list of plot types and explains why.public int getNumberOfAxes()
IPlot
getNumberOfAxes
in interface IPlot
public java.util.Map<java.lang.String,java.lang.String> getProperties()
IPlot
getProperties
in interface IPlot
public void setProperties(java.util.Map<java.lang.String,java.lang.String> props) throws java.lang.Exception
IPlot
setProperties
in interface IPlot
props
- The updated propertiesjava.lang.Exception
- This exception indicates that the IPlot could not update its
properties or redraw itself.public java.net.URI getDataSource()
IPlot
getDataSource
in interface IPlot
public java.lang.String getSourceHost()
IPlot
getSourceHost
in interface IPlot
public boolean isSourceRemote()
IPlot
isSourceRemote
in interface IPlot
public void setDataSource(java.net.URI file) throws java.lang.NullPointerException, java.io.IOException, java.lang.IllegalArgumentException, java.lang.Exception
file
- The new data source URI.java.lang.NullPointerException
- if the specified file is nulljava.io.IOException
- if there was an error while reading the file's contentsjava.lang.IllegalArgumentException
- if there are no plots availablejava.lang.Exception
- if there is some other unspecified problem with the filepublic IVizService getVizService()