org.tbee.swing.table
Class JTable

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.tbee.swing.table.JTable
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable, org.jdesktop.swingx.event.TableColumnModelExtListener
Direct Known Subclasses:
JpaEntitySearchResultTable, JTableForEdit, JTableRowHeader

public class JTable
extends org.jdesktop.swingx.JXTable

This is an extended JTable that provides a.o. alternating row colors and a focus handling patch. This table is based upon JXTable, if the provided TableModel is not a TableSorter, the JXTable autosorting is activated. TBEE 2007-02-09: JTableAutoSizer may resize columns, if it does, for some reason the following editCellAt is not done correctly. Even though the JTable itself firmly believes it is editing. Repeating the edit cell instruction works around this problem. http://forum.java.sun.com/thread.jspa?threadID=5134899

Version:
$Revision: 1.134 $
Author:
$Author: toeukpap $
See Also:
Serialized Form

Nested Class Summary
protected static class JTable.OnFocusStopEditHandler
           
 
Nested classes/interfaces inherited from class org.jdesktop.swingx.JXTable
org.jdesktop.swingx.JXTable.BooleanEditor, org.jdesktop.swingx.JXTable.GenericEditor, org.jdesktop.swingx.JXTable.NumberEditor, org.jdesktop.swingx.JXTable.TableAdapter
 
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
protected  JTable.OnFocusStopEditHandler iFocusLostHandler
           
protected  JTableColumnResizer iJTableColumnResizer
           
protected  JTableRowResizer iJTableRowResizer
           
static String SORTERCHANGED_PROPERTYID
           
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Fields inherited from class org.jdesktop.swingx.JXTable
compoundHighlighter, dataAdapter, editorRemover, FOCUS_NEXT_COMPONENT, FOCUS_PREVIOUS_COMPONENT, HORIZONTALSCROLL_ACTION_COMMAND, isXTableRowHeightSet, MATCH_HIGHLIGHTER, PACKALL_ACTION_COMMAND, PACKSELECTED_ACTION_COMMAND, resetDefaultTableCellRendererHighlighter, searchable, UIPREFIX, USE_DTCR_COLORMEMORY_HACK
 
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
JTable()
           
JTable(int numRows, int numColumns)
           
JTable(Object[][] rowData, Object[] columnNames)
           
JTable(TableModel data)
           
JTable(TableModel data, TableColumnModel columns)
           
JTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
           
JTable(Vector rowData, Vector columnNames)
           
 
Method Summary
 void cancelEdit()
          Cancel the edit
 void changeSelection(int row, int column, boolean toggle, boolean extend)
          Prevent resizing of the columns to change the selection
 void changeSelectionForced(int row, int column, boolean toggle, boolean extend)
          Prevent resizing of the columns to change the selection
 void columnAdded(TableColumnModelEvent e)
          Tells listeners that a column was added to the model.
 void columnMarginChanged(ChangeEvent e)
          For monitoring preference related changes with auto save
 void columnMoved(TableColumnModelEvent e)
          a column move must abort the edit
 void columnRemoved(TableColumnModelEvent e)
          Tells listeners that a column was removed from the model.
 Color getAlternateRowColor()
           
 boolean getAlternatingRowColor()
           
 boolean getAutoSavePreferences()
           
 TableCellEditor getCellEditor(int row, int column)
          allow for per cell editors (this does not take sorting into account)
 TableCellRenderer getCellRenderer(int row, int column)
          allow for per cell renderer (this does not take sorting into account)
 TableCellEditor getColumnEditor(int column)
           
 TableCellRenderer getColumnRenderer(int column)
           
 boolean getColumnsAreResizable()
          turn resizing on/of
 boolean getDisabledTableShowsCellsAsDisabled()
          DisabledTableShowsCellsAsDisabled
 String getNameForPreferences()
           
 boolean getResizableRowsAreAllSameHeight()
           
 boolean getRowHeightAutomatical()
          allow rows to size to a single size value
 boolean getRowHeightIndividualAutomatical()
          allow individual rows to size
 boolean getRowsAreResizable()
          turn resizing on/of
 Color getSecondAlternateRowColor()
           
 boolean getShowValueExceptionsInDialog()
           
 boolean getSwallowSetValueExceptions()
           
 TableModel getTableModel()
          wrapped to cast the model to TBEE's model
 String getToolipAt(int row, int column)
          Show get value exceptions
 boolean getUneditableCellsShowAsDisabled()
          UneditableCellsShowAsDisabled
 boolean getUneditableTableShowsCellsAsDisabled()
          UneditableTableShowsCellsAsDisabled
 Object getValueAt(int row, int column)
          Show get value exceptions
 String getValueAtAsString(int row, int col)
          Convert cell values to string (needed by JTableMultipleCellsCopyAdapter).
