public class EditablePlot extends Plot
The style of editing is very particular. This class assumes the data specify a function of x. I.e., there there is exactly one y value for every x value. Thus, with the right mouse button, you are allowed to trace out new y values starting with some leftmost x value. You can only trace values to the right. This feature makes it easy to trace values with discontinuities. Just start at the left, and drag to the right to the point of the discontinuity, then drag to the left, then right again. You will have to try it... Notice that this style of editing probably does not make sense with error bars, since there is no mechanism for editing the error bars.
To be able to modify the data in a dataset, of course, there must be data in the dataset. Thus, you should create a dataset (for example by calling addPoint()) before editing it. Only the visible part of the dataset can be edited (that is, the portion of the dataset along the visible part of the horizontal axis). If you zoom in, then, you can edit particular points more precisely.
To be notified when the user sketches a new signal, create an object that implements the EditListener interface and add that listener using addEditListener().
Modifier and Type | Class and Description |
---|---|
class |
EditablePlot.EditMouseListener
Listen for mouse button events.
|
class |
EditablePlot.ModifyListener
Listen for mouse motion events.
|
class |
EditablePlot.UndoListener
Control-Z is undo and Control-Y is redo.
|
PlotBox.ButtonListener, PlotBox.CommandListener, PlotBox.DragListener, PlotBox.MoveListener, PlotBox.MoveMotionListener, PlotBox.ZoomListener, PlotBox.ZoomListener2
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
_currentdataset, _marks, _points
_background, _bottomPadding, _colors, _documentBase, _foreground, _grid, _height, _leftPadding, _LOG10SCALE, _lrx, _lry, _originalXhigh, _originalXlow, _originalXRangeGiven, _originalYhigh, _originalYlow, _originalYRangeGiven, _padding, _plotImage, _preferredHeight, _preferredWidth, _rangesGivenByZooming, _rightPadding, _specifiedPlotRectangle, _topPadding, _ulx, _uly, _usecolor, _wrap, _wrapHigh, _wrapLow, _xBottom, _xhighgiven, _xlog, _xlowgiven, _xMax, _xMin, _xRangeGiven, _xscale, _xTop, _yBottom, _yhighgiven, _ylog, _ylowgiven, _yMax, _yMin, _yRangeGiven, _yscale, _yTop, PTPLOT_RELEASE
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
EditablePlot()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addEditListener(EditListener listener)
Add a listener to be informed when the user modifies a data set.
|
double[][] |
getData(int dataset)
Get the data in the specified dataset.
|
void |
redo()
Redo the latest signal editing operation that was undone by
calling undo(), if there was one.
|
void |
removeEditListener(EditListener listener)
Unregister a edit listener.
|
void |
setEditable(int dataset)
Specify which dataset is editable.
|
void |
undo()
Undo the latest signal editing operation, if there was one.
|
_checkDatasetIndex, _drawBar, _drawErrorBar, _drawImpulse, _drawLine, _drawLine, _drawPlot, _drawPoint, _exportLatexPlotData, _parseLine, _resetScheduledTasks, _scheduledRedraw, _setWidth, _writeOldSyntax, addLegend, addPoint, addPointWithErrorBars, clear, clear, erasePoint, fillPlot, getConnected, getImpulses, getLineStyles, getMarksStyle, getMaxDataSets, getNumDataSets, getReuseDatasets, markDisconnections, parseFile, read, samplePlot, setBars, setBars, setConnected, setConnected, setImpulses, setImpulses, setLineStyle, setLineStyles, setMarksStyle, setMarksStyle, setNumSets, setPointsPersistence, setReuseDatasets, setXPersistence, writeData, writeFormat
_automaticRescale, _drawPlot, _help, _setButtonsVisibility, _setPadding, _timedRepaint, _zoom, _zoomBox, _zoomStart, addCaptionLine, addXTick, addYTick, clearCaptions, clearLegends, deferIfNecessary, destroy, export, exportImage, exportImage, exportImage, exportImage, exportImage, exportLatex, getCaptions, getColor, getColorByName, getColors, getDataurl, getDocumentBase, getGrid, getLegend, getLegendDataset, getPlotRectangle, getPreferredSize, getTitle, getXAutoRange, getXLabel, getXLog, getXRange, getXTicks, getYAutoRange, getYLabel, getYLog, getYRange, getYTicks, init, paintComponent, parseFile, print, read, removeLegend, renameLegend, resetAxes, setAutomaticRescale, setBackground, setBackground, setBounds, setButtons, setCaptions, setColor, setColors, setColors, setDataurl, setDocumentBase, setForeground, setForeground, setGrid, setLabelFont, setPlotRectangle, setPlotRectangle, setSize, setTimedRepaint, setTitle, setTitleFont, setWrap, setXLabel, setXLog, setXRange, setYLabel, setYLog, setYRange, write, write, write, writeOldSyntax, zoom, zoomEqual
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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
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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPoint
addCaptionLine, addXTick, addYTick, clearCaptions, clearLegends, deferIfNecessary, destroy, getCaptions, getColor, getColors, getDataurl, getDocumentBase, getGrid, getLegend, getLegendDataset, getPlotRectangle, getTitle, getXAutoRange, getXLabel, getXLog, getXRange, getXTicks, getYAutoRange, getYLabel, getYLog, getYRange, getYTicks, init, parseFile, read, removeLegend, renameLegend, repaint, resetAxes, setAutomaticRescale, setBackground, setButtons, setCaptions, setColor, setColors, setDataurl, setDocumentBase, setForeground, setGrid, setLabelFont, setPlotRectangle, setSize, setTimedRepaint, setTitle, setTitleFont, setWrap, setXLabel, setXLog, setXRange, setYLabel, setYLog, setYRange, write, write, write, writeOldSyntax, zoom
public void addEditListener(EditListener listener)
listener
- The listener.EditListener
,
removeEditListener(EditListener)
public double[][] getData(int dataset)
dataset
- The dataset.public void redo()
public void removeEditListener(EditListener listener)
listener
- The listener to remove from the list of listeners
to which edit events are sent.addEditListener(EditListener)
public void setEditable(int dataset)
dataset
- The editable dataset.public void undo()