KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > swing > data > SelectionModel


1 /*
2  * $Id: SelectionModel.java,v 1.1 2005/02/24 20:35:32 rbair Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7 package org.jdesktop.swing.data;
8
9 /**
10  * A basic selection model interface that can be used in any situation
11  * where one or more contiguous or noncontiguous "rows" may be
12  * selected.
13  * <p/>
14  * The SelectionModel is used to define which rows are selected in a
15  * collection of rows. From the perspective of the SelectionModel, index
16  * 0 is the first index. Any index value &lt; 0 is invalid, as is any index
17  * greater than the size of the collection. It is up to the implementation
18  * of SelectionModel to ensure that the upper index is valid.
19  * <p/>
20  * @author Richard Bair
21  */

22 public interface SelectionModel {
23     /**
24      *
25      * @param indices
26      */

27     public void setSelectionIndices(int[] indices);
28     
29     /**
30      *
31      * @return
32      */

33     public int[] getSelectionIndices();
34     
35     /**
36      * Add a listener to the list that's notified each time a change to the selection
37      * occurs.
38      * @param listener The listener to be notified
39      */

40     public void addSelectionModelListener(SelectionModelListener listener);
41     
42     /**
43      * Remove the given listener from the list that's notified each time a change
44      * to the selection occurs
45      * @param listener the listener to be removed
46      */

47     public void removeSelectionModelListener(SelectionModelListener listener);
48 // /**
49
// * Change the selection to be between index0 and index1 inclusive. If this represents
50
// * a change to the current selection, then notify each SelectionModelListener. Note
51
// * that index0 doesn't have to be less than or equal to index1.
52
// * @param index0 one end of the interval
53
// * @param index1 other end of the interval.
54
// */
55
// public void setSelectionInterval(int index0, int index1);
56
// /**
57
// * Change the selection to be the set union of the current selection and the indices
58
// * between index0 and index1 inclusive. If this represents a change to the current
59
// * selection, then notify each SelectionModelListener. Note that index0 doesn't have
60
// * to be less than or equal to index1.
61
// * @param index0 one end of the interval
62
// * @param index1 other end of the interval
63
// */
64
// public void addSelectionInterval(int index0, int index1);
65
// /**
66
// * Change the selection to be the set difference of the current selection and the
67
// * indices between index0 and index1 inclusive. If this represents a change to the
68
// * current selection, then notify each SelectionModelListener. Note that index0
69
// * doesn't have to be less than or equal to index1.
70
// * @param index0 one end of the interval
71
// * @param index1 other end of the interval
72
// */
73
// public void removeSelectionInterval(int index0, int index1);
74
// /**
75
// * @return the first selected index or -1 if the selection is empty
76
// */
77
// public int getMinSelectionIndex();
78
// /**
79
// * @return the last selected index or -1 if the selection is empty
80
// */
81
// public int getMaxSelectionIndex();
82
// /**
83
// * @param index a valid index
84
// * @return true if the specified index is selected
85
// */
86
// public boolean isSelectedIndex(int index);
87
// /**
88
// * Change the selection to the empty set. If this represents a change to the current
89
// * selection, then notify each listener.
90
// */
91
// public void clearSelection();
92
// /**
93
// * @return true if no indices are selected
94
// */
95
// public boolean isSelectionEmpty();
96
}
97
Popular Tags