Package com.jidesoft.swing
Class CheckBoxListSelectionModel
- java.lang.Object
-
- javax.swing.DefaultListSelectionModel
-
- com.jidesoft.swing.CheckBoxListSelectionModel
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.EventListener,javax.swing.event.ListDataListener,javax.swing.ListSelectionModel
public class CheckBoxListSelectionModel extends javax.swing.DefaultListSelectionModel implements javax.swing.event.ListDataListener- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CheckBoxListSelectionModel()CheckBoxListSelectionModel(javax.swing.ListModel model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSelectionInterval(int index0, int index1)voidcontentsChanged(javax.swing.event.ListDataEvent e)intgetAllEntryIndex()Gets the index of the "all" entry in the CheckBoxList.intgetMinSelectionIndex()javax.swing.ListModelgetModel()voidinsertIndexInterval(int index, int length, boolean before)Overrides so that inserting a row will not be selected automatically if the row after it is selected.voidintervalAdded(javax.swing.event.ListDataEvent e)voidintervalRemoved(javax.swing.event.ListDataEvent e)booleanisAllEntryConsidered()Gets the flag indicating if this CheckBoxListSelectionModel should consider the CheckBoxList.ALL item if there is one.booleanisSelectedIndex(int index)voidremoveSelectionInterval(int index0, int index1)voidsetAllEntryConsidered(boolean allEntryConsidered)Sets the flag indicating if this CheckBoxListSelectionModel should consider the CheckBoxList.ALL item if there is one.voidsetAllEntryIndex(int allEntryIndex)Sets the index of the "all" entry in the CheckBoxList.voidsetModel(javax.swing.ListModel model)voidsetSelectionInterval(int index0, int index1)protected voidupdateAllEntryIf()-
Methods inherited from class javax.swing.DefaultListSelectionModel
addListSelectionListener, clearSelection, clone, fireValueChanged, fireValueChanged, fireValueChanged, getAnchorSelectionIndex, getLeadSelectionIndex, getListeners, getListSelectionListeners, getMaxSelectionIndex, getSelectionMode, getValueIsAdjusting, isLeadAnchorNotificationEnabled, isSelectionEmpty, moveLeadSelectionIndex, removeIndexInterval, removeListSelectionListener, setAnchorSelectionIndex, setLeadAnchorNotificationEnabled, setLeadSelectionIndex, setSelectionMode, setValueIsAdjusting, toString
-
-
-
-
Method Detail
-
getAllEntryIndex
public int getAllEntryIndex()
Gets the index of the "all" entry in the CheckBoxList.- Returns:
- the index of the "all" entry. -1 if no "all" entry exists.
- Since:
- 3.3.5
- See Also:
setAllEntryIndex(int)
-
setAllEntryIndex
public void setAllEntryIndex(int allEntryIndex)
Sets the index of the "all" entry in the CheckBoxList. If the CheckBoxList has an "all" entry, check that entry on/off will check/uncheck all other entries. Uncheck any other entry will uncheck the "all" entry.- Parameters:
allEntryIndex- the index of the "all" entry.
-
getModel
public javax.swing.ListModel getModel()
-
setModel
public void setModel(javax.swing.ListModel model)
-
intervalAdded
public void intervalAdded(javax.swing.event.ListDataEvent e)
- Specified by:
intervalAddedin interfacejavax.swing.event.ListDataListener
-
intervalRemoved
public void intervalRemoved(javax.swing.event.ListDataEvent e)
- Specified by:
intervalRemovedin interfacejavax.swing.event.ListDataListener
-
contentsChanged
public void contentsChanged(javax.swing.event.ListDataEvent e)
- Specified by:
contentsChangedin interfacejavax.swing.event.ListDataListener
-
updateAllEntryIf
protected void updateAllEntryIf()
-
insertIndexInterval
public void insertIndexInterval(int index, int length, boolean before)Overrides so that inserting a row will not be selected automatically if the row after it is selected.- Specified by:
insertIndexIntervalin interfacejavax.swing.ListSelectionModel- Overrides:
insertIndexIntervalin classjavax.swing.DefaultListSelectionModel- Parameters:
index- the index where the rows will be inserted.length- the number of the rows that will be inserted.before- it's before or after the index.
-
isAllEntryConsidered
public boolean isAllEntryConsidered()
Gets the flag indicating if this CheckBoxListSelectionModel should consider the CheckBoxList.ALL item if there is one.- Returns:
- true if need check. Otherwise false.
- Since:
- 3.3.3
- See Also:
setAllEntryConsidered(boolean)
-
setAllEntryConsidered
public void setAllEntryConsidered(boolean allEntryConsidered)
Sets the flag indicating if this CheckBoxListSelectionModel should consider the CheckBoxList.ALL item if there is one. By default, the flag is true. If you want to improve the performance and don't have "all" entry, or if you do have an entry similar to "all" entry but want to treat it as a normal entry, please set it to false.- Parameters:
allEntryConsidered- the flag- Since:
- 3.3.3
-
isSelectedIndex
public boolean isSelectedIndex(int index)
- Specified by:
isSelectedIndexin interfacejavax.swing.ListSelectionModel- Overrides:
isSelectedIndexin classjavax.swing.DefaultListSelectionModel
-
setSelectionInterval
public void setSelectionInterval(int index0, int index1)- Specified by:
setSelectionIntervalin interfacejavax.swing.ListSelectionModel- Overrides:
setSelectionIntervalin classjavax.swing.DefaultListSelectionModel
-
getMinSelectionIndex
public int getMinSelectionIndex()
- Specified by:
getMinSelectionIndexin interfacejavax.swing.ListSelectionModel- Overrides:
getMinSelectionIndexin classjavax.swing.DefaultListSelectionModel
-
addSelectionInterval
public void addSelectionInterval(int index0, int index1)- Specified by:
addSelectionIntervalin interfacejavax.swing.ListSelectionModel- Overrides:
addSelectionIntervalin classjavax.swing.DefaultListSelectionModel
-
removeSelectionInterval
public void removeSelectionInterval(int index0, int index1)- Specified by:
removeSelectionIntervalin interfacejavax.swing.ListSelectionModel- Overrides:
removeSelectionIntervalin classjavax.swing.DefaultListSelectionModel
-
-