jdk/src/java.desktop/share/classes/java/awt/peer/ListPeer.java
author serb
Mon, 31 Aug 2015 16:56:09 +0300
changeset 32493 31bd2a308840
parent 25859 3317bb8137f4
permissions -rw-r--r--
8076178: [macosx] Few open swing and awt reg-tests fail after their update to avoid SunToolkit.realSync Reviewed-by: azvegint, yan
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: 1975
diff changeset
     2
 * Copyright (c) 1995, 1998, 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: 1975
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: 1975
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: 1975
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1975
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1975
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package java.awt.peer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.Dimension;
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    28
import java.awt.List;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    31
 * The peer interface for {@link List}.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    32
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * The peer interfaces are intended only for use in porting
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * the AWT. They are not intended for use by application
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * developers, and developers should not implement peers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * nor invoke any of the peer methods directly on the peer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * instances.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
public interface ListPeer extends ComponentPeer {
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    40
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    41
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    42
     * Returns the indices of the list items that are currently selected.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    43
     * The returned array is not required to be a copy, the callers of this
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    44
     * method already make sure it is not modified.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    45
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    46
     * @return the indices of the list items that are currently selected
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    47
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    48
     * @see List#getSelectedIndexes()
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    49
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    int[] getSelectedIndexes();
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    51
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    52
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    53
     * Adds an item to the list at the specified index.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    54
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    55
     * @param item the item to add to the list
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    56
     * @param index the index where to add the item into the list
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    57
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    58
     * @see List#add(String, int)
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    59
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    void add(String item, int index);
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    61
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    62
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    63
     * Deletes items from the list. All items from start to end should are
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    64
     * deleted, including the item at the start and end indices.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    65
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    66
     * @param start the first item to be deleted
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    67
     * @param end the last item to be deleted
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    68
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    void delItems(int start, int end);
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    70
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    71
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    72
     * Removes all items from the list.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    73
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    74
     * @see List#removeAll()
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    75
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    void removeAll();
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    77
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    78
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    79
     * Selects the item at the specified {@code index}.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    80
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    81
     * @param index the index of the item to select
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    82
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    83
     * @see List#select(int)
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    84
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    void select(int index);
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    86
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    87
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    88
     * De-selects the item at the specified {@code index}.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    89
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    90
     * @param index the index of the item to de-select
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    91
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    92
     * @see List#deselect(int)
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    93
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    void deselect(int index);
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    95
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    96
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    97
     * Makes sure that the item at the specified {@code index} is visible,
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    98
     * by scrolling the list or similar.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
    99
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   100
     * @param index the index of the item to make visible
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   101
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   102
     * @see List#makeVisible(int)
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   103
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    void makeVisible(int index);
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   105
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   106
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   107
     * Toggles multiple selection mode on or off.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   108
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   109
     * @param m {@code true} for multiple selection mode,
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   110
     *        {@code false} for single selection mode
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   111
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   112
     * @see List#setMultipleMode(boolean)
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   113
     */
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   114
    void setMultipleMode(boolean m);
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   115
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   116
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   117
     * Returns the preferred size for a list with the specified number of rows.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   118
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   119
     * @param rows the number of rows
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   120
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   121
     * @return the preferred size of the list
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   122
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   123
     * @see List#getPreferredSize(int)
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   124
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    Dimension getPreferredSize(int rows);
1975
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   126
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   127
    /**
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   128
     * Returns the minimum size for a list with the specified number of rows.
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   129
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   130
     * @param rows the number of rows
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   131
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   132
     * @return the minimum size of the list
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   133
     *
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   134
     * @see List#getMinimumSize(int)
b8dae32335f2 6792515: Specify awt peer's API
rkennke
parents: 1964
diff changeset
   135
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    Dimension getMinimumSize(int rows);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
}