jdk/src/share/classes/javax/swing/tree/TreeSelectionModel.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 20455 f6f9a0c2796b
child 23010 6dadb192ad81
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.swing.tree;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.swing.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.beans.PropertyChangeListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
  * This interface represents the current state of the selection for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
  * the tree component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
  * For information and examples of using tree selection models,
20455
f6f9a0c2796b 8020688: Broken links in documentation at http://docs.oracle.com/javase/6/docs/api/index.
mcherkas
parents: 5506
diff changeset
    35
  * see <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
  * in <em>The Java Tutorial.</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  * The state of the tree selection is characterized by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
  * a set of TreePaths, and optionally a set of integers. The mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  * from TreePath to integer is done by way of an instance of RowMapper.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
  * It is not necessary for a TreeSelectionModel to have a RowMapper to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
  * correctly operate, but without a RowMapper <code>getSelectionRows</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
  * will return null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  * A TreeSelectionModel can be configured to allow only one
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
  * path (<code>SINGLE_TREE_SELECTION</code>) a number of
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20455
diff changeset
    50
  * contiguous paths (<code>CONTIGUOUS_TREE_SELECTION</code>) or a number of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
  * discontiguous paths (<code>DISCONTIGUOUS_TREE_SELECTION</code>).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
  * A <code>RowMapper</code> is used to determine if TreePaths are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
  * contiguous.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
  * In the absence of a RowMapper <code>CONTIGUOUS_TREE_SELECTION</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
  * <code>DISCONTIGUOUS_TREE_SELECTION</code> behave the same, that is they
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
  * allow any number of paths to be contained in the TreeSelectionModel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  * For a selection model of <code>CONTIGUOUS_TREE_SELECTION</code> any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  * time the paths are changed (<code>setSelectionPath</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
  * <code>addSelectionPath</code> ...) the TreePaths are again checked to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
  * make they are contiguous. A check of the TreePaths can also be forced
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
  * by invoking <code>resetRowSelection</code>. How a set of discontiguous
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
  * TreePaths is mapped to a contiguous set is left to implementors of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  * this interface to enforce a particular policy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  * Implementations should combine duplicate TreePaths that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  * added to the selection. For example, the following code
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
  *   TreePath[] paths = new TreePath[] { treePath, treePath };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  *   treeSelectionModel.setSelectionPaths(paths);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
  * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
  * should result in only one path being selected:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  * <code>treePath</code>, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  * not two copies of <code>treePath</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  * The lead TreePath is the last path that was added (or set). The lead
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
  * row is then the row that corresponds to the TreePath as determined
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  * from the RowMapper.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
  * @author Scott Violet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
