Class CommandStackDialog
- java.lang.Object
- 
- java.awt.Component
- 
- java.awt.Container
- 
- javax.swing.JComponent
- 
- javax.swing.JPanel
- 
- org.openstreetmap.josm.gui.dialogs.ToggleDialog
- 
- org.openstreetmap.josm.gui.dialogs.CommandStackDialog
 
 
 
 
 
 
- 
- All Implemented Interfaces:
- java.awt.event.AWTEventListener,- java.awt.image.ImageObserver,- java.awt.MenuContainer,- java.io.Serializable,- java.util.EventListener,- javax.accessibility.Accessible,- UndoRedoHandler.CommandQueuePreciseListener,- Helpful,- ShowHideButtonListener,- PreferenceChangedListener,- Destroyable
 
 public class CommandStackDialog extends ToggleDialog implements UndoRedoHandler.CommandQueuePreciseListener Dialog displaying list of all executed commands (undo/redo buffer).- Since:
- 94
- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description private static classCommandStackDialog.CommandCellRendererprivate classCommandStackDialog.CommandStackPopup(package private) classCommandStackDialog.MouseEventHandlerclassCommandStackDialog.SelectActionAction that selects the objects that take part in a command.classCommandStackDialog.SelectAndZoomActionAction that selects the objects that take part in a command, then zoom to them.protected classCommandStackDialog.UndoRedoActionAction to undo or redo all commands up to (and including) the selected item.private classCommandStackDialog.UndoRedoSelectionListenerSelection listener for undo and redo area.protected static classCommandStackDialog.UndoRedoTypeundo / redo switch to reduce duplicate code- 
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialogToggleDialog.ButtonHidingType, ToggleDialog.TitleBar, ToggleDialog.ToggleDialogAction
 - 
Nested classes/interfaces inherited from class javax.swing.JPaneljavax.swing.JPanel.AccessibleJPanel
 - 
Nested classes/interfaces inherited from class javax.swing.JComponentjavax.swing.JComponent.AccessibleJComponent
 
- 
 - 
Field SummaryFields Modifier and Type Field Description private CommandStackDialog.UndoRedoTypelastOperationprivate javax.swing.tree.DefaultMutableTreeNoderedoRootprivate CommandStackDialog.UndoRedoSelectionListenerredoSelectionListenerprivate javax.swing.JTreeredoTreeprivate javax.swing.tree.DefaultTreeModelredoTreeModelprivate javax.swing.JScrollPanescrollPaneprivate CommandStackDialog.SelectActionselectActionprivate CommandStackDialog.SelectAndZoomActionselectAndZoomActionprivate javax.swing.JSeparatorseparatorprivate java.util.Set<IEnabledStateUpdating>showNotifyListenerSimple listener setup to update the button enabled state when the side dialog shows.private java.awt.Componentspacerprivate javax.swing.tree.DefaultMutableTreeNodeundoRootprivate CommandStackDialog.UndoRedoSelectionListenerundoSelectionListenerprivate javax.swing.JTreeundoTreeprivate javax.swing.tree.DefaultTreeModelundoTreeModel- 
Fields inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialogbutton, buttonHiding, detachedDialog, dialogsPanel, isCollapsed, isDocked, isShowing, name, preferenceClass, preferencePrefix, PROP_DYNAMIC_BUTTONS, titleBar, toggleAction, windowMenuItem
 - 
Fields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
- 
 - 
