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 intMINIMUM_COLUMN_WIDTH
-
Constructor Summary
Constructors Constructor Description TerraTableViewHeaderSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcolumnCellRendererChanged(TableView.Column column, TableView.CellRenderer previousCellRenderer)Called when a column's cell renderer has changed.voidcolumnFilterChanged(TableView.Column column, java.lang.Object previousFilter)Called when a column's filter has changed.voidcolumnHeaderDataChanged(TableView.Column column, java.lang.Object previousHeaderData)Called when a column's header data has changed.voidcolumnHeaderDataRendererChanged(TableView.Column column, TableView.HeaderDataRenderer previousHeaderDataRenderer)Called when a column's header data renderer has changed.voidcolumnInserted(TableView tableView, int index)Called when a column is inserted into a table view's column sequence.voidcolumnNameChanged(TableView.Column column, java.lang.String previousName)Called when a column's name has changed.voidcolumnsRemoved(TableView tableView, int index, Sequence<TableView.Column> columns)Called when columns are removed from a table view's column sequence.voidcolumnWidthChanged(TableView.Column column, int previousWidth, boolean previousRelative)Called when a column's width has changed.voidcolumnWidthLimitsChanged(TableView.Column column, int previousMinimumWidth, int previousMaximumWidth)Called when a column's width limits have changed.voidenabledChanged(Component component)Called when a component's enabled state has changed.java.awt.ColorgetBackgroundColor()intgetBaseline(int width, int height)Should be implemented in every subclass.java.awt.ColorgetBorderColor()java.awt.ColorgetColor()booleangetColumnsResizable()java.awt.ColorgetDisabledBackgroundColor()java.awt.ColorgetDisabledBorderColor()java.awt.ColorgetDisabledColor()java.awt.FontgetFont()intgetHeaderAt(int x)BoundsgetHeaderBounds(int headerIndex)booleangetHeadersPressable()booleangetIncludeTrailingVerticalGridLine()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.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.booleanisFocusable()By default, skins are focusable.voidlayout()If the component on which the skin is installed is a container, lays out the container's children.booleanmouseClick(Component component, Mouse.Button button, int x, int y, int count)Called when a mouse button is clicked over a component.booleanmouseDown(Component component, Mouse.Button button, int x, int y)Called when a mouse button is pressed over a component.booleanmouseMove(Component component, int x, int y)Called when the mouse is moved over a component.voidmouseOut(Component component)Called when the mouse exits a component.booleanmouseUp(Component component, Mouse.Button button, int x, int y)Called when a mouse button is released over a component.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidsetBackgroundColor(int backgroundColor)voidsetBackgroundColor(java.awt.Color backgroundColor)voidsetBackgroundColor(java.lang.String backgroundColor)voidsetBorderColor(int borderColor)voidsetBorderColor(java.awt.Color borderColor)voidsetBorderColor(java.lang.String borderColor)voidsetColor(int color)voidsetColor(java.awt.Color color)voidsetColor(java.lang.String color)voidsetColumnsResizable(boolean columnsResizable)voidsetDisabledBackgroundColor(int disabledBackgroundColor)voidsetDisabledBackgroundColor(java.awt.Color disabledBackgroundColor)voidsetDisabledBackgroundColor(java.lang.String disabledBackgroundColor)voidsetDisabledBorderColor(int disabledBorderColor)voidsetDisabledBorderColor(java.awt.Color disabledBorderColor)voidsetDisabledBorderColor(java.lang.String disabledBorderColor)voidsetDisabledColor(int disabledColor)voidsetDisabledColor(java.awt.Color disabledColor)voidsetDisabledColor(java.lang.String disabledColor)voidsetFont(java.awt.Font font)voidsetFont(java.lang.String font)voidsetFont(Dictionary<java.lang.String,?> font)voidsetHeadersPressable(boolean headersPressable)voidsetIncludeTrailingVerticalGridLine(boolean includeTrailingVerticalGridLine)voidsortAdded(TableView tableView, java.lang.String columnName)Called when a sort has been added to a table view.voidsortChanged(TableView tableView)Called when a table view's sort has changed.voidsortModeChanged(TableViewHeader tableViewHeader, TableViewHeader.SortMode previousSortMode)Called when a table view header's sort mode has changed.voidsortRemoved(TableView tableView, java.lang.String columnName, SortDirection sortDirection)Called when a sort has been removed from a table view.voidsortUpdated(TableView tableView, java.lang.String columnName, SortDirection previousSortDirection)Called when a sort has been updated in a table view.voidtableViewChanged(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: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 classComponentSkin- 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- 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- 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.
-
getHeaderAt
public int getHeaderAt(int x)
- Specified by:
getHeaderAtin interfaceTableViewHeader.Skin
-
getHeaderBounds
public Bounds getHeaderBounds(int headerIndex)
- Specified by:
getHeaderBoundsin interfaceTableViewHeader.Skin
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkinBy default, skins are focusable.- Specified by:
isFocusablein interfaceSkin- Overrides:
isFocusablein classComponentSkin- Returns:
trueif 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:ComponentStateListenerCalled when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabledflag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()method.- Specified by:
enabledChangedin interfaceComponentStateListener- Overrides:
enabledChangedin classComponentSkin- Parameters:
component- The component whose enabled state is changing.
-
mouseMove
public boolean mouseMove(Component component, int x, int y)
Description copied from interface:ComponentMouseListenerCalled when the mouse is moved over a component.- Specified by:
mouseMovein interfaceComponentMouseListener- Overrides:
mouseMovein classComponentSkin- Parameters:
component- Component that is under the mouse.x- X position of the mouse.y- Y position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate (default return).
-
mouseOut
public void mouseOut(Component component)
Description copied from interface:ComponentMouseListenerCalled when the mouse exits a component.Default is to do nothing.
- Specified by:
mouseOutin interfaceComponentMouseListener- Overrides:
mouseOutin 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:ComponentMouseButtonListenerCalled when a mouse button is pressed over a component.- Specified by:
mouseDownin interfaceComponentMouseButtonListener- Overrides:
mouseDownin 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:
trueto consume the event;falseto allow it to propagate (default).
-
mouseUp
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListenerCalled when a mouse button is released over a component.- Specified by:
mouseUpin interfaceComponentMouseButtonListener- Overrides:
mouseUpin 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:
trueto consume the event;falseto allow it to propagate (default).
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListenerCalled when a mouse button is clicked over a component.- Specified by:
mouseClickin interfaceComponentMouseButtonListener- Overrides:
mouseClickin 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:
trueto consume the event;falseto allow it to propagate (default).
-
tableViewChanged
public void tableViewChanged(TableViewHeader tableViewHeader, TableView previousTableView)
Description copied from interface:TableViewHeaderListenerCalled when a table view header's table view has changed.- Specified by:
tableViewChangedin 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:TableViewHeaderListenerCalled when a table view header's sort mode has changed.- Specified by:
sortModeChangedin 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:TableViewColumnListenerCalled when a column is inserted into a table view's column sequence.- Specified by:
columnInsertedin 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:TableViewColumnListenerCalled when columns are removed from a table view's column sequence.- Specified by:
columnsRemovedin 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:TableViewColumnListenerCalled when a column's name has changed.- Specified by:
columnNameChangedin 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:TableViewColumnListenerCalled when a column's header data has changed.- Specified by:
columnHeaderDataChangedin 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:TableViewColumnListenerCalled when a column's header data renderer has changed.- Specified by:
columnHeaderDataRendererChangedin 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:TableViewColumnListenerCalled when a column's width has changed.- Specified by:
columnWidthChangedin 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:TableViewColumnListenerCalled when a column's width limits have changed.- Specified by:
columnWidthLimitsChangedin 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:TableViewColumnListenerCalled when a column's filter has changed.- Specified by:
columnFilterChangedin 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:TableViewColumnListenerCalled when a column's cell renderer has changed.- Specified by:
columnCellRendererChangedin 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:TableViewSortListenerCalled when a sort has been added to a table view.- Specified by:
sortAddedin 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:TableViewSortListenerCalled when a sort has been updated in a table view.- Specified by:
sortUpdatedin 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:TableViewSortListenerCalled when a sort has been removed from a table view.- Specified by:
sortRemovedin 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:TableViewSortListenerCalled when a table view's sort has changed.- Specified by:
sortChangedin interfaceTableViewSortListener- Parameters:
tableView- The source of this event.
-
-