public class ListModelList<E> extends AbstractListModel<E> implements Sortable<E>, java.util.List<E>, java.io.Serializable
This is the ListModel
as a List
to be used with Listbox
.
Add or remove the contents of this model as a List would cause the associated Listbox to change accordingly.
For more information, please refer to ZK Developer's Reference: List Model
ListModel
,
ListModelList
,
ListModelMap
,
Serialized FormAbstractListModel.DefaultSelectionControl<E>
Modifier and Type | Field and Description |
---|---|
protected java.util.List<E> |
_list |
_selection
INTERNAL_EVENT
Constructor and Description |
---|
ListModelList()
Constructor.
|
ListModelList(java.util.Collection<? extends E> c)
Constructor.
|
ListModelList(E[] array)
Constructor.
|
ListModelList(int initialCapacity)
Constructor.
|
ListModelList(java.util.List<E> list,
boolean live)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o) |
void |
add(int index,
E element) |
boolean |
addAll(java.util.Collection<? extends E> c) |
boolean |
addAll(int index,
java.util.Collection<? extends E> c) |
void |
addSelection(E obj)
Deprecated.
As of release 6.0.0, replaced with
AbstractListModel.addToSelection(E) . |
void |
clear() |
java.lang.Object |
clone() |
boolean |
contains(java.lang.Object elem) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object o) |
protected void |
fireSelectionEvent(E e)
Selectable's implementor use only.
|
E |
get(int index) |
E |
getElementAt(int j)
Returns the value at the specified index.
|
java.util.List<E> |
getInnerList()
Get the inner real List.
|
int |
getSize()
Returns the length of the list.
|
java.lang.String |
getSortDirection(java.util.Comparator<E> cmpr)
Returns the sort direction of this model for the given comparator.
|
int |
hashCode() |
int |
indexOf(java.lang.Object elem) |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object elem) |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
void |
removeRange(int fromIndex,
int toIndex)
Remove from fromIndex(inclusive) to toIndex(exclusive).
|
void |
removeSelection(java.lang.Object obj)
Deprecated.
As of release 6.0.0, replaced with
AbstractListModel.removeFromSelection(java.lang.Object) . |
boolean |
retainAll(java.util.Collection<?> c) |
E |
set(int index,
E element) |
int |
size() |
void |
sort(java.util.Comparator<E> cmpr,
boolean ascending)
Sorts the data.
|
java.util.List<E> |
subList(int fromIndex,
int toIndex) |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
boolean |
update(E element)
Updates the same element to trigger an event of
ListDataEvent.CONTENTS_CHANGED . |
addListDataListener, addPagingEventListener, addToSelection, clearSelection, fireEvent, getActivePage, getPageCount, getPageSize, getSelection, getSelectionControl, isMultiple, isSelected, isSelectionEmpty, newEmptySelection, readSelection, removeAllSelection, removeFromSelection, removeListDataListener, removePagingEventListener, retainAllSelection, setActivePage, setMultiple, setPageSize, setSelection, setSelectionControl, writeSelection
protected java.util.List<E> _list
public ListModelList(java.util.List<E> list, boolean live)
list
- the list to representlive
- whether to have a 'live' ListModel
on top of
the specified list.
If false, the content of the specified list is copied.
If true, this object is a 'facade' of the specified list,
i.e., when you add or remove items from this ListModelList,
the inner "live" list would be changed accordingly.
However, it is not a good idea to modify list
if it is passed to this method with live is true,
since Listbox
is not smart enough to handle it.
Instead, modify it thru this object.public ListModelList()
public ListModelList(java.util.Collection<? extends E> c)
Notice that if the data is static or not shared, it is better to
use ListModelList(c, true)
instead, since
making a copy is slower.
public ListModelList(E[] array)
public ListModelList(int initialCapacity)
initialCapacity
- the initial capacity for this ListModelList.public void removeRange(int fromIndex, int toIndex)
fromIndex
- the begin index (inclusive) to be removed.toIndex
- the end index (exclusive) to be removed.public java.util.List<E> getInnerList()
public int getSize()
ListModel
public E getElementAt(int j)
ListModel
getElementAt
in interface ListModel<E>
public boolean update(E element)
ListDataEvent.CONTENTS_CHANGED
.element
- public boolean add(E o)
public boolean addAll(java.util.Collection<? extends E> c)
public boolean addAll(int index, java.util.Collection<? extends E> c)
addAll
in interface java.util.List<E>
public void clear()
public boolean contains(java.lang.Object elem)
public boolean containsAll(java.util.Collection<?> c)
public boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
public int indexOf(java.lang.Object elem)
indexOf
in interface java.util.List<E>
public boolean isEmpty()
public java.util.Iterator<E> iterator()
public int lastIndexOf(java.lang.Object elem)
lastIndexOf
in interface java.util.List<E>
public java.util.ListIterator<E> listIterator()
listIterator
in interface java.util.List<E>
public java.util.ListIterator<E> listIterator(int index)
listIterator
in interface java.util.List<E>
public boolean remove(java.lang.Object o)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public int size()
public java.util.List<E> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<E>
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public void sort(java.util.Comparator<E> cmpr, boolean ascending)
public java.lang.String getSortDirection(java.util.Comparator<E> cmpr)
Sortable
Default: "natural".
getSortDirection
in interface Sortable<E>
public java.lang.Object clone()
clone
in class AbstractListModel<E>
protected void fireSelectionEvent(E e)
AbstractListModel
Fires a selection event for component to scroll into view. The override
subclass must put the index0 of AbstractListModel.fireEvent(int, int, int)
as
the view index to scroll. By default, the value -1 is assumed which means
no scroll into view.
The method is invoked when both methods are invoked. AbstractListModel.addToSelection(Object)
and AbstractListModel.setSelection(Collection)
.
fireSelectionEvent
in class AbstractListModel<E>
e
- selected object.public void addSelection(E obj)
AbstractListModel.addToSelection(E)
.public void removeSelection(java.lang.Object obj)
AbstractListModel.removeFromSelection(java.lang.Object)
.Copyright © 2005-2011 Potix Corporation. All Rights Reserved.