org.opensourcephysics.cabrillo.tracker
Class TrackPlottingPanel

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 org.opensourcephysics.display.DrawingPanel
                      extended by org.opensourcephysics.display.InteractivePanel
                          extended by org.opensourcephysics.display.PlottingPanel
                              extended by org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.rmi.Remote, java.util.EventListener, javax.accessibility.Accessible, InteractiveMouseHandler, Renderable, Tool

public class TrackPlottingPanel
extends PlottingPanel
implements Tool

This is a plotting panel for a track

Author:
Douglas Brown
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractivePanel
InteractivePanel.IADMouseController
 
Nested classes/interfaces inherited from class org.opensourcephysics.display.DrawingPanel
DrawingPanel.ZoomBox
 
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
protected  Step clickedStep
           
protected  javax.swing.JMenuItem copyImageItem
           
protected  DatasetManager data
           
protected  javax.swing.JMenuItem dataBuilderItem
           
protected  javax.swing.Action dataFunctionListener
           
protected  HighlightableDataset dataset
           
protected  javax.swing.JMenuItem dataToolItem
           
protected  java.awt.Font font
           
protected  javax.swing.JMenuItem helpItem
           
protected  int highlightIndex
           
protected  java.awt.Rectangle hitRect
           
protected  boolean isCustom
           
protected  boolean isZoomMode
           
protected  javax.swing.JCheckBoxMenuItem linesItem
           
protected  org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.PlotMouseListener mouseListener
           
protected  java.beans.PropertyChangeListener playerListener
           
protected  org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.ClickableAxes plotAxes
           
protected  PlotTrackView plotTrackView
           
protected  javax.swing.JCheckBoxMenuItem pointsItem
           
protected  javax.swing.JMenuItem printItem
           
protected  java.lang.String title
           
protected  TTrack track
           
protected  javax.swing.JRadioButtonMenuItem[] xChoices
           
protected  javax.swing.ButtonGroup xGroup
           
protected  int xIndex
           
protected  java.lang.String xLabel
           
protected  java.awt.event.ItemListener xListener
           
protected  javax.swing.JPopupMenu xPopup
           
protected  javax.swing.JRadioButtonMenuItem[] yChoices
           
protected  javax.swing.ButtonGroup yGroup
           
protected  int yIndex
           
protected  java.lang.String yLabel
           
protected  java.awt.event.ItemListener yListener
           
protected  javax.swing.JPopupMenu yPopup
           
 
Fields inherited from class org.opensourcephysics.display.InteractivePanel
containsInteractive, interactive, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, mouseAction, mouseEvent
 
Fields inherited from class org.opensourcephysics.display.DrawingPanel
adjustableGutter, antialiasShapeOn, antialiasTextOn, autoscaleItem, autoscaleMargin, autoscaleX, autoscaleXMax, autoscaleXMin, autoscaleY, autoscaleYMax, autoscaleYMin, bgColor, blMessageBox, BOTTOM_LEFT, BOTTOM_RIGHT, bottomGutter, bottomGutterPreferred, brMessageBox, clipAtGutter, coordinateStrBuilder, customInspector, decimalFormat, dimensionSetter, drawableList, enableZoom, fixedPixelPerUnit, fixedScale, glassPanel, glassPanelLayout, height, leftGutter, leftGutterPreferred, mouseController, offscreenImage, optionController, pixelMatrix, pixelTransform, popupmenu, propertiesItem, rightGutter, rightGutterPreferred, scaleItem, scientificFormat, showCoordinates, snapshotItem, squareAspect, tlMessageBox, TOP_LEFT, TOP_RIGHT, topGutter, topGutterPreferred, trMessageBox, viewRect, width, workingImage, xceil, xfloor, xLeftMarginPercentage, xmax, xmaxPreferred, xmin, xminPreferred, xPixPerUnit, xRightMarginPercentage, yBottomMarginPercentage, yceil, yfloor, ymax, ymaxPreferred, ymin, yminPreferred, yPixPerUnit, yTopMarginPercentage, zoomBox, zoomInItem, zoomOutItem
 
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
TrackPlottingPanel(TTrack _track, DatasetManager _data)
          Constructs a TrackPlottingPanel for a track.
 
