JIDE 3.5.15

com.jidesoft.grid
Class CellStyleTable

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

public class CellStyleTable
extends NavigableTable

CellStyleTable introduces cell styles to table. As long as the table model implements StyleModel and its StyleModel.isCellStyleOn() returns true, CellStyleTable will use the CellStyle that is returned from StyleModel.getCellStyleAt(int, int) to customize the cell renderer to reflect the cell style as much as possible.

User can provide their own cell renderer. For some cell renderers, not all styles apply.

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
protected  List<CellStyle> _cellStyleList
           
static String PROPERTY_FILLS_SELECTION
           
static String PROPERTY_FILLS_VIEWPORT_WITH_STRIPE
           
 
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
CellStyleTable()
           
CellStyleTable(int numRows, int numColumns)
           
CellStyleTable(Object[][] rowData, Object[] columnNames)
           
CellStyleTable(TableModel dm)
           
CellStyleTable(TableModel dm, TableColumnModel cm)
           
CellStyleTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
           
CellStyleTable(Vector<?> rowData, Vector<?> columnNames)
           
 
Method Summary
 void addCellStyleCustomizer(CellStyleCustomizer customizer)
          Adds a new CellStyleCustomizer.
 void clearCellStyleCustomizers()
          Clears all the CellStyleCustomizers.
protected  void collectCellStyles(int row, int column)
          Collects the cell style of the cell and put into a sorted ArrayList which is a field called _cellStyleList.
protected  Component configureEditorComponent(int row, int column, Component component)
          Changes the style of editor component using the CellStyle object from StyleModel.
protected  Component configureRendererComponent(int row, int column, Component component)
          Changes the style of renderer component using the CellStyle object from StyleModel.
protected  void customizeEditorComponent(int row, int column, Component component, CellStyle cellStyle)
          Changes the style of editor component using the CellStyle object from StyleModel the CellStyle of the corresponding cell is not null.
protected  void customizeRendererComponent(int row, int column, Component component, CellStyle cellStyle)
          Changes the style of renderer component using the CellStyle object from StyleModel when CellStyle of corresponding cell is not null.
 CellStyle getCellStyleAt(int row, int column)
          Get the merged cell style for the cell from all its underlying StyleModel.
 CellStyleCustomizer[] getCellStyleCustomizers()
          Gets all the CellStyleCustomizers.
 CellStyleProvider getCellStyleProvider()
          Gets the CellStyleProvider for the table.
 CellStyle[] getCellStyles(int row, int column)
          Gets all cell styles associated with the cell.
 CellStyle getFocusCellStyle()
          Gets the cell style for the focus cell.
 TableModel getNextStyleModel(TableModel model)
          Gets the next style model of the specified model.
 TableModel getStyleModel()
          Gets style model.
 TableStyleProvider getTableStyleProvider()
          Gets the TableStyleProvider for the table.
 boolean isFillsSelection()
          Gets the flag indicating if the selection should be filled if JTable.getAutoResizeMode() returns JideTable.AUTO_RESIZE_FILL.
 boolean isFillsViewportWithStripe()
          Get the flag indicating if the viewport will be filled with stripe if possible.
protected  void mergeCellStyle(CellStyle mergedCellStyle, CellStyle originalCellStyle)
          Merges the styles from the originalCellStyle to mergedCellStyle only if the mergedCellStyle doesn't have the particular style set before.
protected  CellStyle mergeCellStyles(List<CellStyle> cellStyles)
          Merges the cell styles in the list into one CellStyle.
protected  boolean needPaintStripedBackground()
          Checks if the striped background of non-table area should be painted.
 void paintCellOverlay(Graphics g, Component component, int row, int column, Rectangle cellRect)
          Overrides this method to paint the overlayBorder and the overlayCellPainter from the CellStyle.
 void paintCellUnderlay(Graphics g, Component component, int row, int column, Rectangle cellRect)
          Overrides this method to paint the underlayCellPainter from the CellStyle.
protected  void paintComponent(Graphics g)
           
 Component prepareEditor(TableCellEditor editor, int row, int column)
          Override this method to get the style from CellStyle defined by StyleModel and set it to component return from super.prepareEditor().
 Component prepareRenderer(TableCellRenderer renderer, int row, int column)
          Override this method to get the style from CellStyle defined by StyleModel and set it to component return from super.prepareRenderer().
 void releaseRendererComponent(TableCellRenderer renderer, int row, int column, Component component)
           
 void removeCellStyleCustomizer(CellStyleCustomizer customizer)
          Removes an existing CellStyleCustomizer.
 void setCellStyleProvider(CellStyleProvider cellStyleProvider)
          Sets the CellStyleProvider for the table.
 void setFillsSelection(boolean fillsSelection)
          Sets the flag indicating if the selection should be filled if JTable.getAutoResizeMode() returns JideTable.AUTO_RESIZE_FILL.
 void setFillsViewportWithStripe(boolean fillsViewportWithStripe)
          Set the flag indicating if the viewport will be filled with stripe if possible.
 void setFocusCellStyle(CellStyle focusCellStyle)
          Sets the cell style for the focus cell.
 void setTableStyleProvider(TableStyleProvider styleProvider)
          Sets the TableStyleProvider for the table.
 