public interface TreeSelectionModel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    /** Selection can only contain one path at a time. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public static final int               SINGLE_TREE_SELECTION = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /** Selection can only be contiguous. This will only be enforced if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * a RowMapper instance is provided. That is, if no RowMapper is set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * this behaves the same as DISCONTIGUOUS_TREE_SELECTION. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public static final int               CONTIGUOUS_TREE_SELECTION = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /** Selection can contain any number of items that are not necessarily
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * contiguous. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public static final int               DISCONTIGUOUS_TREE_SELECTION = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * Sets the selection model, which must be one of SINGLE_TREE_SELECTION,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * This may change the selection if the current selection is not valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * for the new mode. For example, if three TreePaths are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * selected when the mode is changed to <code>SINGLE_TREE_SELECTION</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * only one TreePath will remain selected. It is up to the particular
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * implementation to decide what TreePath remains selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    void setSelectionMode(int mode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Returns the current selection mode, one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * <code>SINGLE_TREE_SELECTION</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * <code>CONTIGUOUS_TREE_SELECTION</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * <code>DISCONTIGUOUS_TREE_SELECTION</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    int getSelectionMode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
      * Sets the selection to path. If this represents a change, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
      * the TreeSelectionListeners are notified. If <code>path</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
      * null, this has the same effect as invoking <code>clearSelection</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
      * @param path new path to select
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    void setSelectionPath(TreePath path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
      * Sets the selection to path. If this represents a change, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
      * the TreeSelectionListeners are notified. If <code>paths</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
      * null, this has the same effect as invoking <code>clearSelection</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
      * @param paths new selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    void setSelectionPaths(TreePath[] paths);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
      * Adds path to the current selection. If path is not currently
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
      * in the selection the TreeSelectionListeners are notified. This has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
      * no effect if <code>path</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
      * @param path the new path to add to the current selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    void addSelectionPath(TreePath path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
      * Adds paths to the current selection.  If any of the paths in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
      * paths are not currently in the selection the TreeSelectionListeners
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
      * are notified. This has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
      * no effect if <code>paths</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
      * @param paths the new paths to add to the current selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    void addSelectionPaths(TreePath[] paths);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
      * Removes path from the selection. If path is in the selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
      * The TreeSelectionListeners are notified. This has no effect if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
      * <code>path</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
      * @param path the path to remove from the selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    void removeSelectionPath(TreePath path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
      * Removes paths from the selection.  If any of the paths in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      * <code>paths</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
      * are in the selection, the TreeSelectionListeners are notified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
      * This method has no effect if <code>paths</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
      * @param paths the path to remove from the selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    void removeSelectionPaths(TreePath[] paths);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
      * Returns the first path in the selection. How first is defined is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
      * up to implementors, and may not necessarily be the TreePath with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
      * the smallest integer value as determined from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
      * <code>RowMapper</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    TreePath getSelectionPath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
      * Returns the paths in the selection. This will return null (or an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
      * empty array) if nothing is currently selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    TreePath[] getSelectionPaths();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * Returns the number of paths that are selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    int getSelectionCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
      * Returns true if the path, <code>path</code>, is in the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
      * selection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    boolean isPathSelected(TreePath path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
      * Returns true if the selection is currently empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    boolean isSelectionEmpty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
      * Empties the current selection.  If this represents a change in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
      * current selection, the selection listeners are notified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    void clearSelection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * Sets the RowMapper instance. This instance is used to determine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * the row for a particular TreePath.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    void setRowMapper(RowMapper newMapper);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Returns the RowMapper instance that is able to map a TreePath to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    RowMapper getRowMapper();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
      * Returns all of the currently selected rows. This will return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
      * null (or an empty array) if there are no selected TreePaths or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
      * a RowMapper has not been set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    int[] getSelectionRows();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * Returns the smallest value obtained from the RowMapper for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * current set of selected TreePaths. If nothing is selected,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * or there is no RowMapper, this will return -1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    int getMinSelectionRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * Returns the largest value obtained from the RowMapper for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * current set of selected TreePaths. If nothing is selected,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * or there is no RowMapper, this will return -1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    int getMaxSelectionRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
      * Returns true if the row identified by <code>row</code> is selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    boolean isRowSelected(int row);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * Updates this object's mapping from TreePaths to rows. This should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * be invoked when the mapping from TreePaths to integers has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * (for example, a node has been expanded).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * You do not normally have to call this; JTree and its associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * listeners will invoke this for you. If you are implementing your own
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * view class, then you will have to invoke this.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    void resetRowSelection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * Returns the lead selection index. That is the last index that was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * added.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    int getLeadSelectionRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * Returns the last path that was added. This may differ from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * leadSelectionPath property maintained by the JTree.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    TreePath getLeadSelectionPath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * Adds a PropertyChangeListener to the listener list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * The listener is registered for all properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * A PropertyChangeEvent will get fired when the selection mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @param listener  the PropertyChangeListener to be added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    void addPropertyChangeListener(PropertyChangeListener listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * Removes a PropertyChangeListener from the listener list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * This removes a PropertyChangeListener that was registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * for all properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * @param listener  the PropertyChangeListener to be removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    void removePropertyChangeListener(PropertyChangeListener listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
      * Adds x to the list of listeners that are notified each time the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
      * set of selected TreePaths changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
      * @param x the new listener to be added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    void addTreeSelectionListener(TreeSelectionListener x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      * Removes x from the list of listeners that are notified each time
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      * the set of selected TreePaths changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
      * @param x the listener to remove
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    void removeTreeSelectionListener(TreeSelectionListener x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
}