Method Summary
protected  void buildPopupmenu()
          Builds the default popup menu for this panel.
protected  void createVarChoices()
           
protected  java.awt.Rectangle findViewRect()
          Overrides DrawingPanel method to prevent changes to glassPanel.
 HighlightableDataset getDataset()
          Gets the dataset
static XML.ObjectLoader getLoader()
          Returns an XML.ObjectLoader to save and load object data.
protected  TViewChooser getOwner()
          Gets the TViewChooser that owns (displays) this panel.
 javax.swing.JPopupMenu getPopupMenu()
          Gets the popup menu.
 java.lang.String getTitle()
          Gets the title.
 java.lang.String getXLabel()
          Gets the label for the X (horizontal) axis.
protected  java.lang.String getXVariable()
          Gets the x variable name.
 java.lang.String getYLabel()
          Gets the label for the Y (vertical) axis.
protected  java.lang.String getYVariable()
          Gets the y variable name.
protected  void plotData()
          Plots the data.
 void scale(java.util.ArrayList<Drawable> list)
          Overrides DrawingPanel scale method
protected  void scaleXMax()
          Sets the max on the horizontal axis scale.
protected  void scaleXMin()
          Sets the min on the horizontal axis scale.
protected  void scaleYMax()
          Sets the max on the vertical axis scale.
protected  void scaleYMin()
          Sets the min on the vertical axis scale.
 void send(Job job, Tool replyTo)
          Sends a job to this tool and specifies a tool to reply to.
protected  void setHighlighted(int frameNumber)
          Sets the highlighted point.
protected  void setPlotTrackView(PlotTrackView view)
          Sets the PlotTrackView that owns this.
 void setPreferredMinMax(double xmin, double xmax, double ymin, double ymax, boolean invalidateImage)
          Sets preferred min/max values.
 void setPreferredMinMaxX(double xmin, double xmax)
          Sets preferred min/max x values.
 void setTitle(java.lang.String title)
          Sets the title.
 void setXLabel(java.lang.String label)
          Sets the label for the X (horizontal) axis.
protected  void setXVariable(java.lang.String name)
          Sets the x variable by name.
 void setYLabel(java.lang.String label)
          Sets the label for the Y (vertical) axis.
protected  void setYVariable(java.lang.String name)
          Sets the x variable by name.
protected  void showPlotCoordinates(int index)
          Shows plot coordinates at the specified dataset index.
 
Methods inherited from class org.opensourcephysics.display.PlottingPanel
computeGutters, getAxes, getBottomGutter, getInteractive, getPixelTransform, getTopGutter, paintFirst, pixToX, pixToY, recomputeTransform, setAxes, setAxesVisible, setCartesian, setLogScale, setLogScaleX, setLogScaleY, setPixelScale, setPolar, setTitle, setXLabel, setYLabel, xToGraphics, xToPix, yToGraphics, yToPix
 
Methods inherited from class org.opensourcephysics.display.InteractivePanel
addDrawable, clear, getCurrentDraggable, getMouseAction, getMouseButton, getMouseClickCount, getMouseIntX, getMouseIntY, getMouseX, getMouseY, handleMouseAction, saveMouseEvent, scaleX, scaleY, setInteractiveMouseHandler, setShowCoordinates
 
