123 * *
124 * Internal field *
125 * *
126 **********************************************************************/
127
128 ListChangeListener.Change selectedItemChange;
129
130
131
132 /***********************************************************************
133 * *
134 * Public selection API *
135 * *
136 **********************************************************************/
137
138 /**
139 * Returns the number of items in the data model that underpins the control.
140 * An example would be that a ListView selection model would likely return
141 * <code>listView.getItems().size()</code>. The valid range of selectable
142 * indices is between 0 and whatever is returned by this method.
143 */
144 protected abstract int getItemCount();
145
146 /**
147 * Returns the item at the given index. An example using ListView would be
148 * <code>listView.getItems().get(index)</code>.
149 *
150 * @param index The index of the item that is requested from the underlying
151 * data model.
152 * @return Returns null if the index is out of bounds, or an element of type
153 * T that is related to the given index.
154 */
155 protected abstract T getModelItem(int index);
156 protected abstract void focus(int index);
157 protected abstract int getFocusedIndex();
158
159 static class ShiftParams {
160 private final int clearIndex;
161 private final int setIndex;
162 private final boolean selected;
|
123 * *
124 * Internal field *
125 * *
126 **********************************************************************/
127
128 ListChangeListener.Change selectedItemChange;
129
130
131
132 /***********************************************************************
133 * *
134 * Public selection API *
135 * *
136 **********************************************************************/
137
138 /**
139 * Returns the number of items in the data model that underpins the control.
140 * An example would be that a ListView selection model would likely return
141 * <code>listView.getItems().size()</code>. The valid range of selectable
142 * indices is between 0 and whatever is returned by this method.
143 * @return the number of items in the data model that underpins the control
144 */
145 protected abstract int getItemCount();
146
147 /**
148 * Returns the item at the given index. An example using ListView would be
149 * <code>listView.getItems().get(index)</code>.
150 *
151 * @param index The index of the item that is requested from the underlying
152 * data model.
153 * @return Returns null if the index is out of bounds, or an element of type
154 * T that is related to the given index.
155 */
156 protected abstract T getModelItem(int index);
157 protected abstract void focus(int index);
158 protected abstract int getFocusedIndex();
159
160 static class ShiftParams {
161 private final int clearIndex;
162 private final int setIndex;
163 private final boolean selected;
|