pivot.wtk.skin
Class TablePaneSkin

java.lang.Object
  extended by pivot.wtk.skin.ComponentSkin
      extended by pivot.wtk.skin.ContainerSkin
          extended by pivot.wtk.skin.TablePaneSkin
All Implemented Interfaces:
ComponentKeyListener, ComponentLayoutListener, ComponentListener, ComponentMouseButtonListener, ComponentMouseListener, ComponentMouseWheelListener, ComponentStateListener, ConstrainedVisual, ContainerListener, Skin, TablePane.Skin, TablePaneAttributeListener, TablePaneListener, Visual
Direct Known Subclasses:
TerraTablePaneSkin

public class TablePaneSkin
extends ContainerSkin
implements TablePane.Skin, TablePaneListener, TablePaneAttributeListener

Table pane skin.

Author:
tvolkert

Nested Class Summary
 
Nested classes/interfaces inherited from class pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
 
Nested classes/interfaces inherited from interface pivot.wtk.TablePaneListener
TablePaneListener.Adapter
 
Nested classes/interfaces inherited from interface pivot.wtk.ComponentListener
ComponentListener.Adapter
 
Nested classes/interfaces inherited from interface pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter
 
Nested classes/interfaces inherited from interface pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter
 
Nested classes/interfaces inherited from interface pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter
 
Nested classes/interfaces inherited from interface pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter
 
Field Summary
 
Fields inherited from class pivot.wtk.skin.ComponentSkin
SHOW_TOOLTIP_TIMEOUT
 
Constructor Summary
TablePaneSkin()
           
 
Method Summary
 void cellInserted(TablePane.Row row, int column)
          Called when a cell has been inserted into a table pane.
 void cellsRemoved(TablePane.Row row, int column, Sequence<Component> removed)
          Called when cell's have been removed from a table pane.
 void cellUpdated(TablePane.Row row, int column, Component previousComponent)
          Called when a cell has been updated in a table pane.
 void columnInserted(TablePane tablePane, int index)
          Called when a column has been inserted into a table pane.
 void columnSelectedChanged(TablePane.Column column)
          Called when a column's selected state has changed.
 void columnSpanChanged(TablePane tablePane, Component component, int previousColumnSpan)
          Called when a component's column span attribute has changed.
 void columnsRemoved(TablePane tablePane, int index, Sequence<TablePane.Column> columns)
          Called when column's have been removed from a table pane.
 void columnWidthChanged(TablePane.Column column, int previousWidth, boolean previousRelative)
          Called when a column's width has changed.
 int getColumnAt(int x)
           
 Bounds getColumnBounds(int column)
           
static int[] getColumnWidths(TablePane tablePane, int width, int[] rowHeights)
          Gets the width of each column of a table pane given the specified constraints.
 Color getGridColor()
          Gets the color used to paint the table pane's grid lines.
 int getHorizontalSpacing()
          Gets the spacing that will be applied in between the table pane's columns during layout.
 Insets getPadding()
          Gets the padding that will be reserved around the table pane during layout.
 int getPreferredHeight(int width)
          Returns the visual's preferred height given the provided width constraint.
 Dimensions getPreferredSize()
          Returns the visual's unconstrained preferred size.
 int getPreferredWidth(int height)
          Returns the visual's preferred width given the provided height constraint.
 int getRowAt(int y)
           
 Bounds getRowBounds(int row)
           
static int[] getRowHeights(TablePane tablePane, int height, int[] columnWidths)
          Gets the height of each row of a table pane given the specified constraints.
 Color getSelectionBackgroundColor()
          Gets the background color used to paint the selected rows and columns.
 boolean getShowHorizontalGridLines()
          Tells whether or not horizontal grid lines will be painted in between the table pane's rows.
 boolean getShowVerticalGridLines()
          Tells whether or not vertical grid lines will be painted in between the table pane's columns.
 int getVerticalSpacing()
          Gets the spacing that will be applied in between the table pane's rows during layout.
 void install(Component component)
          Associates a skin with a component.
 void layout()
          If the component on which the skin is installed is a container, lays out the container's children.
 void paint(Graphics2D graphics)
          Paints the visual.
 void rowHeightChanged(TablePane.Row row, int previousHeight, boolean previousRelative)
          Called when a row's height has changed.
 void rowInserted(TablePane tablePane, int index)
          Called when a row has been inserted into a table pane.
 void rowSelectedChanged(TablePane.Row row)
          Called when a row's selected state has changed.
 void rowSpanChanged(TablePane tablePane, Component component, int previousRowSpan)
          Called when a component's row span attribute has changed.
 void rowsRemoved(TablePane tablePane, int index, Sequence<TablePane.Row> rows)
          Called when rows have been removed from a table pane.
 void setGridColor(Color gridColor)
          Sets the color used to paint the table pane's grid lines.
 void setGridColor(String gridColor)
          Sets the color used to paint the table pane's grid lines.
 void setHorizontalSpacing(int horizontalSpacing)
          Sets the spacing that will be applied in between the table pane's columns during layout.
 void setPadding(Dictionary<String,?> padding)
          Sets the padding that will be reserved around the table pane during layout.
 void setPadding(Insets padding)
          Sets the padding that will be reserved around the table pane during layout.
 void setPadding(int padding)
          Sets the padding that will be reserved around the table pane during layout.
 void setSelectionBackgroundColor(Color selectionBackgroundColor)
          Sets the background color used to paint the selected rows and columns.
 void setSelectionBackgroundColor(String selectionBackgroundColor)
          Sets the background color used to paint the selected rows and columns.
 void setShowHorizontalGridLines(boolean showHorizontalGridLines)
          Sets whether or not horizontal grid lines will be painted in between the table pane's rows.
 void setShowVerticalGridLines(boolean showVerticalGridLines)
          Sets whether or not vertical grid lines will be painted in between the table pane's columns.
 void setVerticalSpacing(int verticalSpacing)
          Sets the spacing that will be applied in between the table pane's rows during layout.
 void uninstall()
          Dissociates a skin from a component.
 
