org.zkoss.zul.impl
Class GroupsListModel<D,G,F>

java.lang.Object
  extended by org.zkoss.zul.AbstractListModel<java.lang.Object>
      extended by org.zkoss.zul.impl.GroupsListModel<D,G,F>
All Implemented Interfaces:
java.io.Serializable, Selectable<java.lang.Object>, ListModel<java.lang.Object>
Direct Known Subclasses:
BindingGroupsListModel

public class GroupsListModel<D,G,F>
extends AbstractListModel<java.lang.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:
Serialized Form

Nested Class Summary
static class GroupsListModel.GroupDataInfo
          The group information returned by getDataInfo(int).
 
Field Summary
protected  GroupsModel<D,G,F> _model
           
 
Fields inherited from class org.zkoss.zul.AbstractListModel
_selection
 
Constructor Summary
protected GroupsListModel(GroupsModel<D,G,F> model)
           
 
Method Summary
 void addSelection(java.lang.Object obj)
          Deprecated. As of release 6.0.0, replaced with addToSelection(java.lang.Object).
 boolean addToSelection(java.lang.Object obj)
          Add the specified object into selection.
 void clearSelection()
          Change the selection to the empty set.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object o)
           
 GroupingInfo getDataInfo(int index)
          Returns the group info of given index
 java.lang.Object getElementAt(int index)
          Returns the value at the specified index.
 int getGroupOffset(int groupIndex)
          Returns the offset from 0 that a group in this ListModel.
 java.util.List<int[]> getGroupsInfos()
           
 GroupsModel<D,G,F> getGroupsModel()
           
 java.util.Set<java.lang.Object> getSelection()
          Returns the current selection.
 int getSize()
          Returns the length of the list.
 int hashCode()
           
 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.
 boolean removeFromSelection(java.lang.Object obj)
          Remove the specified object from selection.
 void removeSelection(java.lang.Object obj)
          Deprecated. As of release 6.0.0, replaced with removeFromSelection(java.lang.Object).
 void setMultiple(boolean multiple)
          Sets the selection mode to be multiple.
 void setSelection(java.util.Collection<?> selection)
          Replace the current selection with the given set.
static
<D,G,F> GroupsListModel<D,G,F>
toListModel(GroupsModel<D,G,F> model)
          Returns the list model (ListModel) representing the given groups model.
 java.lang.String toString()
           
 
Methods inherited from class org.zkoss.zul.AbstractListModel
addListDataListener, fireEvent, fireSelectionEvent, newEmptySelection, readSelection, removeAllSelection, removeListDataListener, retainAllSelection, writeSelection
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_model

protected GroupsModel<D,G,F> _model
Constructor Detail

GroupsListModel

protected GroupsListModel(GroupsModel<D,G,F> model)
Method Detail

toListModel

public static <D,G,F> GroupsListModel<D,G,F> toListModel(GroupsModel<D,G,F> model)
Returns the list model (ListModel) representing the given groups model.

Since:
6.0.0

getGroupsInfos

public java.util.List<int[]> 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

public GroupsModel<D,G,F> getGroupsModel()

getDataInfo

public GroupingInfo getDataInfo(int index)
Returns the group info of given index


equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addSelection

public void addSelection(java.lang.Object obj)
Deprecated. As of release 6.0.0, replaced with addToSelection(java.lang.Object).


removeSelection

public void removeSelection(java.lang.Object obj)
Deprecated. As of release 6.0.0, replaced with removeFromSelection(java.lang.Object).


getElementAt

public java.lang.Object getElementAt(int index)
Description copied from interface: ListModel
Returns the value at the specified index.


getSize

public int getSize()
Description copied from interface: ListModel
Returns the length of the list.


getSelection

public java.util.Set<java.lang.Object> getSelection()
Description copied from class: AbstractListModel
Returns the current selection. It is readonly. Don't modify it directly

Specified by:
getSelection in interface Selectable<java.lang.Object>
Overrides:
getSelection in class AbstractListModel<java.lang.Object>
Returns:
the current selection.

setSelection

public void setSelection(java.util.Collection<?> selection)
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:
setSelection in interface Selectable<java.lang.Object>
Overrides:
setSelection in class AbstractListModel<java.lang.Object>

isSelected

public boolean isSelected(java.lang.Object obj)
Returns whether an object is selected.

Specified by:
isSelected in interface Selectable<java.lang.Object>
Overrides:
isSelected in class AbstractListModel<java.lang.Object>

isSelectionEmpty

public boolean isSelectionEmpty()
Returns true if the selection is currently empty.

Specified by:
isSelectionEmpty in interface Selectable<java.lang.Object>
Overrides:
isSelectionEmpty in class AbstractListModel<java.lang.Object>

addToSelection

public boolean addToSelection(java.lang.Object obj)
Add the specified object into selection.

If this represents a change to the current selection then notify each ListDataListener, including UI.

Specified by:
addToSelection in interface Selectable<java.lang.Object>
Overrides:
addToSelection in class AbstractListModel<java.lang.Object>
Parameters:
obj - the object to be as selection.
Returns:
true if it is added successfully; false if obj is not part of the data, or was already selected.

removeFromSelection

public boolean removeFromSelection(java.lang.Object obj)
Remove the specified object from selection.

If this represents a change to the current selection then notify each ListDataListener, including UI.

Specified by:
removeFromSelection in interface Selectable<java.lang.Object>
Overrides:
removeFromSelection in class AbstractListModel<java.lang.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:
clearSelection in interface Selectable<java.lang.Object>
Overrides:
clearSelection in class AbstractListModel<java.lang.Object>

isMultiple

public boolean isMultiple()
Returns whether the current selection mode is multiple.

Specified by:
isMultiple in interface Selectable<java.lang.Object>
Overrides:
isMultiple in class AbstractListModel<java.lang.Object>
See Also:
Selectable.setMultiple(boolean)

setMultiple

public void setMultiple(boolean multiple)
Sets the selection mode to be multiple.

Specified by:
setMultiple in interface Selectable<java.lang.Object>
Overrides:
setMultiple in class AbstractListModel<java.lang.Object>

clone

public java.lang.Object clone()
Overrides:
clone in class AbstractListModel<java.lang.Object>


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo