public interface ListDataModel
String
ID and an object to be displayed in the list.Modifier and Type | Method and Description |
---|---|
void |
add(int index,
String id,
Object item)
This method adds a new item into the specified position.
|
void |
add(Map<String,Object> items)
Adds all the items from the map where each key is an item unique ID and each value is an item itself.
|
void |
add(String id,
Object item)
This method adds a new item in the list.
|
void |
addListModelListener(ListModelListener listener)
Adds a list model listener to fire events regarding data changes.
|
void |
clear()
This method clears the list of items.
|
Object |
get(int index)
This method returns an item by its index.
|
Object |
get(String id)
This method returns an item by its ID.
|
int |
getCount()
Returns a number of items in the list.
|
Object |
getSelected()
This method returns a selected item.
|
String |
getSelectedId()
This method gets a selected item ID.
|
int |
getSelectedIndex()
This method gets a selected item index.
|
boolean |
isEmpty()
This method returns
true if the list of items is empty. |
void |
remove(int... indexes)
This method removes items specified by the indexes.
|
void |
remove(String... ids)
This method removes the specified items.
|
void |
removeListModelListener(ListModelListener listener)
Removes a list model listener.
|
void |
setSelectedId(String id)
This method sets a currently selected item specifying it by ID.
|
void |
setSelectedIndex(int index)
This method sets a currently selected item specifying it by the index.
|
void add(String id, Object item)
id
- an unique ID of the item. If there is an item with the same ID, this method replaces it with
a new value.item
- is an item to be placed into the list.void add(int index, String id, Object item)
index
- is an index value.id
- is an item ID.item
- is an item.Object get(String id)
id
- is an item ID.Object get(int index)
index
- is an item index.void remove(String... ids)
ids
- is a list of item IDs.void remove(int... indexes)
indexes
- is a list of item indexes.String getSelectedId()
int getSelectedIndex()
Object getSelected()
void setSelectedId(String id)
id
- is an item ID.void setSelectedIndex(int index)
index
- is an item index.void clear()
boolean isEmpty()
true
if the list of items is empty.int getCount()
void addListModelListener(ListModelListener listener)
listener
- is a listener to add.void removeListModelListener(ListModelListener listener)
listener
- is a listener to remove.Copyright © 2008–2013. All rights reserved.