jdk/src/share/classes/javax/swing/ListSelectionModel.java
author malenkov
Wed, 30 Apr 2014 19:28:05 +0400
changeset 24544 c0133e7c7162
parent 5506 202f599c92aa
child 24983 f5a6e2ed8c7d
permissions -rw-r--r--
8041917: unexcepted behavior of LineBorder while using Boolean variable true Reviewed-by: alexsch, serb
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, 2006, 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;
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * This interface represents the current state of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * selection for any of the components that display a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * list of values with stable indices.  The selection is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * modeled as a set of intervals, each interval represents
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * a contiguous range of selected list elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * The methods for modifying the set of selected intervals
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * all take a pair of indices, index0 and index1, that represent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * a closed interval, i.e. the interval includes both index0 and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * index1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @author Hans Muller
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * @author Philip Milne
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * @see DefaultListSelectionModel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
public interface ListSelectionModel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * A value for the selectionMode property: select one list index
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * at a time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * @see #setSelectionMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    int SINGLE_SELECTION = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * A value for the selectionMode property: select one contiguous
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * range of indices at a time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @see #setSelectionMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    int SINGLE_INTERVAL_SELECTION = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * A value for the selectionMode property: select one or more
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * contiguous ranges of indices at a time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @see #setSelectionMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    int MULTIPLE_INTERVAL_SELECTION = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * Changes the selection to be between {@code index0} and {@code index1}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * inclusive. {@code index0} doesn't have to be less than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * {@code index1}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * In {@code SINGLE_SELECTION} selection mode, only the second index
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * If this represents a change to the current selection, then each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * {@code ListSelectionListener} is notified of the change.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @param index0 one end of the interval.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @param index1 other end of the interval
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * @see #addListSelectionListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    void setSelectionInterval(int index0, int index1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * Changes the selection to be the set union of the current selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * and the indices between {@code index0} and {@code index1} inclusive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * {@code index0} doesn't have to be less than or equal to {@code index1}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * In {@code SINGLE_SELECTION} selection mode, this is equivalent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * to calling {@code setSelectionInterval}, and only the second index
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * is used. In {@code SINGLE_INTERVAL_SELECTION} selection mode, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * method behaves like {@code setSelectionInterval}, unless the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * interval is immediately adjacent to or overlaps the existing selection,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * and can therefore be used to grow the selection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * If this represents a change to the current selection, then each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * {@code ListSelectionListener} is notified of the change.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @param index0 one end of the interval.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @param index1 other end of the interval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @see #addListSelectionListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @see #setSelectionInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    void addSelectionInterval(int index0, int index1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * Changes the selection to be the set difference of the current selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * and the indices between {@code index0} and {@code index1} inclusive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * {@code index0} doesn't have to be less than or equal to {@code index1}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * In {@code SINGLE_INTERVAL_SELECTION} selection mode, if the removal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * would produce two disjoint selections, the removal is extended through
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * the greater end of the selection. For example, if the selection is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * {@code 0-10} and you supply indices {@code 5,6} (in any order) the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * resulting selection is {@code 0-4}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * If this represents a change to the current selection, then each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * {@code ListSelectionListener} is notified of the change.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @param index0 one end of the interval.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @param index1 other end of the interval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * @see #addListSelectionListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    void removeSelectionInterval(int index0, int index1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * Returns the first selected index or -1 if the selection is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    int getMinSelectionIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * Returns the last selected index or -1 if the selection is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    int getMaxSelectionIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * Returns true if the specified index is selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    boolean isSelectedIndex(int index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Return the first index argument from the most recent call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * The most recent index0 is considered the "anchor" and the most recent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * index1 is considered the "lead".  Some interfaces display these
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * indices specially, e.g. Windows95 displays the lead index with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * dotted yellow outline.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * @see #getLeadSelectionIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @see #setSelectionInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @see #addSelectionInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    int getAnchorSelectionIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * Set the anchor selection index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @see #getAnchorSelectionIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    void setAnchorSelectionIndex(int index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * Return the second index argument from the most recent call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @see #getAnchorSelectionIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * @see #setSelectionInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @see #addSelectionInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    int getLeadSelectionIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * Set the lead selection index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @see #getLeadSelectionIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    void setLeadSelectionIndex(int index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * Change the selection to the empty set.  If this represents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * a change to the current selection then notify each ListSelectionListener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @see #addListSelectionListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    void clearSelection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * Returns true if no indices are selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    boolean isSelectionEmpty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * Insert length indices beginning before/after index.  This is typically
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * called to sync the selection model with a corresponding change
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * in the data model.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    void insertIndexInterval(int index, int length, boolean before);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * Remove the indices in the interval index0,index1 (inclusive) from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * the selection model.  This is typically called to sync the selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * model width a corresponding change in the data model.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    void removeIndexInterval(int index0, int index1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * Sets the {@code valueIsAdjusting} property, which indicates whether
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * or not upcoming selection changes should be considered part of a single
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * change. The value of this property is used to initialize the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * {@code valueIsAdjusting} property of the {@code ListSelectionEvent}s that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * are generated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * For example, if the selection is being updated in response to a user
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * drag, this property can be set to {@code true} when the drag is initiated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * and set to {@code false} when the drag is finished. During the drag,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * listeners receive events with a {@code valueIsAdjusting} property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * set to {@code true}. At the end of the drag, when the change is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * finalized, listeners receive an event with the value set to {@code false}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * Listeners can use this pattern if they wish to update only when a change
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * has been finalized.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * Setting this property to {@code true} begins a series of changes that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * is to be considered part of a single change. When the property is changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * back to {@code false}, an event is sent out characterizing the entire
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * selection change (if there was one), with the event's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * {@code valueIsAdjusting} property set to {@code false}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @param valueIsAdjusting the new value of the property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @see #getValueIsAdjusting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @see javax.swing.event.ListSelectionEvent#getValueIsAdjusting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    void setValueIsAdjusting(boolean valueIsAdjusting);
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 {@code true} if the selection is undergoing a series of changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * @return true if the selection is undergoing a series of changes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @see #setValueIsAdjusting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    boolean getValueIsAdjusting();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * Sets the selection mode. The following list describes the accepted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * selection modes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * <li>{@code ListSelectionModel.SINGLE_SELECTION} -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     *   Only one list index can be selected at a time. In this mode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     *   {@code setSelectionInterval} and {@code addSelectionInterval} are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *   equivalent, both replacing the current selection with the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     *   represented by the second argument (the "lead").
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * <li>{@code ListSelectionModel.SINGLE_INTERVAL_SELECTION} -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     *   Only one contiguous interval can be selected at a time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     *   In this mode, {@code addSelectionInterval} behaves like
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     *   {@code setSelectionInterval} (replacing the current selection),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     *   unless the given interval is immediately adjacent to or overlaps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *   the existing selection, and can therefore be used to grow it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * <li>{@code ListSelectionModel.MULTIPLE_INTERVAL_SELECTION} -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     *   In this mode, there's no restriction on what can be selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @see #getSelectionMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @throws IllegalArgumentException if the selection mode isn't
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     *         one of those allowed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    void setSelectionMode(int selectionMode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * Returns the current selection mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @return the current selection mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @see #setSelectionMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    int getSelectionMode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * Add a listener to the list that's notified each time a change
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * to the selection occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * @param x the ListSelectionListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * @see #removeListSelectionListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @see #setSelectionInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @see #addSelectionInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @see #removeSelectionInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * @see #clearSelection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * @see #insertIndexInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * @see #removeIndexInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    void addListSelectionListener(ListSelectionListener 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
     * Remove a listener from the list that's notified each time a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * change to the selection occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * @param x the ListSelectionListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @see #addListSelectionListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    void removeListSelectionListener(ListSelectionListener x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
}