Package com.illumon.iris.gui.table
Class IrisTableSelectionModel
java.lang.Object
com.illumon.iris.gui.table.IrisTableSelectionModel
- All Implemented Interfaces:
Serializable,Cloneable,ListSelectionModel
- Direct Known Subclasses:
DbKeyedTableSelectionModel
public class IrisTableSelectionModel
extends Object
implements ListSelectionModel, Cloneable, Serializable
A ListSelectionModel that maintains selection as snapshot of the underlying
Key Columns.
This implementation is largely derived from DefaultListSelectionModel
with changes to facilitate the snapshot method.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected int[]protected booleanprotected intprotected EventListenerListprotected IrisTableModelprotected HashSet<com.fishlib.datastructures.util.SmartKey>Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddSelectionInterval(int index0, int index1) protected voidchangeSelection(int clearMin, int clearMax, int setMin, int setMax, boolean clearFirst) protected voidclear(int r) voidclone()protected booleancontains(int a, int b, int i) protected voidprotected voidfireValueChanged(boolean isAdjusting) protected voidfireValueChanged(int firstIndex, int lastIndex) protected voidfireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) intintint[]getKeys()Get the current set of key column indicesint<T extends EventListener>
T[]getListeners(Class<T> listenerType) intintprotected com.fishlib.datastructures.util.SmartKeygetSelectionKey(int position) Get the SmartKey associated with a particular row position.intAlways returns MULTIPLE_INTERVAL_SELECTION since we can't predict where rows will appear after a table ticks.booleanvoidinsertIndexInterval(int index, int length, boolean before) booleanbooleanisSelectedIndex(int position) booleanReturns if the selection is empty.protected voidmarkAsDirty(int r) voidremoveIndexInterval(int index0, int index1) voidvoidremoveSelectionInterval(int index0, int index1) protected voidset(int r) voidsetAnchorSelectionIndex(int anchorIndex) voidvoidsetLeadAnchorNotificationEnabled(boolean flag) voidsetLeadSelectionIndex(int leadIndex) voidsetSelectionInterval(int index0, int index1) voidsetSelectionMode(int selectionMode) Does nothing.voidsetValueIsAdjusting(boolean isAdjusting) protected voidupdateLeadAnchorIndices(int anchorIndex, int leadIndex) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.swing.ListSelectionModel
getSelectedIndices, getSelectedItemsCount
-
Field Details
-
model
-
selectedKeyValues
-
keys
protected int[] keys -
anchorIndex
protected int anchorIndex -
leadIndex
protected int leadIndex -
listenerList
-
leadAnchorNotificationEnabled
protected boolean leadAnchorNotificationEnabled
-
-
Constructor Details
-
IrisTableSelectionModel
-
-
Method Details
-
setKeys
-
getValueIsAdjusting
public boolean getValueIsAdjusting()- Specified by:
getValueIsAdjustingin interfaceListSelectionModel
-
addListSelectionListener
- Specified by:
addListSelectionListenerin interfaceListSelectionModel
-
removeListSelectionListener
- Specified by:
removeListSelectionListenerin interfaceListSelectionModel
-
getListSelectionListeners
-
getListeners
-
setValueIsAdjusting
public void setValueIsAdjusting(boolean isAdjusting) - Specified by:
setValueIsAdjustingin interfaceListSelectionModel
-
getAnchorSelectionIndex
public int getAnchorSelectionIndex()- Specified by:
getAnchorSelectionIndexin interfaceListSelectionModel
-
getLeadSelectionIndex
public int getLeadSelectionIndex()- Specified by:
getLeadSelectionIndexin interfaceListSelectionModel
-
fireValueChanged
protected void fireValueChanged(boolean isAdjusting) -
fireValueChanged
protected void fireValueChanged(int firstIndex, int lastIndex) -
fireValueChanged
protected void fireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) -
fireValueChanged
protected void fireValueChanged() -
setLeadAnchorNotificationEnabled
public void setLeadAnchorNotificationEnabled(boolean flag) -
isLeadAnchorNotificationEnabled
public boolean isLeadAnchorNotificationEnabled() -
contains
protected boolean contains(int a, int b, int i) -
changeSelection
protected void changeSelection(int clearMin, int clearMax, int setMin, int setMax, boolean clearFirst) -
getMinSelectionIndex
public int getMinSelectionIndex()- Specified by:
getMinSelectionIndexin interfaceListSelectionModel
-
getMaxSelectionIndex
public int getMaxSelectionIndex()- Specified by:
getMaxSelectionIndexin interfaceListSelectionModel
-
getSelectionMode
public int getSelectionMode()Always returns MULTIPLE_INTERVAL_SELECTION since we can't predict where rows will appear after a table ticks.- Specified by:
getSelectionModein interfaceListSelectionModel- Returns:
- MULTIPLE_INTERVAL_SELECTION
-
setSelectionMode
public void setSelectionMode(int selectionMode) Does nothing. This Model is always MULTIPLE_INTERVAL_SELECTION- Specified by:
setSelectionModein interfaceListSelectionModel
-
isSelectedIndex
public boolean isSelectedIndex(int position) - Specified by:
isSelectedIndexin interfaceListSelectionModel- Parameters:
position- the position of the selection to search for.- Returns:
- ImplNote:
- the parameter is renamed 'position' to remove any confusion between Deephaven Table's concept of 'key' space and 'position' space.
-
isSelectionEmpty
public boolean isSelectionEmpty()Returns if the selection is empty.- Specified by:
isSelectionEmptyin interfaceListSelectionModel- Returns:
- true if the selection is empty, false otherwise
- ImplNote:
- If the selection is actually empty, this method is guaranteed to be correct, however there is a chance that there may be keys in the selection without the corresponding rows present in the table. In this situation, this method will return false but when the table is searched for selected rows the user may get an empty set.
-
clearSelection
public void clearSelection()- Specified by:
clearSelectionin interfaceListSelectionModel
-
setSelectionInterval
public void setSelectionInterval(int index0, int index1) - Specified by:
setSelectionIntervalin interfaceListSelectionModel
-
addSelectionInterval
public void addSelectionInterval(int index0, int index1) - Specified by:
addSelectionIntervalin interfaceListSelectionModel
-
removeSelectionInterval
public void removeSelectionInterval(int index0, int index1) - Specified by:
removeSelectionIntervalin interfaceListSelectionModel
-
insertIndexInterval
public void insertIndexInterval(int index, int length, boolean before) - Specified by:
insertIndexIntervalin interfaceListSelectionModel
-
removeIndexInterval
public void removeIndexInterval(int index0, int index1) - Specified by:
removeIndexIntervalin interfaceListSelectionModel
-
setAnchorSelectionIndex
public void setAnchorSelectionIndex(int anchorIndex) - Specified by:
setAnchorSelectionIndexin interfaceListSelectionModel
-
setLeadSelectionIndex
public void setLeadSelectionIndex(int leadIndex) - Specified by:
setLeadSelectionIndexin interfaceListSelectionModel
-
getKeys
public int[] getKeys()Get the current set of key column indices -
markAsDirty
protected void markAsDirty(int r) -
set
protected void set(int r) -
clear
protected void clear(int r) -
updateLeadAnchorIndices
protected void updateLeadAnchorIndices(int anchorIndex, int leadIndex) -
getKeyCount
public int getKeyCount() -
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
getSelectionKey
protected com.fishlib.datastructures.util.SmartKey getSelectionKey(int position) Get the SmartKey associated with a particular row position.- Parameters:
position- the position of the row in the table.
-