Package org.zkoss.zul.impl
Class GroupsListModel<D,G,F>
- All Implemented Interfaces:
Serializable,GroupsSelectableModel<Object>,Pageable,Selectable<Object>,ListModel<Object>,PageableModel
public class GroupsListModel<D,G,F>
extends AbstractListModel<Object>
implements GroupsSelectableModel<Object>
Encapsulates
GroupsModel as an instance of ListModel
such that it is easier to handle by Listbox and
Group.- Since:
- 3.5.0
- Author:
- tomyeh
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe group information returned bygetDataInfo(int).Nested classes/interfaces inherited from class org.zkoss.zul.AbstractListModel
AbstractListModel.DefaultSelectionControl<E> -
Field Summary
FieldsFields inherited from class org.zkoss.zul.AbstractListModel
_selectionFields inherited from interface org.zkoss.zul.PageableModel
INTERNAL_EVENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddToSelection(Object obj) Add the specified object into selection.voidClean up internal listener, it will be called when components changing model.voidChange the selection to the empty set.clone()booleangetDataInfo(int index) Returns the group info of given indexgetElementAt(int index) Returns the value at the specified index.intgetGroupOffset(int groupIndex) Returns the offset from 0 that a group in this ListModel.List<int[]>GroupsModel<D,G, F> Returns the current selection.Returns the selection control for the selection model, if any.intgetSize()Returns the length of the list.inthashCode()booleanReturns whether the groups are selectablebooleanReturns whether the current selection mode is multiple.booleanisSelected(Object obj) Returns whether an object is selected.booleanReturns true if the selection is currently empty.booleanRemove the specified object from selection.voidsetGroupSelectable(boolean groupSelectable) Sets the groups are selectablevoidsetMultiple(boolean multiple) Sets the selection mode to be multiple.voidsetSelection(Collection<?> selection) Replace the current selection with the given set.voidSets the selection control for the selection modelstatic <D,G, F> GroupsListModel<D, G, F> toListModel(GroupsModel<D, G, F> model) Returns the list model (ListModel) representing the given groups model.toString()Methods inherited from class org.zkoss.zul.AbstractListModel
addListDataListener, addPagingEventListener, fireEvent, fireSelectionEvent, getActivePage, getListDataListeners, getPageCount, getPageSize, getTotalSize, newEmptySelection, readSelection, removeAllSelection, removeListDataListener, removePagingEventListener, retainAllSelection, setActivePage, setPageSize, writeSelection
-
Field Details
-
_model
-
-
Constructor Details
-
GroupsListModel
-
-
Method Details
-
toListModel
Returns the list model (ListModel) representing the given groups model.- Since:
- 6.0.0
-
cleanInternalListener
public void cleanInternalListener()Clean up internal listener, it will be called when components changing model.- Since:
- 8.6.0
-
getGroupsInfos
-
getGroupOffset
public int getGroupOffset(int groupIndex) Returns the offset from 0 that a group in this ListModel.For example, _gpofs[2] is the offset of group 2 (the third group) in this ListModel.
- Parameters:
groupIndex- the group index- Returns:
- the offset from 0 that a group in this ListModel.
-
getGroupsModel
-
getDataInfo
Returns the group info of given index -
equals
-
hashCode
public int hashCode() -
toString
-
getElementAt
Description copied from interface:ListModelReturns the value at the specified index.- Specified by:
getElementAtin interfaceListModel<D>
-
getSize
public int getSize()Description copied from interface:ListModelReturns the length of the list. -
getSelection
Description copied from class:AbstractListModelReturns the current selection. It is readonly. Don't modify it directly- Specified by:
getSelectionin interfaceSelectable<D>- Overrides:
getSelectionin classAbstractListModel<Object>- Returns:
- the current selection.
-
setSelection
Replace the current selection with the given set.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
setSelectionin interfaceSelectable<D>- Overrides:
setSelectionin classAbstractListModel<Object>
-
isSelected
Returns whether an object is selected.- Specified by:
isSelectedin interfaceSelectable<D>- Overrides:
isSelectedin classAbstractListModel<Object>
-
isSelectionEmpty
public boolean isSelectionEmpty()Returns true if the selection is currently empty.- Specified by:
isSelectionEmptyin interfaceSelectable<D>- Overrides:
isSelectionEmptyin classAbstractListModel<Object>
-
addToSelection
Add the specified object into selection.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
addToSelectionin interfaceSelectable<D>- Overrides:
addToSelectionin classAbstractListModel<Object>- Parameters:
obj- the object to be as selection.- Returns:
- true if it is added successfully; false if
objis not part of the data, or was already selected.
-
removeFromSelection
Remove the specified object from selection.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
removeFromSelectionin interfaceSelectable<D>- Overrides:
removeFromSelectionin classAbstractListModel<Object>- Parameters:
obj- the object to be remove from selection.- Returns:
- whether it is removed successfully
-
clearSelection
public void clearSelection()Change the selection to the empty set.If this represents a change to the current selection then notify each ListDataListener, including UI.
- Specified by:
clearSelectionin interfaceSelectable<D>- Overrides:
clearSelectionin classAbstractListModel<Object>
-
isMultiple
public boolean isMultiple()Returns whether the current selection mode is multiple.- Specified by:
isMultiplein interfaceSelectable<D>- Overrides:
isMultiplein classAbstractListModel<Object>- See Also:
-
setMultiple
public void setMultiple(boolean multiple) Sets the selection mode to be multiple.- Specified by:
setMultiplein interfaceSelectable<D>- Overrides:
setMultiplein classAbstractListModel<Object>
-
getSelectionControl
Description copied from interface:SelectableReturns the selection control for the selection model, if any.- Specified by:
getSelectionControlin interfaceSelectable<D>- Overrides:
getSelectionControlin classAbstractListModel<Object>
-
setSelectionControl
Description copied from interface:SelectableSets the selection control for the selection model- Specified by:
setSelectionControlin interfaceSelectable<D>- Overrides:
setSelectionControlin classAbstractListModel<Object>
-
clone
- Overrides:
clonein classAbstractListModel<Object>
-
setGroupSelectable
public void setGroupSelectable(boolean groupSelectable) Description copied from interface:GroupsSelectableModelSets the groups are selectable- Specified by:
setGroupSelectablein interfaceGroupsSelectableModel<D>
-
isGroupSelectable
public boolean isGroupSelectable()Description copied from interface:GroupsSelectableModelReturns whether the groups are selectable- Specified by:
isGroupSelectablein interfaceGroupsSelectableModel<D>
-