Methods inherited from class pivot.wtk.skin.ContainerSkin
componentInserted, componentsRemoved, contextKeyChanged, focusTraversalPolicyChanged, getBackgroundColor, getBackgroundPaint, isFocusable, isOpaque, setBackgroundColor, setBackgroundColor, setBackgroundPaint, setBackgroundPaint
 
Methods inherited from class pivot.wtk.skin.ComponentSkin
cursorChanged, displayableChanged, enabledChanged, focusedChanged, getComponent, getHeight, getWidth, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setSize, sizeChanged, styleUpdated, tooltipTextChanged, visibleChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TablePaneSkin

public TablePaneSkin()
Method Detail

install

public void install(Component component)
Description copied from interface: Skin
Associates a skin with a component.

Specified by:
install in interface Skin
Overrides:
install in class ContainerSkin
Parameters:
component - The component to which the skin is being attached.

uninstall

public void uninstall()
Description copied from interface: Skin
Dissociates a skin from a component.

Specified by:
uninstall in interface Skin
Overrides:
uninstall in class ContainerSkin

getPreferredWidth

public int getPreferredWidth(int height)
Description copied from interface: ConstrainedVisual
Returns the visual's preferred width given the provided height constraint.

Specified by:
getPreferredWidth in interface ConstrainedVisual
Overrides:
getPreferredWidth in class ContainerSkin
Parameters:
height - The height by which to constrain the preferred width, or -1 for no constraint.

getPreferredHeight

public int getPreferredHeight(int width)
Description copied from interface: ConstrainedVisual
Returns the visual's preferred height given the provided width constraint.

Specified by:
getPreferredHeight in interface ConstrainedVisual
Overrides:
getPreferredHeight in class ContainerSkin
Parameters:
width - The width by which to constrain the preferred height, or -1 for no constraint.

getPreferredSize

public Dimensions getPreferredSize()
Description copied from interface: ConstrainedVisual
Returns the visual's unconstrained preferred size.

Specified by:
getPreferredSize in interface ConstrainedVisual
Overrides:
getPreferredSize in class ComponentSkin

layout

public void layout()
Description copied from interface: Skin
If the component on which the skin is installed is a container, lays out the container's children.

Specified by:
layout in interface Skin

paint

public void paint(Graphics2D graphics)
Description copied from interface: Visual
Paints the visual.

Specified by:
paint in interface Visual
Overrides:
paint in class ContainerSkin
Parameters:
graphics - The graphics context in which to paint the visual.

getPadding

public Insets getPadding()
Gets the padding that will be reserved around the table pane during layout.


setPadding

public void setPadding(Insets padding)
Sets the padding that will be reserved around the table pane during layout.


setPadding

public final void setPadding(int padding)
Sets the padding that will be reserved around the table pane during layout.


setPadding

public final void setPadding(Dictionary<String,?> padding)
Sets the padding that will be reserved around the table pane during layout.


getHorizontalSpacing

public int getHorizontalSpacing()
Gets the spacing that will be applied in between the table pane's columns during layout.


setHorizontalSpacing

public void setHorizontalSpacing(int horizontalSpacing)
Sets the spacing that will be applied in between the table pane's columns during layout.


getVerticalSpacing

public int getVerticalSpacing()
Gets 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.


getShowHorizontalGridLines

public boolean getShowHorizontalGridLines()
Tells 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.


getShowVerticalGridLines

public boolean getShowVerticalGridLines()
Tells 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.


getGridColor

public Color getGridColor()
Gets the color used to paint the table pane's grid lines.


setGridColor

public void setGridColor(Color gridColor)
Sets the color used to paint the table pane's grid lines.


setGridColor

public final void setGridColor(String gridColor)
Sets the color used to paint the table pane's grid lines.


getSelectionBackgroundColor

public Color getSelectionBackgroundColor()
Gets the background color used to paint the selected rows and columns.


setSelectionBackgroundColor

public void setSelectionBackgroundColor(Color selectionBackgroundColor)
Sets the background color used to paint the selected rows and columns.


