Package com.illumon.iris.gui.table
Class GuiTable
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
com.illumon.iris.gui.table.GuiTable
- All Implemented Interfaces:
Workspace,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,CellEditorListener,ListSelectionListener,RowSorterListener,TableColumnModelListener,TableModelListener,Scrollable
- Direct Known Subclasses:
InputOverlayTable,InputRowsTable,IrisTable
A basic UI table backed by a
WColumnSet and IrisTableModel- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class javax.swing.JTable
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintModeNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsFields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeaderFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionGuiTable(com.fishlib.io.logger.Logger log) Create a blank GuiTable.GuiTable(com.fishlib.io.logger.Logger log, IrisTableModel model) GuiTable(com.fishlib.io.logger.Logger log, IrisTableModel model, TableColumnModel columnModel) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanvoidchangeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) protected voidconvertTableColumns(org.jdom2.Element tableInfo) static HiddenColumnModelcreateDefaultColumnModel(com.fishlib.dataobjects.WColumnSet wColumnSet) protected JTableHeadercreateFilterMenu(GuiColumn column, FilterStrategyImpl filterStrategy) Creates a menu for the Filter by...static TableColumncreateTableColumn(GuiColumn column, int modelIndex) protected TransferHandlerCreates the transfer handler.static StringgenerateToolTip(int col, TableModel model, GuiColumn column) booleanGet if alerts should propagate up through the tabs.com.fishlib.dataobjects.WColumnSetGets the FreezeColumnsManager.intintint[]org.jdom2.ElementSerialize the class into an element to be stored in the workspaceprotected voidhandleUnmentionedColumns(HiddenColumnModel columnModel, Set<TableColumn> unmentionedColumns, Collection<String> initialHiddenColumns) Handle any columns that have not been visited by the current column ordering.booleanGet if table changes will alert the user.booleanGet if the table will scroll with new items added.booleanGet if the table should respond to OneClick eventsprotected voidvoidvoidprocessDoubleClick(int row, int col, MouseEvent e) Process a double click.protected voidprocessHeaderClick(int col, MouseEvent e) Process a header single or double click.protected voidprocessSingleClick(int row, int col, MouseEvent e) Process a single click.voidReset the state of the columns (order, hidden, locked, etc) to the state defined by the query.introwAtPoint(Point point) We want to make sure that if we're actually negative we can differentiate that from running off the end of the table, so instead we return -2 instead of -1 in that case.voidscrollToCenter(int row) Scroll a specific row to the center of the view.voidscrollToRow(int row) Scroll a specific row to the top of the view.voidsetAlertsOn(boolean alertsOn) Set if table changes should alert the user.voidsetAlertsPropagate(boolean alertsPropagate) Set if the alerts should propagate up through the tabs.voidsetAlertsStyle(GuiTable.AlertStyle alertStyle) protected voidsetColumnFormatter(String columnName, org.jdom2.Element formatInfo) Sets the column formatter from workspace info.voidsetDefaultAlert(boolean defaultAlert) voidsetFollowTable(boolean followTable) Set if the table view should follow new rows that are added.voidsetFreezeColumnsManager(FreezeColumnsManager freezeColumnsManager) Sets the FreezeColumnsManager to allow this GuiTable to support Freeze Columns.voidsetModel(IrisTableModel model) protected voidsetModel(IrisTableModel model, TableColumnModel columnModel) voidsetOneClickOn(boolean oneClickOn) Set if the table should respond to OneClick events.voidsetTableDescription(String tableDescription) voidsetTableHeader(JTableHeader tableHeader) voidsetWorkspaceInfo(org.jdom2.Element workspaceInfo) Restore the class to the state defined by the data persisted in workspaceInfobooleanshouldSelectAlert(GuiTable.AlertStyle alertStyle) voidvoidCalled when the table changes in order to properly process updates to columns.protected static booleanworkspaceHasFreezeColumns(org.jdom2.Element workspaceInfo) Indicates if a workspace element contains freeze columns.Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRowCount, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane, updateUI, valueChangedMethods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.gui.workspace.Workspace
isGlobalSetting
-
Field Details
-
columnSet_
protected com.fishlib.dataobjects.WColumnSet columnSet_
-
-
Constructor Details
-
GuiTable
public GuiTable(com.fishlib.io.logger.Logger log) Create a blank GuiTable. Note that users MUST callsetModel(IrisTableModel)for it to function properly. -
GuiTable
-
GuiTable
public GuiTable(com.fishlib.io.logger.Logger log, IrisTableModel model, TableColumnModel columnModel)
-
-
Method Details
-
setModel
-
setModel
-
getOriginalRenderer
-
setFreezeColumnsManager
Sets the FreezeColumnsManager to allow this GuiTable to support Freeze Columns.- Parameters:
freezeColumnsManager- the FreezeColumnsManager
-
getFreezeColumnsManager
Gets the FreezeColumnsManager. This will be null if the table does no support Freeze Columns.- Returns:
- the FreezeColumnsManager, null if Freeze Columns are not supported
-
createTransferHandler
Creates the transfer handler.- Returns:
- the transfer handler
-
createDefaultColumnModel
public static HiddenColumnModel createDefaultColumnModel(com.fishlib.dataobjects.WColumnSet wColumnSet) -
maybeAddSelectionModel
protected void maybeAddSelectionModel() -
changeSelection
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) - Overrides:
changeSelectionin classJTable
-
getSelectedRow
public int getSelectedRow()- Overrides:
getSelectedRowin classJTable
-
createDefaultTableHeader
- Overrides:
createDefaultTableHeaderin classJTable
-
getHeaderToolTipText
-
generateToolTip
-
getColumnSet
public com.fishlib.dataobjects.WColumnSet getColumnSet() -
getOriginalTableModel
-
createTableColumn
-
getGridColor
- Overrides:
getGridColorin classJTable
-
setTableHeader
- Overrides:
setTableHeaderin classJTable
-
getRowHeight
public int getRowHeight()- Overrides:
getRowHeightin classJTable
-
getSelectedRows
public int[] getSelectedRows()- Overrides:
getSelectedRowsin classJTable
-
getViewableCells
- Returns:
- TableBounds of the viewable cells or TableBounds.EMPTY if no viewable cells
-
rowAtPoint
We want to make sure that if we're actually negative we can differentiate that from running off the end of the table, so instead we return -2 instead of -1 in that case.- Overrides:
rowAtPointin classJTable
-
processSingleClick
Process a single click. The base method does nothing and may be overridden.- Parameters:
row- The row clicked.col- The column clicked.e- The details of the click event.
-
processDoubleClick
Process a double click. The base method does nothing and may be overridden.- Parameters:
row- The row clicked.col- The column clicked.e- The details of the click event.
-
processHeaderClick
Process a header single or double click. The base method creates aTableHeaderPopupbut may be overridden.- Parameters:
col- The column clicked.e- The details of the click event.
-
isAlertsOn
public boolean isAlertsOn()Get if table changes will alert the user. -
setAlertsOn
public void setAlertsOn(boolean alertsOn) Set if table changes should alert the user. -
isOneClickOn
public boolean isOneClickOn()Get if the table should respond to OneClick events -
setOneClickOn
public void setOneClickOn(boolean oneClickOn) Set if the table should respond to OneClick events. -
isFollowingTable
public boolean isFollowingTable()Get if the table will scroll with new items added. -
setFollowTable
public void setFollowTable(boolean followTable) Set if the table view should follow new rows that are added.- Parameters:
followTable-
-
getAlertsPropagate
public boolean getAlertsPropagate()Get if alerts should propagate up through the tabs.- Returns:
-
setAlertsPropagate
public void setAlertsPropagate(boolean alertsPropagate) Set if the alerts should propagate up through the tabs.- Parameters:
alertsPropagate-
-
getAlertStyle
-
setAlertsStyle
-
shouldSelectAlert
-
setDefaultAlert
public void setDefaultAlert(boolean defaultAlert) -
scrollToRow
public void scrollToRow(int row) Scroll a specific row to the top of the view.- Parameters:
row- The row to scroll into view.
-
scrollToCenter
public void scrollToCenter(int row) Scroll a specific row to the center of the view.- Parameters:
row- The roll to center.
-
tableChanged
- Specified by:
tableChangedin interfaceTableModelListener- Overrides:
tableChangedin classJTable
-
updateColumns
public void updateColumns()Called when the table changes in order to properly process updates to columns.
Handles the following column updates:
- preserve current order
- keep hidden columns hidden
- add new columns to the end
- replace columns that are the "same"
- remove missing columns
- fix renderers of the wrong column typeSubclasses may override this method to add additional updates to columns. It is recommended to call super.updateColumns() before operating on columns.
-
getWorkspaceInfo
public org.jdom2.Element getWorkspaceInfo()Description copied from interface:WorkspaceSerialize the class into an element to be stored in the workspace- Specified by:
getWorkspaceInfoin interfaceWorkspace- Returns:
- An
Elementcontaining the data to persist.
-
setWorkspaceInfo
public void setWorkspaceInfo(org.jdom2.Element workspaceInfo) Description copied from interface:WorkspaceRestore the class to the state defined by the data persisted in workspaceInfo- Specified by:
setWorkspaceInfoin interfaceWorkspace- Parameters:
workspaceInfo- AnElementcontaining the persisted state.
-
workspaceHasFreezeColumns
protected static boolean workspaceHasFreezeColumns(org.jdom2.Element workspaceInfo) Indicates if a workspace element contains freeze columns.- Parameters:
workspaceInfo- the workspace element to check- Returns:
- true if it contains freeze columns, false otherwise
-
convertTableColumns
protected void convertTableColumns(org.jdom2.Element tableInfo) -
handleUnmentionedColumns
protected void handleUnmentionedColumns(HiddenColumnModel columnModel, Set<TableColumn> unmentionedColumns, Collection<String> initialHiddenColumns) Handle any columns that have not been visited by the current column ordering. When this method is invoked all layout hints including atFront() and atBack() have been evaluated. The default implementation simply places them at the end of the current order.- Parameters:
columnModel- The modelunmentionedColumns- The columns that have not yet been inserted into the orderinitialHiddenColumns- The columns which were explicitly hidden
-
setColumnFormatter
Sets the column formatter from workspace info. The default implementation does nothing but subclasses should override this method to create the correct concrete formatter.- Parameters:
columnName- the name of the columnformatInfo- element containing workspace info
-
resetColumns
public void resetColumns()Reset the state of the columns (order, hidden, locked, etc) to the state defined by the query. It will _not_ respect the same settings from the workspace. -
areSavedLayoutsAllowed
protected boolean areSavedLayoutsAllowed() -
getFrontColumns
-
getBackColumns
-
getAutoFilterColumns
-
getFreezeColumns
-
setTableDescription
-
getHiddenColumns
-
createFilterMenu
Creates a menu for the Filter by... option.- Parameters:
column- the column to filterfilterStrategy- the filter strategy for the model- Returns:
- a new filter menu
-
paint
- Overrides:
paintin classJComponent
-