spv.view
Class MultiplePlotWidget

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 spv.view.MultiplePlotWidget
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.Observer, javax.accessibility.Accessible, javax.swing.Scrollable, PlotWidget

public class MultiplePlotWidget
extends javax.swing.JPanel
implements PlotWidget, javax.swing.Scrollable

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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  GraphicsCanvas[] canvases
           
private  int nrows
           
private  PlottableSpectrum[] plottables
           
private  int[] tags
           
private  int tile_height
           
private  boolean tiles_fixed_aspect
           
private  int tiles_row
           
private  boolean x_autolog
           
private  boolean y_autolog
           
 
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.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MultiplePlotWidget(PlottableSpectrum[] plottables, int[] tags, boolean no_access)
           
 
Method Summary
protected  void attachDataSets(java.util.ArrayList dslist, GraphicsCanvas canvas)
           
private  void buildAndAttachDataSets(Plottable plottable, GraphicsCanvas canvas)
           
 void buildCanvases()
           
private  java.util.ArrayList buildDataSetList(Plottable plottable)
           
 void createHardcopy()
          Prints the plot area.
 void dataUpdated(java.lang.Object arg)
          Data was updated.
 void doZoom(int sense)
           
 java.util.List<GraphicsCanvas> getCanvasList()
          Returns a List with all instances of GraphicsCanvas that exist in this instance.
 Command[] getCommands()
          returns the array of Command instances.
 java.awt.Component getComponent()
           
 java.lang.String[] getConfigurableButtonNames()
          Gets the names of configurable buttons.
 javax.swing.JComponent getDisplayComponent()
          Gets the displayable Swing JComponent where the widget lives.
 boolean getFromPlotStatus()
           
 javax.swing.JComponent getJComponent()
          Gets the Swing JComponent where the widget lives.
 GraphicsCanvas getMainCanvas()
          Gets the main canvas.
 PlotStatus getPlotStatus()
          Gets the object with the plot setup parameters.
 java.lang.Object getPlottedObject()
          Gets the Object underlying the Plottable.
 java.awt.Dimension getPreferredScrollableViewportSize()
           
 int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
           
 boolean getScrollableTracksViewportHeight()
           
 boolean getScrollableTracksViewportWidth()
           
 int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
           
 Viewport getViewport()
          Returns a viewport.
 boolean isScrollable()
          Returns true if the plot widget must be displayed within a scroll pane.
 void lockSelections()
          Locks selections.
 void plot()
          Builds the plot.
 void quit()
          Quits the plot widget.
 void removeListeners()
          Remove all cursor listeners from the global cursor instance.
 void setCommand(Callback type, Command command)
          Stores a callback reference using the Command interface.
 void setCursorArrows(boolean cursor_arrows)
          Selects cursor arrows.
 void setCursorDashPattern(java.lang.String dash)
          Sets cursor dash pattern,
 void setCursorLogFile(java.io.PrintWriter cursor_log)
          Sets a print writer object for logging cursor activity.
 void setCursorText(boolean on)
          Turns on/off cursor text output.
 void setFormattedCursor(boolean formatted)
          Selects formatted or unformatted cursor text output.
 void setPlotStatus(PlotStatus ps)
          Sets the object with the plot setup parameters.
private  void setSizes(PlottableSpectrum[] plottables)
           
 void setSmallCursor(boolean small)
          Selects cursor size.
 void setSystemCursor()
          Selects no (application-controlled) cursor.
 void setXAutoLog(boolean auto_log)
          Sets the auto log mode for the X axis.
 void setYAutoLog(boolean auto_log)
          Sets the auto log mode for the Y axis.
 void unlockSelections()
          Unlocks selections.
 void unsetCommand(Callback type)
          Removes a callback reference.
 void unsetCommands()
          Removes all callback references.
 void update(java.util.Observable o, java.lang.Object arg)
           
 void zoomReset()
          Resets to default WCS.
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface spv.view.PlotWidget
getSize
 

Field Detail

plottables

private PlottableSpectrum[] plottables

tags

private int[] tags

canvases

private GraphicsCanvas[] canvases

