JIDE 3.5.15

com.jidesoft.grid
Class ContextSensitiveTable

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 com.jidesoft.grid.JideTable
                      extended by com.jidesoft.grid.ContextSensitiveTable
All Implemented Interfaces:
IndexChangeListener, TableAdapter, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable
Direct Known Subclasses:
NavigableTable

public class ContextSensitiveTable
extends JideTable

ContextSensitiveTable is a JTable which supports EditorContext. If you pass a regular TableModel, it just acts like JTable. However if the model is ContextSensitiveTableModel, it will use the editor context information to get the correct cell renderer and cell editor from CellRendererManager and CellEditorManager respectively. Please note cell editor/renderer assigned to table column has a higher priority. Only when the cell editor/renderer on the table column is null, the renderer/editor on CellRendererManager or CellEditorManager will then be used.

By default, we use combobox as the cell editor for boolean. If you prefer to use the check box as in regular Swing table, you can call the code below when your application starts. It will affect all your tables. If you prefer to just change one table, you would need to return BooleanCheckBoxCellEditor.CONTEXT in ContextSensitiveTableModel#getEditorContextAt method for the paticular boolean column.

 CellEditorManager.initDefaultEditor();
 final CellEditorFactory cellEditorFactory = new CellEditorFactory() {
 public CellEditor create() {
      return new BooleanCheckBoxCellEditor();
 }
 };
 CellEditorManager.registerEditor(Boolean.class, cellEditorFactory);
 CellEditorManager.registerEditor(boolean.class, cellEditorFactory);
 

CellRendererManager.initDefaultRenderer(); BooleanCheckBoxCellRenderer booleanCheckBoxCellRenderer = new BooleanCheckBoxCellRenderer(); CellRendererManager.registerRenderer(Boolean.class, booleanCheckBoxCellRenderer); CellRendererManager.registerRenderer(boolean.class, booleanCheckBoxCellRenderer);

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jidesoft.grid.JideTable
JideTable.NonContiguousTransferHandler
 
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 com.jidesoft.grid.JideTable
_batchProcessing, _cellChangeEvent, _clickCountToStart, _columnAutoResizer, _columnResizer, _headerDraggingMouseMotionListener, _rolloverCellEditor, _rolloverCellEditorListener, _rolloverColumn, _rolloverEditorComp, _rolloverEditorRemover, _rolloverRow, _rowHeights, _rowResizer, ACTION_NAME_CANCEL_EDITING, AUTO_RESIZE_ALL_COLUMNS_FILL, AUTO_RESIZE_FILL, AUTO_RESIZE_LAST_COLUMN_FILL, AUTO_RESIZE_NEXT_COLUMN_FILL, AUTO_RESIZE_SUBSEQUENT_COLUMNS_FILL, CLIENT_PROPERTY_LAZY_CALCULATE_ROW_HEIGHT, EDITOR_AUTO_COMPLETION_MODE_COLUMN, EDITOR_AUTO_COMPLETION_MODE_NONE, EDITOR_AUTO_COMPLETION_MODE_ROW, EDITOR_AUTO_COMPLETION_MODE_TABLE, PROPERTY_CLEAR_SELECTION_ON_TABLE_DATA_CHANGES, PROPERTY_EDITOR_AUTO_COMPLETION_MODE, PROPERTY_FILLS_BOTTOM, PROPERTY_FILLS_GRIDS, PROPERTY_FILLS_RIGHT, PROPERTY_LOAD_SELECTION_ON_TABLE_DATA_CHANGES, PROPERTY_NON_CONTIGUOUS_CELL_SELECTION, PROPERTY_ROW_AUTO_RESIZES, PROPERTY_SCROLL_ROW_WHEN_ROW_HEIGHT_CHANGES, PROPERTY_TABLE_SELECTION_MODEL, ROW_AUTO_RESIZES_PROPERTY
 
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
ContextSensitiveTable()
           
ContextSensitiveTable(int numRows, int numColumns)
           
ContextSensitiveTable(Object[][] rowData, Object[] columnNames)
           
ContextSensitiveTable(TableModel dm)
           
ContextSensitiveTable(TableModel dm, TableColumnModel cm)
           
ContextSensitiveTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
           
ContextSensitiveTable(Vector<?> rowData, Vector<?> columnNames)
           
 
Method Summary
protected  String convertElementToString(Object value, int row, int column)
          Get the displayed string of the specified value in designated row and column.
protected  TransferHandler createDefaultTransferHandler()
          Creates default TransferHandler.
 Class<?> getCellClassAt(int row, int column)
          Gets the cell class at the cell.
 TableCellEditor getCellEditor(int row, int column)
          Returns an appropriate cell editor for the cell specified by this row and column.
