JIDE 3.5.15

com.jidesoft.list
Class SortableGroupableListModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by com.jidesoft.list.DefaultListModelWrapper
          extended by com.jidesoft.list.SortableListModel
              extended by com.jidesoft.list.SortableGroupableListModel
All Implemented Interfaces:
IndexChangeEventGenerator, EventFireListModel, GroupableListModel, ListGroupChangeListener, ListModelWrapper, Serializable, EventListener, ListDataListener, ListModel

public class SortableGroupableListModel
extends SortableListModel
implements GroupableListModel, ListGroupChangeListener

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jidesoft.list.SortableListModel
SORT_ASCENDING, SORT_DESCENDING, UNSORTED
 
Fields inherited from class com.jidesoft.list.DefaultListModelWrapper
_adjustingIndexes, _indexes, _model
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
SortableGroupableListModel()
           
SortableGroupableListModel(ListModel model)
          Creates a SortableGroupableListModel from any list model.
 
Method Summary
 void addListGroupChangeListener(ListGroupChangeListener l)
          Adds a listener to the list that's notified each time a change to the data model occurs.
protected  void fireGroupChanged(Object source)
          AbstractListModel subclasses must call this method after the group for any of the item is changed.
 Object getGroupAt(int index)
          Returns the group of the element at the specified index.
 Object[] getGroups()
          Returns all groups, which control the order of appearance.
 ListGroupChangeListener[] getListGroupChangeListeners()
          Returns an array of all the list group change listeners registered on this DefaultGroupableListModel.
 void groupChanged(ListGroupChangeEvent e)
          Sent after the grouping of GroupableListModel has been changed.
 void removeListGroupChangeListener(ListGroupChangeListener l)
          Removes a listener from the list that's notified each time a change to the data model occurs.
 void setActualModel(ListModel model)
          Sets the actual list model.
 void setSortOrder(int sortOrder)
          Sets the sort order.
 void unsort()
          Unsorts the list model.
 
Methods inherited from class com.jidesoft.list.SortableListModel
addSortListener, compare, compare, contentsChanged, fireSortEvent, fireSortingEvent, getComparator, getComparatorContext, getSortableListModel, getSortListeners, getSortOrder, getSortRanges, intervalAdded, intervalRemoved, isAlwaysUseComparators, isAutoResort, isOptimized, removeSortListener, reset, resort, search, setAlwaysUseComparators, setAutoResort, setComparator, setComparatorContext, setIndexes, setOptimized, sort, sort, sort
 
Methods inherited from class com.jidesoft.list.DefaultListModelWrapper
addIndexChangeListener, createCompoundListDataEvent, fireEvents, fireIndexChanged, fireListDataEvent, getActualIndexAt, getActualModel, getElementAt, getIndexAt, getIndexChangeListeners, getIndexes, getSize, reallocateIndexes, removeIndexChangeListener
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
 

Constructor Detail

SortableGroupableListModel

public SortableGroupableListModel()

SortableGroupableListModel

public SortableGroupableListModel(ListModel model)
Creates a SortableGroupableListModel from any list model.

Parameters:
model - the list model
Method Detail

setActualModel

public void setActualModel(ListModel model)
Sets the actual list model.

Specified by:
setActualModel in interface ListModelWrapper
Overrides:
setActualModel in class DefaultListModelWrapper
Parameters:
model - the list model.

setSortOrder

public void setSortOrder(int sortOrder)
Sets the sort order.

Overrides:
setSortOrder in class SortableListModel
Parameters:
sortOrder - the new sort order. The value could be SortableListModel.UNSORTED, SortableListModel.SORT_DESCENDING, or SortableListModel.SORT_ASCENDING.

unsort

public void unsort()
Unsorts the list model.

Overrides:
unsort in class SortableListModel

getGroupAt

public Object getGroupAt(int index)
Description copied from interface: GroupableListModel
Returns the group of the element at the specified index. Note that the order of groups is controlled by first getGroups() then getGroupAt(int).

Specified by:
getGroupAt in interface GroupableListModel
Parameters:
index - the index of element
Returns:
the group for the specified index.
See Also:
GroupableListModel.getGroups()

getGroups

public Object[] getGroups()
Description copied from interface: GroupableListModel
Returns all groups, which control the order of appearance. Besides, if getGroupAt(int) returns a value that doesn't exist in the groups, the value will be arranged after the array.

Specified by:
getGroups in interface GroupableListModel
Returns:
an array of groups in the order of appearance.
See Also:
GroupableListModel.getGroupAt(int)

addListGroupChangeListener

public void addListGroupChangeListener(ListGroupChangeListener l)
Adds a listener to the list that's notified each time a change to the data model occurs.

Specified by:
addListGroupChangeListener in interface GroupableListModel
Parameters:
l - the ListGroupChangeListener to be added

removeListGroupChangeListener

public void removeListGroupChangeListener(ListGroupChangeListener l)
Removes a listener from the list that's notified each time a change to the data model occurs.

Specified by:
removeListGroupChangeListener in interface GroupableListModel
Parameters:
l - the ListGroupChangeListener to be removed

getListGroupChangeListeners

public ListGroupChangeListener[] getListGroupChangeListeners()
Returns an array of all the list group change listeners registered on this DefaultGroupableListModel.

Returns:
all of this model's ListGroupChangeListeners, or an empty array if no list data listeners are currently registered
See Also:
addListGroupChangeListener(com.jidesoft.list.ListGroupChangeListener), removeListGroupChangeListener(com.jidesoft.list.ListGroupChangeListener)

fireGroupChanged

protected void fireGroupChanged(Object source)
AbstractListModel subclasses must call this method after the group for any of the item is changed.

Parameters:
source - the ListModel that changed, typically "this"

groupChanged

public void groupChanged(ListGroupChangeEvent e)
Description copied from interface: ListGroupChangeListener
Sent after the grouping of GroupableListModel has been changed.

Specified by:
groupChanged in interface ListGroupChangeListener
Parameters:
e - a ListGroupChangeListener encapsulating the event information

JIDE 3.5.15