Methods inherited from class org.opensourcephysics.display.DrawingPanel
actionPerformed, addDrawableAtIndex, addDrawables, checkWorkingImage, enableInspector, getAspectRatio, getCoordinateStringBuilder, getDimensionSetter, getDrawables, getDrawables, getGlassPanel, getGutters, getHeight, getImageRatio, getLeftGutter, getMaxPixPerUnit, getMeasure, getObjectOfClass, getPixelMatrix, getPreferredXMax, getPreferredXMin, getPreferredYMax, getPreferredYMin, getRightGutter, getScale, getVideoTool, getViewRect, getWidth, getXMax, getXMin, getXPixPerUnit, getYMax, getYMin, getYPixPerUnit, getZoomBox, hasInspector, hideInspector, invalidateImage, isAdjustableGutter, isAntialiasShapeOn, isAntialiasTextOn, isAutoscaleX, isAutoscaleXMax, isAutoscaleXMin, isAutoscaleY, isAutoscaleYMax, isAutoscaleYMin, isBuffered, isClipAtGutter, isFixedScale, isIconified, isLogScaleX, isLogScaleY, isPointInside, isSquareAspect, isValidImage, isZoom, limitAutoscaleX, limitAutoscaleY, measure, paint, paintComponent, paintDrawableList, paintEverything, paintLast, project, refreshGUI, removeDrawable, removeDrawables, removeObjectsOfClass, removeOptionController, render, render, replaceDrawable, resetGutters, scale, scaleX, scaleY, setAdjustableGutter, setAntialiasShapeOn, setAntialiasTextOn, setAutoscaleMargin, setAutoscaleX, setAutoscaleY, setBounds, setBounds, setBuffered, setClipAtGutter, setCoordinateStringBuilder, setCustomInspector, setFixedScale, setFontLevel, setGutters, setGutters, setIgnoreRepaint, setMessage, setMessage, setMouseCursor, setPixelsPerUnit, setPopupMenu, setPreferredGutters, setPreferredMinMax, setPreferredMinMaxY, setSquareAspect, setVideoTool, setVisible, setXLeftMarginPercentage, setXMarginPercentage, setXMarginPercentage, setXRightMarginPercentage, setYBottomMarginPercentage, setYMarginPercentage, setYMarginPercentage, setYTopMarginPercentage, setZoom, showInspector, snapshot, zoomIn, zoomOut
 
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, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, 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
 

Field Detail

track

protected TTrack track

data

protected DatasetManager data

xChoices

protected javax.swing.JRadioButtonMenuItem[] xChoices

yChoices

protected javax.swing.JRadioButtonMenuItem[] yChoices

xGroup

protected javax.swing.ButtonGroup xGroup

yGroup

protected javax.swing.ButtonGroup yGroup

xIndex

protected int xIndex

yIndex

protected int yIndex

dataset

protected HighlightableDataset dataset

xPopup

protected javax.swing.JPopupMenu xPopup

yPopup

protected javax.swing.JPopupMenu yPopup

dataFunctionListener

protected javax.swing.Action dataFunctionListener

copyImageItem

protected javax.swing.JMenuItem copyImageItem

dataBuilderItem

protected javax.swing.JMenuItem dataBuilderItem

dataToolItem

protected javax.swing.JMenuItem dataToolItem

printItem

protected javax.swing.JMenuItem printItem

helpItem

protected javax.swing.JMenuItem helpItem

linesItem

protected javax.swing.JCheckBoxMenuItem linesItem

pointsItem

protected javax.swing.JCheckBoxMenuItem pointsItem

xLabel

protected java.lang.String xLabel

yLabel

protected java.lang.String yLabel

title

protected java.lang.String title

highlightIndex

protected int highlightIndex

xListener

protected java.awt.event.ItemListener xListener

yListener

protected java.awt.event.ItemListener yListener

plotTrackView

protected PlotTrackView plotTrackView

isCustom

protected boolean isCustom

font

protected java.awt.Font font

hitRect

protected java.awt.Rectangle hitRect

plotAxes

protected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.ClickableAxes plotAxes

isZoomMode

protected boolean isZoomMode

mouseListener

protected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.PlotMouseListener mouseListener

playerListener

protected java.beans.PropertyChangeListener playerListener

clickedStep

protected Step clickedStep
Constructor Detail

TrackPlottingPanel

public TrackPlottingPanel(TTrack _track,
                          DatasetManager _data)
Constructs a TrackPlottingPanel for a track.

Parameters:
_track - the track
_data - the track's data
Method Detail

send

public void send(Job job,
                 Tool replyTo)
Description copied from interface: Tool
Sends a job to this tool and specifies a tool to reply to.