tiles_row

private int tiles_row

nrows

private int nrows

tiles_fixed_aspect

private boolean tiles_fixed_aspect

tile_height

private int tile_height

x_autolog

private boolean x_autolog

y_autolog

private boolean y_autolog
Constructor Detail

MultiplePlotWidget

public MultiplePlotWidget(PlottableSpectrum[] plottables,
                          int[] tags,
                          boolean no_access)
Method Detail

removeListeners

public void removeListeners()
Description copied from interface: PlotWidget
Remove all cursor listeners from the global cursor instance.

Specified by:
removeListeners in interface PlotWidget

getCommands

public Command[] getCommands()
Description copied from interface: PlotWidget
returns the array of Command instances.

Specified by:
getCommands in interface PlotWidget
Returns:
the array of Command instances

buildCanvases

public void buildCanvases()

plot

public void plot()
          throws ViewException
Description copied from interface: PlotWidget
Builds the plot.

Specified by:
plot in interface PlotWidget
Throws:
ViewException

attachDataSets

protected void attachDataSets(java.util.ArrayList dslist,
                              GraphicsCanvas canvas)

setSizes

private void setSizes(PlottableSpectrum[] plottables)

buildAndAttachDataSets

private void buildAndAttachDataSets(Plottable plottable,
                                    GraphicsCanvas canvas)

buildDataSetList

private java.util.ArrayList buildDataSetList(Plottable plottable)

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable

isScrollable

public boolean isScrollable()
Description copied from interface: PlotWidget
Returns true if the plot widget must be displayed within a scroll pane.

Specified by:
isScrollable in interface PlotWidget
Returns:
true if the plot widget must be displayed within a scroll pane

getPlottedObject

public java.lang.Object getPlottedObject()
Description copied from interface: PlotWidget
Gets the Object underlying the Plottable.

Specified by:
getPlottedObject in interface PlotWidget
Returns:
the underlying object being plotted

getComponent

public java.awt.Component getComponent()

getConfigurableButtonNames

public java.lang.String[] getConfigurableButtonNames()
Description copied from interface: PlotWidget
Gets the names of configurable buttons.

Specified by:
getConfigurableButtonNames in interface PlotWidget
Returns:
the configuable button's names

getJComponent

public javax.swing.JComponent getJComponent()
Description copied from interface: PlotWidget
Gets the Swing JComponent where the widget lives.

Specified by:
getJComponent in interface PlotWidget
Returns:
the component where the widget lives

getDisplayComponent

public javax.swing.JComponent getDisplayComponent()
Description copied from interface: PlotWidget
Gets the displayable Swing JComponent where the widget lives.

The component returned by getJComponent may not be directly displayable since it might be transparent. getDisplayComponent returns a component that has a opaque background with defined color.

Specified by:
getDisplayComponent in interface PlotWidget
Returns:
the displayable component where the widget lives

quit

public void quit()
Description copied from interface: PlotWidget
Quits the plot widget.

Specified by:
quit in interface PlotWidget

createHardcopy

public void createHardcopy()
Description copied from interface: PlotWidget
Prints the plot area.

Specified by:
createHardcopy in interface PlotWidget

setCursorText

public void setCursorText(boolean on)
Description copied from interface: PlotWidget
Turns on/off cursor text output.

Specified by:
setCursorText in interface PlotWidget
Parameters:
on - true to set cursor text on

setCursorDashPattern

public void setCursorDashPattern(java.lang.String dash)
Description copied from interface: PlotWidget
Sets cursor dash pattern,

Specified by:
setCursorDashPattern in interface PlotWidget
Parameters:
dash - the dash pattern

setSmallCursor

public void setSmallCursor(boolean small)
Description copied from interface: PlotWidget
Selects cursor size.

Specified by:
setSmallCursor in interface PlotWidget
Parameters:
small - true to set small cursor

setSystemCursor

public void setSystemCursor()
Description copied from interface: PlotWidget
Selects no (application-controlled) cursor.

Specified by:
setSystemCursor in interface PlotWidget

setCursorArrows