protected  TableCellEditor getCellEditorFromManager(int row, int column)
          Gets the cell editor from the CellEditorManager based on the values returned from getCellClassAt and getEditorContextAt.
 TableCellRenderer getCellRenderer(int row, int column)
          Returns an appropriate renderer for the cell specified by this row and column.
protected  TableCellRenderer getCellRendererFromManager(int row, int column)
          Gets the cell editor from the CellRendererManager based on the values returned from getCellClassAt and getEditorContextAt.
 ConverterContext getConverterContextAt(int row, int column)
          Gets the ConverterContext at the cell.
 TableCellRenderer getDefaultCellRenderer()
          Gets the default cell renderer.
 EditorContext getEditorContextAt(int row, int column)
          Gets the EditorContext at the cell.
 void invalidateCellRendererCache()
          For the performance consideration, we cached the cell renderers after getting it from CellRendererManager.
 boolean isCellEditorManagerEnabled()
          Checks if CellEditorManager is in enabled.
 boolean isCellRendererManagerEnabled()
          Checks if CellRendererManager is in enabled.
 Component prepareEditor(TableCellEditor editor, int row, int column)
           
 void setCellEditorManagerEnabled(boolean cellEditorManagerEnabled)
          By default, ContextSensitiveTable will use cell editors that are registered in CellEditorManager if the model is ContextSensitiveTableModel.
 void setCellRendererManagerEnabled(boolean cellRendererManagerEnabled)
          By default, ContextSensitiveTable will use cell renderers that are registered in CellRendererManager if the model is ContextSensitiveTableModel.
 void setDefaultCellRenderer(TableCellRenderer defaultCellRenderer)
          Sets the default cell renderer.
 void updateUI()
           
 
Methods inherited from class com.jidesoft.grid.JideTable
addCellEditorListener, addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, addRowValidator, addUndo, addUndoableEditListener, addValidator, adjustSelectionWhenColumnMoved, alwaysCalculateCellRect, calculateAutoResizedRowHeights, calculateAutoResizedRowHeights, calculateRowHeight, changeSelection, clearSelection, clearSelectionPermanently, columnSelectionChanged, configureEnclosingScrollPaneExplicitly, convertRowIndexToModel, convertRowIndexToView, createCellAutoCompletion, createDefaultColumnsFromModel, createDefaultSelectionModel, createDefaultTableHeader, createDefaultTableSelectionModel, createRowAutoScrollingListener, createRowHeights, createSortHeaderRenderer, editCellAt, editingCanceled, editingStopped, fireEditingCanceled, fireEditingStarted, fireEditingStarting, fireEditingStopped, fireEditingStopping, getActualUIClassID, getCellEditorListeners, getCellRect, getClickCountToStart, getDefaultRenderer, getDirtyRegion, getEditorAutoCompletionMode, getEditorAutoCompletionMode, getEditorCellRect, getGridColor, getGridColorProvider, getRolloverCellEditor, getRolloverColumn, getRolloverRow, getRowHeight, getRowHeights, getRowValidator, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getTableColumnWidthKeeper, getTableHeaderToolTipText, getTableHeaderToolTipText, getTableSelectionModel, getTextComponentForEditorComponent, getToolTipText, getUndoManager, getValidator, getValueAt, getVerticalGridColor, indexChanged, initTable, isAdjustEditorLocationOnModelChanged, isAlwaysRequestFocusForEditor, isAutoResizeFillMode, isAutoSelectTextWhenStartsEditing, isAutoStartCellEditing, isAutoStartCellEditingKey, isBatchProcessing, isCalculateRowHeightsOnWidthChange, isCellContentVisible, isCellFocused, isCellSelected, isClearPropertyAtStructureChange, isClearSelectionOnTableDataChanges, isColumnAutoResizable, isColumnResizable, isColumnSelected, isEnableIgnored, isFillBottom, isFillGrids, isFillRight, isFillsBottom, isFillsGrids, isFillsGridsBottom, isFillsGridsRight, isFillsRight, isKeepRowHeights, isLoadSelectionOnTableDataChanged, isNestedTableHeader, isNonContiguousCellSelection, isRollover, isRowAutoResizes, isRowHeightChanged, isRowResizable, isRowSelected, isScrollRowWhenRowHeightChanges, isSelectInsertedRows, isTablePrinting, isValidCellEditingKey, isVariousRowHeights, loadTableRowSettings, paintCellOverlay, paintCellUnderlay, paintFillHeader, prepareRenderer, processKeyBinding, releaseRendererComponent, removeCellEditorListener, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRolloverEditor, removeRowSelectionInterval, removeRowValidator, removeUndoableEditListener, removeValidator, resetTransferHandler, rolloverCellAt, rowAtPoint, saveTableRowSettings, scrollRowToVisible, selectAll, setAdjustEditorLocationOnModelChanged, setAlwaysRequestFocusForEditor, setAutoResizeMode, setAutoSelectTextWhenStartsEditing, setAutoStartCellEditing, setBatchProcessing, setCalculateRowHeightsOnWidthChange, setCellContentVisible, setClearPropertyAtStructureChange, setClearSelectionOnTableDataChanges, setClickCountToStart, setColumnAutoResizable, setColumnResizable, setColumnSelectionAllowed, setColumnSelectionInterval, setEditorAutoCompletionMode, setEnabled, setEnableIgnored, setFillBottom, setFillGrids, setFillRight, setFillsBottom, setFillsGrids, setFillsRight, setGridColorProvider, setKeepRowHeights, setLoadSelectionOnTableDataChanged, setModel, setNestedTableHeader, setNonContiguousCellSelection, setPreferredSize, setRowAutoResizes, setRowHeight, setRowHeight, setRowHeights, setRowResizable, setRowSelectionAllowed, setRowSelectionInterval, setScrollRowWhenRowHeightChanges, setSelectInsertedRows, setSortTableHeaderRenderer, setTableColumnWidthKeeper, setTableHeader, setTablePrinting, setTableSelectionModel, setVariousRowHeights, shouldCellBePaintedAsFocused, shouldCellBePaintedAsSelected, startCellEditing, tableChanged, validate, validateRow, valueChanged
 
