01: /*
02: ItsNat Java Web Application Framework
03: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
04: Author: Jose Maria Arranz Santamaria
05:
06: This program is free software: you can redistribute it and/or modify
07: it under the terms of the GNU Affero General Public License as published by
08: the Free Software Foundation, either version 3 of the License, or
09: (at your option) any later version. See the GNU Affero General Public
10: License for more details. See the copy of the GNU Affero General Public License
11: included in this program. If not, see <http://www.gnu.org/licenses/>.
12: */
13:
14: package org.itsnat.comp;
15:
16: import org.itsnat.comp.ui.ItsNatListMultSelUI;
17: import java.util.List;
18: import javax.swing.ListSelectionModel;
19:
20: /**
21: * Is the base interface of multiple selection lists.
22: *
23: * <p>This component family uses a <code>javax.swing.ListSelectionModel</code> to keep
24: * track of selection states. When a list item is selected (usually by clicking it) the selection
25: * state is updated accordingly using the selection model (this one fires any listener registered).</p>
26: *
27: * <p>By default this component type uses a <code>javax.swing.DefaultListModel</code>
28: * data model.</p>
29: *
30: * @author Jose Maria Arranz Santamaria
31: */
32: public interface ItsNatListMultSel extends ItsNatList {
33: /**
34: * Constructs a <code>javax.swing.ListModel</code> from an array of objects and then
35: * applies {@link #setListModel(javax.swing.ListModel)} to it.
36: *
37: * <p>Submitted array must not change, because no changes are detected.</p>
38: *
39: * @param listData an array of Objects containing the items of the new list model
40: * @see #setListData(java.util.List)
41: */
42: public void setListData(Object[] listData);
43:
44: /**
45: * Constructs a <code>javax.swing.ListModel</code> from a <code>java.util.List</code> and then
46: * applies {@link #setListModel(javax.swing.ListModel)} to it.
47: *
48: * <p>Submitted list must not change, because no changes are detected.</p>
49: *
50: * @param listData a <code>java.util.List</code> containing the items of the new list model
51: * @see #setListData(Object[])
52: */
53: public void setListData(List listData);
54:
55: /**
56: * Returns the current selection model.
57: *
58: * @return the current selection model. By default a <code>javax.swing.DefaultListSelectionModel</code> instance.
59: * @see #setListSelectionModel(javax.swing.ListSelectionModel)
60: */
61: public ListSelectionModel getListSelectionModel();
62:
63: /**
64: * Sets the new selection model.
65: *
66: * <p>If the new selection model is the current defined then is "reset",
67: * component listener is removed and added again. Use this technique if
68: * you want to add a listener to be executed <i>before</i> the default component listener.
69: *
70: * @param selectionModel the new selection model.
71: * @see #getListSelectionModel()
72: */
73: public void setListSelectionModel(ListSelectionModel selectionModel);
74:
75: /**
76: * Returns an array with indices of the current selected elements.
77: *
78: * @return an array with the current selected elements.
79: * @see #setSelectedIndices(int[])
80: */
81: public int[] getSelectedIndices();
82:
83: /**
84: * Sets the current selected elements.
85: *
86: * @param indices index array of the new selected elements.
87: * @see #getSelectedIndices()
88: */
89: public void setSelectedIndices(int[] indices);
90:
91: /**
92: * Returns the user interface manager of this component.
93: *
94: * @return the user interface manager.
95: */
96: public ItsNatListMultSelUI getItsNatListMultSelUI();
97: }
|