Methods inherited from class com.jidesoft.grid.NavigableTable
changeSelection, findNearestNavigableCellInColumn, findNearestNavigableCellInRow, findNextNavigableCell, findNextNavigableCellInColumn, findNextNavigableCellInRow, findNextNavigableCellVertically, findPreviousNavigableCell, findPreviousNavigableCellInColumn, findPreviousNavigableCellInRow, findPreviousNavigableCellVertically, getNavigableModel, getNextNavigableModel, isCellNavigable, isNavigationKey, processKeyBinding
 
Methods inherited from class com.jidesoft.grid.ContextSensitiveTable
convertElementToString, createDefaultTransferHandler, getCellClassAt, getCellEditor, getCellEditorFromManager, getCellRenderer, getCellRendererFromManager, getConverterContextAt, getDefaultCellRenderer, getEditorContextAt, invalidateCellRendererCache, isCellEditorManagerEnabled, isCellRendererManagerEnabled, setCellEditorManagerEnabled, setCellRendererManagerEnabled, setDefaultCellRenderer, updateUI
 
Methods inherited from class com.jidesoft.grid.JideTable
addCellEditorListener, addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, addRowValidator, addUndo, addUndoableEditListener, addValidator, adjustSelectionWhenColumnMoved, alwaysCalculateCellRect, calculateAutoResizedRowHeights, calculateAutoResizedRowHeights, calculateRowHeight, 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, paintFillHeader, 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, 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
 

Field Detail

PROPERTY_FILLS_VIEWPORT_WITH_STRIPE

public static final String PROPERTY_FILLS_VIEWPORT_WITH_STRIPE
See Also:
Constant Field Values

PROPERTY_FILLS_SELECTION

public static final String PROPERTY_FILLS_SELECTION
See Also:
Constant Field Values

_cellStyleList

protected final List<CellStyle> _cellStyleList
Constructor Detail

CellStyleTable

public CellStyleTable()

CellStyleTable

public CellStyleTable(int numRows,
                      int numColumns)

CellStyleTable

public CellStyleTable(TableModel dm)

CellStyleTable

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

CellStyleTable

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

CellStyleTable

public CellStyleTable(TableModel dm,
                      TableColumnModel cm)

CellStyleTable

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

getStyleModel

public TableModel getStyleModel()
Gets style model. By default it just returns the value of getModel(). However if getModel() is TableModelWrapper, it will use TableModelWrapperUtils.getActualTableModel(javax.swing.table.TableModel, Class) to find an instance of StyleModel. If it can finds one, it will return null.

Returns:
the style model. The return value is either null or an instance of StyleModel.

getNextStyleModel

public TableModel getNextStyleModel(TableModel model)
Gets the next style model of the specified model. If the model is not an instance of TableModelWrapper, null will be returned as there is no next style model after it. If it is a TableModelWrapper, it will try to find the first inner model that is a style model. If there is a style model, it will return it. Otherwise, null will be returned.

Parameters:
model - the model.
Returns:
the next style model. The return value may or may not be an instance of StyleModel.

paintCellUnderlay

public void paintCellUnderlay(Graphics g,
                              Component component,
                              int row,
                              int column,
                              Rectangle cellRect)
Overrides this method to paint the underlayCellPainter from the CellStyle.

Overrides:
paintCellUnderlay in class JideTable
Parameters:
g - the Graphics
component - the component
row - the row index
column - the column index
cellRect - the cell rectangle of the cell at the specified row index and column index.
Since:
3.3.4

releaseRendererComponent

public void releaseRendererComponent(TableCellRenderer renderer,
                                     int row,
                                     int column,
                                     Component component)
Overrides:
releaseRendererComponent in class JideTable

paintCellOverlay

public void paintCellOverlay(Graphics g,
                             Component component,
                             int row,
                             int column,
                             Rectangle cellRect)
Overrides this method to paint the overlayBorder and the overlayCellPainter from the CellStyle.

Overrides:
paintCellOverlay in class JideTable
Parameters:
g - the Graphics
component - the component
row - the row index
column - the column index
cellRect - the cell rectangle of the cell at the specified row index and column index.

prepareRenderer

public Component prepareRenderer(TableCellRenderer renderer,
                                 int row,
                                 int column)
Override this method to get the style from CellStyle defined by StyleModel and set it to component return from super.prepareRenderer().