Methods inherited from class javax.swing.JTable
columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createScrollPaneForTable, doLayout, editCellAt, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, getUpdateSelectionOnSort, initializeLocalVars, isCellEditable, isEditing, moveColumn, paramString, print, print, print, print, print, resizeAndRepaint, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setCellEditor, setCellSelectionEnabled, setColumnModel, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowMargin, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane
 
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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, 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
 
Methods inherited from interface com.jidesoft.grid.TableAdapter
getCellSelectionEnabled, getColumnClass, getColumnCount, getColumnName, getColumnSelectionAllowed, getRowCount, getRowSelectionAllowed, isCellEditable, setCellSelectionEnabled, setValueAt
 

Constructor Detail

ContextSensitiveTable

public ContextSensitiveTable()

ContextSensitiveTable

public ContextSensitiveTable(int numRows,
                             int numColumns)

ContextSensitiveTable

public ContextSensitiveTable(TableModel dm)

ContextSensitiveTable

public ContextSensitiveTable(Object[][] rowData,
                             Object[] columnNames)

ContextSensitiveTable

public ContextSensitiveTable(Vector<?> rowData,
                             Vector<?> columnNames)

ContextSensitiveTable

public ContextSensitiveTable(TableModel dm,
                             TableColumnModel cm)

ContextSensitiveTable

public ContextSensitiveTable(TableModel dm,
                             TableColumnModel cm,
                             ListSelectionModel sm)
Method Detail

createDefaultTransferHandler

protected TransferHandler createDefaultTransferHandler()
Description copied from class: JideTable
Creates default TransferHandler.

Overrides:
createDefaultTransferHandler in class JideTable
Returns:
the default TransferHandler instance.

getCellRenderer

public TableCellRenderer getCellRenderer(int row,
                                         int column)
Returns an appropriate renderer for the cell specified by this row and column. First, it will check if defaultCellRenderer is set using getDefaultCellRenderer() method. If null, it will check is isCellRendererManagerEnabled() is true. If true, it will look for the cell renderer that assigned to the specific column. Only if the renderer is still null, it will use the EditorContext information from ContextSensitiveTableModel and get the correct CellRedenerer from the CellRendererManager. In any case, if we can't determine a cell renderer, we will call super.getCellRenderer(row, column) just like regular JTable.

Overrides:
getCellRenderer in class JTable
Parameters:
row - the row of the cell to render, where 0 is the first row
column - the column of the cell to render, where 0 is the first column
Returns:
the renderer for the column and row.

getCellRendererFromManager

protected TableCellRenderer getCellRendererFromManager(int row,
                                                       int column)
Gets the cell editor from the CellRendererManager based on the values returned from getCellClassAt and getEditorContextAt.

Parameters:
row - the row index.
column - the column index.
Returns:
the cell renderer. Null if the cell editor is not registered in CellRendererManager.

invalidateCellRendererCache

public void invalidateCellRendererCache()
For the performance consideration, we cached the cell renderers after getting it from CellRendererManager. Since usually CellRendererManagerdoesn't change dynamically in the life span of a table, it should be fine. However if for whatever reason you have to change CellRendererManager on fly, you can call this method to invalidate the cache.


updateUI

public void updateUI()
Overrides:
updateUI in class JideTable

