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 as snapshot of the underlying
Key Columns.
This implementation is largely derived from DefaultListSelectionModel
with changes to facilitate the snapshot method.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected int
anchorIndex
protected int[]
keys
protected boolean
leadAnchorNotificationEnabled
protected int
leadIndex
protected EventListenerList
listenerList
protected IrisTableModel
model
protected HashSet<com.fishlib.datastructures.util.SmartKey>
selectedKeyValues
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
-
Constructor Summary
Constructors Constructor Description IrisTableSelectionModel(IrisTableModel model)
-
Method Summary
Modifier and Type Method Description void
addListSelectionListener(ListSelectionListener l)
void
addSelectionInterval(int index0, int index1)
protected void
changeSelection(int clearMin, int clearMax, int setMin, int setMax, boolean clearFirst)
protected void
clear(int r)
void
clearSelection()
Object
clone()
protected boolean
contains(int a, int b, int i)
protected void
fireValueChanged()
protected void
fireValueChanged(boolean isAdjusting)
protected void
fireValueChanged(int firstIndex, int lastIndex)
protected void
fireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
int
getAnchorSelectionIndex()
int
getKeyCount()
int[]
getKeys()
Get the current set of key column indicesint
getLeadSelectionIndex()
<T extends EventListener>
T[]getListeners(Class<T> listenerType)
ListSelectionListener[]
getListSelectionListeners()
int
getMaxSelectionIndex()
int
getMinSelectionIndex()
protected com.fishlib.datastructures.util.SmartKey
getSelectionKey(int position)
Get the SmartKey associated with a particular row position.int
getSelectionMode()
Always returns MULTIPLE_INTERVAL_SELECTION since we can't predict where rows will appear after a table ticks.boolean
getValueIsAdjusting()
void
insertIndexInterval(int index, int length, boolean before)
boolean
isLeadAnchorNotificationEnabled()
boolean
isSelectedIndex(int position)
boolean
isSelectionEmpty()
Returns if the selection is empty.protected void
markAsDirty(int r)
void
removeIndexInterval(int index0, int index1)
void
removeListSelectionListener(ListSelectionListener l)
void
removeSelectionInterval(int index0, int index1)
protected void
set(int r)
void
setAnchorSelectionIndex(int anchorIndex)
void
setKeys(String[] keyStrings)
void
setLeadAnchorNotificationEnabled(boolean flag)
void
setLeadSelectionIndex(int leadIndex)
void
setSelectionInterval(int index0, int index1)
void
setSelectionMode(int selectionMode)
Does nothing.void
setValueIsAdjusting(boolean isAdjusting)
protected void
updateLeadAnchorIndices(int anchorIndex, int leadIndex)
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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
-
Method Details
-
setKeys
-
getValueIsAdjusting
public boolean getValueIsAdjusting()- Specified by:
getValueIsAdjusting
in interfaceListSelectionModel
-
addListSelectionListener
- Specified by:
addListSelectionListener
in interfaceListSelectionModel
-
removeListSelectionListener
- Specified by:
removeListSelectionListener
in interfaceListSelectionModel
-
getListSelectionListeners
-
getListeners
-
setValueIsAdjusting
public void setValueIsAdjusting(boolean isAdjusting)- Specified by:
setValueIsAdjusting
in interfaceListSelectionModel
-
getAnchorSelectionIndex
public int getAnchorSelectionIndex()- Specified by:
getAnchorSelectionIndex
in interfaceListSelectionModel
-
getLeadSelectionIndex
public int getLeadSelectionIndex()- Specified by:
getLeadSelectionIndex
in 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:
getMinSelectionIndex
in interfaceListSelectionModel
-
getMaxSelectionIndex
public int getMaxSelectionIndex()- Specified by:
getMaxSelectionIndex
in 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:
getSelectionMode
in interfaceListSelectionModel
- Returns:
- MULTIPLE_INTERVAL_SELECTION
-
setSelectionMode
public void setSelectionMode(int selectionMode)Does nothing. This Model is always MULTIPLE_INTERVAL_SELECTION- Specified by:
setSelectionMode
in interfaceListSelectionModel
-
isSelectedIndex
public boolean isSelectedIndex(int position)- Specified by:
isSelectedIndex
in 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:
isSelectionEmpty
in 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:
clearSelection
in interfaceListSelectionModel
-
setSelectionInterval
public void setSelectionInterval(int index0, int index1)- Specified by:
setSelectionInterval
in interfaceListSelectionModel
-
addSelectionInterval
public void addSelectionInterval(int index0, int index1)- Specified by:
addSelectionInterval
in interfaceListSelectionModel
-
removeSelectionInterval
public void removeSelectionInterval(int index0, int index1)- Specified by:
removeSelectionInterval
in interfaceListSelectionModel
-
insertIndexInterval
public void insertIndexInterval(int index, int length, boolean before)- Specified by:
insertIndexInterval
in interfaceListSelectionModel
-
removeIndexInterval
public void removeIndexInterval(int index0, int index1)- Specified by:
removeIndexInterval
in interfaceListSelectionModel
-
setAnchorSelectionIndex
public void setAnchorSelectionIndex(int anchorIndex)- Specified by:
setAnchorSelectionIndex
in interfaceListSelectionModel
-
setLeadSelectionIndex
public void setLeadSelectionIndex(int leadIndex)- Specified by:
setLeadSelectionIndex
in 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:
clone
in 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.
-