setSelectionBackgroundColor

public final void setSelectionBackgroundColor(String selectionBackgroundColor)
Sets the background color used to paint the selected rows and columns.


getColumnWidths

public static int[] getColumnWidths(TablePane tablePane,
                                    int width,
                                    int[] rowHeights)
Gets the width of each column of a table pane given the specified constraints. This method is static to allow other skins (such as TablePaneHeaderSkin) to hook into it.

Parameters:
tablePane - The table pane
width - The width constraint of the table pane
rowHeights - The heights of the table pane's rows, which will be used as height constraints to the column widths when necessary, or null if the row heights are not yet known (the column widths will be unconstrained)
Returns:
An array containing the width of each column in the table pane given the specified constraints

getRowHeights

public static int[] getRowHeights(TablePane tablePane,
                                  int height,
                                  int[] columnWidths)
Gets the height of each row of a table pane given the specified constraints. This method is static to allow other skins (such as TablePaneHeaderSkin) to hook into it.

Parameters:
tablePane - The table pane
height - The height constraint of the table pane
columnWidths - The widths of the table pane's columns, which will be used as width constraints to the row heights when necessary, or null if the column widths are not yet known (the row heights will be unconstrained)
Returns:
An array containing the height of each row in the table pane given the specified constraints

getRowAt

public int getRowAt(int y)
Specified by:
getRowAt in interface TablePane.Skin

getRowBounds

public Bounds getRowBounds(int row)
Specified by:
getRowBounds in interface TablePane.Skin

getColumnAt

public int getColumnAt(int x)
Specified by:
getColumnAt in interface TablePane.Skin

getColumnBounds

public Bounds getColumnBounds(int column)
Specified by:
getColumnBounds in interface TablePane.Skin

rowInserted

public void rowInserted(TablePane tablePane,
                        int index)
Description copied from interface: TablePaneListener
Called when a row has been inserted into a table pane.

Specified by:
rowInserted in interface TablePaneListener

rowsRemoved

public void rowsRemoved(TablePane tablePane,
                        int index,
                        Sequence<TablePane.Row> rows)
Description copied from interface: TablePaneListener
Called when rows have been removed from a table pane.

Specified by:
rowsRemoved in interface TablePaneListener

rowHeightChanged

public void rowHeightChanged(TablePane.Row row,
                             int previousHeight,
                             boolean previousRelative)
Description copied from interface: TablePaneListener
Called when a row's height has changed.

Specified by:
rowHeightChanged in interface TablePaneListener

rowSelectedChanged

public void rowSelectedChanged(TablePane.Row row)
Description copied from interface: TablePaneListener
Called when a row's selected state has changed.

Specified by:
rowSelectedChanged in interface TablePaneListener

columnInserted

public void columnInserted(TablePane tablePane,
                           int index)
Description copied from interface: TablePaneListener
Called when a column has been inserted into a table pane.

Specified by:
columnInserted in interface TablePaneListener

columnsRemoved

public void columnsRemoved(TablePane tablePane,
                           int index,
                           Sequence<TablePane.Column> columns)
Description copied from interface: TablePaneListener
Called when column's have been removed from a table pane.

Specified by:
columnsRemoved in interface TablePaneListener

columnWidthChanged

public void columnWidthChanged(TablePane.Column column,
                               int previousWidth,
                               boolean previousRelative)
Description copied from interface: TablePaneListener
Called when a column's width has changed.

Specified by:
columnWidthChanged in interface TablePaneListener

columnSelectedChanged

public void columnSelectedChanged(TablePane.Column column)
Description copied from interface: TablePaneListener
Called when a column's selected state has changed.

Specified by:
columnSelectedChanged in interface TablePaneListener

cellInserted

public void cellInserted(TablePane.Row row,
                         int column)
Description copied from interface: TablePaneListener
Called when a cell has been inserted into a table pane.

Specified by:
cellInserted in interface TablePaneListener

cellsRemoved

public void cellsRemoved(TablePane.Row row,
                         int column,
                         Sequence<Component> removed)
Description copied from interface: TablePaneListener
Called when cell's have been removed from a table pane.

Specified by:
cellsRemoved in interface TablePaneListener

cellUpdated

public void cellUpdated(TablePane.Row row,
                        int column,
                        Component previousComponent)
Description copied from interface: TablePaneListener
Called when a cell has been updated in a table pane.

Specified by:
cellUpdated in interface TablePaneListener

rowSpanChanged

public void rowSpanChanged(TablePane tablePane,
                           Component component,
                           int previousRowSpan)
Description copied from interface: TablePaneAttributeListener
Called when a component's row span attribute has changed.

Specified by:
rowSpanChanged in interface TablePaneAttributeListener

columnSpanChanged

public void columnSpanChanged(TablePane tablePane,
                              Component component,
                              int previousColumnSpan)
Description copied from interface: TablePaneAttributeListener
Called when a component's column span attribute has changed.

Specified by:
columnSpanChanged in interface TablePaneAttributeListener