getCellEditor

public TableCellEditor getCellEditor(int row,
                                     int column)
Returns an appropriate cell editor for the cell specified by this row and column. First, we will check is isCellEditorManagerEnabled() is true. If true, it will look for the cell editor that assigned to the specific column. Only if the editor is still null, it will use the EditorContext information from ContextSensitiveTableModel and get the correct CellEditorfrom the CellRendererManager. In any case, if we can't determine a cell editor, we will call super.getCellEditor(row, column) just like regular JTable.

Overrides:
getCellEditor in class JTable
Parameters:
row - the row of the cell to edit, where 0 is the first row
column - the column of the cell to edit, where 0 is the first column
Returns:
the TableCellEditor that does the editing
See Also:
JTable.cellEditor

prepareEditor

public Component prepareEditor(TableCellEditor editor,
                               int row,
                               int column)
Overrides:
prepareEditor in class JideTable

getCellEditorFromManager

protected TableCellEditor getCellEditorFromManager(int row,
                                                   int column)
Gets the cell editor from the CellEditorManager based on the values returned from getCellClassAt and getEditorContextAt.

Parameters:
row - the row index.
column - the column index.
Returns:
the cell editor. Null if the cell editor is not registered in CellEditorManager.

isCellEditorManagerEnabled

public boolean isCellEditorManagerEnabled()
Checks if CellEditorManager is in enabled. Default is true.

Returns:
true if CellEditorManager is enabled. Otherwise false.

setCellEditorManagerEnabled

public void setCellEditorManagerEnabled(boolean cellEditorManagerEnabled)
By default, ContextSensitiveTable will use cell editors that are registered in CellEditorManager if the model is ContextSensitiveTableModel. However if for some reason you don't want this feature, you can call this method to enable or disable it.

Parameters:
cellEditorManagerEnabled - true to enable CellEditorManager. False to disable it.

isCellRendererManagerEnabled

public boolean isCellRendererManagerEnabled()
Checks if CellRendererManager is in enabled. Default is true.

Returns:
true if CellRendererManager is enabled. Otherwise false.

setCellRendererManagerEnabled

public void setCellRendererManagerEnabled(boolean cellRendererManagerEnabled)
By default, ContextSensitiveTable will use cell renderers that are registered in CellRendererManager if the model is ContextSensitiveTableModel. However if for some reason you don't want this feature, you can call this method to enable or disable it.

Parameters:
cellRendererManagerEnabled - true to enable CellRendererManager. False to disable it.

getDefaultCellRenderer

public TableCellRenderer getDefaultCellRenderer()
Gets the default cell renderer. This is the first cell renderer getCellRenderer(int, int) will look for. In the other word, if you ever set it using setDefaultCellRenderer(javax.swing.table.TableCellRenderer), it will be guaranteed to be used (unless subclass of it overrides getCellRenderer(int, int) to return something else).

Returns:
the default cell renderer.

setDefaultCellRenderer

public void setDefaultCellRenderer(TableCellRenderer defaultCellRenderer)
Sets the default cell renderer.

Parameters:
defaultCellRenderer - the default cell renderer. This renderer will be used by all cells.
See Also:
getDefaultCellRenderer()

getConverterContextAt

public ConverterContext getConverterContextAt(int row,
                                              int column)
Gets the ConverterContext at the cell.

Parameters:
row - the row index. It is the view row index.
column - the column index. It is the view column index.
Returns:
the ConverterContext at the specified cell.If the model is a ContextSensitiveTableModel, it will return getConverterContextAt method of the model after converting the column to model column index. If not, it will return null.

getEditorContextAt

public EditorContext getEditorContextAt(int row,
                                        int column)
Gets the EditorContext at the cell.

Parameters:
row - the row index. It is the view row index.
column - the column index. It is the view column index.
Returns:
the EditorContext at the specified cell. If the model is a ContextSensitiveTableModel, it will return getEditorContextAt method of the model after converting the column to model column index. If not, it will return null.

getCellClassAt

public Class<?> getCellClassAt(int row,
                               int column)
Gets the cell class at the cell.

Parameters:
row - the row index. It is the view row index.
column - the column index. It is the view column index.
Returns:
the cell class at the specified cell. If the model is a ContextSensitiveTableModel, it will return getCellClassAt method of the model after converting the column to model column index. If not, it will return getColumnClass at of the model.

convertElementToString

protected String convertElementToString(Object value,
                                        int row,
                                        int column)
Description copied from class: JideTable
Get the displayed string of the specified value in designated row and column.

Overrides:
convertElementToString in class JideTable
Parameters:
value - the cell value
row - the row of the cell
column - the column of the cell
Returns:
the string to be displayed in the cell on renderering.

JIDE 3.5.15