Package jaxx.runtime.swing.list
Class DefaultCheckListModel<T>
java.lang.Object
javax.swing.AbstractListModel
jaxx.runtime.swing.list.DefaultCheckListModel<T>
- Type Parameters:
T- list element type
- All Implemented Interfaces:
java.io.Serializable,javax.swing.ListModel,CheckListModel<T>
- Direct Known Subclasses:
DefaultFilterableCheckListModel
public class DefaultCheckListModel<T> extends javax.swing.AbstractListModel implements CheckListModel<T>
Default model for check list. It is based on the list of items
Implementation of checks is based on HashSet of checked items
- Author:
- Eugene Ryzhikov, Kevin Morin
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<T>checksprotected java.util.List<T>dataFields inherited from class javax.swing.AbstractListModel
listenerList -
Constructor Summary
Constructors Constructor Description DefaultCheckListModel(java.util.Collection<? extends T> data)DefaultCheckListModel(T... data) -
Method Summary
Modifier and Type Method Description protected java.util.List<T>data()java.util.Collection<T>getCheckedItems()Returns a collections of checked itemsjava.lang.ObjectgetElementAt(int index)intgetOriginalSize()Returns the number of items before the filter was appliedintgetSize()booleanisCheckedIndex(int index)Returns the check state of the element at specified positionvoidsetCheckedIndex(int index, boolean value)Sets the check state of the element at specified positionvoidsetCheckedItems(java.util.Collection<T> items)Sets checked itemsMethods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
-
Field Details
-
data
-
checks
-
-
Constructor Details
-
DefaultCheckListModel
-
DefaultCheckListModel
-
-
Method Details
-
getSize
public int getSize()- Specified by:
getSizein interfacejavax.swing.ListModel<T>
-
getOriginalSize
public int getOriginalSize()Description copied from interface:CheckListModelReturns the number of items before the filter was applied- Specified by:
getOriginalSizein interfaceCheckListModel<T>- Returns:
-
data
-
getElementAt
public java.lang.Object getElementAt(int index)- Specified by:
getElementAtin interfacejavax.swing.ListModel<T>
-
isCheckedIndex
public boolean isCheckedIndex(int index)Description copied from interface:CheckListModelReturns the check state of the element at specified position- Specified by:
isCheckedIndexin interfaceCheckListModel<T>- Parameters:
index- element index- Returns:
- true if element at specified position is checked
-
setCheckedIndex
public void setCheckedIndex(int index, boolean value)Description copied from interface:CheckListModelSets the check state of the element at specified position- Specified by:
setCheckedIndexin interfaceCheckListModel<T>- Parameters:
index- element index
-
getCheckedItems
Description copied from interface:CheckListModelReturns a collections of checked items- Specified by:
getCheckedItemsin interfaceCheckListModel<T>- Returns:
-
setCheckedItems
Description copied from interface:CheckListModelSets checked items- Specified by:
setCheckedItemsin interfaceCheckListModel<T>
-