Class SubstanceTableUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TableUI
javax.swing.plaf.basic.BasicTableUI
org.pushingpixels.substance.internal.ui.SubstanceTableUI
- All Implemented Interfaces:
UpdateOptimizationAware
UI for tables in Substance look and feel. Unfortunately, the entire
painting stack has been copied from
BasicTableUI since the methods
are private. The animation effects are implemented in the
BasicTableUI.paintCell(Graphics, Rectangle, int, int).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classRepaints a single cell during the fade animation cycle.protected classRepaints a single column during the fade animation cycle.protected classRepaints a single row during the fade animation cycle.static classID of a single table cell.protected classState listener for tracking the selection changes.Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTableUI
BasicTableUI.FocusHandler, BasicTableUI.KeyHandler, BasicTableUI.MouseInputHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<Class<?>, TableCellEditor> Map of default editors.protected Map<Class<?>, TableCellRenderer> Map of default renderers.protected Booleanprotected Booleanprotected SubstanceTableUI.TableCellIdprotected intHolds the currently rolled-over column index, or-1if none such.protected Set<SubstanceTableUI.TableCellId> Holds the currently rolled-over row-column index, ornullif none such.protected Map<SubstanceTableUI.TableCellId, Object> Holds the list of currently selected row-column indexes.protected org.pushingpixels.substance.internal.ui.SubstanceTableUI.RolloverFadeListenerListener for transition animations on table rollovers.protected FocusListenerprotected PropertyChangeListenerListener that listens to changes on table properties.protected SubstanceTableUI.TableStateListenerListener for transition animations on list selections.Fields inherited from class javax.swing.plaf.basic.BasicTableUI
focusListener, keyListener, mouseInputListener, rendererPane, table -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanChecks whether the table has animations.protected booleanChecks whether the table has rollover animations.protected booleanChecks whether the table has selection animations.static ComponentUIcreateUI(JComponent comp) Returns the cell renderer insets of this table.getCellState(SubstanceTableUI.TableCellId cellIndex) Returns the current state for the specified cell.getId(int row, int column) Returns a comparable ID for the specified location.Returns the current state for the specified cell.intReturns the index of the rollover column.booleanbooleanprotected voidprotected voidinstallEditorIfNecessary(Class<?> clazz, TableCellEditor editor) Installs Substance-specific renderers for column classes that don't have application-specific renderers installed by the user code.protected voidprotected voidinstallRendererIfNecessary(Class<?> clazz, TableCellRenderer renderer) Installs Substance-specific renderers for column classes that don't have application-specific renderers installed by the user code.booleanisFocusedCell(int row, int column) Returns indication whether the specified cell has focus.voidpaint(Graphics g, JComponent c) Paint a representation of thetableinstance that was set in installUI().protected voidprotected voidpaintCells(Graphics g, int rMin, int rMax, int cMin, int cMax) protected voidpaintDraggedArea(Graphics g, int rMin, int rMax, TableColumn draggedColumn, int distance) protected voidprotected voidPaints the grid lines within aRect, using the grid color set with setGridColor.protected voidsyncSelection(boolean enforceNoAnimations) Synchronizes the current selection state.protected voidprotected voiduninstallEditorIfNecessary(Class<?> clazz, TableCellEditor editor) Uninstalls default Substance editors that were installed ininstallEditorIfNecessary(Class, TableCellEditor).protected voidprotected voiduninstallRendererIfNecessary(Class<?> clazz, TableCellRenderer renderer) Uninstalls default Substance renderers that were installed ininstallRendererIfNecessary(Class, TableCellRenderer).voidupdate(Graphics g, JComponent c) Methods inherited from class javax.swing.plaf.basic.BasicTableUI
createFocusListener, createKeyListener, createMouseInputListener, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installKeyboardActions, installUI, uninstallKeyboardActions, uninstallUIMethods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
Field Details
-
selectedIndices
Holds the list of currently selected row-column indexes. -
rolledOverIndices
Holds the currently rolled-over row-column index, ornullif none such. -
focusedCellId
-
rolledOverColumn
protected int rolledOverColumnHolds the currently rolled-over column index, or-1if none such. This is used for the table header animations. -
defaultRenderers
Map of default renderers. -
defaultEditors
Map of default editors. -
substancePropertyChangeListener
Listener that listens to changes on table properties. -
substanceTableStateListener
Listener for transition animations on list selections. -
substanceFadeRolloverListener
protected org.pushingpixels.substance.internal.ui.SubstanceTableUI.RolloverFadeListener substanceFadeRolloverListenerListener for transition animations on table rollovers. -
substanceFocusListener
-
drawLeadingVerticalLine
-
drawTrailingVerticalLine
-
-
Constructor Details
-
SubstanceTableUI
public SubstanceTableUI()Creates a UI delegate for table.
-
-
Method Details
-
createUI
-
installDefaults
protected void installDefaults()- Overrides:
installDefaultsin classBasicTableUI
-
installRendererIfNecessary
Installs Substance-specific renderers for column classes that don't have application-specific renderers installed by the user code.- Parameters:
clazz- Column class.renderer- Default renderer for the specified column class.
-
installEditorIfNecessary
Installs Substance-specific renderers for column classes that don't have application-specific renderers installed by the user code.- Parameters:
clazz- Column class.editor- Default renderer for the specified column class.
-
uninstallDefaults
protected void uninstallDefaults()- Overrides:
uninstallDefaultsin classBasicTableUI
-
uninstallRendererIfNecessary
Uninstalls default Substance renderers that were installed ininstallRendererIfNecessary(Class, TableCellRenderer).- Parameters:
clazz- Column class.renderer- Renderer to restore.
-
uninstallEditorIfNecessary
Uninstalls default Substance editors that were installed ininstallEditorIfNecessary(Class, TableCellEditor).- Parameters:
clazz- Column class.editor- Editor to restore.
-
installListeners
protected void installListeners()- Overrides:
installListenersin classBasicTableUI
-
uninstallListeners
protected void uninstallListeners()- Overrides:
uninstallListenersin classBasicTableUI
-
paint
Paint a representation of thetableinstance that was set in installUI().- Overrides:
paintin classBasicTableUI
-
paintGrid
Paints the grid lines within aRect, using the grid color set with setGridColor. Paints vertical lines ifgetShowVerticalLines()returns true and paints horizontal lines ifgetShowHorizontalLines()returns true. -
paintCells
-
paintDraggedArea
protected void paintDraggedArea(Graphics g, int rMin, int rMax, TableColumn draggedColumn, int distance) -
paintCell
-
paintDropLines
-
getId
Returns a comparable ID for the specified location.- Parameters:
row- Row index.column- Column index.- Returns:
- Comparable ID for the specified location.
-
syncSelection
protected void syncSelection(boolean enforceNoAnimations) Synchronizes the current selection state.- Parameters:
enforceNoAnimations- Whether to force no animations.
-
getCellState
Returns the current state for the specified cell.- Parameters:
cellIndex- Cell index.- Returns:
- The current state for the specified cell.
-
getModelStateInfo
Returns the current state for the specified cell.- Parameters:
cellId- Cell index.- Returns:
- The current state for the specified cell.
-
_hasAnimations
protected boolean _hasAnimations()Checks whether the table has animations.- Returns:
trueif the table has animations,falseotherwise.
-
_hasSelectionAnimations
protected boolean _hasSelectionAnimations()Checks whether the table has selection animations.- Returns:
trueif the table has selection animations,falseotherwise.
-
_hasRolloverAnimations
protected boolean _hasRolloverAnimations()Checks whether the table has rollover animations.- Returns:
trueif the table has rollover animations,falseotherwise.
-
getRolloverColumnIndex
public int getRolloverColumnIndex()Returns the index of the rollover column.- Returns:
- The index of the rollover column.
-
isFocusedCell
public boolean isFocusedCell(int row, int column) Returns indication whether the specified cell has focus.- Parameters:
row- Cell row index.column- Cell column index.- Returns:
trueIf the focus is on the specified cell,falseotherwise.
-
update
- Overrides:
updatein classComponentUI
-
getCellRendererInsets
Returns the cell renderer insets of this table. Is for internal use only.- Returns:
- The cell renderer insets of this table.
-
hasSelectionAnimations
public boolean hasSelectionAnimations() -
hasRolloverAnimations
public boolean hasRolloverAnimations() -
getUpdateOptimizationInfo
- Specified by:
getUpdateOptimizationInfoin interfaceUpdateOptimizationAware
-
getStateTransitionTracker
-