nl.astron.lofar.java.gui.plotter
Class PlotController

java.lang.Object
  extended by nl.astron.lofar.java.gui.plotter.PlotController

public class PlotController
extends java.lang.Object

The PlotController class functions as the central controller between:

- The Visual component PlotPanel, which delivers input on what kind of plot the user wants
- The Model/Data component PlotDataManager, which delivers the dataset based on the users input and the configured data access layer
- The Utility Component IPlot, which makes the plot using the configured framework and the dataset
- The plot will then be returned to the PlotPanel.

Version:
$Id$
Author:
pompert

Constructor Summary
PlotController()
          Creates a new instance of PlotController
 
Method Summary
 javax.swing.JComponent createPlot(int type, boolean separateLegend, java.lang.Object constraints)
          This method will attempt to create a JComponent plot using the framework class and Data Access layer in the plotter_config.properties file.
 java.awt.Image createPlotImage(java.lang.Object constraints)
          This method will create an Image of a plot.
 void exportData(java.lang.Object arguments)
          This method will attempt to export a plot using the Data Export layer specified in the plotter_config.properties file.
 void finalize()
          Cleans up the instance variables
 javax.swing.JComponent getLegendForPlot(javax.swing.JComponent aPlot)
          This method will attempt to retrieve a JComponent legend for the supplied JComponent plot.
 java.util.HashMap getPlotData()
          This method allows a user to get the dataset for the plot currently in memory.
 javax.swing.JComponent modifyPlot(javax.swing.JComponent currentPlot, java.lang.Object newConstraints)
          This method allows a user to modify a plot currently in memory by altering its dataset
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlotController

public PlotController()
Creates a new instance of PlotController

Method Detail

finalize

public void finalize()
              throws java.lang.Throwable
Cleans up the instance variables

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

createPlot

public javax.swing.JComponent createPlot(int type,
                                         boolean separateLegend,
                                         java.lang.Object constraints)
                                  throws PlotterException
This method will attempt to create a JComponent plot using the framework class and Data Access layer in the plotter_config.properties file.

Parameters:
type - A plot type (as defined in PlotConstants.PLOT_*)
separateLegend - True to generate a separate legend JComponent, false to have a legend embedded in the plot
constraints - A data access object to be passed on to the data access layer
Returns:
the JComponent plot that has been generated by the configured framework
Throws:
PlotterException - will be thrown when either the Data Access layer or the Plotter Framework have run into an exception that the user needs to be aware of.

getLegendForPlot

public javax.swing.JComponent getLegendForPlot(javax.swing.JComponent aPlot)
                                        throws PlotterException
This method will attempt to retrieve a JComponent legend for the supplied JComponent plot. Important: The JComponent plot you provide must have been generated by the plotter framework implementation class (for example PlotSGTImpl). An exception can be thrown if you attempt to retrieve a Legend for say a JPanel or JButton.

Parameters:
aPlot - The JComponent plot that needs to have a separate legend
Returns:
the legend JComponent for the plot JComponent specified
Throws:
PlotterException - will be thrown if the legend could not be generated for the given JComponent.

createPlotImage

public java.awt.Image createPlotImage(java.lang.Object constraints)
                               throws PlotterException
This method will create an Image of a plot. It works identically to getPlot() as this method too accepts an object with constraints.

Parameters:
constraints - The Object with constraints to be passed to the data access layer
Returns:
image file of the plot requested
Throws:
PlotterException - will be thrown when either the Data Access layer or the Plotter Framework have run into an exception that the user needs to be aware of.

exportData

public void exportData(java.lang.Object arguments)
                throws PlotterException
This method will attempt to export a plot using the Data Export layer specified in the plotter_config.properties file.

Parameters:
arguments - The object containing arguments to be passed to the data export layer
Throws:
PlotterException - will be thrown when the Data Export layer has run into an exception that the user needs to be aware of.

modifyPlot

public javax.swing.JComponent modifyPlot(javax.swing.JComponent currentPlot,
                                         java.lang.Object newConstraints)
                                  throws PlotterException
This method allows a user to modify a plot currently in memory by altering its dataset

Parameters:
newConstraints - An object containing instructions what to do with the dataset prior to rebuilding the plot
Throws:
PlotterException - will be thrown when either the Data Access layer or the Plotter Framework have run into an exception that the user needs to be aware of.

getPlotData

public java.util.HashMap getPlotData()
                              throws PlotterException
This method allows a user to get the dataset for the plot currently in memory.

Throws:
PlotterException - will be thrown if the dataset does not exist.