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.IADMouseControllerNested classes/interfaces inherited from class org.opensourcephysics.display.DrawingPanel
DrawingPanel.PopupmenuListener, DrawingPanel.ZoomBoxNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BitSetprotected Stepprotected TCoordinateStringBuilderprotected Actionprotected HighlightableDatasetprotected DatasetManagerprotected JMenuItemprotected Fontprotected TFrameprotected HashMap<TTrack,HighlightableDataset> protected Actionprotected Rectangleprotected booleanprotected booleanprotected JCheckBoxMenuItemprotected booleanprotected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.PlotMouseListenerprotected Integerprotected PropertyChangeListenerprotected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.ClickableAxesprotected PlotTrackViewprotected JCheckBoxMenuItemprotected booleanprotected JPopupMenuprotected Stringprotected intprotected Stringprotected ItemListenerprotected JPopupMenuprotected Stringprotected ItemListenerprotected JPopupMenuFields inherited from class org.opensourcephysics.display.PlottingPanel
axes, id, log10, logBase10FunctionFields inherited from class org.opensourcephysics.display.InteractivePanel
containsInteractive, interactive, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, mouseAction, mouseEventFields 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, zoomTimerFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields 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 TypeMethodDescriptionvoidAdds a guest track.protected voidBuilds the default popup menu for this panel.voidprotected voidprotected voidvoiddispose()voidfinalize()Overrides DrawingPanel method to prevent changes to glassPanel and deal with multiple plots.voidfireRepaint(TTrack track) Gets the datasetstatic XML.ObjectLoaderReturns an XML.ObjectLoader to save and load object data.protected TViewChoosergetOwner()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 StringGets the x variable name.Gets the label for the Y (vertical) axis.protected StringGets the y variable name.protected voidinitAxes()Override to specify a different kind of axes.booleanReturns true if mouse coordinates are displayedprotected voidplotData()Plots the data.protected voidrefreshDataset(HighlightableDataset hds, DatasetManager manager, boolean xIsAngle, boolean yIsAngle, boolean degrees) Refreshes the data in a dataset based on current x and y index.protected voidRefreshes the decimal separators.voidremoveGuest(TTrack guest) Removes a guest track.voidrepaint()booleanOverrides requestFocusInWindow.voidOverrides DrawingPanel scale methodprotected voidSets the max on the horizontal axis scale.protected voidSets the min on the horizontal axis scale.protected voidSets the max on the vertical axis scale.protected voidSets the min on the vertical axis scale.protected voidselectAction(Object source) voidSends a job to this tool and specifies a tool to reply to.voidsetHighlights(BitSet highlightFrames) protected voidSets the PlotTrackView that owns this.voidsetPreferredMinMax(double xmin, double xmax, double ymin, double ymax, boolean invalidateImage) Sets preferred min/max values.voidsetPreferredMinMaxX(double xmin, double xmax) Sets preferred min/max x values.voidsetPreferredMinMaxY(double ymin, double ymax) Sets preferred min/max y values.voidSets the title.protected voidvoidSets the label for the X (horizontal) axis.protected voidsetXVariable(String name) Sets the x variable by name.voidSets the label for the Y (vertical) axis.protected voidsetYVariable(String name) Sets the y variable by name.voidprotected voidshowPlotCoordinates(int index) Shows plot coordinates at the specified dataset index.protected voidshowZeroOnAxis(String axis) Rescales this plot so the zero value is included in the range ymin-ymax.voidsnapshot()Creates a snapshot of this plot or, if possible, of the parent TViewChooser.toString()voidMethods 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, yToPixMethods inherited from class org.opensourcephysics.display.InteractivePanel
addDrawable, clear, getCurrentDraggable, getMouseAction, getMouseButton, getMouseClickCount, getMouseIntX, getMouseIntY, getMouseX, getMouseY, handleMouseAction, saveMouseEvent, scaleX, scaleY, setInteractiveMouseHandler, setMouseListeners, setShowCoordinatesMethods 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, zoomOutMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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:PlottingPanelOverride to specify a different kind of axes.- Overrides:
initAxesin classPlottingPanel
-
send
Description copied from interface:ToolSends 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:
setXLabelin 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:
setYLabelin classPlottingPanel- Parameters:
label- the y label
-
getYLabel
Gets the label for the Y (vertical) axis.- Returns:
- the y label
-
setTitle
Sets the title.- Overrides:
setTitlein 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:
scalein classDrawingPanel
-
getPopupMenu
Gets the popup menu.- Overrides:
getPopupMenuin classDrawingPanel
-
snapshot
public void snapshot()Creates a snapshot of this plot or, if possible, of the parent TViewChooser.- Overrides:
snapshotin classDrawingPanel
-
buildPopupMenu
protected void buildPopupMenu()Builds the default popup menu for this panel.- Overrides:
buildPopupMenuin classDrawingPanel
-
selectAction
-
findViewRect
Overrides DrawingPanel method to prevent changes to glassPanel and deal with multiple plots.- Overrides:
findViewRectin 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:DrawingPanelRefreshes the decimal separators.- Overrides:
refreshDecimalSeparatorsin classDrawingPanel
-
setPreferredMinMax
public void setPreferredMinMax(double xmin, double xmax, double ymin, double ymax, boolean invalidateImage) Sets preferred min/max values. Overrides DrawingPanel method.- Overrides:
setPreferredMinMaxin 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:
setPreferredMinMaxXin classDrawingPanel- Parameters:
xmin-xmax-
-
setPreferredMinMaxY
public void setPreferredMinMaxY(double ymin, double ymax) Sets preferred min/max y values. Overrides DrawingPanel method.- Overrides:
setPreferredMinMaxYin classDrawingPanel- Parameters:
ymin-ymax-
-
requestFocusInWindow
public boolean requestFocusInWindow()Overrides requestFocusInWindow. This declines the focus if scale setter is visible.- Overrides:
requestFocusInWindowin 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:DrawingPanelReturns true if mouse coordinates are displayed- Overrides:
isShowCoordinatesin classDrawingPanel- Returns:
trueif 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:
repaintin classDrawingPanel
-
dispose
public void dispose()- Specified by:
disposein interfaceOSPRuntime.Disposable- Overrides:
disposein classInteractivePanel
-
finalize
public void finalize() -
toString
-