CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.gui.tree
Class DefaultUndoableTreeSelectionModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeSelectionModel
      extended by ch.randelshofer.gui.tree.DefaultUndoableTreeSelectionModel
All Implemented Interfaces:
UndoableTreeSelectionModel, Undoable, java.io.Serializable, java.lang.Cloneable, javax.swing.tree.TreeSelectionModel, javax.swing.undo.StateEditable

public class DefaultUndoableTreeSelectionModel
extends javax.swing.tree.DefaultTreeSelectionModel
implements UndoableTreeSelectionModel

Supports UndoableEditListeners.

Version:
1.0.1 2011-01-19 Removes unused imports.
1.0 2001-10-09
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultTreeSelectionModel
changeSupport, leadIndex, leadPath, leadRow, listenerList, listSelectionModel, rowMapper, selection, SELECTION_MODE_PROPERTY, selectionMode
 
Fields inherited from interface javax.swing.tree.TreeSelectionModel
CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION, SINGLE_TREE_SELECTION
 
Fields inherited from interface javax.swing.undo.StateEditable
RCSID
 
Constructor Summary
DefaultUndoableTreeSelectionModel()
          Creates new DefaultUndoableTreeSelectionModel
 
Method Summary
 void addSelectionPaths(javax.swing.tree.TreePath[] paths)
          Adds paths to the current selection.
 void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
          Adds an UndoableEditListener.
 void clearSelection()
          Empties the current selection.
 void fireUndoableEditEvent(javax.swing.undo.UndoableEdit edit)
          Notify all listeners that have registered interest for notification on this event type.
 void removeSelectionPath(javax.swing.tree.TreePath path)
          Removes path from the selection.
 void removeSelectionPaths(javax.swing.tree.TreePath[] paths)
          Removes paths from the selection.
 void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
          Removes an UndoableEditListener.
 void restoreState(java.util.Hashtable state)
          Upon receiving this message the receiver should extract any relevant state out of state.
 void setSelectionPath(javax.swing.tree.TreePath path)
          Sets the selection to path.
 void setSelectionPaths(javax.swing.tree.TreePath[] paths)
          Sets the selection to the paths in paths.
 void storeState(java.util.Hashtable state)
          Upon receiving this message the receiver should place any relevant state into state.
 
Methods inherited from class javax.swing.tree.DefaultTreeSelectionModel
addPropertyChangeListener, addSelectionPath, addTreeSelectionListener, arePathsContiguous, canPathsBeAdded, canPathsBeRemoved, clone, fireValueChanged, getLeadSelectionPath, getLeadSelectionRow, getListeners, getMaxSelectionRow, getMinSelectionRow, getPropertyChangeListeners, getRowMapper, getSelectionCount, getSelectionMode, getSelectionPath, getSelectionPaths, getSelectionRows, getTreeSelectionListeners, insureRowContinuity, insureUniqueness, isPathSelected, isRowSelected, isSelectionEmpty, notifyPathChange, removePropertyChangeListener, removeTreeSelectionListener, resetRowSelection, setRowMapper, setSelectionMode, toString, updateLeadIndex
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.TreeSelectionModel
addPropertyChangeListener, addSelectionPath, addTreeSelectionListener, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getRowMapper, getSelectionCount, getSelectionMode, getSelectionPath, getSelectionPaths, getSelectionRows, isPathSelected, isRowSelected, isSelectionEmpty, removePropertyChangeListener, removeTreeSelectionListener, resetRowSelection, setRowMapper, setSelectionMode
 

Constructor Detail

DefaultUndoableTreeSelectionModel

public DefaultUndoableTreeSelectionModel()
Creates new DefaultUndoableTreeSelectionModel

Method Detail

addUndoableEditListener

public void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Adds an UndoableEditListener.

Specified by:
addUndoableEditListener in interface Undoable

removeUndoableEditListener

public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Removes an UndoableEditListener.

Specified by:
removeUndoableEditListener in interface Undoable

fireUndoableEditEvent

public void fireUndoableEditEvent(javax.swing.undo.UndoableEdit edit)
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Specified by:
fireUndoableEditEvent in interface UndoableTreeSelectionModel

addSelectionPaths

public void addSelectionPaths(javax.swing.tree.TreePath[] paths)
Adds paths to the current selection. If any of the paths in paths are not currently in the selection the TreeSelectionListeners are notified.

The lead path is set to the last element in paths.

Specified by:
addSelectionPaths in interface javax.swing.tree.TreeSelectionModel
Overrides:
addSelectionPaths in class javax.swing.tree.DefaultTreeSelectionModel
Parameters:
paths - the new paths to add to the current selection.

clearSelection

public void clearSelection()
Empties the current selection. If this represents a change in the current selection, the selection listeners are notified.

Specified by:
clearSelection in interface javax.swing.tree.TreeSelectionModel
Overrides:
clearSelection in class javax.swing.tree.DefaultTreeSelectionModel

removeSelectionPath

public void removeSelectionPath(javax.swing.tree.TreePath path)
Removes path from the selection. If path is in the selection The TreeSelectionListeners are notified.

Specified by:
removeSelectionPath in interface javax.swing.tree.TreeSelectionModel
Overrides:
removeSelectionPath in class javax.swing.tree.DefaultTreeSelectionModel
Parameters:
path - the path to remove from the selection.

removeSelectionPaths

public void removeSelectionPaths(javax.swing.tree.TreePath[] paths)
Removes paths from the selection. If any of the paths in paths are in the selection the TreeSelectionListeners are notified.

Specified by:
removeSelectionPaths in interface javax.swing.tree.TreeSelectionModel
Overrides:
removeSelectionPaths in class javax.swing.tree.DefaultTreeSelectionModel
Parameters:
paths - the paths to remove from the selection.

setSelectionPath

public void setSelectionPath(javax.swing.tree.TreePath path)
Sets the selection to path. If this represents a change, then the TreeSelectionListeners are notified.

Specified by:
setSelectionPath in interface javax.swing.tree.TreeSelectionModel
Overrides:
setSelectionPath in class javax.swing.tree.DefaultTreeSelectionModel
Parameters:
path - new path to select

setSelectionPaths

public void setSelectionPaths(javax.swing.tree.TreePath[] paths)
Sets the selection to the paths in paths. If this represents a change the TreeSelectionListeners are notified. Potentially paths will be held by the reciever, in other words don't change any of the objects in the array once passed in.

The lead path is set to the last path in pPaths.

Specified by:
setSelectionPaths in interface javax.swing.tree.TreeSelectionModel
Overrides:
setSelectionPaths in class javax.swing.tree.DefaultTreeSelectionModel
Parameters:
paths - new selection.

restoreState

public void restoreState(java.util.Hashtable state)
Upon receiving this message the receiver should extract any relevant state out of state.

Specified by:
restoreState in interface javax.swing.undo.StateEditable

storeState

public void storeState(java.util.Hashtable state)
Upon receiving this message the receiver should place any relevant state into state.

Specified by:
storeState in interface javax.swing.undo.StateEditable

(c) Werner Randelshofer.
All rights reserved.