Overrides:
prepareRenderer in class JideTable
Parameters:
renderer - the renderer at the specified cell.
row - the row index.
column - the column index.
Returns:
the component used by paint the cell at the specified row and column.

prepareEditor

public Component prepareEditor(TableCellEditor editor,
                               int row,
                               int column)
Override this method to get the style from CellStyle defined by StyleModel and set it to component return from super.prepareEditor().

Overrides:
prepareEditor in class ContextSensitiveTable
Parameters:
editor - the cell editor.
row - the row index.
column - the column index.
Returns:
the component used to edit the cell at the specified row and column.

configureRendererComponent

protected Component configureRendererComponent(int row,
                                               int column,
                                               Component component)
Changes the style of renderer component using the CellStyle object from StyleModel.

Parameters:
row - the row index.
column - the column index.
component - the renderer component
Returns:
the component after configuring it from cell styles.

mergeCellStyles

protected CellStyle mergeCellStyles(List<CellStyle> cellStyles)
Merges the cell styles in the list into one CellStyle.

Parameters:
cellStyles - the list of CellStyles. The CellStyle priority is from the highest to the lowest in this list.
Returns:
a CellStyle that merges all the CellStyles in the list.
Since:
3.2.3

mergeCellStyle

protected void mergeCellStyle(CellStyle mergedCellStyle,
                              CellStyle originalCellStyle)
Merges the styles from the originalCellStyle to mergedCellStyle only if the mergedCellStyle doesn't have the particular style set before.

Parameters:
mergedCellStyle - the cell style to merge to
originalCellStyle - the cell style to merge from
Since:
3.2.3

addCellStyleCustomizer

public void addCellStyleCustomizer(CellStyleCustomizer customizer)
Adds a new CellStyleCustomizer. When you add extra non-default styles to CellStyle class and use this interface to read the style from CellStyle and customizes the renderer component or the editor component. Without this method, you need to override customizeRendererComponent(int, int, java.awt.Component, CellStyle) or customizeEditorComponent(int, int, java.awt.Component, CellStyle) methods.

Parameters:
customizer - a new CellStyleCustomizer.

removeCellStyleCustomizer

public void removeCellStyleCustomizer(CellStyleCustomizer customizer)
Removes an existing CellStyleCustomizer.

Parameters:
customizer - the CellStyleCustomizer to be removed

getCellStyleCustomizers

public CellStyleCustomizer[] getCellStyleCustomizers()
Gets all the CellStyleCustomizers.

Returns:
all the CellStyleCustomizers.

clearCellStyleCustomizers

public void clearCellStyleCustomizers()
Clears all the CellStyleCustomizers.


customizeRendererComponent

protected void customizeRendererComponent(int row,
                                          int column,
                                          Component component,
                                          CellStyle cellStyle)
Changes the style of renderer component using the CellStyle object from StyleModel when CellStyle of corresponding cell is not null.

Parameters:
row - the row index.
column - the column index.
component - the component.
cellStyle - the cell style.

configureEditorComponent

protected Component configureEditorComponent(int row,
                                             int column,
                                             Component component)
Changes the style of editor component using the CellStyle object from StyleModel.

Parameters:
row - the row index.
column - the column index.
component - the editor component
Returns:
the component after configuring with cell style.

getCellStyleAt

public CellStyle getCellStyleAt(int row,
                                int column)
Get the merged cell style for the cell from all its underlying StyleModel.

Parameters:
row - the row index
column - the column index
Returns:
the merged cell style.

getCellStyles

public CellStyle[] getCellStyles(int row,
                                 int column)
Gets all cell styles associated with the cell.

Parameters:
row - the row index
column - the column index
Returns:
the CellStyle array associated with the cell. Empty array if nothing defined.

collectCellStyles

protected void collectCellStyles(int row,
                                 int column)
Collects the cell style of the cell and put into a sorted ArrayList which is a field called _cellStyleList.

Parameters:
row - the row index.
column - the column index.

customizeEditorComponent

protected void customizeEditorComponent(int row,
                                        int column,
                                        Component component,
                                        CellStyle cellStyle)
Changes the style of editor component using the CellStyle object from StyleModel the CellStyle of the corresponding cell is not null.

Parameters:
row - the row index.
column - the column index.
component - the component.
cellStyle - the cell style.

getCellStyleProvider

public CellStyleProvider getCellStyleProvider()
Gets the CellStyleProvider for the table. It is null by default. But you can use setCellStyleProvider(CellStyleProvider) to change it.

We probably shouldn't create this method but just let people using getTableStyleProvider instead. However we leave this method there just for backward compatibility.

Returns:
the CellStyleProvider.

setCellStyleProvider

