org.jivesoftware.spark.component
Class Table

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.jdesktop.swingx.JXTable
                      extended by org.jivesoftware.spark.component.Table
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable
Direct Known Subclasses:
JiveSortableTable

public abstract class Table
extends org.jdesktop.swingx.JXTable

Table class can be used to maintain quality look and feel throughout the product. This is mainly from the rendering capabilities.

Version:
1.0, 03/12/14
See Also:
Serialized Form

Nested Class Summary
 class Table.ComboBoxRenderer
           
 class Table.JButtonRenderer
          A swing renderer used to display Buttons within a table.
static class Table.JiveTableModel
          The internal Table Model.
 class Table.JLabelRenderer
          A swing renderer used to display labels within a table.
 class Table.MyComboBoxEditor
           
 class Table.TextAreaCellRenderer
          A swing renderer to dispaly Textareas within a table.
 
Nested classes/interfaces inherited from class org.jdesktop.swingx.JXTable
org.jdesktop.swingx.JXTable.BooleanEditor, org.jdesktop.swingx.JXTable.BooleanRenderer, org.jdesktop.swingx.JXTable.DateRenderer, org.jdesktop.swingx.JXTable.DoubleRenderer, org.jdesktop.swingx.JXTable.GenericEditor, org.jdesktop.swingx.JXTable.IconRenderer, org.jdesktop.swingx.JXTable.NumberEditor, org.jdesktop.swingx.JXTable.NumberRenderer, org.jdesktop.swingx.JXTable.TableAdapter, org.jdesktop.swingx.JXTable.TableRolloverController<T extends javax.swing.JTable>, org.jdesktop.swingx.JXTable.TableSearchable
 
Nested classes/interfaces inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.awt.Color SELECTION_COLOR
          Define the color of row and column selections.
static java.awt.Color TOOLTIP_COLOR
          Define the color used in the tooltips.
 
Fields inherited from class org.jdesktop.swingx.JXTable
AUTO_RESIZE_INTELLI_OFF, dataAdapter, filters, highlighters, HORIZONTALSCROLL_ACTION_COMMAND, isXTableRowHeightSet, MATCH_HIGHLIGHTER, PACKALL_ACTION_COMMAND, PACKSELECTED_ACTION_COMMAND, resetDefaultTableCellRendererHighlighter, searchable, UIPREFIX
 
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
 
Constructor Summary
protected Table()
          Empty Constructor.
protected Table(java.lang.String[] headers)
          Creates a table using the specified table headers.
 
Method Summary
 void add(java.util.List list)
          Adds a list to the table model.
 void addObject(int row, java.lang.Object object)
          Associate an object with a row.
 void clearObjectMap()
          Clears all objects from map.
 void clearTable()
          Removes all columns and rows from table.
 void enterPressed()
          Override to handle when enter is pressed.
 javax.swing.table.TableCellRenderer getCellRenderer(int row, int column)
           
 java.lang.Object getObject(int row)
          Returns the associated row object.
 java.lang.Object[] getRowObject(int selectedRow)
          Returns the object[] of a row.
 java.lang.Object[] getSelectedRowObject()
          Get the object array of a row.
 Table.JiveTableModel getTableModel()
          Returns the table model.
 java.lang.String getToolTipText(java.awt.event.MouseEvent e)
           
 java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer, int rowIndex, int vColIndex)
           
 
