java.lang.Iterable
, java.util.Collection
, java.util.List
, javax.swing.ListModel
public class OptionsListModel
extends java.util.AbstractList
implements javax.swing.ListModel
List
and
ListModel
(which ListModel really
ought to do itself), and also provides methods to create
some useful models like JComboBoxModel based on the same data.Constructor | Description |
---|---|
OptionsListModel() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(java.lang.Object obj) |
|
void |
addListDataListener(javax.swing.event.ListDataListener l) |
|
void |
fireContentsChanged(int i0,
int i1) |
|
void |
fireIntervalAdded(int i0,
int i1) |
|
void |
fireIntervalRemoved(int i0,
int i1) |
|
java.lang.Object |
get(int index) |
|
java.lang.Object |
getElementAt(int index) |
|
int |
getSize() |
|
int |
idToIndex(int id) |
Returns the index at which an option with the given ID currently resides.
|
int |
indexToId(int index) |
Returns the unique ID value for the option currently at a given index
in this list.
|
CheckBoxMenu |
makeCheckBoxMenu(java.lang.String menuName) |
|
javax.swing.JComboBox |
makeComboBox() |
Makes a new JComboBox from this model.
|
javax.swing.ComboBoxModel |
makeComboBoxModel() |
Constructs a new ComboBoxModel backed by this list.
|
javax.swing.JMenu |
makeJMenu(java.lang.String menuName,
javax.swing.Action menuAction) |
Constructs a new JMenu backed by this list.
|
java.lang.Object |
remove(int irow) |
|
void |
removeListDataListener(javax.swing.event.ListDataListener l) |
|
java.lang.Object |
set(int irow,
java.lang.Object obj) |
|
int |
size() |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
public java.lang.Object get(int index)
get
in interface java.util.List
get
in class java.util.AbstractList
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
public int size()
size
in interface java.util.Collection
size
in interface java.util.List
size
in class java.util.AbstractCollection
public int getSize()
getSize
in interface javax.swing.ListModel
public boolean add(java.lang.Object obj)
add
in interface java.util.Collection
add
in interface java.util.List
add
in class java.util.AbstractList
public java.lang.Object set(int irow, java.lang.Object obj)
set
in interface java.util.List
set
in class java.util.AbstractList
public java.lang.Object remove(int irow)
remove
in interface java.util.List
remove
in class java.util.AbstractList
public int indexToId(int index)
index
- current index for optionpublic int idToIndex(int id)
id
- unique identifierid
, or -1indexToId(int)
public javax.swing.ComboBoxModel makeComboBoxModel()
makeComboBox()
public javax.swing.JComboBox makeComboBox()
makeComboBoxModel()
by ensuring that the box is
revalidated when new items are added to the model; otherwise the
box can end up too small. It also ensures that the box is
rendered by using the name of the RowSubset is written.public javax.swing.JMenu makeJMenu(java.lang.String menuName, javax.swing.Action menuAction)
menuName
- the name of the menumenuAction
- the action to activatepublic CheckBoxMenu makeCheckBoxMenu(java.lang.String menuName)
public void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener
in interface javax.swing.ListModel
public void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener
in interface javax.swing.ListModel
public void fireContentsChanged(int i0, int i1)
public void fireIntervalAdded(int i0, int i1)
public void fireIntervalRemoved(int i0, int i1)
Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.