Constructor SummaryConstructors Constructor Description CommandStackDialog()Constructs a newCommandStackDialog.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddShowNotifyListener(IEnabledStateUpdating listener)private voidbuildRedoTree()private voidbuildTrees()Build the trees of undo and redo commands (initially or when they have changed).private voidbuildUndoTree()voidcleaned(UndoRedoHandler.CommandQueueCleanedEvent e)Notifies the listener about commands being cleaned.voidcommandAdded(UndoRedoHandler.CommandAddedEvent e)Notifies the listener about a new command added to the queue.voidcommandRedone(UndoRedoHandler.CommandRedoneEvent e)Notifies the listener about a command that has been redone.voidcommandUndone(UndoRedoHandler.CommandUndoneEvent e)Notifies the listener about a command that has been undone.private voidensureTreesConsistency()protected static java.util.Collection<? extends OsmPrimitive>getAffectedPrimitives(PseudoCommand c)Return primitives that are affected by some commandprotected CommandListMutableTreeNodegetNodeForCommand(PseudoCommand c)Wraps a command in a CommandListMutableTreeNode.PseudoCommandgetSelectedCommand()Returns the selected undo/redo commandvoidhideNotify()Called when toggle dialog is hidden (collapsed, removed, MapFrame is removed, ...).protected booleanredoTreeIsEmpty()voidshowNotify()Called when toggle dialog is shown (after it was created or expanded).private voidswapNode(javax.swing.tree.DefaultTreeModel srcModel, javax.swing.tree.DefaultMutableTreeNode srcRoot, int srcIndex, javax.swing.tree.DefaultTreeModel dstModel, javax.swing.tree.DefaultMutableTreeNode dstRoot, int dstIndex)private voidupdateTitle()protected voidwireUpdateEnabledStateUpdater(IEnabledStateUpdating updater, javax.swing.JTree tree)Wires updater for enabled state to the events.- 
Methods inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialogbuttonHidden, buttonShown, clearButtonActions, closeDetachedDialog, collapse, createLayout, createLayout, destroy, detach, dock, dockWhenClosingDetachedDlg, eventDispatched, expand, getButton, getDefaultDetachedSize, getLastHeight, getName, getPreferencePrefix, getPreferredHeight, getToggleAction, helpTopic, hideDialog, isDialogInCollapsedView, isDialogInDefaultView, isDialogShowing, preferenceChanged, registerInWindowMenu, rememberHeight, setButton, setContentVisible, setDialogsPanel, setIsButtonHiding, setIsCollapsed, setIsDocked, setIsShowing, setTitle, showDialog, stateChanged, toggleButtonHook, toString, unfurlDialog
 - 
Methods inherited from class javax.swing.JPanelgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 - 
Methods inherited from class javax.swing.JComponentaddAncestorListener, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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.Containeradd, 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.Componentaction, 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, 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, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
 
- 
 
- 
- 
- 
Field Detail- 
undoTreeModelprivate final javax.swing.tree.DefaultTreeModel undoTreeModel 
 - 
redoTreeModelprivate final javax.swing.tree.DefaultTreeModel redoTreeModel 
 - 
undoTreeprivate final javax.swing.JTree undoTree 
 - 
redoTreeprivate final javax.swing.JTree redoTree 
 - 
undoRootprivate javax.swing.tree.DefaultMutableTreeNode undoRoot 
 - 
redoRootprivate javax.swing.tree.DefaultMutableTreeNode redoRoot 
 - 
undoSelectionListenerprivate final transient CommandStackDialog.UndoRedoSelectionListener undoSelectionListener 
 - 
redoSelectionListenerprivate final transient CommandStackDialog.UndoRedoSelectionListener redoSelectionListener 
 - 
scrollPaneprivate final javax.swing.JScrollPane scrollPane 
 - 
separatorprivate final javax.swing.JSeparator separator 
 - 
spacerprivate final java.awt.Component spacer 
 - 
lastOperationprivate CommandStackDialog.UndoRedoType lastOperation 
 - 
selectActionprivate final CommandStackDialog.SelectAction selectAction 
 - 
selectAndZoomActionprivate final CommandStackDialog.SelectAndZoomAction selectAndZoomAction 
 - 
showNotifyListenerprivate final transient java.util.Set<IEnabledStateUpdating> showNotifyListener Simple listener setup to update the button enabled state when the side dialog shows.
 
- 
 - 
Constructor Detail- 
CommandStackDialogpublic CommandStackDialog() Constructs a newCommandStackDialog.
 
