public class DefaultKListModel extends Object implements KListModel
KListModel
interface.Modifier and Type | Field and Description |
---|---|
protected ArrayList |
data
The actual data for this model.
|
protected KListModelSupport |
support
The support object for firing
KListModelEvent s. |
COLUMN_NAMES_PROPERTY, COLUMN_TYPES_PROPERTY
Constructor and Description |
---|
DefaultKListModel()
Construct a new
KBasicListModel . |
Modifier and Type | Method and Description |
---|---|
void |
addItem(Object item)
Add an item to the model.
|
void |
addListModelListener(KListModelListener listener)
Add a
ListModelListener to this model's list of listeners. |
void |
clear()
Remove all items from the model.
|
Icon |
getIcon(Object item)
Get the icon for an item.
|
Object |
getItemAt(int index)
Get the item at the specified index in the model.
|
int |
getItemCount()
Get the number of items in the model.
|
Iterator |
getItems()
Return an
Enumeration of the items in the model. |
String |
getLabel(Object item)
Get the label for an item.
|
Object |
getValueForProperty(Object item,
String property)
Get the value of an arbitrary property for a given item.
|
int |
indexOf(Object item)
Get the index of the specified item in the model.
|
void |
insertItemAt(Object item,
int index)
Insert an item at the specified index in the model.
|
boolean |
isEmpty()
Determine if the model is empty.
|
void |
removeItem(Object item)
Remove the specified item from the model.
|
void |
removeItemAt(int index)
Remove the item at the specified index from the model.
|
void |
removeListModelListener(KListModelListener listener)
Remove a
KListModelListener from this model's list of
listeners. |
void |
sort(Comparator comparator)
Sort the model.
|
void |
updateItem(Object item)
Indicate to listeners that the specified item has changed.
|
void |
updateItemAt(int index)
Indicate to listeners that the item at the specified index has changed.
|
protected KListModelSupport support
KListModelEvent
s.public DefaultKListModel()
KBasicListModel
.public boolean isEmpty()
KListModel
isEmpty
in interface KListModel
true
if the model is empty, and false
otherwise.public void clear()
KListModel
clear
in interface KListModel
public int getItemCount()
KListModel
getItemCount
in interface KListModel
public Iterator getItems()
KListModel
Enumeration
of the items in the model.getItems
in interface KListModel
Enumeration
of the items.public Object getItemAt(int index)
KListModel
getItemAt
in interface KListModel
index
- The index.public int indexOf(Object item)
KListModel
indexOf
in interface KListModel
item
- The item.-1
if the item is not in
the model.public void addItem(Object item)
KListModel
addItem
in interface KListModel
item
- The new item.public void insertItemAt(Object item, int index)
KListModel
insertItemAt
in interface KListModel
item
- The new item.index
- The index.public void removeItemAt(int index)
KListModel
removeItemAt
in interface KListModel
index
- The index.public void removeItem(Object item)
KListModel
removeItem
in interface KListModel
item
- The item.public void updateItem(Object item)
KListModel
updateItem
in interface KListModel
item
- The item.public void updateItemAt(int index)
KListModel
updateItemAt
in interface KListModel
index
- The index.public void addListModelListener(KListModelListener listener)
KListModel
ListModelListener
to this model's list of listeners.addListModelListener
in interface KListModel
listener
- The listener to add.public void removeListModelListener(KListModelListener listener)
KListModel
KListModelListener
from this model's list of
listeners.removeListModelListener
in interface KListModel
listener
- The listener to remove.public String getLabel(Object item)
KListModel
getLabel
in interface KListModel
item
- The item.public Icon getIcon(Object item)
KListModel
getIcon
in interface KListModel
item
- The item.public Object getValueForProperty(Object item, String property)
KListModel
getValueForProperty
in interface KListModel
item
- The item.property
- The name of the property.null
if
there is no value for this property.public void sort(Comparator comparator)
comparator
- The Comparator
to use for the sorting.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses