public abstract class AbstractGroupsModel<D,H,F,E> extends Object implements GroupsModel<D,H,F>, GroupsSelectableModel<E>, Serializable
GroupsModel.
Implements Selectable interface to handle the selection status.
(Since 6.0.0)
Generics:
Selectable,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractGroupsModel.DefaultSelectionControl<E>
A default selection control implementation for
AbstractGroupsModel,
by default it assumes all elements are selectable. |
| Modifier and Type | Field and Description |
|---|---|
protected Set<E> |
_selection
The current selection.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractGroupsModel() |
| Modifier and Type | Method and Description |
|---|---|
void |
addGroupsDataListener(GroupsDataListener l)
Adds a listener to the groups that's notified each time a change
to the data model occurs.
|
boolean |
addToSelection(E obj)
Add the specified object into selection.
|
void |
clearSelection()
Change the selection to the empty set.
|
Object |
clone() |
protected void |
fireEvent(int type,
int groupIndex,
int index0,
int index1)
Fires a
GroupsDataEvent for all registered listener
(thru addGroupsDataListener(org.zkoss.zul.event.GroupsDataListener). |
protected void |
fireSelectionEvent(E e)
Selectable's implementor use only.
|
Set<E> |
getSelection()
Returns the current selection.
|
SelectionControl |
getSelectionControl()
Returns the selection control for the selection model, if any.
|
boolean |
isGroupSelectable()
Returns whether the groups are selectable
|
boolean |
isMultiple()
Returns whether the current selection mode is multiple.
|
boolean |
isSelected(Object obj)
Returns whether an object is selected.
|
boolean |
isSelectionEmpty()
Returns true if the selection is currently empty.
|
protected Set<E> |
newEmptySelection()
Instantiation an empty set of the section.
|
protected void |
readSelection(ObjectInputStream s)
Reads back
_selection. |
protected void |
removeAllSelection(Collection<?> c)
Removes the selection of the given collection.
|
boolean |
removeFromSelection(Object obj)
Remove the specified object from selection.
|
void |
removeGroupsDataListener(GroupsDataListener l)
Removes a listener from the groups that's notified each time
a change to the data model occurs.
|
protected void |
retainAllSelection(Collection<?> c)
Removes the selection that doesn't belong to the given collection.
|
void |
setGroupSelectable(boolean groupSelectable)
Sets the groups are selectable
|
void |
setMultiple(boolean multiple)
Sets the selection mode to be multiple.
|
void |
setSelection(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(ObjectOutputStream s)
Writes
_selection. |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddOpenGroup, getChild, getChildCount, getGroup, getGroupCount, getGroupfoot, hasGroupfoot, isGroupOpened, removeOpenGroupprotected void fireEvent(int type,
int groupIndex,
int index0,
int index1)
GroupsDataEvent for all registered listener
(thru addGroupsDataListener(org.zkoss.zul.event.GroupsDataListener).
Note: you can invoke this method only in an event listener.
public void setSelectionControl(SelectionControl ctrl)
SelectablesetSelectionControl in interface Selectable<E>public SelectionControl getSelectionControl()
SelectablegetSelectionControl in interface Selectable<E>public void addGroupsDataListener(GroupsDataListener l)
GroupsModeladdGroupsDataListener in interface GroupsModel<D,H,F>public void removeGroupsDataListener(GroupsDataListener l)
GroupsModelremoveGroupsDataListener in interface GroupsModel<D,H,F>public Set<E> getSelection()
getSelection in interface Selectable<E>public void setSelection(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(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(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, 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(Collection<?> c)
protected void retainAllSelection(Collection<?> c)
public boolean isMultiple()
isMultiple in interface Selectable<E>Selectable.setMultiple(boolean)public void setMultiple(boolean multiple)
setMultiple in interface Selectable<E>public boolean isGroupSelectable()
GroupsSelectableModelisGroupSelectable in interface GroupsSelectableModel<E>public void setGroupSelectable(boolean groupSelectable)
GroupsSelectableModelsetGroupSelectable in interface GroupsSelectableModel<E>protected Set<E> newEmptySelection()
_selection.
By default, it instantiates an instance of LinkedHashMap. The deriving class might override to instantiate a different class.
protected void writeSelection(ObjectOutputStream s) throws IOException
_selection.
Default: write it directly. Override it if E is not serializable.
IOExceptionprotected void readSelection(ObjectInputStream s) throws IOException, ClassNotFoundException
_selection.
Default: write it directly. Override it if E is not serializable.
IOExceptionClassNotFoundExceptionCopyright © 2015. All rights reserved.