org.knime.core.node.tableview
Class TableRowHeaderView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by org.knime.core.node.tableview.TableRowHeaderView
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable

public final class TableRowHeaderView
extends JTable

Row Header for a table view on a DataTable. It displays a DataRow's key (type DataCell)using the toString() method. Thus, this table has exactly one column. The model for this kind of view is a TableRowHeaderModel.
This class is used in conjunction with a TableContentView as the row header view in a scroll pane (realized by TableView).

Author:
Bernd Wiswedel, University Konstanz
See Also:
TableContentView, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTable
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields 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, tableHeader
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 void addColumn(TableColumn aColumn)
          Makes sure to register a property handler and sets the correct cell renderer.
static TableRowHeaderView createHeaderView(JTable table)
          Factory method that creates a row header view for a given table.
 boolean isShowColorInfo()
          Is the color info shown?
 Component prepareRenderer(TableCellRenderer renderer, int row, int column)
          Overridden in order to set the correct selection color (depending on hilite status).
 void setColumnName(String newName)
          Delegating method to model.
 void setModel(TableModel tableModel)
          Sets a new model for this view The argument must be instance of TableRowHeaderModel.
 void setRenderer(DataValueRenderer renderer)
          Set a new renderer for our column.
 void setRowHeight(int myRowHeight)
          Overridden in order to fire an event.
 void setRowHeight(int row, int myRowHeight)
          Overridden in order to fire an event that an individual row has changed.
 void setSelectionBackground(Color back)
          Overridden to avoid event storm.
 void setShowColorInfo(boolean isShowColor)
          Shall row header encode the color information in an icon?
 void tableChanged(TableModelEvent e)
          Resets all individual row heights as the super implementation deletes the private SizeSequence field.
 void updateUI()
          Changes look and feel here (by calling JTable.updateUI()) and also in the renderer.
 
Methods inherited from class javax.swing.JTable
addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, 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, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane, valueChanged
 
Methods 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, update
 
Methods 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addColumn

public void addColumn(TableColumn aColumn)
Makes sure to register a property handler and sets the correct cell renderer.

Overrides:
addColumn in class JTable
See Also:
JTable.addColumn(javax.swing.table.TableColumn)

setModel

public void setModel(TableModel tableModel)
Sets a new model for this view The argument must be instance of TableRowHeaderModel.

Overrides:
setModel in class JTable
Parameters:
tableModel - the new model
Throws:
NullPointerException - if argument is null.
ClassCastException - if dataModel is not of type TableRowHeaderModel.
See Also:
JTable.setModel(javax.swing.table.TableModel)

tableChanged

public void tableChanged(TableModelEvent e)
Resets all individual row heights as the super implementation deletes the private SizeSequence field.

Specified by:
tableChanged in interface TableModelListener
Overrides:
tableChanged in class JTable
See Also:
JTable.tableChanged(TableModelEvent)

setColumnName

public void setColumnName(String newName)
Delegating method to model. It sets the column header name which is, by default, "Key".

Parameters:
newName - the new name of the column or null to leave empty

prepareRenderer

public Component prepareRenderer(TableCellRenderer renderer,
                                 int row,
                                 int column)
Overridden in order to set the correct selection color (depending on hilite status).

Overrides:
prepareRenderer in class JTable
See Also:
JTable.prepareRenderer(TableCellRenderer, int, int)

setSelectionBackground

public void setSelectionBackground(Color back)
Overridden to avoid event storm. The super implementation will invoke a repaint if the color has changed. Since that happens frequently (and also within the repaint) this causes an infinite loop.

Overrides:
setSelectionBackground in class JTable
See Also:
JTable.setSelectionBackground(java.awt.Color)

setShowColorInfo

public void setShowColorInfo(boolean isShowColor)
Shall row header encode the color information in an icon?

Parameters:
isShowColor - true for show icon (and thus the color), false ignore colors

isShowColorInfo

public boolean isShowColorInfo()
Is the color info shown?

Returns:
true if icon with the color is present, false otherwise

setRowHeight

public void setRowHeight(int row,
                         int myRowHeight)
Overridden in order to fire an event that an individual row has changed.

Overrides:
setRowHeight in class JTable
See Also:
JTable.setRowHeight(int, int)

setRowHeight

public void setRowHeight(int myRowHeight)
Overridden in order to fire an event. The super class will also fire a property change event with property name "rowHeight". This event, however, is not propagated when the row height doesn't change. The super class will therefore not handle the case where there is at least one individual row height and the majority row height (as set by setRowHeight) stays the same. It will swallow the event.

Overrides:
setRowHeight in class JTable
See Also:
JTable.setRowHeight(int)

updateUI

public void updateUI()
Changes look and feel here (by calling JTable.updateUI()) and also in the renderer.

Overrides:
updateUI in class JTable

setRenderer

public void setRenderer(DataValueRenderer renderer)
Set a new renderer for our column.

Parameters:
renderer - the new renderer

createHeaderView

public static TableRowHeaderView createHeaderView(JTable table)
Factory method that creates a row header view for a given table. The argument's model must be an instance of TableContentInterface in order to connect the returned view to argument view. This method will also bind both selection models together (in particular, the returned view will use the argument's view) and also both tables row height.

Parameters:
table - the table to which to connect to
Returns:
a new header view connected to table
Throws:
NullPointerException - if the argument is null.
IllegalArgumentException - if the table's model is not instance of TableContentInterface.


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.