Package com.illumon.iris.console.db
Class DbKeyedTableSelectionModel
java.lang.Object
com.illumon.iris.gui.table.IrisTableSelectionModel
com.illumon.iris.console.db.DbKeyedTableSelectionModel
- All Implemented Interfaces:
Serializable
,Cloneable
,ListSelectionModel
A Table selection model that maintains user selection inside and outside the viewport.
When selections are made, key-values are cached and rows are considered selected if:
1) The row is populated
2) The values of the key columns match ont of the selected values
If a long running selection operation is in progress, and another selection event
arrives, it will be ignored. The special case is getTableForSelection which will
retry until it manages to acquire the lock
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
-
Field Summary
FieldsFields inherited from class com.illumon.iris.gui.table.IrisTableSelectionModel
anchorIndex, keys, leadAnchorNotificationEnabled, leadIndex, listenerList, model, selectedKeyValues
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
-
Constructor Summary
ConstructorsConstructorDescriptionDbKeyedTableSelectionModel
(GuiTable parent, IrisTableModel model) DbKeyedTableSelectionModel
(GuiTable parent, IrisTableModel model, com.fishlib.io.logger.Logger log) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSelectionInterval
(int index0, int index1) Build a table containing the cached key-valueprotected void
changeSelection
(int clearMin, int clearMax, int setMin, int setMax, boolean clearFirst) Change the selection while performing all operations at the same time in the same thread context.void
int
int
getSnapshotForSelection
(BitSet columns) Get a SnapshotTable containing all selected rows from the original table, including only the specified columns.getSnapshotForSelection
(BitSet columns, boolean stripPreview) Get a SnapshotTable containing all selected rows from the original table, including only the specified columns.boolean
Returns if the selection is empty.boolean
isUnique()
Returns true if the keys are unique.void
removeSelectionInterval
(int index0, int index1) void
void
setLeadSelectionIndex
(int leadIndex) void
setLogger
(com.fishlib.io.logger.Logger log) void
setSelectionInterval
(int index0, int index1) protected void
Methods inherited from class com.illumon.iris.gui.table.IrisTableSelectionModel
addListSelectionListener, clear, clone, contains, fireValueChanged, fireValueChanged, fireValueChanged, fireValueChanged, getAnchorSelectionIndex, getKeyCount, getKeys, getLeadSelectionIndex, getListeners, getListSelectionListeners, getSelectionKey, getSelectionMode, getValueIsAdjusting, insertIndexInterval, isLeadAnchorNotificationEnabled, isSelectedIndex, markAsDirty, removeIndexInterval, removeListSelectionListener, set, setAnchorSelectionIndex, setLeadAnchorNotificationEnabled, setSelectionMode, setValueIsAdjusting, updateLeadAnchorIndices
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
-
keySet
-
-
Constructor Details
-
DbKeyedTableSelectionModel
-
DbKeyedTableSelectionModel
public DbKeyedTableSelectionModel(GuiTable parent, IrisTableModel model, com.fishlib.io.logger.Logger log)
-
-
Method Details
-
isUnique
public boolean isUnique()Returns true if the keys are unique.- Returns:
- true if the keys are unique, false otherwise
-
setLogger
public void setLogger(com.fishlib.io.logger.Logger log) -
setKeys
- Overrides:
setKeys
in classIrisTableSelectionModel
-
clearSelection
public void clearSelection()- Specified by:
clearSelection
in interfaceListSelectionModel
- Overrides:
clearSelection
in classIrisTableSelectionModel
-
setSelectionInterval
public void setSelectionInterval(int index0, int index1) - Specified by:
setSelectionInterval
in interfaceListSelectionModel
- Overrides:
setSelectionInterval
in classIrisTableSelectionModel
-
addSelectionInterval
public void addSelectionInterval(int index0, int index1) - Specified by:
addSelectionInterval
in interfaceListSelectionModel
- Overrides:
addSelectionInterval
in classIrisTableSelectionModel
-
removeSelectionInterval
public void removeSelectionInterval(int index0, int index1) - Specified by:
removeSelectionInterval
in interfaceListSelectionModel
- Overrides:
removeSelectionInterval
in classIrisTableSelectionModel
-
setLeadSelectionIndex
public void setLeadSelectionIndex(int leadIndex) - Specified by:
setLeadSelectionIndex
in interfaceListSelectionModel
- Overrides:
setLeadSelectionIndex
in classIrisTableSelectionModel
-
isSelectionEmpty
public boolean isSelectionEmpty()Description copied from class:IrisTableSelectionModel
Returns if the selection is empty.- Specified by:
isSelectionEmpty
in interfaceListSelectionModel
- Overrides:
isSelectionEmpty
in classIrisTableSelectionModel
- Returns:
- true if the selection is empty, false otherwise
-
getMinSelectionIndex
public int getMinSelectionIndex()- Specified by:
getMinSelectionIndex
in interfaceListSelectionModel
- Overrides:
getMinSelectionIndex
in classIrisTableSelectionModel
-
getMaxSelectionIndex
public int getMaxSelectionIndex()- Specified by:
getMaxSelectionIndex
in interfaceListSelectionModel
- Overrides:
getMaxSelectionIndex
in classIrisTableSelectionModel
-
changeSelection
protected void changeSelection(int clearMin, int clearMax, int setMin, int setMax, boolean clearFirst) Change the selection while performing all operations at the same time in the same thread context. If all the rows are available in the viewport and populated, we will cache the values for the key columns directly. If the rows are in the viewport and not populated, or simply not in the viewport, the entire selection operation will be delegated to another thread that will perform all of the selection operations at once. When rows are outside the viewport, the values will be retrieved remotely from the database- Overrides:
changeSelection
in classIrisTableSelectionModel
-
buildSelectionTable
Build a table containing the cached key-value -
getSnapshotForSelection
-
getSnapshotForSelection
Get a SnapshotTable containing all selected rows from the original table, including only the specified columns.- ImplNote:
- This method may result in a whereIn() query, so it must not be invoked on the swing thread.
-
getSnapshotForSelection
Get a SnapshotTable containing all selected rows from the original table, including only the specified columns.- Parameters:
stripPreview
- Remove preview columns to return the raw data (e.g., return the complete double [] instead of an array preview)- ImplNote:
- This method may result in a whereIn() query, so it must not be invoked on the swing thread.
-
updateKey
-