Class TrackPlottingPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.opensourcephysics.display.DrawingPanel
org.opensourcephysics.display.InteractivePanel
org.opensourcephysics.display.PlottingPanel
org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel
- All Implemented Interfaces:
ActionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,InteractiveMouseHandler
,OSPRuntime.Disposable
,Renderable
,Tool
This is a plotting panel for a track
- Author:
- Douglas Brown
- See Also:
-
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.PopupmenuListener, DrawingPanel.ZoomBox
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BitSet
protected Step
protected TCoordinateStringBuilder
protected Action
protected HighlightableDataset
protected DatasetManager
protected JMenuItem
protected Font
protected TFrame
protected HashMap<TTrack,
HighlightableDataset> protected Action
protected Rectangle
protected boolean
protected boolean
protected JCheckBoxMenuItem
protected boolean
protected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.PlotMouseListener
protected Integer
protected PropertyChangeListener
protected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.ClickableAxes
protected PlotTrackView
protected JCheckBoxMenuItem
protected boolean
protected JPopupMenu
protected String
protected int
protected String
protected ItemListener
protected JPopupMenu
protected String
protected ItemListener
protected JPopupMenu
Fields inherited from class org.opensourcephysics.display.PlottingPanel
axes, id, log10, logBase10Function
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, BOTTOM_LEFT, BOTTOM_RIGHT, bottomGutter, bottomGutterPreferred, clipAtGutter, coordinateStrBuilder, currentTime, customInspector, decimalFormat, dimensionSetter, displayCoordsOnMouseMoved, drawableList, dxmax, dxmin, dymax, dymin, enableZoom, fixedPixelPerUnit, fixedScale, guiChangeListener, imageRatio, isDisposed, isInteractive, lastHeight, lastWidth, leftGutter, leftGutterPreferred, logScaleX, logScaleY, messages, messagesAsJLabels, mouseController, offscreenImage, optionController, paintDrawables, pixelMatrix, pixelTransform, popupmenu, propertiesItem, RECORD_PAINT_TIMES, refreshDelay, refreshTimer, rightGutter, rightGutterPreferred, scaleItem, scientificFormat, showCoordinates, snapshotItem, squareAspect, TOP_LEFT, TOP_RIGHT, topGutter, topGutterPreferred, vidCap, viewRect, workingImage, xceil, xfloor, xLeftMarginPercentage, xmax, xmaxPreferred, xmin, xminPreferred, xPixPerUnit, xRightMarginPercentage, yBottomMarginPercentage, yceil, yfloor, ymax, ymaxPreferred, ymin, yminPreferred, yPixPerUnit, yTopMarginPercentage, zoomBox, zoomCount, zoomDelay, zoomInItem, zoomOutItem, zoomTimer
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Fields inherited from interface org.opensourcephysics.display.OSPRuntime.Disposable
allocated
-
Constructor Summary
ConstructorsConstructorDescriptionTrackPlottingPanel
(TTrack track, DatasetManager data) Constructs a TrackPlottingPanel for a track. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a guest track.protected void
Builds the default popup menu for this panel.void
protected void
protected void
void
dispose()
void
finalize()
Overrides DrawingPanel method to prevent changes to glassPanel and deal with multiple plots.void
fireRepaint
(TTrack track) Gets the datasetstatic XML.ObjectLoader
Returns an XML.ObjectLoader to save and load object data.protected TViewChooser
getOwner()
Gets the TViewChooser that owns (displays) this panel.Gets the popup menu.getTitle()
Gets the title.Gets the label for the X (horizontal) axis.protected String
Gets the x variable name.Gets the label for the Y (vertical) axis.protected String
Gets the y variable name.protected void
initAxes()
Override to specify a different kind of axes.boolean
Returns true if mouse coordinates are displayedprotected void
plotData()
Plots the data.protected void
refreshDataset
(HighlightableDataset hds, DatasetManager manager, boolean xIsAngle, boolean yIsAngle, boolean degrees) Refreshes the data in a dataset based on current x and y index.protected void
Refreshes the decimal separators.void
removeGuest
(TTrack guest) Removes a guest track.void
repaint()
boolean
Overrides requestFocusInWindow.void
Overrides DrawingPanel scale methodprotected void
Sets the max on the horizontal axis scale.protected void
Sets the min on the horizontal axis scale.protected void
Sets the max on the vertical axis scale.protected void
Sets the min on the vertical axis scale.protected void
selectAction
(Object source) void
Sends a job to this tool and specifies a tool to reply to.void
setHighlights
(BitSet highlightFrames) protected void
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
setPreferredMinMaxY
(double ymin, double ymax) Sets preferred min/max y values.void
Sets the title.protected void
void
Sets the label for the X (horizontal) axis.protected void
setXVariable
(String name) Sets the x variable by name.void
Sets the label for the Y (vertical) axis.protected void
setYVariable
(String name) Sets the y variable by name.void
protected void
showPlotCoordinates
(int index) Shows plot coordinates at the specified dataset index.protected void
showZeroOnAxis
(String axis) Rescales this plot so the zero value is included in the range ymin-ymax.void
snapshot()
Creates a snapshot of this plot or, if possible, of the parent TViewChooser.toString()
void
Methods inherited from class org.opensourcephysics.display.PlottingPanel
computeGutters, getAxes, getBottomGutter, getInteractive, getTopGutter, paintFirst, pixToX, pixToY, 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, setMouseListeners, setShowCoordinates
Methods inherited from class org.opensourcephysics.display.DrawingPanel
actionPerformed, addDrawableAtIndex, addDrawables, addMessageLabel, addOptionController, checkWorkingImage, displayCoordinates, dref, enableInspector, firePropertyChange, getAspectRatio, getCoordinateStringBuilder, getDimensionSetter, getDrawables, getDrawables, getDrawables, getDrawablesExcept, getDrawablesExcept, getDrawablesNoClone, getFirstDrawable, getGlassPane, getGutters, getHeight, getImageRatio, getLeftGutter, getMaxPixPerUnit, getMeasure, getObjectOfClass, getPixelMatrix, getPixelTransform, getPixelTransform, getPreferredXMax, getPreferredXMin, getPreferredYMax, getPreferredYMin, getRightGutter, getScale, getSnapshotItem, 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, isZoomEvent, limitAutoscaleX, limitAutoscaleY, measure, paint, paintComponent, paintDrawableList, paintEverything, paintLast, project, receiveToolReply, recomputeTransform, refreshGUI, removeDrawable, removeDrawables, removeObjectsOfClass, removeOptionController, render, render, repaint, repaintForZoom, repaintIfNecessary, replaceDrawable, resetGutters, scale, scaleX, scaleY, setAdjustableGutter, setAntialiasShapeOn, setAntialiasTextOn, setAutoscaleMargin, setAutoscaleX, setAutoscaleY, setBounds, setBounds, setBuffered, setClipAtGutter, setCoordinateStringBuilder, setCustomInspector, setFixedScale, setFontFactor, setFontLevel, setGutters, setGutters, setMessage, setMessage, setMouseCursor, setPaintDrawables, setPixelsPerUnit, setPopupMenu, setPreferredGutters, setPreferredMinMax, setSquareAspect, setVideoTool, setVisible, setXLeftMarginPercentage, setXMarginPercentage, setXMarginPercentage, setXRightMarginPercentage, setYBottomMarginPercentage, setYMarginPercentage, setYMarginPercentage, setYTopMarginPercentage, setZoom, showInspector, transformPath, transformShape, validateImage, 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, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
frame
-
panelID
-
trackID
protected int trackID -
datasetManager
-
dataset
-
guests
-
guestDatasets
-
xPopup
-
yPopup
-
popup
-
linesItem
-
pointsItem
-
dataToolItem
-
dataFunctionListener
-
guestListener
-
xLabel
-
yLabel
-
title
-
xListener
-
yListener
-
plotTrackView
-
isCustom
protected boolean isCustom -
font
-
hitRect
-
plotAxes
protected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.ClickableAxes plotAxes -
isZoomMode
protected boolean isZoomMode -
mouseListener
protected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.PlotMouseListener mouseListener -
playerListener
-
clickedStep
-
coordStringBuilder
-
linesItemSelected
protected boolean linesItemSelected -
pointsItemSelected
protected boolean pointsItemSelected -
bsFrameHighlights
-
-
Constructor Details
-
TrackPlottingPanel
Constructs a TrackPlottingPanel for a track.- Parameters:
track
- the trackdata
- the track's data
-
-
Method Details
-
initAxes
protected void initAxes()Description copied from class:PlottingPanel
Override to specify a different kind of axes.- Overrides:
initAxes
in classPlottingPanel
-
send
Description copied from interface:Tool
Sends a job to this tool and specifies a tool to reply to. -
getDataset
Gets the dataset- Returns:
- the dataset plotted on this panel
-
setXLabel
Sets the label for the X (horizontal) axis. Overrides PlottingPanel.- Overrides:
setXLabel
in classPlottingPanel
- Parameters:
label
- the x label.
-
getXLabel
Gets the label for the X (horizontal) axis.- Returns:
- the x label
-
setYLabel
Sets the label for the Y (vertical) axis. Overrides PlottingPanel.- Overrides:
setYLabel
in classPlottingPanel
- Parameters:
label
- the y label
-
getYLabel
Gets the label for the Y (vertical) axis.- Returns:
- the y label
-
setTitle
Sets the title.- Overrides:
setTitle
in classPlottingPanel
- Parameters:
title
- the title.
-
getTitle
Gets the title.- Returns:
- the title
-
addGuest
Adds a guest track. Guest tracks are plotted along with the main track.- Parameters:
guest
- the track
-
removeGuest
Removes a guest track.- Parameters:
guest
- the track
-
scale
Overrides DrawingPanel scale method- Overrides:
scale
in classDrawingPanel
-
getPopupMenu
Gets the popup menu.- Overrides:
getPopupMenu
in classDrawingPanel
-
snapshot
public void snapshot()Creates a snapshot of this plot or, if possible, of the parent TViewChooser.- Overrides:
snapshot
in classDrawingPanel
-
buildPopupMenu
protected void buildPopupMenu()Builds the default popup menu for this panel.- Overrides:
buildPopupMenu
in classDrawingPanel
-
selectAction
-
findViewRect
Overrides DrawingPanel method to prevent changes to glassPanel and deal with multiple plots.- Overrides:
findViewRect
in classDrawingPanel
-
showZeroOnAxis
Rescales this plot so the zero value is included in the range ymin-ymax. -
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
Gets the TViewChooser that owns (displays) this panel.- Returns:
- the TViewChooser. May return null.
-
plotData
protected void plotData()Plots the data. -
refreshDataset
protected void refreshDataset(HighlightableDataset hds, DatasetManager manager, boolean xIsAngle, boolean yIsAngle, boolean degrees) Refreshes the data in a dataset based on current x and y index.- Parameters:
hds
- the dataset to refreshmanager
- the DatasetManager with the data columnsxIsAngle
- true if the x index is an angleyIsAngle
- true if the y index is an angledegrees
- true if angle units are degrees
-
showPlotCoordinates
protected void showPlotCoordinates(int index) Shows plot coordinates at the specified dataset index.- Parameters:
index
- the index
-
refreshDecimalSeparators
protected void refreshDecimalSeparators()Description copied from class:DrawingPanel
Refreshes the decimal separators.- Overrides:
refreshDecimalSeparators
in classDrawingPanel
-
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 classDrawingPanel
- 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 classDrawingPanel
- Parameters:
xmin
-xmax
-
-
setPreferredMinMaxY
public void setPreferredMinMaxY(double ymin, double ymax) Sets preferred min/max y values. Overrides DrawingPanel method.- Overrides:
setPreferredMinMaxY
in classDrawingPanel
- Parameters:
ymin
-ymax
-
-
requestFocusInWindow
public boolean requestFocusInWindow()Overrides requestFocusInWindow. This declines the focus if scale setter is visible.- Overrides:
requestFocusInWindow
in classJComponent
-
setXVariable
Sets the x variable by name.- Parameters:
name
- the name of the dataset to plot on the x axis
-
getXVariable
Gets the x variable name.- Returns:
- the name of the x variable
-
setYVariable
Sets the y variable by name.- Parameters:
name
- the name of the dataset to plot on the y axis
-
getYVariable
Gets the y variable name.- Returns:
- the name of the y variable, without the defined information
-
setPlotTrackView
Sets the PlotTrackView that owns this.- Parameters:
view
- the PlotTrackView
-
createXYPopups
protected void createXYPopups() -
createVarItems
protected void createVarItems() -
updateVarSelection
public void updateVarSelection() -
setVariables
protected void setVariables() -
isShowCoordinates
public boolean isShowCoordinates()Description copied from class:DrawingPanel
Returns true if mouse coordinates are displayed- Overrides:
isShowCoordinates
in classDrawingPanel
- Returns:
true
if mouse coordinates are displayed
-
getLoader
Returns an XML.ObjectLoader to save and load object data.- Returns:
- the XML.ObjectLoader
-
fireRepaint
-
showDataTool
public void showDataTool() -
clearPopup
public void clearPopup() -
setHighlights
-
repaint
public void repaint()- Overrides:
repaint
in classDrawingPanel
-
dispose
public void dispose()- Specified by:
dispose
in interfaceOSPRuntime.Disposable
- Overrides:
dispose
in classInteractivePanel
-
finalize
public void finalize() -
toString
-