com.ezware.oxbow.swingbits.list
Class DefaultCheckListModel<T>

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by com.ezware.oxbow.swingbits.list.DefaultCheckListModel<T>
Type Parameters:
T - list element type
All Implemented Interfaces:
ICheckListModel<T>, Serializable, ListModel

public class DefaultCheckListModel<T>
extends AbstractListModel
implements ICheckListModel<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
See Also:
Serialized Form

Field Summary
static IObjectToStringTranslator DEFAULT_TRANSLATOR
           
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
DefaultCheckListModel(Collection<? extends T> data)
           
DefaultCheckListModel(T... data)
           
 
Method Summary
 void filter(String filter, IObjectToStringTranslator translator, CheckListFilterType filterType)
          Allows filtered view.
 Collection<T> getCheckedItems()
          Returns a collections of checked items
 Object getElementAt(int index)
           
 int getSize()
           
 boolean isCheckedIndex(int index)
          Returns the check state of the element at specified position
 void setCheckedIndex(int index, boolean value)
          Sets the check state of the element at specified position
 void setCheckedItems(Collection<T> items)
          Sets checked items
 
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, removeListDataListener
 

Field Detail

DEFAULT_TRANSLATOR

public static IObjectToStringTranslator DEFAULT_TRANSLATOR
Constructor Detail

DefaultCheckListModel

public DefaultCheckListModel(Collection<? extends T> data)

DefaultCheckListModel

public DefaultCheckListModel(T... data)
Method Detail

getSize

public int getSize()
Specified by:
getSize in interface ListModel

getElementAt

public Object getElementAt(int index)
Specified by:
getElementAt in interface ListModel

isCheckedIndex

public boolean isCheckedIndex(int index)
Description copied from interface: ICheckListModel
Returns the check state of the element at specified position

Specified by:
isCheckedIndex in interface ICheckListModel<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: ICheckListModel
Sets the check state of the element at specified position

Specified by:
setCheckedIndex in interface ICheckListModel<T>
Parameters:
index - element index

getCheckedItems

public Collection<T> getCheckedItems()
Description copied from interface: ICheckListModel
Returns a collections of checked items

Specified by:
getCheckedItems in interface ICheckListModel<T>
Returns:

setCheckedItems

public void setCheckedItems(Collection<T> items)
Description copied from interface: ICheckListModel
Sets checked items

Specified by:
setCheckedItems in interface ICheckListModel<T>

filter

public void filter(String filter,
                   IObjectToStringTranslator translator,
                   CheckListFilterType filterType)
Description copied from interface: ICheckListModel
Allows filtered view. Setting empty or null filter will clear filter and show all items

Specified by:
filter in interface ICheckListModel<T>
Parameters:
filter - filter string
translator - object to string translator to aid the search


Copyright © 2011. All Rights Reserved.