public class DnDListModel<T> extends AbstractListModel<T>
The DnDListModel acts as a wrapper around an internal list of items; providing notification as the items are changed.
listenerList
Constructor and Description |
---|
DnDListModel()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addItem(T newItem)
Append a new item to the end of the list of current items
|
void |
addItems(Collection<T> newItems)
Add new items to the end of the list of current items
|
void |
addItems(T[] newItems)
Add new items to the end of the list of current items
|
void |
clear()
Remove all items from the list
|
boolean |
contains(T item)
Query whether this list contains the specified item
|
T |
getElementAt(int index)
Get the list item at the specified index.
|
List<T> |
getElementsAt(Collection<Integer> indices)
Returns a list of the items at the indices specified in the Collection.
|
List<T> |
getElementsAt(int[] indices)
Returns a list of the items at the specified indices.
|
boolean |
getNotifyListeners() |
int |
getSize() |
int |
indexOf(T item)
Get the (first) index of the given item in the list of items held by this model.
|
void |
insertItem(int destIndex,
T newItem)
Insert an item into the list at the specified position.
|
void |
insertItems(int destIndex,
Collection<T> newItems)
Insert new items into the list at the specified position.
|
void |
insertItems(int destIndex,
T[] newItems)
Insert new items into the list at the specified position.
|
void |
moveItems(int destIndex,
int[] srcIndices)
Move the items currently positioned at the indices in the
srcIndices array as block
such that they are inserted into the list at destIndex . |
void |
removeAt(int index)
Remove the item at the specified index
|
void |
removeItem(T item)
Removes the first instance of the specified item if it is contained in the list
|
void |
setNofifyListeners(boolean notify) |
String |
toString() |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
public void setNofifyListeners(boolean notify)
public boolean getNotifyListeners()
public int getSize()
public T getElementAt(int index)
Note: this method returns a live reference.
IndexOutOfBoundsException
- if index is invalidpublic List<T> getElementsAt(int[] indices)
Note: The returned List contains live references.
IndexOutOfBoundsException
- if any of the indices are invalidpublic List<T> getElementsAt(Collection<Integer> indices)
Note: The returned List contains live references.
IndexOutOfBoundsException
- if any of the indices are invalidpublic void addItem(T newItem)
public void addItems(T[] newItems)
public void addItems(Collection<T> newItems)
public void insertItem(int destIndex, T newItem)
destIndex
- the position of the new item: if < 0 the item will be inserted at the
start of the list; if >= the current list size the item will be appended to the end of
the listpublic void insertItems(int destIndex, T[] newItems)
destIndex
- the position of the new item: if < 0 the items will be inserted at the
start of the list; if >= the current list size the items will be appended to the end
of the listpublic void insertItems(int destIndex, Collection<T> newItems)
destIndex
- the position of the new item: if < 0 the items will be inserted at the
start of the list; if >= the current list size the items will be appended to the end
of the listpublic void moveItems(int destIndex, int[] srcIndices)
srcIndices
array as block
such that they are inserted into the list at destIndex
. It is assumed that
srcIndices is sorted in ascending order.public void removeAt(int index)
public void removeItem(T item)
public void clear()
public boolean contains(T item)
public int indexOf(T item)
item
- the item to search forCopyright © 1996–2023 Geotools. All rights reserved.