Package org.apache.pivot.wtk.skin.terra
Class TerraTableViewHeaderSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.terra.TerraTableViewHeaderSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,Skin
,TableViewColumnListener
,TableViewHeader.Skin
,TableViewHeaderListener
,TableViewSortListener
,Visual
public class TerraTableViewHeaderSkin extends ComponentSkin implements TableViewHeader.Skin, TableViewHeaderListener, TableViewColumnListener, TableViewSortListener
Table view header skin.
-
-
Nested Class Summary
-
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.TableViewColumnListener
TableViewColumnListener.Adapter, TableViewColumnListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TableViewHeaderListener
TableViewHeaderListener.Adapter, TableViewHeaderListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TableViewSortListener
TableViewSortListener.Adapter, TableViewSortListener.Listeners
-
-
Field Summary
Fields Modifier and Type Field Description static int
MINIMUM_COLUMN_WIDTH
-
Constructor Summary
Constructors Constructor Description TerraTableViewHeaderSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
columnCellRendererChanged(TableView.Column column, TableView.CellRenderer previousCellRenderer)
Called when a column's cell renderer has changed.void
columnFilterChanged(TableView.Column column, java.lang.Object previousFilter)
Called when a column's filter has changed.void
columnHeaderDataChanged(TableView.Column column, java.lang.Object previousHeaderData)
Called when a column's header data has changed.void
columnHeaderDataRendererChanged(TableView.Column column, TableView.HeaderDataRenderer previousHeaderDataRenderer)
Called when a column's header data renderer has changed.void
columnInserted(TableView tableView, int index)
Called when a column is inserted into a table view's column sequence.void
columnNameChanged(TableView.Column column, java.lang.String previousName)
Called when a column's name has changed.void
columnsRemoved(TableView tableView, int index, Sequence<TableView.Column> columns)
Called when columns are removed from a table view's column sequence.void
columnWidthChanged(TableView.Column column, int previousWidth, boolean previousRelative)
Called when a column's width has changed.void
columnWidthLimitsChanged(TableView.Column column, int previousMinimumWidth, int previousMaximumWidth)
Called when a column's width limits have changed.void
enabledChanged(Component component)
Called when a component's enabled state has changed.java.awt.Color
getBackgroundColor()
int
getBaseline(int width, int height)
Should be implemented in every subclass.java.awt.Color
getBorderColor()
java.awt.Color
getColor()
boolean
getColumnsResizable()
java.awt.Color
getDisabledBackgroundColor()
java.awt.Color
getDisabledBorderColor()
java.awt.Color
getDisabledColor()
java.awt.Font
getFont()
int
getHeaderAt(int x)
Bounds
getHeaderBounds(int headerIndex)
boolean
getHeadersPressable()
boolean
getIncludeTrailingVerticalGridLine()
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.void
install(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.boolean
isFocusable()
By default, skins are focusable.void
layout()
If the component on which the skin is installed is a container, lays out the container's children.boolean
mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Called when a mouse button is clicked over a component.boolean
mouseDown(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is pressed over a component.boolean
mouseMove(Component component, int x, int y)
Called when the mouse is moved over a component.void
mouseOut(Component component)
Called when the mouse exits a component.boolean
mouseUp(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is released over a component.void
paint(java.awt.Graphics2D graphics)
Paints the visual.void
setBackgroundColor(int backgroundColor)
void
setBackgroundColor(java.awt.Color backgroundColor)
void
setBackgroundColor(java.lang.String backgroundColor)
void
setBorderColor(int borderColor)
void
setBorderColor(java.awt.Color borderColor)
void
setBorderColor(java.lang.String borderColor)
void
setColor(int color)
void
setColor(java.awt.Color color)
void
setColor(java.lang.String color)
void
setColumnsResizable(boolean columnsResizable)
void
setDisabledBackgroundColor(int disabledBackgroundColor)
void
setDisabledBackgroundColor(java.awt.Color disabledBackgroundColor)
void
setDisabledBackgroundColor(java.lang.String disabledBackgroundColor)
void
setDisabledBorderColor(int disabledBorderColor)
void
setDisabledBorderColor(java.awt.Color disabledBorderColor)
void
setDisabledBorderColor(java.lang.String disabledBorderColor)
void
setDisabledColor(int disabledColor)
void
setDisabledColor(java.awt.Color disabledColor)
void
setDisabledColor(java.lang.String disabledColor)
void
setFont(java.awt.Font font)
void
setFont(java.lang.String font)
void
setFont(Dictionary<java.lang.String,?> font)
void
setHeadersPressable(boolean headersPressable)
void
setIncludeTrailingVerticalGridLine(boolean includeTrailingVerticalGridLine)
void
sortAdded(TableView tableView, java.lang.String columnName)
Called when a sort has been added to a table view.void
sortChanged(TableView tableView)
Called when a table view's sort has changed.void
sortModeChanged(TableViewHeader tableViewHeader, TableViewHeader.SortMode previousSortMode)
Called when a table view header's sort mode has changed.void
sortRemoved(TableView tableView, java.lang.String columnName, SortDirection sortDirection)
Called when a sort has been removed from a table view.void
sortUpdated(TableView tableView, java.lang.String columnName, SortDirection previousSortDirection)
Called when a sort has been updated in a table view.void
tableViewChanged(TableViewHeader tableViewHeader, TableView previousTableView)
Called when a table view header's table view has changed.-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, focusedChanged, fontFromObject, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, isOpaque, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseOver, 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
-
-
-
-
Field Detail
-
MINIMUM_COLUMN_WIDTH
public static final int MINIMUM_COLUMN_WIDTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
install
public void install(Component component)
Description copied from class:ComponentSkin
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.- Specified by:
install
in interfaceSkin
- Overrides:
install
in classComponentSkin
- Parameters:
component
- The component to which the skin is being attached.
-
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 interfaceConstrainedVisual
- Parameters:
height
- The height by which to constrain the preferred width, or-1
for no constraint.- Returns:
- The preferred width given the height 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 interfaceConstrainedVisual
- Parameters:
width
- The width by which to constrain the preferred height, or-1
for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisual
Returns the visual's unconstrained preferred size.- Specified by:
getPreferredSize
in interfaceConstrainedVisual
- Overrides:
getPreferredSize
in 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:ComponentSkin
Should be implemented in every subclass.The default implementation here simply returns -1 (no baseline).
- Specified by:
getBaseline
in interfaceConstrainedVisual
- Overrides:
getBaseline
in 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
-1
if this visual does not have a baseline.
-
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.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:Visual
Paints the visual.
-
getHeaderAt
public int getHeaderAt(int x)
- Specified by:
getHeaderAt
in interfaceTableViewHeader.Skin
-
getHeaderBounds
public Bounds getHeaderBounds(int headerIndex)
- Specified by:
getHeaderBounds
in interfaceTableViewHeader.Skin
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkin
By default, skins are focusable.- Specified by:
isFocusable
in interfaceSkin
- Overrides:
isFocusable
in classComponentSkin
- Returns:
true
if this skin is focusable;false
, otherwise.
-
getFont
public java.awt.Font getFont()
-
setFont
public void setFont(java.awt.Font font)
-
setFont
public final void setFont(java.lang.String font)
-
setFont
public final void setFont(Dictionary<java.lang.String,?> font)
-
getColor
public java.awt.Color getColor()
-
setColor
public void setColor(java.awt.Color color)
-
setColor
public final void setColor(java.lang.String color)
-
setColor
public final void setColor(int color)
-
getDisabledColor
public java.awt.Color getDisabledColor()
-
setDisabledColor
public void setDisabledColor(java.awt.Color disabledColor)
-
setDisabledColor
public final void setDisabledColor(java.lang.String disabledColor)
-
setDisabledColor
public final void setDisabledColor(int disabledColor)
-
getBackgroundColor
public java.awt.Color getBackgroundColor()
-
setBackgroundColor
public void setBackgroundColor(java.awt.Color backgroundColor)
-
setBackgroundColor
public final void setBackgroundColor(java.lang.String backgroundColor)
-
setBackgroundColor
public final void setBackgroundColor(int backgroundColor)
-
getDisabledBackgroundColor
public java.awt.Color getDisabledBackgroundColor()
-
setDisabledBackgroundColor
public void setDisabledBackgroundColor(java.awt.Color disabledBackgroundColor)
-
setDisabledBackgroundColor
public final void setDisabledBackgroundColor(java.lang.String disabledBackgroundColor)
-
setDisabledBackgroundColor
public final void setDisabledBackgroundColor(int disabledBackgroundColor)
-
getBorderColor
public java.awt.Color getBorderColor()
-
setBorderColor
public void setBorderColor(java.awt.Color borderColor)
-
setBorderColor
public final void setBorderColor(java.lang.String borderColor)
-
setBorderColor
public final void setBorderColor(int borderColor)
-
getDisabledBorderColor
public java.awt.Color getDisabledBorderColor()
-
setDisabledBorderColor
public void setDisabledBorderColor(java.awt.Color disabledBorderColor)
-
setDisabledBorderColor
public final void setDisabledBorderColor(java.lang.String disabledBorderColor)
-
setDisabledBorderColor
public final void setDisabledBorderColor(int disabledBorderColor)
-
getHeadersPressable
public boolean getHeadersPressable()
-
setHeadersPressable
public void setHeadersPressable(boolean headersPressable)
-
getColumnsResizable
public boolean getColumnsResizable()
-
setColumnsResizable
public void setColumnsResizable(boolean columnsResizable)
-
getIncludeTrailingVerticalGridLine
public boolean getIncludeTrailingVerticalGridLine()
-
setIncludeTrailingVerticalGridLine
public void setIncludeTrailingVerticalGridLine(boolean includeTrailingVerticalGridLine)
-
enabledChanged
public void enabledChanged(Component component)
Description copied from interface:ComponentStateListener
Called when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabled
flag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()
method.- Specified by:
enabledChanged
in interfaceComponentStateListener
- Overrides:
enabledChanged
in classComponentSkin
- Parameters:
component
- The component whose enabled state is changing.
-
mouseMove
public boolean mouseMove(Component component, int x, int y)
Description copied from interface:ComponentMouseListener
Called when the mouse is moved over a component.- Specified by:
mouseMove
in interfaceComponentMouseListener
- Overrides:
mouseMove
in classComponentSkin
- Parameters:
component
- Component that is under the mouse.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default return).
-
mouseOut
public void mouseOut(Component component)
Description copied from interface:ComponentMouseListener
Called when the mouse exits a component.Default is to do nothing.
- Specified by:
mouseOut
in interfaceComponentMouseListener
- Overrides:
mouseOut
in classComponentSkin
- Parameters:
component
- Component that has now lost the mouse pointer.
-
mouseDown
public boolean mouseDown(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is pressed over a component.- Specified by:
mouseDown
in interfaceComponentMouseButtonListener
- Overrides:
mouseDown
in classComponentSkin
- Parameters:
component
- Component that is under the mouse pointer.button
- Which mouse button was pressed.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
mouseUp
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is released over a component.- Specified by:
mouseUp
in interfaceComponentMouseButtonListener
- Overrides:
mouseUp
in classComponentSkin
- Parameters:
component
- Component user the mouse pointer.button
- Which mouse button that was released.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is clicked over a component.- Specified by:
mouseClick
in interfaceComponentMouseButtonListener
- Overrides:
mouseClick
in classComponentSkin
- Parameters:
component
- Component user the mouse pointer.button
- Which mouse button was clicked.x
- X position of the mouse.y
- Y position of the mouse.count
- Number of clicks (1 = single click, 2 = double click, etc.).- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
tableViewChanged
public void tableViewChanged(TableViewHeader tableViewHeader, TableView previousTableView)
Description copied from interface:TableViewHeaderListener
Called when a table view header's table view has changed.- Specified by:
tableViewChanged
in interfaceTableViewHeaderListener
- Parameters:
tableViewHeader
- The source of this event.previousTableView
- The table view that used to be associated with this header.
-
sortModeChanged
public void sortModeChanged(TableViewHeader tableViewHeader, TableViewHeader.SortMode previousSortMode)
Description copied from interface:TableViewHeaderListener
Called when a table view header's sort mode has changed.- Specified by:
sortModeChanged
in interfaceTableViewHeaderListener
- Parameters:
tableViewHeader
- The source of this event.previousSortMode
- The previous sort mode for this header.
-
columnInserted
public void columnInserted(TableView tableView, int index)
Description copied from interface:TableViewColumnListener
Called when a column is inserted into a table view's column sequence.- Specified by:
columnInserted
in interfaceTableViewColumnListener
- Parameters:
tableView
- The table view that has changed.index
- Where the new column has been inserted.
-
columnsRemoved
public void columnsRemoved(TableView tableView, int index, Sequence<TableView.Column> columns)
Description copied from interface:TableViewColumnListener
Called when columns are removed from a table view's column sequence.- Specified by:
columnsRemoved
in interfaceTableViewColumnListener
- Parameters:
tableView
- The table view that has changed.index
- The starting location of the removed columns.columns
- The actual sequence of columns that were removed.
-
columnNameChanged
public void columnNameChanged(TableView.Column column, java.lang.String previousName)
Description copied from interface:TableViewColumnListener
Called when a column's name has changed.- Specified by:
columnNameChanged
in interfaceTableViewColumnListener
- Parameters:
column
- The column that changed names.previousName
- What the previous name was.
-
columnHeaderDataChanged
public void columnHeaderDataChanged(TableView.Column column, java.lang.Object previousHeaderData)
Description copied from interface:TableViewColumnListener
Called when a column's header data has changed.- Specified by:
columnHeaderDataChanged
in interfaceTableViewColumnListener
- Parameters:
column
- The column that changed.previousHeaderData
- What the header data used to be.
-
columnHeaderDataRendererChanged
public void columnHeaderDataRendererChanged(TableView.Column column, TableView.HeaderDataRenderer previousHeaderDataRenderer)
Description copied from interface:TableViewColumnListener
Called when a column's header data renderer has changed.- Specified by:
columnHeaderDataRendererChanged
in interfaceTableViewColumnListener
- Parameters:
column
- The column whose header data renderer has changed.previousHeaderDataRenderer
- The previous renderer for header data.
-
columnWidthChanged
public void columnWidthChanged(TableView.Column column, int previousWidth, boolean previousRelative)
Description copied from interface:TableViewColumnListener
Called when a column's width has changed.- Specified by:
columnWidthChanged
in interfaceTableViewColumnListener
- Parameters:
column
- The column that changed.previousWidth
- The previous numeric value of the column width.previousRelative
- Whether the previous width was relative or not.
-
columnWidthLimitsChanged
public void columnWidthLimitsChanged(TableView.Column column, int previousMinimumWidth, int previousMaximumWidth)
Description copied from interface:TableViewColumnListener
Called when a column's width limits have changed.- Specified by:
columnWidthLimitsChanged
in interfaceTableViewColumnListener
- Parameters:
column
- The source of this event.previousMinimumWidth
- The previous minimum column width.previousMaximumWidth
- The previous maximum column width.
-
columnFilterChanged
public void columnFilterChanged(TableView.Column column, java.lang.Object previousFilter)
Description copied from interface:TableViewColumnListener
Called when a column's filter has changed.- Specified by:
columnFilterChanged
in interfaceTableViewColumnListener
- Parameters:
column
- The source of this event.previousFilter
- The previous filter value for this column.
-
columnCellRendererChanged
public void columnCellRendererChanged(TableView.Column column, TableView.CellRenderer previousCellRenderer)
Description copied from interface:TableViewColumnListener
Called when a column's cell renderer has changed.- Specified by:
columnCellRendererChanged
in interfaceTableViewColumnListener
- Parameters:
column
- The source of this event.previousCellRenderer
- The previous cell renderer for this column.
-
sortAdded
public void sortAdded(TableView tableView, java.lang.String columnName)
Description copied from interface:TableViewSortListener
Called when a sort has been added to a table view.- Specified by:
sortAdded
in interfaceTableViewSortListener
- Parameters:
tableView
- The source of this event.columnName
- The new column name added to the sort criteria.
-
sortUpdated
public void sortUpdated(TableView tableView, java.lang.String columnName, SortDirection previousSortDirection)
Description copied from interface:TableViewSortListener
Called when a sort has been updated in a table view.- Specified by:
sortUpdated
in interfaceTableViewSortListener
- Parameters:
tableView
- The source of this event.columnName
- The column that was updated.previousSortDirection
- The previous value of the sort direction for this column.
-
sortRemoved
public void sortRemoved(TableView tableView, java.lang.String columnName, SortDirection sortDirection)
Description copied from interface:TableViewSortListener
Called when a sort has been removed from a table view.- Specified by:
sortRemoved
in interfaceTableViewSortListener
- Parameters:
tableView
- The source of this event.columnName
- The column name that was removed from the sort criteria.sortDirection
- What the sort direction was for this column.
-
sortChanged
public void sortChanged(TableView tableView)
Description copied from interface:TableViewSortListener
Called when a table view's sort has changed.- Specified by:
sortChanged
in interfaceTableViewSortListener
- Parameters:
tableView
- The source of this event.
-
-