36 import java.util.Vector;
37 import javax.swing.event.*;
38 import javax.swing.DefaultListSelectionModel;
39
40 /**
41 * Default implementation of TreeSelectionModel. Listeners are notified
42 * whenever
43 * the paths in the selection change, not the rows. In order
44 * to be able to track row changes you may wish to become a listener
45 * for expansion events on the tree and test for changes from there.
46 * <p>resetRowSelection is called from any of the methods that update
47 * the selected paths. If you subclass any of these methods to
48 * filter what is allowed to be selected, be sure and message
49 * <code>resetRowSelection</code> if you do not message super.
50 *
51 * <strong>Warning:</strong>
52 * Serialized objects of this class will not be compatible with
53 * future Swing releases. The current serialization support is
54 * appropriate for short term storage or RMI between applications running
55 * the same version of Swing. As of 1.4, support for long term storage
56 * of all JavaBeans™
57 * has been added to the <code>java.beans</code> package.
58 * Please see {@link java.beans.XMLEncoder}.
59 *
60 * @see javax.swing.JTree
61 *
62 * @author Scott Violet
63 */
64 @SuppressWarnings("serial")
65 public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeSelectionModel
66 {
67 /** Property name for selectionMode. */
68 public static final String SELECTION_MODE_PROPERTY = "selectionMode";
69
70 /** Used to messaged registered listeners. */
71 protected SwingPropertyChangeSupport changeSupport;
72
73 /** Paths that are currently selected. Will be null if nothing is
74 * currently selected. */
75 protected TreePath[] selection;
76
|
36 import java.util.Vector;
37 import javax.swing.event.*;
38 import javax.swing.DefaultListSelectionModel;
39
40 /**
41 * Default implementation of TreeSelectionModel. Listeners are notified
42 * whenever
43 * the paths in the selection change, not the rows. In order
44 * to be able to track row changes you may wish to become a listener
45 * for expansion events on the tree and test for changes from there.
46 * <p>resetRowSelection is called from any of the methods that update
47 * the selected paths. If you subclass any of these methods to
48 * filter what is allowed to be selected, be sure and message
49 * <code>resetRowSelection</code> if you do not message super.
50 *
51 * <strong>Warning:</strong>
52 * Serialized objects of this class will not be compatible with
53 * future Swing releases. The current serialization support is
54 * appropriate for short term storage or RMI between applications running
55 * the same version of Swing. As of 1.4, support for long term storage
56 * of all JavaBeans
57 * has been added to the <code>java.beans</code> package.
58 * Please see {@link java.beans.XMLEncoder}.
59 *
60 * @see javax.swing.JTree
61 *
62 * @author Scott Violet
63 */
64 @SuppressWarnings("serial")
65 public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeSelectionModel
66 {
67 /** Property name for selectionMode. */
68 public static final String SELECTION_MODE_PROPERTY = "selectionMode";
69
70 /** Used to messaged registered listeners. */
71 protected SwingPropertyChangeSupport changeSupport;
72
73 /** Paths that are currently selected. Will be null if nothing is
74 * currently selected. */
75 protected TreePath[] selection;
76
|