protected  boolean isGetValueAtForEditor()
          is the current getValueAt for an editor or a renderer
 boolean isPrinting()
          is the table currently being printed?
 Component prepareEditor(TableCellEditor editor, int row, int column)
          auto set row height
 Component prepareRenderer(TableCellRenderer renderer, int row, int col)
          Set the background of the component
 void print(Graphics g)
          Remember if we are being printed
 void printBindings()
           
 void repaintTableHeader()
          Force a repaint on the column headers
protected  void resetDefaultTableCellRendererColors(Component renderer, int row, int column)
          Method to apply a hack around DefaultTableCellRenderer "color memory" (Issue #258-swingx).
 void restoreAutoSavePreferences()
          restore the "autosave" setting itself
 void restoreColumnOrderPreferences()
           
 void restoreColumnVisiblePreferences()
           
 void restoreColumnWidthPreferences()
           
 void restorePreferences()
          restore all preferences
 void saveAutoSavePreferences()
          remember the "autosave" setting itself
 void saveColumnOrderPreferences()
           
 void saveColumnVisiblePreferences()
           
 void saveColumnWidthPreferences()
           
 void savePreferences()
          save all preferences
 void setAlternateRowColor(Color value)
          the color to use for the alternating background color for rows
 void setAlternatingRowColor(boolean value)
          alternate the background color for rows
 void setAutoResizeMode(int v)
          For monitoring preference related changes with auto save
 void setAutoSavePreferences(boolean value)
          AutoSavePreferences
 void setCellEditor(int row, int column, TableCellEditor tableCellEditor)
           
 void setCellRenderer(int row, int column, TableCellRenderer tableCellRenderer)
           
 void setColumnEditor(int column, TableCellEditor cellEditor)
          set a editor for a whole column
 void setColumnRenderer(int column, TableCellRenderer renderer)
          set a renderer for a whole column
 void setColumnsAreResizable(boolean value)
           
 void setDisabledTableShowsCellsAsDisabled(boolean value)
           
 void setEditable(boolean editable)
          must repaint because cells may be shown disabled
 void setEnabled(boolean editable)
          must repaint because cells may be shown disabled
 void setModel(TableModel m)
          Determine if we use inner sorting or by JXTable
 void setName(String value)
          Upon setting the name, any preferences are restored
 void setNameForPreferences(String value)
          NameForPreferences; name is also used for other things, like the SwingEventDispatcher
 void setResizableRowsAreAllSameHeight(boolean value)
           
 void setRowHeight(int row, int height)
          PCE changes to row heights
 void setRowHeightAutomatical(boolean value)
           
 void setRowHeightIndividualAutomatical(boolean value)
           
 void setRowsAreResizable(boolean value)
           
 void setRowSorter(RowSorter<? extends TableModel> sorter)
          install a table header renderer that shows multiple sort icons when using JDK6 sorting
 void setSecondAlternateRowColor(Color value)
          the second color to use for the alternating background color for rows
 void setShowValueExceptionsInDialog(boolean value)
          if an exception occurs during getValue or setValue, show a dialog
 void setSwallowSetValueExceptions(boolean value)
          if an exception occurs during getValue or setValue, log it and then make it go away
 void setUneditableCellsShowAsDisabled(boolean value)
           
 void setUneditableTableShowsCellsAsDisabled(boolean value)
           
 void setValueAt(Object aValue, int row, int column)
          Show set value exceptions
 void setValueAtAsString(String value, int row, int col)
          Convert cell values to string (needed by JTableMultipleCellsCopyAdapter).
 void sorterChanged(RowSorterEvent e)
          If the sorter is changed, our view changed, so we need to inform our listeners: mimick a PCE (The event is fired by the TableRowSorter class; we could expect our listeners to subscribe to that, but I feel this also is a JTable behavior.)
 void stopEdit()
          Stop the edit by either accepting or cancelling
 void tableChanged(TableModelEvent e)
          Cancel edits if the model changed
 JTable withDisabledTableShowsCellsAsDisabled(boolean value)
           
 JTable withNameForPreferences(String value)
           
 JTable withUneditableCellsShowAsDisabled(boolean value)
           
 JTable withUneditableTableShowsCellsAsDisabled(boolean value)
           
 
Methods inherited from class org.jdesktop.swingx.JXTable
addHighlighter, adjustComponentOrientation, adminSetRowHeight, columnPropertyChange, columnSelectionChanged, configureColumnControl, configureEnclosingScrollPane, configureSorterProperties, createDefaultColumnControl, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultEditors, createDefaultRenderers, createDefaultRowSorter, createDefaultStringValueRegistry, createDefaultTableHeader, createHighlighterChangeListener, createLinkController, createRolloverProducer, doFind, doLayout, editCellAt, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getColumn, getColumnControl, getColumnCount, getColumnExt, getColumnExt, getColumnFactory, getColumnMargin, getColumns, getColumns, getComponentAdapter, getComponentAdapter, getCompoundHighlighter, getControlsSorterProperties, getHighlighterChangeListener, getHighlighters, getLinkController, getNewDefaultRenderer, getPreferredScrollableViewportSize, getRowFilter, getScrollableTracksViewportWidth, getSearchable, getSelectionMode, getSortController, getSortedColumn, getSortOrder, getSortOrder, getSortOrderCycle, getSortsOnUpdates, getStringAt, getStringValueRegistry, getUIString, getUIString, getVisibleColumnCount, getVisibleRowCount, hasSortController, initializeColumnPreferredWidth, initializeColumnWidths, isAutoStartEditOnKeyStroke, isCellEditable, isColumnControlVisible, isDataChanged, isEditable, isFocusCycleRoot, isHorizontalScrollEnabled, isRolloverEnabled, isRowHeightEnabled, isSortable, isSortable, isSortable, isStructureChanged, isTerminateEditOnFocusLost, isUpdate, packAll, packColumn, packColumn, packSelected, packTable, removeEditor, removeHighlighter, removeNotify, resetSortOrder, rowAtPoint, scrollCellToVisible, scrollColumnToVisible, scrollRowToVisible, setAutoCreateRowSorter, setAutoStartEditOnKeyStroke, setColumnControl, setColumnControlVisible, setColumnFactory, setColumnMargin, setColumnModel, setColumnSequence, setComponentOrientation, setDefaultRenderer, setFillsViewportHeight, setGridColor, setHighlighters, setHorizontalScrollEnabled, setLocale, setPreferredScrollableViewportSize, setRolloverEnabled, setRowFilter, setRowHeight, setRowHeightEnabled, setSearchable, setSelectionBackground, setSelectionForeground, setShowGrid, setShowGrid, setSortable, setSortOrder, setSortOrder, setSortOrderCycle, setSortsOnUpdates, setTerminateEditOnFocusLost, setVisibleColumnCount, setVisibleRowCount, toggleSortOrder, toggleSortOrder, transferFocus, transferFocusBackward, unconfigureColumnControl, unconfigureEnclosingScrollPane, updateColumnControlUI, updateColumnUI, updateHighlighterUI, updateHorizontalAction, updateLocaleActionState, updateLocaleState, updateRowHeightUI, updateUI
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, clearSelection, columnAtPoint, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultDataModel, createDefaultSelectionModel, createScrollPaneForTable, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoResizeMode, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, initializeLocalVars, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeRowSelectionInterval, resizeAndRepaint, selectAll, setAutoCreateColumnsFromModel, setCellEditor, setCellSelectionEnabled, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setIntercellSpacing, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionMode, setSelectionModel, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, sizeColumnsToFit, sizeColumnsToFit, 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, 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, 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, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

iJTableColumnResizer

protected JTableColumnResizer iJTableColumnResizer

iJTableRowResizer

protected JTableRowResizer iJTableRowResizer

SORTERCHANGED_PROPERTYID

public static final String SORTERCHANGED_PROPERTYID
See Also:
Constant Field Values

iFocusLostHandler

protected JTable.OnFocusStopEditHandler iFocusLostHandler
Constructor Detail

JTable

public JTable()

JTable

public JTable(TableModel data)

JTable

public JTable(TableModel data,
              TableColumnModel columns)

JTable

public JTable(TableModel dm,
              TableColumnModel cm,
              ListSelectionModel sm)

JTable

public JTable(int numRows,
              int numColumns)

JTable

public JTable(Vector rowData,
              Vector columnNames)

JTable

public JTable(Object[][] rowData,
              Object[] columnNames)
Method Detail

getTableModel

public TableModel getTableModel()
wrapped to cast the model to TBEE's model

Returns:

setShowValueExceptionsInDialog

public void setShowValueExceptionsInDialog(boolean value)
if an exception occurs during getValue or setValue, show a dialog


getShowValueExceptionsInDialog

public boolean getShowValueExceptionsInDialog()

setSwallowSetValueExceptions

public void setSwallowSetValueExceptions(boolean value)
if an exception occurs during getValue or setValue, log it and then make it go away


getSwallowSetValueExceptions

public boolean getSwallowSetValueExceptions()

setAlternatingRowColor

public void setAlternatingRowColor(boolean value)
alternate the background color for rows


getAlternatingRowColor

public boolean getAlternatingRowColor()

setAlternateRowColor

public void setAlternateRowColor(Color value)
the color to use for the alternating background color for rows


getAlternateRowColor

public Color getAlternateRowColor()

setSecondAlternateRowColor

public void setSecondAlternateRowColor(Color value)
the second color to use for the alternating background color for rows


getSecondAlternateRowColor

public Color getSecondAlternateRowColor()

prepareRenderer

public Component prepareRenderer(TableCellRenderer renderer,
                                 int row,
                                 int col)
Set the background of the component

Overrides:
prepareRenderer in class org.jdesktop.swingx.JXTable

getUneditableCellsShowAsDisabled

public boolean getUneditableCellsShowAsDisabled()
UneditableCellsShowAsDisabled


setUneditableCellsShowAsDisabled

public void setUneditableCellsShowAsDisabled(boolean value)

withUneditableCellsShowAsDisabled

public JTable withUneditableCellsShowAsDisabled(boolean value)

getDisabledTableShowsCellsAsDisabled

public boolean getDisabledTableShowsCellsAsDisabled()
DisabledTableShowsCellsAsDisabled


setDisabledTableShowsCellsAsDisabled

public void setDisabledTableShowsCellsAsDisabled(boolean value)

withDisabledTableShowsCellsAsDisabled

public JTable withDisabledTableShowsCellsAsDisabled(boolean value)

getUneditableTableShowsCellsAsDisabled

public boolean getUneditableTableShowsCellsAsDisabled()
UneditableTableShowsCellsAsDisabled


setUneditableTableShowsCellsAsDisabled

public void setUneditableTableShowsCellsAsDisabled(boolean value)

withUneditableTableShowsCellsAsDisabled

public JTable withUneditableTableShowsCellsAsDisabled(boolean value)

setEditable

public void setEditable(boolean editable)
must repaint because cells may be shown disabled

Overrides:
setEditable in class org.jdesktop.swingx.JXTable

setEnabled

public void setEnabled(boolean editable)
must repaint because cells may be shown disabled

Overrides:
setEnabled in class JComponent

prepareEditor

public Component prepareEditor(TableCellEditor editor,
                               int row,
                               int column)
auto set row height

Overrides:
prepareEditor in class org.jdesktop.swingx.JXTable

isGetValueAtForEditor

protected boolean isGetValueAtForEditor()
is the current getValueAt for an editor or a renderer


columnMoved

public void columnMoved(TableColumnModelEvent e)
a column move must abort the edit

Specified by:
columnMoved in interface TableColumnModelListener
Overrides:
columnMoved in class JTable

columnAdded

public void columnAdded(TableColumnModelEvent e)
Tells listeners that a column was added to the model.

Specified by:
columnAdded in interface TableColumnModelListener
Overrides:
columnAdded in class org.jdesktop.swingx.JXTable

columnRemoved

public void columnRemoved(TableColumnModelEvent e)
Tells listeners that a column was removed from the model.

Specified by:
columnRemoved in interface TableColumnModelListener
Overrides:
columnRemoved in class JTable

getColumnsAreResizable

public boolean getColumnsAreResizable()
turn resizing on/of


setColumnsAreResizable

public void setColumnsAreResizable(boolean value)

getResizableRowsAreAllSameHeight

public boolean getResizableRowsAreAllSameHeight()
Returns:

setResizableRowsAreAllSameHeight

public void setResizableRowsAreAllSameHeight(boolean value)

getRowsAreResizable

public boolean getRowsAreResizable()
turn resizing on/of


setRowsAreResizable

public void setRowsAreResizable(boolean value)

changeSelection

public void changeSelection(int row,
                            int column,
                            boolean toggle,
                            boolean extend)
Prevent resizing of the columns to change the selection

Overrides:
changeSelection in class JTable

changeSelectionForced

public void changeSelectionForced(int row,
                                  int column,
                                  boolean toggle,
                                  boolean extend)
Prevent resizing of the columns to change the selection


setRowHeight

public void setRowHeight(int row,
                         int height)
PCE changes to row heights

Overrides:
setRowHeight in class JTable

getRowHeightIndividualAutomatical

public boolean getRowHeightIndividualAutomatical()
allow individual rows to size


setRowHeightIndividualAutomatical

public void setRowHeightIndividualAutomatical(boolean value)

getRowHeightAutomatical

public boolean getRowHeightAutomatical()
allow rows to size to a single size value


setRowHeightAutomatical

public void setRowHeightAutomatical(boolean value)

setColumnRenderer

public void setColumnRenderer(int column,
                              TableCellRenderer renderer)
set a renderer for a whole column


getColumnRenderer

public TableCellRenderer getColumnRenderer(int column)

setColumnEditor

public void setColumnEditor(int column,
                            TableCellEditor cellEditor)
set a editor for a whole column


getColumnEditor

public TableCellEditor getColumnEditor(int column)

getCellRenderer

public TableCellRenderer getCellRenderer(int row,
                                         int column)
allow for per cell renderer (this does not take sorting into account)

Overrides:
getCellRenderer in class org.jdesktop.swingx.JXTable

setCellRenderer

public void setCellRenderer(int row,
                            int column,
                            TableCellRenderer tableCellRenderer)

getCellEditor

public TableCellEditor getCellEditor(int row,
                                     int column)
allow for per cell editors (this does not take sorting into account)

Overrides:
getCellEditor in class JTable

setCellEditor

public void setCellEditor(int row,
                          int column,
                          TableCellEditor tableCellEditor)

setModel

public void setModel(TableModel m)
Determine if we use inner sorting or by JXTable

Overrides:
setModel in class org.jdesktop.swingx.JXTable

print

public void print(Graphics g)
Remember if we are being printed

Overrides:
print in class JComponent

isPrinting

public boolean isPrinting()
is the table currently being printed?

Returns:

getValueAtAsString

public String getValueAtAsString(int row,
                                 int col)
Convert cell values to string (needed by JTableMultipleCellsCopyAdapter). The reason this method is placed in JTable and not in JTableMultipleCellsCopyAdapter is because this way it can easily be overridden to include special logic for cells.


getValueAt

public Object getValueAt(int row,
                         int column)
Show get value exceptions

Overrides:
getValueAt in class JTable

setValueAt

public void setValueAt(Object aValue,
                       int row,
                       int column)
Show set value exceptions

Overrides:
setValueAt in class org.jdesktop.swingx.JXTable

setValueAtAsString

public void setValueAtAsString(String value,
                               int row,
                               int col)
Convert cell values to string (needed by JTableMultipleCellsCopyAdapter). The reason this method is placed in JTable and not in JTableMultipleCellsCopyAdapter is because this way it can easily be overridden to include specialy logic for cells.


getToolipAt

public String getToolipAt(int row,
                          int column)
Show get value exceptions


setNameForPreferences

public void setNameForPreferences(String value)
NameForPreferences; name is also used for other things, like the SwingEventDispatcher


getNameForPreferences

public String getNameForPreferences()

withNameForPreferences

public JTable withNameForPreferences(String value)

setAutoSavePreferences

public void setAutoSavePreferences(boolean value)
AutoSavePreferences


getAutoSavePreferences

public boolean getAutoSavePreferences()

savePreferences

public void savePreferences()
save all preferences


restorePreferences

public void restorePreferences()
restore all preferences


setName

public void setName(String value)
Upon setting the name, any preferences are restored

Overrides:
setName in class Component

columnMarginChanged

public void columnMarginChanged(ChangeEvent e)
For monitoring preference related changes with auto save

Specified by:
columnMarginChanged in interface TableColumnModelListener
Overrides:
columnMarginChanged in class org.jdesktop.swingx.JXTable

setAutoResizeMode

public void setAutoResizeMode(int v)
For monitoring preference related changes with auto save

Overrides:
setAutoResizeMode in class org.jdesktop.swingx.JXTable

saveColumnWidthPreferences

public void saveColumnWidthPreferences()

restoreColumnWidthPreferences

public void restoreColumnWidthPreferences()

saveColumnOrderPreferences

public void saveColumnOrderPreferences()

restoreColumnOrderPreferences

public void restoreColumnOrderPreferences()

saveColumnVisiblePreferences

public void saveColumnVisiblePreferences()

restoreColumnVisiblePreferences

public void restoreColumnVisiblePreferences()

saveAutoSavePreferences

public void saveAutoSavePreferences()
remember the "autosave" setting itself


restoreAutoSavePreferences

public void restoreAutoSavePreferences()
restore the "autosave" setting itself


repaintTableHeader

public void repaintTableHeader()
Force a repaint on the column headers


setRowSorter

public void setRowSorter(RowSorter<? extends TableModel> sorter)
install a table header renderer that shows multiple sort icons when using JDK6 sorting

Overrides:
setRowSorter in class org.jdesktop.swingx.JXTable

printBindings

public void printBindings()

stopEdit

public void stopEdit()
Stop the edit by either accepting or cancelling


cancelEdit

public void cancelEdit()
Cancel the edit


tableChanged

public void tableChanged(TableModelEvent e)
Cancel edits if the model changed

Specified by:
tableChanged in interface TableModelListener
Overrides:
tableChanged in class org.jdesktop.swingx.JXTable

sorterChanged

public void sorterChanged(RowSorterEvent e)
If the sorter is changed, our view changed, so we need to inform our listeners: mimick a PCE (The event is fired by the TableRowSorter class; we could expect our listeners to subscribe to that, but I feel this also is a JTable behavior.)

Specified by:
sorterChanged in interface RowSorterListener
Overrides:
sorterChanged in class JTable

resetDefaultTableCellRendererColors

protected void resetDefaultTableCellRendererColors(Component renderer,
                                                   int row,
                                                   int column)
Method to apply a hack around DefaultTableCellRenderer "color memory" (Issue #258-swingx). Applies the hack if the client property USE_DTCR_COLORMEMORY_HACK having the value of Boolean.TRUE, does nothing otherwise. The property is true by default.

The hack consists of applying a specialized Highlighter to force reset the color "memory" of DefaultTableCellRenderer. Note that the hack is applied always, that is even if there are no custom Highlighters.

Client code which solves the problem at the core (that is in a well-behaved DefaultTableCellRenderer) can disable the hack by removing the client property or by subclassing and override this to do nothing.

Overrides:
resetDefaultTableCellRendererColors in class org.jdesktop.swingx.JXTable
Parameters:
renderer - the TableCellRenderer to hack
row - the row of the cell to render
column - the column index of the cell to render
See Also:
prepareRenderer(TableCellRenderer, int, int), JXTable.USE_DTCR_COLORMEMORY_HACK, org.jdesktop.swingx.decorator.ResetDTCRColorHighlighter


Copyright © 2011 KnowledgePlaza. All Rights Reserved.