Methods inherited from class org.jdesktop.swingx.JXTable
addHighlighter, adjustComponentOrientation, adminSetRowHeight, columnMarginChanged, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, configureViewportBackground, convertRowIndexToModel, convertRowIndexToView, createAndConfigureColumn, createDefaultColumnControl, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultEditors, createDefaultRenderers, createDefaultTableHeader, createLinkController, createPipelineListener, createRolloverProducer, doLayout, getColumn, getColumnControl, getColumnCount, getColumnExt, getColumnExt, getColumnFactory, getColumnMargin, getColumns, getColumns, getComponentAdapter, getComponentAdapter, getFillsViewportHeight, getFilterPipelineListener, getFilters, getHighlighterChangeListener, getHighlighters, getLinkController, getNewDefaultRenderer, getPreferredScrollableViewportSize, getRowCount, getRowModelMapper, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getSearchable, getSelectionMapper, getSelectionMode, getSortController, getSortedColumn, getSortOrder, getSortOrder, getValueAt, getVisibleRowCount, init, initializeColumnPreferredWidth, isAutoStartEditOnKeyStroke, isCellEditable, isColumnControlVisible, isDataChanged, isEditable, isHierarchical, isHorizontalScrollEnabled, isRolloverEnabled, isRowHeightEnabled, isSortable, isSortable, isSortable, isStructureChanged, isTerminateEditOnFocusLost, isUpdate, packAll, packColumn, packColumn, packSelected, packTable, prepareEditor, removeColumns, removeHighlighter, resetDefaultTableCellRendererColors, resetSortOrder, rowAtPoint, scrollCellToVisible, scrollColumnToVisible, scrollRowToVisible, setAutoResizeMode, setAutoStartEditOnKeyStroke, setColumnControl, setColumnControlVisible, setColumnFactory, setColumnMargin, setColumnSequence, setComponentOrientation, setDefaultMargins, setEditable, setFillsViewportHeight, setFilters, setHighlighters, setHorizontalScrollEnabled, setModel, setRolloverEnabled, setRowHeight, setRowHeight, setRowHeightEnabled, setSearchable, setSelectionModel, setSortable, setSortOrder, setSortOrder, setTerminateEditOnFocusLost, setValueAt, setVisibleRowCount, tableChanged, toggleSortOrder, toggleSortOrder, updateHighlighters, updateHorizontalAction, updateOnFilterContentChanged, updateUI, updateViewSizeSequence
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMoved, convertColumnIndexToModel, convertColumnIndexToView, createDefaultDataModel, createDefaultSelectionModel, createScrollPaneForTable, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPrintable, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, initializeLocalVars, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, selectAll, setAutoCreateColumnsFromModel, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, sizeColumnsToFit, sizeColumnsToFit, 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, 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, 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, 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
 

Field Detail

SELECTION_COLOR

public static final java.awt.Color SELECTION_COLOR
Define the color of row and column selections.


TOOLTIP_COLOR

public static final java.awt.Color TOOLTIP_COLOR
Define the color used in the tooltips.

Constructor Detail

Table

protected Table()
Empty Constructor.


Table

protected Table(java.lang.String[] headers)
Creates a table using the specified table headers.

Parameters:
headers - the table headers to use.
Method Detail

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
Overrides:
getToolTipText in class javax.swing.JTable

getCellRenderer

public javax.swing.table.TableCellRenderer getCellRenderer(int row,
                                                           int column)
Overrides:
getCellRenderer in class javax.swing.JTable

prepareRenderer

public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer,
                                          int rowIndex,
                                          int vColIndex)
Overrides:
prepareRenderer in class org.jdesktop.swingx.JXTable

add

public void add(java.util.List list)
Adds a list to the table model.

Parameters:
list - the list to add to the model.

getSelectedRowObject

public java.lang.Object[] getSelectedRowObject()
Get the object array of a row.

Returns:
the object array of a row.

getRowObject

public java.lang.Object[] getRowObject(int selectedRow)
Returns the object[] of a row.

Parameters:
selectedRow - the row to retrieve.
Returns:
the object[] of a row.

clearTable

public void clearTable()
Removes all columns and rows from table.


getTableModel

public Table.JiveTableModel getTableModel()
Returns the table model.

Returns:
the table model.

clearObjectMap

public void clearObjectMap()
Clears all objects from map.


addObject

public void addObject(int row,
                      java.lang.Object object)
Associate an object with a row.

Parameters:
row - - the current row
object - - the object to associate with the row.

getObject

public java.lang.Object getObject(int row)
Returns the associated row object.

Parameters:
row - - the row associated with the object.
Returns:
The object associated with the row.

enterPressed

public void enterPressed()
Override to handle when enter is pressed.