- 
 - 
Method Detail- 
updateTitleprivate void updateTitle() 
 - 
wireUpdateEnabledStateUpdaterprotected void wireUpdateEnabledStateUpdater(IEnabledStateUpdating updater, javax.swing.JTree tree) Wires updater for enabled state to the events. Also updates dialog title if needed.- Parameters:
- updater- updater
- tree- tree on which wire updater
 
 - 
showNotifypublic void showNotify() Description copied from class:ToggleDialogCalled when toggle dialog is shown (after it was created or expanded). Descendants may overwrite this method, it's a good place to register listeners needed to keep dialog updated- Overrides:
- showNotifyin class- ToggleDialog
 
 - 
addShowNotifyListenerprivate void addShowNotifyListener(IEnabledStateUpdating listener) 
 - 
hideNotifypublic void hideNotify() Description copied from class:ToggleDialogCalled when toggle dialog is hidden (collapsed, removed, MapFrame is removed, ...). Good place to unregister listeners- Overrides:
- hideNotifyin class- ToggleDialog
 
 - 
buildTreesprivate void buildTrees() Build the trees of undo and redo commands (initially or when they have changed).
 - 
buildUndoTreeprivate void buildUndoTree() 
 - 
buildRedoTreeprivate void buildRedoTree() 
 - 
ensureTreesConsistencyprivate void ensureTreesConsistency() 
 - 
getNodeForCommandprotected CommandListMutableTreeNode getNodeForCommand(PseudoCommand c) Wraps a command in a CommandListMutableTreeNode. Recursively adds child commands.- Parameters:
- c- the command
- Returns:
- the resulting node
 
 - 
getAffectedPrimitivesprotected static java.util.Collection<? extends OsmPrimitive> getAffectedPrimitives(PseudoCommand c) Return primitives that are affected by some command- Parameters:
- c- the command
- Returns:
- collection of affected primitives, only usable ones
 
 - 
redoTreeIsEmptyprotected boolean redoTreeIsEmpty() 
 - 
cleanedpublic void cleaned(UndoRedoHandler.CommandQueueCleanedEvent e) Description copied from interface:UndoRedoHandler.CommandQueuePreciseListenerNotifies the listener about commands being cleaned.- Specified by:
- cleanedin interface- UndoRedoHandler.CommandQueuePreciseListener
- Parameters:
- e- event
 
 - 
commandAddedpublic void commandAdded(UndoRedoHandler.CommandAddedEvent e) Description copied from interface:UndoRedoHandler.CommandQueuePreciseListenerNotifies the listener about a new command added to the queue.- Specified by:
- commandAddedin interface- UndoRedoHandler.CommandQueuePreciseListener
- Parameters:
- e- event
 
 - 
commandUndonepublic void commandUndone(UndoRedoHandler.CommandUndoneEvent e) Description copied from interface:UndoRedoHandler.CommandQueuePreciseListenerNotifies the listener about a command that has been undone.- Specified by:
- commandUndonein interface- UndoRedoHandler.CommandQueuePreciseListener
- Parameters:
- e- event
 
 - 
commandRedonepublic void commandRedone(UndoRedoHandler.CommandRedoneEvent e) Description copied from interface:UndoRedoHandler.CommandQueuePreciseListenerNotifies the listener about a command that has been redone.- Specified by:
- commandRedonein interface- UndoRedoHandler.CommandQueuePreciseListener
- Parameters:
- e- event
 
 - 
swapNodeprivate void swapNode(javax.swing.tree.DefaultTreeModel srcModel, javax.swing.tree.DefaultMutableTreeNode srcRoot, int srcIndex, javax.swing.tree.DefaultTreeModel dstModel, javax.swing.tree.DefaultMutableTreeNode dstRoot, int dstIndex) 
 - 
getSelectedCommandpublic PseudoCommand getSelectedCommand() Returns the selected undo/redo command- Returns:
- the selected undo/redo command or null
 
 
- 
 
-