public void setCellStyleProvider(CellStyleProvider cellStyleProvider)
Sets the CellStyleProvider for the table. StyleModel is usually defined if the style depends on the data in the table model. However there are cases style depending on the view only such as row stripes. In older releases, you will have to subclass SortableTableModel or whatever the outer-most table model which is not very convenience. That's why we introduce CellStyleProvider at CellStyleTable . You can simply use a setter to define rows stripes instead of subclass a table model.

The cell style returned from CellStyleProvider has the least priority except that of the TableStyleProvider. In the other word, if you use any cell style in the inner table model, those cell styles will be used first. For example, if you have a cell style that says using red background if the value in the cell is negative. You of course want the background to be red even though it has row stripes defined in this CellStyleProvider.

There are RowStripeTableStyleProvider and ColumnStripeTableStyleProvider which provide row stripes and column stripes respectively.

We probably shouldn't create this method but just let people using setTableStyleProvider instead. However we leave this method there just for backward compatibility. The only difference between CellStyleProvider and TableStyleProvider is CellStyleProvider's getCellStyleAt takes a model v.s. TableStyleProvider's getCellStyleAt takes a JTable as parameter. Since the first parameter of CellStyleProvider's getCellStyleAt is a model, so the row and column index parameters are the indices as in the model. In TableStyleProvider, the two indices are view indices.

This method will repaint the table.

Parameters:
cellStyleProvider - a new CellStyleProvider.
See Also:
setTableStyleProvider(TableStyleProvider)

getTableStyleProvider

public TableStyleProvider getTableStyleProvider()
Gets the TableStyleProvider for the table. It is null by default. But you can use setTableStyleProvider(TableStyleProvider) to change it.

Returns:
the TableStyleProvider.

setTableStyleProvider

public void setTableStyleProvider(TableStyleProvider styleProvider)
Sets the TableStyleProvider for the table. StyleModel is usually defined if the style depends on the data in the table model. However there are cases style depending on the view only such as row stripes. In older releases, you will have to subclass SortableTableModel or whatever the outer-most table model which is not very convenience. That's why we introduce TableStyleProvider at CellStyleTable . You can simply use a setter to define rows stripes instead of subclass a table model.

The cell style returned from TableStyleProvider has the least priority. In the other word, if you use any cell style in the inner table model, those cell styles will be used first. For example, if you have a cell style that says using red background if the value in the cell is negative. You of course want the background to be red even though it has row stripes defined in this TableCellStyleProvider.

There are RowStripeTableStyleProvider and ColumnStripeTableStyleProvider which provide row stripes and column stripes respectively.

This method will repaint the table.

Parameters:
styleProvider - a new TableStyleProvider.

getFocusCellStyle

public CellStyle getFocusCellStyle()
Gets the cell style for the focus cell. In the case of the JTable, the JTable must have focus and the cell must be the leading selection cell.

Returns:
the CellStyle for the leading selection cell.

setFocusCellStyle

public void setFocusCellStyle(CellStyle focusCellStyle)
Sets the cell style for the focus cell. In the case of the JTable, the JTable must have focus and the cell must be the leading selection cell.

Please note since the leading selection cell is always selected, when defining the CellStyle for the background and foreground, it should use CellStyle.setSelectionBackground(java.awt.Color) and CellStyle.setSelectionForeground(java.awt.Color) instead of setBackground or setForeground.

Parameters:
focusCellStyle - the CellStyle for the leading selection cell.

isFillsViewportWithStripe

public boolean isFillsViewportWithStripe()
Get the flag indicating if the viewport will be filled with stripe if possible.

Returns:
true if the viewport will be filled with stripe if possible. Otherwise false.
See Also:
setFillsViewportWithStripe(boolean)

setFillsViewportWithStripe

public void setFillsViewportWithStripe(boolean fillsViewportWithStripe)
Set the flag indicating if the viewport will be filled with stripe if possible.

By default, the flag is set to true. If you just want to simply paint the content with table.getBackground(), you could set this flag to false.

Parameters:
fillsViewportWithStripe - the flag

paintComponent

protected void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

needPaintStripedBackground

protected boolean needPaintStripedBackground()
Checks if the striped background of non-table area should be painted.

Returns:
true if painting needed. Otherwise false.

isFillsSelection

public boolean isFillsSelection()
Gets the flag indicating if the selection should be filled if JTable.getAutoResizeMode() returns JideTable.AUTO_RESIZE_FILL.

Returns:
true if the selection should be filled. Otherwise false.
See Also:
setFillsSelection(boolean)

setFillsSelection

public void setFillsSelection(boolean fillsSelection)
Sets the flag indicating if the selection should be filled if JTable.getAutoResizeMode() returns JideTable.AUTO_RESIZE_FILL.

By default, this flag is true. However, some customers think the row might be too real to be confused. In that case, you might want to set this flag to false.

Parameters:
fillsSelection - the flag

JIDE 3.5.15