Specified by:
send in interface Tool
Parameters:
job - the Job
replyTo - the tool to notify when the job is complete (may be null)

getDataset

public HighlightableDataset getDataset()
Gets the dataset

Returns:
the dataset plotted on this panel

setXLabel

public void setXLabel(java.lang.String label)
Sets the label for the X (horizontal) axis. Overrides PlottingPanel.

Overrides:
setXLabel in class PlottingPanel
Parameters:
label - the x label.

getXLabel

public java.lang.String getXLabel()
Gets the label for the X (horizontal) axis.

Returns:
the x label

setYLabel

public void setYLabel(java.lang.String label)
Sets the label for the Y (vertical) axis. Overrides PlottingPanel.

Overrides:
setYLabel in class PlottingPanel
Parameters:
label - the y label

getYLabel

public java.lang.String getYLabel()
Gets the label for the Y (vertical) axis.

Returns:
the y label

setTitle

public void setTitle(java.lang.String title)
Sets the title.

Overrides:
setTitle in class PlottingPanel
Parameters:
title - the title.

getTitle

public java.lang.String getTitle()
Gets the title.

Returns:
the title

scale

public void scale(java.util.ArrayList<Drawable> list)
Overrides DrawingPanel scale method

Overrides:
scale in class DrawingPanel

getPopupMenu

public javax.swing.JPopupMenu getPopupMenu()
Gets the popup menu.

Overrides:
getPopupMenu in class DrawingPanel

buildPopupmenu

protected void buildPopupmenu()
Builds the default popup menu for this panel.

Overrides:
buildPopupmenu in class DrawingPanel

scaleXMin

protected void scaleXMin()
Sets the min on the horizontal axis scale.


scaleXMax

protected void scaleXMax()
Sets the max on the horizontal axis scale.


scaleYMin

protected void scaleYMin()
Sets the min on the vertical axis scale.


scaleYMax

protected void scaleYMax()
Sets the max on the vertical axis scale.


getOwner

protected TViewChooser getOwner()
Gets the TViewChooser that owns (displays) this panel.


plotData

protected void plotData()
Plots the data.


showPlotCoordinates

protected void showPlotCoordinates(int index)
Shows plot coordinates at the specified dataset index.


setPreferredMinMax

public void setPreferredMinMax(double xmin,
                               double xmax,
                               double ymin,
                               double ymax,
                               boolean invalidateImage)
Sets preferred min/max values. Overrides DrawingPanel method.

Overrides:
setPreferredMinMax in class DrawingPanel
Parameters:
xmin -
xmax -
ymin -
ymax -
invalidateImage - invalidates image if min/max have changed

setPreferredMinMaxX

public void setPreferredMinMaxX(double xmin,
                                double xmax)
Sets preferred min/max x values. Overrides DrawingPanel method.

Overrides:
setPreferredMinMaxX in class DrawingPanel
Parameters:
xmin -
xmax -

setHighlighted

protected void setHighlighted(int frameNumber)
Sets the highlighted point.

Parameters:
frameNumber - the frame number

setXVariable

protected void setXVariable(java.lang.String name)
Sets the x variable by name.

Parameters:
name - the name of the dataset to plot on the x axis

getXVariable

protected java.lang.String getXVariable()
Gets the x variable name.

Returns:
the name of the x variable

setYVariable

protected void setYVariable(java.lang.String name)
Sets the x variable by name.

Parameters:
name - the name of the dataset to plot on the x axis

getYVariable

protected java.lang.String getYVariable()
Gets the y variable name.

Returns:
the name of the y variable

setPlotTrackView

protected void setPlotTrackView(PlotTrackView view)
Sets the PlotTrackView that owns this.


findViewRect

protected java.awt.Rectangle findViewRect()
Overrides DrawingPanel method to prevent changes to glassPanel.

Overrides:
findViewRect in class DrawingPanel

createVarChoices

protected void createVarChoices()

getLoader

public static XML.ObjectLoader getLoader()
Returns an XML.ObjectLoader to save and load object data.

Returns:
the XML.ObjectLoader