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

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by nl.astron.lofar.java.gui.plotter.PlotPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, javax.accessibility.Accessible

public class PlotPanel
extends javax.swing.JPanel
implements java.awt.print.Printable

This class serves as a JFC/Swing container of a plot generated by the plotter framework. It can be added to other JFC compatible applications, and it serves as the user's access point of the entire plotter class structure.

Version:
$Id$
Author:
pompert
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PlotPanel()
          - Constructs a new PlotPanel - Gets a new PlotController to work with
 
Method Summary
 void createPlot(int type, boolean separateLegend, java.lang.Object constraints)
          This method will attempt to generate a plot using several key arguments: -int type (this is defined by PlotConstants.PLOT_*) -boolean separateLegend (this will tell the plotter that you would like a separate JComponent legend, otherwise you will see a legend where the plotter puts it by default.
 void exportData(java.lang.Object arguments)
          This method will attempt to export the data currently in the plot to your configured data export layer using a single argument: -Object arguments (These are the arguments you need for the data export layer to export the data you currently have in the plot, and this can be anything, as long as your configured data export layer supports them!)
 java.awt.Image exportImage(int type, java.lang.Object constraints)
          This method will attempt to generate a plot image using several key arguments: -int type (this is defined by PlotConstants.PLOT_*) -Object constraints (These are the arguments you need for the data access layer to get the data you want, which can be anything, as long as your configured data access layer supports it!)
 void finalize()
          cleans up the instance variables
 java.util.HashMap getDataForPlot()
          This method will return the dataset for the plot currently in memory.
 javax.swing.JComponent getLegendForPlot()
          This method will return the legend for the plot currently in memory.
 javax.swing.JComponent getPlot()
          This method will return the plot currently in memory
 void modifyPlot(java.lang.Object newConstraints)
          This method will attempt to modify the current plot using one key argument: -Object newConstraints (These are the arguments you need for the data access layer to get the data you want, which can be anything, as long as your configured data access layer supports it!) The plot will be updated to this class' contents so you can view it directly.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
           
 void printPlot(boolean printWithLegend)
          This method will attempt to print the current plot
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlotPanel

public PlotPanel()
- Constructs a new PlotPanel - Gets a new PlotController to work with

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 void createPlot(int type,
                       boolean separateLegend,
                       java.lang.Object constraints)
                throws PlotterException
This method will attempt to generate a plot using several key arguments: -int type (this is defined by PlotConstants.PLOT_*) -boolean separateLegend (this will tell the plotter that you would like a separate JComponent legend, otherwise you will see a legend where the plotter puts it by default. -Object constraints (These are the arguments you need for the data access layer to get the data you want, which can be anything, as long as your configured data access layer supports it!) The plot will be added to this class' contents so you can view it directly. It can also be retrieved separately by calling the getPlot() method.

Parameters:
type - The type of plot to be generated (these types are defined in PlotConstants.PLOT_* )
separateLegend - Tells the plotter if you like a separate legend JComponent, or leave it embedded in the plot itself. Dont forget to call getLegendForPlot() to get the separate legend!
constraints - The arguments to be passed to the configured data access layer
Throws:
PlotterException - will be thrown if an Exception is detected in the plotter that the user needs to be aware of. Please handle this exception in a way that your application does not suffer from it, and make sure the user will be shown a message that something has gone wrong.

exportImage

public java.awt.Image exportImage(int type,
                                  java.lang.Object constraints)
                           throws PlotterException
This method will attempt to generate a plot image using several key arguments: -int type (this is defined by PlotConstants.PLOT_*) -Object constraints (These are the arguments you need for the data access layer to get the data you want, which can be anything, as long as your configured data access layer supports it!)

Parameters:
type - The type of plot to be generated (these types are defined in PlotConstants.PLOT_* )
constraints - The arguments to be passed to the configured data access layer
Returns:
The image file which can be saved to a file or used in different software.
Throws:
PlotterException - will be thrown if an Exception is detected in the plotter that the user needs to be aware of. Please handle this exception in a way that your application does not suffer from it, and make sure the user will be shown a message that something has gone wrong.

exportData

public void exportData(java.lang.Object arguments)
                throws PlotterException
This method will attempt to export the data currently in the plot to your configured data export layer using a single argument: -Object arguments (These are the arguments you need for the data export layer to export the data you currently have in the plot, and this can be anything, as long as your configured data export layer supports them!)

Parameters:
arguments - The arguments to be passed to the configured data export layer
Throws:
PlotterException - will be thrown if an Exception is detected in the plotter that the user needs to be aware of. Please handle this exception in a way that your application does not suffer from it, and make sure the user will be shown a message that something has gone wrong.

modifyPlot

public void modifyPlot(java.lang.Object newConstraints)
                throws PlotterException
This method will attempt to modify the current plot using one key argument: -Object newConstraints (These are the arguments you need for the data access layer to get the data you want, which can be anything, as long as your configured data access layer supports it!) The plot will be updated to this class' contents so you can view it directly. It can also be retrieved separately by calling the getPlot() method.

Parameters:
newConstraints - The arguments to be passed to the configured data access layer
Throws:
PlotterException - will be thrown if an Exception is detected in the plotter that the user needs to be aware of. Please handle this exception in a way that your application does not suffer from it, and make sure the user will be shown a message that something has gone wrong.

printPlot

public void printPlot(boolean printWithLegend)
               throws PlotterPrintException
This method will attempt to print the current plot

Throws:
PlotterPrintException

getPlot

public javax.swing.JComponent getPlot()
This method will return the plot currently in memory

Returns:
The plot currently in memory

getLegendForPlot

public javax.swing.JComponent getLegendForPlot()
                                        throws PlotterException
This method will return the legend for the plot currently in memory. It will throw a NotSupportedException should the plot not have a separate legend available.

Returns:
The plot legend currently in memory
Throws:
PlotterException - will be thrown if an Exception is detected in the plotter that the user needs to be aware of. Please handle this exception in a way that your application does not suffer from it, and make sure the user will be shown a message that something has gone wrong.

getDataForPlot

public java.util.HashMap getDataForPlot()
                                 throws PlotterException
This method will return the dataset for the plot currently in memory. It will throw a NotSupportedException should the plot not have a dataset available.

Returns:
The plot dataset currently in memory
Throws:
PlotterException - will be thrown if an Exception is detected in the plotter that the user needs to be aware of. Please handle this exception in a way that your application does not suffer from it, and make sure the user will be shown a message that something has gone wrong.

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageIndex)
Specified by:
print in interface java.awt.print.Printable