public void setCursorArrows(boolean cursor_arrows)
Description copied from interface: PlotWidget
Selects cursor arrows.

Specified by:
setCursorArrows in interface PlotWidget
Parameters:
cursor_arrows - true to display cursor arrows

setXAutoLog

public void setXAutoLog(boolean auto_log)
Description copied from interface: PlotWidget
Sets the auto log mode for the X axis.

Specified by:
setXAutoLog in interface PlotWidget
Parameters:
auto_log - true to enable auto log

setYAutoLog

public void setYAutoLog(boolean auto_log)
Description copied from interface: PlotWidget
Sets the auto log mode for the Y axis.

Specified by:
setYAutoLog in interface PlotWidget
Parameters:
auto_log - true to enable auto log

setFormattedCursor

public void setFormattedCursor(boolean formatted)
Description copied from interface: PlotWidget
Selects formatted or unformatted cursor text output. Formated output is easier to read but can't handle scientific notation. Thus very small numbers are represented by zero.

Specified by:
setFormattedCursor in interface PlotWidget
Parameters:
formatted - true to set formatted cursor mode

doZoom

public void doZoom(int sense)
Specified by:
doZoom in interface PlotWidget

zoomReset

public void zoomReset()
Description copied from interface: PlotWidget
Resets to default WCS.

Specified by:
zoomReset in interface PlotWidget

dataUpdated

public void dataUpdated(java.lang.Object arg)
Description copied from interface: PlotWidget
Data was updated.

Specified by:
dataUpdated in interface PlotWidget
Parameters:
arg - an argument

setCommand

public void setCommand(Callback type,
                       Command command)
Description copied from interface: PlotWidget
Stores a callback reference using the Command interface.

Specified by:
setCommand in interface PlotWidget
Parameters:
type - the callback type
command - the reference to the command object

unsetCommand

public void unsetCommand(Callback type)
Description copied from interface: PlotWidget
Removes a callback reference.

Specified by:
unsetCommand in interface PlotWidget
Parameters:
type - the callback type

unsetCommands

public void unsetCommands()
Description copied from interface: PlotWidget
Removes all callback references.

Specified by:
unsetCommands in interface PlotWidget

getViewport

public Viewport getViewport()
Description copied from interface: PlotWidget
Returns a viewport.

Specified by:
getViewport in interface PlotWidget
Returns:
a viewport

getPlotStatus

public PlotStatus getPlotStatus()
Description copied from interface: PlotWidget
Gets the object with the plot setup parameters.

Specified by:
getPlotStatus in interface PlotWidget
Returns:
the object with the plot setup parameters

setPlotStatus

public void setPlotStatus(PlotStatus ps)
Description copied from interface: PlotWidget
Sets the object with the plot setup parameters.

Specified by:
setPlotStatus in interface PlotWidget
Parameters:
ps - the object with the plot setup parameters

getFromPlotStatus

public boolean getFromPlotStatus()
Specified by:
getFromPlotStatus in interface PlotWidget

setCursorLogFile

public void setCursorLogFile(java.io.PrintWriter cursor_log)
Description copied from interface: PlotWidget
Sets a print writer object for logging cursor activity.

Specified by:
setCursorLogFile in interface PlotWidget
Parameters:
cursor_log - the print writer object

getMainCanvas

public GraphicsCanvas getMainCanvas()
Description copied from interface: PlotWidget
Gets the main canvas.

Specified by:
getMainCanvas in interface PlotWidget
Returns:
ther main canvas

getCanvasList

public java.util.List<GraphicsCanvas> getCanvasList()
Description copied from interface: PlotWidget
Returns a List with all instances of GraphicsCanvas that exist in this instance. This is used by plot widgets that support multiple plots.

Specified by:
getCanvasList in interface PlotWidget
Returns:
a List with all instances of GraphicsCanvas

lockSelections

public void lockSelections()
Description copied from interface: PlotWidget
Locks selections.

Specified by:
lockSelections in interface PlotWidget

unlockSelections

public void unlockSelections()
Description copied from interface: PlotWidget
Unlocks selections.

Specified by:
unlockSelections in interface PlotWidget

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer