public abstract class AbstractListModel<E> extends java.lang.Object implements ListModel<E>, Selectable<E>, java.io.Serializable, Pageable, PagingEventPublisher
ListModel
and Selectable
Modifier and Type | Class and Description |
---|---|
static class |
AbstractListModel.DefaultSelectionControl<E>
A default selection control implementation for
AbstractListModel ,
by default it assumes all elements are selectable. |
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<E> |
_selection
The current selection.
|
INTERNAL_EVENT
Modifier | Constructor and Description |
---|---|
protected |
AbstractListModel() |
Modifier and Type | Method and Description |
---|---|
void |
addListDataListener(ListDataListener l)
Adds a listener to the list that's notified each time a change
to the data model occurs.
|
void |
addPagingEventListener(PagingListener l)
Adds a listener to the list of listeners to be notified when a PagingEvent
happens outside of standard Paging component
|
boolean |
addToSelection(E obj)
Add the specified object into selection.
|
void |
clearSelection()
Change the selection to the empty set.
|
java.lang.Object |
clone() |
protected void |
fireEvent(int type,
int index0,
int index1)
Fires a
ListDataEvent for all registered listener (thru
addListDataListener(org.zkoss.zul.event.ListDataListener) . |
protected void |
fireSelectionEvent(E e)
Selectable's implementor use only.
|
int |
getActivePage()
Returns the active page (starting from 0).
|
int |
getPageCount()
Returns the number of pages.
|
int |
getPageSize()
Returns the number of items per page.
|
java.util.Set<E> |
getSelection()
Returns the current selection.
|
SelectionControl |
getSelectionControl()
Returns the selection control for the selection model, if any.
|
boolean |
isMultiple()
Returns whether the current selection mode is multiple.
|
boolean |
isSelected(java.lang.Object obj)
Returns whether an object is selected.
|
boolean |
isSelectionEmpty()
Returns true if the selection is currently empty.
|
protected java.util.Set<E> |
newEmptySelection()
Instantiation an empty set of the section.
|
protected void |
readSelection(java.io.ObjectInputStream s)
Reads back
_selection . |
protected void |
removeAllSelection(java.util.Collection<?> c)
Removes the selection of the given collection.
|
boolean |
removeFromSelection(java.lang.Object obj)
Remove the specified object from selection.
|
void |
removeListDataListener(ListDataListener l)
Removes a listener from the list that's notified each time
a change to the data model occurs.
|
void |
removePagingEventListener(PagingListener l)
Removes a listener from the list of listeners to be notified when a PagingEvent
happens outside of standard Paging component
|
protected void |
retainAllSelection(java.util.Collection<?> c)
Removes the selection that doesn't belong to the given collection.
|
void |
setActivePage(int pg)
Sets the active page (starting from 0).
|
void |
setMultiple(boolean multiple)
Sets the selection mode to be multiple.
|
void |
setPageSize(int size)
Sets the number of items per page.
|
void |
setSelection(java.util.Collection<? extends E> selection)
Replace the current selection with the given set.
|
void |
setSelectionControl(SelectionControl ctrl)
Sets the selection control for the selection model
|
protected void |
writeSelection(java.io.ObjectOutputStream s)
Writes
_selection . |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getElementAt, getSize
protected transient java.util.Set<E> _selection
protected void fireEvent(int type, int index0, int index1)
ListDataEvent
for all registered listener (thru
addListDataListener(org.zkoss.zul.event.ListDataListener)
.
Note: you can invoke this method only in an event listener.
public void addListDataListener(ListDataListener l)
addListDataListener
in interface ListModel<E>
public void removeListDataListener(ListDataListener l)
removeListDataListener
in interface ListModel<E>
public java.util.Set<E> getSelection()
getSelection
in interface Selectable<E>
public void setSelection(java.util.Collection<? extends E> selection)
If this represents a change to the current selection then notify each ListDataListener, including UI.
setSelection
in interface Selectable<E>
public boolean isSelected(java.lang.Object obj)
isSelected
in interface Selectable<E>
public boolean isSelectionEmpty()
isSelectionEmpty
in interface Selectable<E>
public boolean addToSelection(E obj)
If this represents a change to the current selection then notify each ListDataListener, including UI.
addToSelection
in interface Selectable<E>
obj
- the object to be as selection.obj
is not part of the data, or was already selected.public boolean removeFromSelection(java.lang.Object obj)
If this represents a change to the current selection then notify each ListDataListener, including UI.
removeFromSelection
in interface Selectable<E>
obj
- the object to be remove from selection.public void clearSelection()
If this represents a change to the current selection then notify each ListDataListener, including UI.
clearSelection
in interface Selectable<E>
protected void fireSelectionEvent(E e)
Fires a selection event for component to scroll into view. The override
subclass must put the index0 of 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. addToSelection(Object)
and setSelection(Collection)
.
e
- selected object.protected void removeAllSelection(java.util.Collection<?> c)
protected void retainAllSelection(java.util.Collection<?> c)
public boolean isMultiple()
isMultiple
in interface Selectable<E>
Selectable.setMultiple(boolean)
public void setMultiple(boolean multiple)
setMultiple
in interface Selectable<E>
public void setSelectionControl(SelectionControl ctrl)
Selectable
setSelectionControl
in interface Selectable<E>
public SelectionControl getSelectionControl()
Selectable
getSelectionControl
in interface Selectable<E>
protected java.util.Set<E> newEmptySelection()
_selection
.
By default, it instantiates an instance of LinkedHashSet. The deriving class might override to instantiate a different class.
protected void writeSelection(java.io.ObjectOutputStream s) throws java.io.IOException
_selection
.
Default: write it directly. Override it if E is not serializable.
java.io.IOException
protected void readSelection(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException
_selection
.
Default: write it directly. Override it if E is not serializable.
java.io.IOException
java.lang.ClassNotFoundException
public java.lang.Object clone()
clone
in class java.lang.Object
public int getPageSize()
Pageable
Default: 20.
getPageSize
in interface Pageable
public void setPageSize(int size) throws WrongValueException
Pageable
setPageSize
in interface Pageable
WrongValueException
public int getPageCount()
Pageable
getPageCount
in interface Pageable
public int getActivePage()
Pageable
getActivePage
in interface Pageable
public void setActivePage(int pg) throws WrongValueException
Pageable
setActivePage
in interface Pageable
WrongValueException
public void addPagingEventListener(PagingListener l)
PagingEventPublisher
addPagingEventListener
in interface PagingEventPublisher
public void removePagingEventListener(PagingListener l)
PagingEventPublisher
removePagingEventListener
in interface PagingEventPublisher
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.