Package org.apache.pivot.wtk.skin
Class TablePaneSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.TablePaneSkin
-
- All Implemented Interfaces:
ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,ContainerListener,ContainerMouseListener,Skin,TablePane.Skin,TablePaneAttributeListener,TablePaneListener,Visual
- Direct Known Subclasses:
TerraTablePaneSkin
public class TablePaneSkin extends ContainerSkin implements TablePane.Skin, TablePaneListener, TablePaneAttributeListener
Table pane skin.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerListener
ContainerListener.Adapter, ContainerListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListener
ContainerMouseListener.Adapter, ContainerMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TablePaneAttributeListener
TablePaneAttributeListener.Adapter, TablePaneAttributeListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TablePaneListener
TablePaneListener.Adapter, TablePaneListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description TablePaneSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcellInserted(TablePane.Row row, int column)Called when a cell has been inserted into a table pane.voidcellsRemoved(TablePane.Row row, int column, Sequence<Component> removed)Called when cells have been removed from a table pane.voidcellUpdated(TablePane.Row row, int column, Component previousComponent)Called when a cell has been updated in a table pane.voidcolumnHighlightedChanged(TablePane.Column column)Called when a column's highlighted state has changed.voidcolumnInserted(TablePane tablePane, int index)Called when a column has been inserted into a table pane.voidcolumnSpanChanged(TablePane tablePane, Component component, int previousColumnSpan)Called when a component's column span attribute has changed.voidcolumnsRemoved(TablePane tablePane, int index, Sequence<TablePane.Column> columns)Called when columns have been removed from a table pane.voidcolumnWidthChanged(TablePane.Column column, int previousWidth, boolean previousRelative)Called when a column's width has changed.intgetBaseline(int width, int height)Should be implemented in every subclass.intgetColumnAt(int x)BoundsgetColumnBounds(int column)java.awt.ColorgetHighlightBackgroundColor()java.awt.ColorgetHorizontalGridColor()intgetHorizontalSpacing()InsetsgetPadding()intgetPreferredHeight(int width)Returns the visual's preferred height given the provided width constraint.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.intgetPreferredWidth(int height)Returns the visual's preferred width given the provided height constraint.intgetRowAt(int y)BoundsgetRowBounds(int row)booleangetShowHorizontalGridLines()booleangetShowVerticalGridLines()java.awt.ColorgetVerticalGridColor()intgetVerticalSpacing()voidinstall(Component component)Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.voidlayout()If the component on which the skin is installed is a container, lays out the container's children.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidrowHeightChanged(TablePane.Row row, int previousHeight, boolean previousRelative)Called when a row's height has changed.voidrowHighlightedChanged(TablePane.Row row)Called when a row's highlighted state has changed.voidrowInserted(TablePane tablePane, int index)Called when a row has been inserted into a table pane.voidrowSpanChanged(TablePane tablePane, Component component, int previousRowSpan)Called when a component's row span attribute has changed.voidrowsRemoved(TablePane tablePane, int index, Sequence<TablePane.Row> rows)Called when rows have been removed from a table pane.voidsetHighlightBackgroundColor(java.awt.Color highlightBackgroundColor)Sets the background color used to paint the highlighted rows and columns.voidsetHighlightBackgroundColor(java.lang.String highlightBackgroundColor)Sets the background color used to paint the highlighted rows and columns.voidsetHorizontalGridColor(java.awt.Color horizontalGridColor)Sets the color used to paint the table pane's horizontal grid lines.voidsetHorizontalGridColor(java.lang.String horizontalGridColor)Sets the color used to paint the table pane's horizontal grid lines.voidsetHorizontalSpacing(int horizontalSpacing)Sets the spacing that will be applied between the table pane's columns during layout.voidsetPadding(int padding)Sets the amount of space that will be reserved around the inside edges of the table pane.voidsetPadding(java.lang.Number padding)Sets the amount of space that will be reserved around the inside edges of the table pane.voidsetPadding(java.lang.String padding)Sets the amount of space that will be reserved around the inside edges of the table pane.voidsetPadding(Dictionary<java.lang.String,?> padding)Sets the amount of space that will be reserved around the inside edges of the table pane.voidsetPadding(Sequence<?> padding)Sets the amount of space that will be reserved around the inside edges of the table pane.voidsetPadding(Insets padding)Sets the amount of space that will be reserved around the inside edges of the table pane.voidsetShowHorizontalGridLines(boolean showHorizontalGridLines)Sets whether or not horizontal grid lines will be painted in between the table pane's rows.voidsetShowVerticalGridLines(boolean showVerticalGridLines)Sets whether or not vertical grid lines will be painted in between the table pane's columns.voidsetVerticalGridColor(java.awt.Color verticalGridColor)Sets the color used to paint the table pane's vertical grid lines.voidsetVerticalGridColor(java.lang.String verticalGridColor)Sets the color used to paint the table pane's vertical grid lines.voidsetVerticalSpacing(int verticalSpacing)Sets the spacing that will be applied in between the table pane's rows during layout.-
Methods inherited from class org.apache.pivot.wtk.skin.ContainerSkin
componentInserted, componentMoved, componentsRemoved, focusTraversalPolicyChanged, getBackgroundColor, getBackgroundPaint, isFocusable, isOpaque, mouseDown, mouseMove, mouseUp, mouseWheel, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint
-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, enabledChanged, focusedChanged, fontFromObject, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, setSize, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
setSize
-
-
-
-
Method Detail
-
install
public void install(Component component)
Description copied from class:ComponentSkinMust be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
installin interfaceSkin- Overrides:
installin classContainerSkin- Parameters:
component- The component to which the skin is being attached.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidthin interfaceConstrainedVisual- Overrides:
getPreferredWidthin classContainerSkin- Parameters:
height- The height by which to constrain the preferred width, or-1for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisualReturns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeightin interfaceConstrainedVisual- Overrides:
getPreferredHeightin classContainerSkin- Parameters:
width- The width by which to constrain the preferred height, or-1for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisualReturns the visual's unconstrained preferred size.- Specified by:
getPreferredSizein interfaceConstrainedVisual- Overrides:
getPreferredSizein classComponentSkin- Returns:
- The preferred size (width and height) of this component.
Depending on the component this can be a static value or derived (as for a container) from its subcomponents, etc.
The default implementation simply calls
ConstrainedVisual.getPreferredWidth(int)andConstrainedVisual.getPreferredHeight(int).
-
getBaseline
public int getBaseline(int width, int height)Description copied from class:ComponentSkinShould be implemented in every subclass.The default implementation here simply returns -1 (no baseline).
- Specified by:
getBaselinein interfaceConstrainedVisual- Overrides:
getBaselinein classComponentSkin- Parameters:
width- Constrained width to compute the baseline for.height- Constrained height to compute the baseline for.- Returns:
- The baseline relative to the origin of this visual, or
-1if this visual does not have a baseline.
-
layout
public void layout()
Description copied from interface:SkinIf the component on which the skin is installed is a container, lays out the container's children.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:VisualPaints the visual.- Specified by:
paintin interfaceVisual- Overrides:
paintin classContainerSkin- Parameters:
graphics- The graphics context in which to paint the visual.
-
getPadding
public Insets getPadding()
- Returns:
- The amount of space that will be reserved around the inside edges of the table pane.
-
setPadding
public void setPadding(Insets padding)
Sets the amount of space that will be reserved around the inside edges of the table pane.- Parameters:
padding- The individual padding amounts for each edge.
-
setPadding
public final void setPadding(int padding)
Sets the amount of space that will be reserved around the inside edges of the table pane.- Parameters:
padding- The single padding value to use for all the edges.
-
setPadding
public final void setPadding(Dictionary<java.lang.String,?> padding)
Sets the amount of space that will be reserved around the inside edges of the table pane.- Parameters:
padding- A dictionary with keys in the set {top, left, bottom, right}.
-
setPadding
public final void setPadding(Sequence<?> padding)
Sets the amount of space that will be reserved around the inside edges of the table pane.- Parameters:
padding- A sequence with values in the order [top, left, bottom, right].
-
setPadding
public final void setPadding(java.lang.Number padding)
Sets the amount of space that will be reserved around the inside edges of the table pane.- Parameters:
padding- The single padding value to use for all the edges.
-
setPadding
public final void setPadding(java.lang.String padding)
Sets the amount of space that will be reserved around the inside edges of the table pane.- Parameters:
padding- A string containing an integer or a JSON dictionary with keys left, top, bottom, and/or right.
-
getHorizontalSpacing
public int getHorizontalSpacing()
- Returns:
- The spacing that will be applied between the table pane's columns during layout.
-
setHorizontalSpacing
public void setHorizontalSpacing(int horizontalSpacing)
Sets the spacing that will be applied between the table pane's columns during layout.- Parameters:
horizontalSpacing- The new spacing value.
-
getVerticalSpacing
public int getVerticalSpacing()
- Returns:
- The spacing that will be applied in between the table pane's rows during layout.
-
setVerticalSpacing
public void setVerticalSpacing(int verticalSpacing)
Sets the spacing that will be applied in between the table pane's rows during layout.- Parameters:
verticalSpacing- The new spacing value.
-
getShowHorizontalGridLines
public boolean getShowHorizontalGridLines()
- Returns:
- Whether or not horizontal grid lines will be painted in between the table pane's rows.
-
setShowHorizontalGridLines
public void setShowHorizontalGridLines(boolean showHorizontalGridLines)
Sets whether or not horizontal grid lines will be painted in between the table pane's rows.- Parameters:
showHorizontalGridLines- Whether to show the horizontal lines.
-
getShowVerticalGridLines
public boolean getShowVerticalGridLines()
- Returns:
- Whether or not vertical grid lines will be painted in between the table pane's columns.
-
setShowVerticalGridLines
public void setShowVerticalGridLines(boolean showVerticalGridLines)
Sets whether or not vertical grid lines will be painted in between the table pane's columns.- Parameters:
showVerticalGridLines- Whether to show the vertical lines.
-
getHorizontalGridColor
public java.awt.Color getHorizontalGridColor()
- Returns:
- The color used to paint the table pane's horizontal grid lines.
-
setHorizontalGridColor
public void setHorizontalGridColor(java.awt.Color horizontalGridColor)
Sets the color used to paint the table pane's horizontal grid lines.- Parameters:
horizontalGridColor- The new grid line color.
-
setHorizontalGridColor
public final void setHorizontalGridColor(java.lang.String horizontalGridColor)
Sets the color used to paint the table pane's horizontal grid lines.- Parameters:
horizontalGridColor- Any of the color values recognized by Pivot.
-
getVerticalGridColor
public java.awt.Color getVerticalGridColor()
- Returns:
- The color used to paint the table pane's vertical grid lines.
-
setVerticalGridColor
public void setVerticalGridColor(java.awt.Color verticalGridColor)
Sets the color used to paint the table pane's vertical grid lines.- Parameters:
verticalGridColor- The new grid line color.
-
setVerticalGridColor
public final void setVerticalGridColor(java.lang.String verticalGridColor)
Sets the color used to paint the table pane's vertical grid lines.- Parameters:
verticalGridColor- Any of the color values recognized by Pivot.
-
getHighlightBackgroundColor
public java.awt.Color getHighlightBackgroundColor()
- Returns:
- The background color used to paint the highlighted rows and columns.
-
setHighlightBackgroundColor
public void setHighlightBackgroundColor(java.awt.Color highlightBackgroundColor)
Sets the background color used to paint the highlighted rows and columns.- Parameters:
highlightBackgroundColor- The new highlight color.
-
setHighlightBackgroundColor
public final void setHighlightBackgroundColor(java.lang.String highlightBackgroundColor)
Sets the background color used to paint the highlighted rows and columns.- Parameters:
highlightBackgroundColor- Any of the color values recognized by Pivot.
-
getRowAt
public int getRowAt(int y)
- Specified by:
getRowAtin interfaceTablePane.Skin
-
getRowBounds
public Bounds getRowBounds(int row)
- Specified by:
getRowBoundsin interfaceTablePane.Skin
-
getColumnAt
public int getColumnAt(int x)
- Specified by:
getColumnAtin interfaceTablePane.Skin
-
getColumnBounds
public Bounds getColumnBounds(int column)
- Specified by:
getColumnBoundsin interfaceTablePane.Skin
-
rowInserted
public void rowInserted(TablePane tablePane, int index)
Description copied from interface:TablePaneListenerCalled when a row has been inserted into a table pane.- Specified by:
rowInsertedin interfaceTablePaneListener- Parameters:
tablePane- The source of this event.index- The index of the inserted row.
-
rowsRemoved
public void rowsRemoved(TablePane tablePane, int index, Sequence<TablePane.Row> rows)
Description copied from interface:TablePaneListenerCalled when rows have been removed from a table pane.- Specified by:
rowsRemovedin interfaceTablePaneListener- Parameters:
tablePane- The source of this event.index- The starting index of the rows that were removed.rows- The actual sequence of rows that were removed.
-
rowHeightChanged
public void rowHeightChanged(TablePane.Row row, int previousHeight, boolean previousRelative)
Description copied from interface:TablePaneListenerCalled when a row's height has changed.- Specified by:
rowHeightChangedin interfaceTablePaneListener- Parameters:
row- The particular row whose height has changed.previousHeight- The previous numeric height value.previousRelative- Whether the previous row height was relative or not.
-
rowHighlightedChanged
public void rowHighlightedChanged(TablePane.Row row)
Description copied from interface:TablePaneListenerCalled when a row's highlighted state has changed.- Specified by:
rowHighlightedChangedin interfaceTablePaneListener- Parameters:
row- The source of this event.
-
columnInserted
public void columnInserted(TablePane tablePane, int index)
Description copied from interface:TablePaneListenerCalled when a column has been inserted into a table pane.- Specified by:
columnInsertedin interfaceTablePaneListener- Parameters:
tablePane- The table pane that changed.index- The location where the column was inserted.
-
columnsRemoved
public void columnsRemoved(TablePane tablePane, int index, Sequence<TablePane.Column> columns)
Description copied from interface:TablePaneListenerCalled when columns have been removed from a table pane.- Specified by:
columnsRemovedin interfaceTablePaneListener- Parameters:
tablePane- The table pane that changed.index- The starting index of the removed columns.columns- The actual sequence of the columns that were removed.
-
columnWidthChanged
public void columnWidthChanged(TablePane.Column column, int previousWidth, boolean previousRelative)
Description copied from interface:TablePaneListenerCalled when a column's width has changed.- Specified by:
columnWidthChangedin interfaceTablePaneListener- Parameters:
column- The column that changed.previousWidth- The previous numeric value of the width.previousRelative- Whether the previous width was relative or not.
-
columnHighlightedChanged
public void columnHighlightedChanged(TablePane.Column column)
Description copied from interface:TablePaneListenerCalled when a column's highlighted state has changed.- Specified by:
columnHighlightedChangedin interfaceTablePaneListener- Parameters:
column- The column that changed.
-
cellInserted
public void cellInserted(TablePane.Row row, int column)
Description copied from interface:TablePaneListenerCalled when a cell has been inserted into a table pane.- Specified by:
cellInsertedin interfaceTablePaneListener- Parameters:
row- The table pane row that has changed.column- The index of the new column.
-
cellsRemoved
public void cellsRemoved(TablePane.Row row, int column, Sequence<Component> removed)
Description copied from interface:TablePaneListenerCalled when cells have been removed from a table pane.- Specified by:
cellsRemovedin interfaceTablePaneListener- Parameters:
row- The table pane row that has changed.column- The starting index of the column(s) that were removed.removed- The actual sequence of removed columns.
-
cellUpdated
public void cellUpdated(TablePane.Row row, int column, Component previousComponent)
Description copied from interface:TablePaneListenerCalled when a cell has been updated in a table pane.- Specified by:
cellUpdatedin interfaceTablePaneListener- Parameters:
row- The table pane row that was changed.column- Index of the column that was updated.previousComponent- The previous cell contents.
-
rowSpanChanged
public void rowSpanChanged(TablePane tablePane, Component component, int previousRowSpan)
Description copied from interface:TablePaneAttributeListenerCalled when a component's row span attribute has changed.- Specified by:
rowSpanChangedin interfaceTablePaneAttributeListener- Parameters:
tablePane- The source of this event.component- The component that changed.previousRowSpan- What the row span value used to be.
-
columnSpanChanged
public void columnSpanChanged(TablePane tablePane, Component component, int previousColumnSpan)
Description copied from interface:TablePaneAttributeListenerCalled when a component's column span attribute has changed.- Specified by:
columnSpanChangedin interfaceTablePaneAttributeListener- Parameters:
tablePane- The source of this event.component- THe component that changed.previousColumnSpan- What the column span for this component used to be.
-
-