Package org.apache.pivot.wtk.skin.terra
Class TerraTabPaneSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.TabPaneSkin
-
- org.apache.pivot.wtk.skin.terra.TerraTabPaneSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,ContainerListener
,ContainerMouseListener
,Skin
,TabPane.Skin
,TabPaneAttributeListener
,TabPaneListener
,TabPaneSelectionListener
,Visual
public class TerraTabPaneSkin extends TabPaneSkin implements TabPaneListener, TabPaneSelectionListener, TabPaneAttributeListener
Tab pane skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
TerraTabPaneSkin.SelectionChangeTransition
Selection change transition.class
TerraTabPaneSkin.TabButton
Tab button component.class
TerraTabPaneSkin.TabButtonSkin
Tab button skin.-
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.TabPaneAttributeListener
TabPaneAttributeListener.Adapter, TabPaneAttributeListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TabPaneListener
TabPaneListener.Adapter, TabPaneListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.TabPaneSelectionListener
TabPaneSelectionListener.Adapter, TabPaneSelectionListener.Listeners
-
-
Field Summary
-
Fields inherited from class org.apache.pivot.wtk.skin.TabPaneSkin
buttonBoxPane
-
-
Constructor Summary
Constructors Constructor Description TerraTabPaneSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeableChanged(TabPane tabPane)
Called when a tab pane's closeable property has changed.void
collapsibleChanged(TabPane tabPane)
Called when a tab pane's collapsible property has changed.void
cornerChanged(TabPane tabPane, Component previousCorner)
Called when a tab pane's corner component has changed.java.awt.Color
getActiveTabColor()
int
getBaseline(int width, int height)
Should be implemented in every subclass.java.awt.Color
getBorderColor()
java.awt.Color
getButtonColor()
java.awt.Font
getButtonFont()
Insets
getButtonPadding()
int
getButtonSpacing()
java.awt.Color
getInactiveBorderColor()
java.awt.Color
getInactiveTabColor()
Insets
getPadding()
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
getSelectionChangeDuration()
int
getSelectionChangeRate()
Orientation
getTabOrientation()
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
keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Key presses have no effect if the event has already been consumed.void
layout()
If the component on which the skin is installed is a container, lays out the container's children.void
paint(java.awt.Graphics2D graphics)
Paints the visual.Vote
previewRemoveTabs(TabPane tabPane, int index, int count)
Called to preview a tab removal.Vote
previewSelectedIndexChange(TabPane tabPane, int selectedIndex)
Called to preview a selected index change.void
removeTabsVetoed(TabPane tabPane, Vote vote)
Called when a tab removal has been vetoed.void
selectedIndexChanged(TabPane tabPane, int previousSelectedIndex)
Called when a tab pane's selected index has changed.void
selectedIndexChangeVetoed(TabPane tabPane, Vote reason)
Called when a selected index change has been vetoed.void
setActiveTabColor(java.lang.Object colorValue)
void
setBorderColor(java.lang.Object colorValue)
void
setButtonColor(java.lang.Object colorValue)
void
setButtonCornerRadius(int radiusValue)
void
setButtonCornerRadius(java.lang.Number radiusValue)
void
setButtonCornerRadius(java.lang.String radiusString)
void
setButtonFont(java.lang.Object fontValue)
void
setButtonPadding(java.lang.Object buttonPaddingValue)
void
setButtonSpacing(int spacingValue)
void
setInactiveBorderColor(java.lang.Object colorValue)
void
setInactiveTabColor(java.lang.Object colorValue)
void
setPadding(java.lang.Object paddingValue)
void
setSelectionChangeDuration(int durationValue)
void
setSelectionChangeRate(int rateValue)
void
setTabOrientation(Orientation orientationValue)
void
tabDataChanged(TabPane tabPane, Component component, java.lang.Object previousTabData)
Called when a tab's tab data attribute has changed.void
tabDataRendererChanged(TabPane tabPane, Button.DataRenderer previousRenderer)
Called when a tab pane's tab data renderer has changed.void
tabInserted(TabPane tabPane, int index)
Called when a tab has been inserted into a tab pane's tab sequence.void
tabsRemoved(TabPane tabPane, int index, Sequence<Component> removed)
Called when a tab has been removed from a tab pane's tab sequence.void
tooltipTextChanged(TabPane tabPane, Component component, java.lang.String previousTooltipText)
Called when a tab's tooltipText attribute has changed.-
Methods inherited from class org.apache.pivot.wtk.skin.TabPaneSkin
isVisible, setVisible
-
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, 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: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 classContainerSkin
- 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
- Overrides:
getPreferredWidth
in classContainerSkin
- 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
- Overrides:
getPreferredHeight
in classContainerSkin
- 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.- Specified by:
paint
in interfaceVisual
- Overrides:
paint
in classContainerSkin
- Parameters:
graphics
- The graphics context in which to paint the visual.
-
getActiveTabColor
public java.awt.Color getActiveTabColor()
-
setActiveTabColor
public void setActiveTabColor(java.lang.Object colorValue)
-
getInactiveTabColor
public java.awt.Color getInactiveTabColor()
-
setInactiveTabColor
public void setInactiveTabColor(java.lang.Object colorValue)
-
getBorderColor
public java.awt.Color getBorderColor()
-
setBorderColor
public void setBorderColor(java.lang.Object colorValue)
-
getInactiveBorderColor
public java.awt.Color getInactiveBorderColor()
-
setInactiveBorderColor
public void setInactiveBorderColor(java.lang.Object colorValue)
-
getPadding
public Insets getPadding()
-
setPadding
public void setPadding(java.lang.Object paddingValue)
-
getButtonFont
public java.awt.Font getButtonFont()
-
setButtonFont
public void setButtonFont(java.lang.Object fontValue)
-
getButtonColor
public java.awt.Color getButtonColor()
-
setButtonColor
public void setButtonColor(java.lang.Object colorValue)
-
getButtonPadding
public Insets getButtonPadding()
-
setButtonPadding
public void setButtonPadding(java.lang.Object buttonPaddingValue)
-
getButtonSpacing
public int getButtonSpacing()
-
setButtonSpacing
public void setButtonSpacing(int spacingValue)
-
setButtonCornerRadius
public final void setButtonCornerRadius(int radiusValue)
-
setButtonCornerRadius
public final void setButtonCornerRadius(java.lang.Number radiusValue)
-
setButtonCornerRadius
public final void setButtonCornerRadius(java.lang.String radiusString)
-
getTabOrientation
public Orientation getTabOrientation()
-
setTabOrientation
public void setTabOrientation(Orientation orientationValue)
-
getSelectionChangeDuration
public int getSelectionChangeDuration()
-
setSelectionChangeDuration
public void setSelectionChangeDuration(int durationValue)
-
getSelectionChangeRate
public int getSelectionChangeRate()
-
setSelectionChangeRate
public void setSelectionChangeRate(int rateValue)
-
keyPressed
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Key presses have no effect if the event has already been consumed.CommandModifier +
KEYPAD_1
toKEYPAD_9
or CommandModifier +1
to9
Select the (enabled) tab at index 0 to 8 respectively.CommandModifier + Tab to cycle forward through the tabs, CommandModifier + Shift + Tab to cycle backward.
- Specified by:
keyPressed
in interfaceComponentKeyListener
- Overrides:
keyPressed
in classComponentSkin
- Parameters:
component
- Component that has the focus.keyCode
- The key code for the key that was pressed.keyLocation
- Location value for the key (left or right for shift keys, etc.).- Returns:
true
to consume the event;false
to allow it to propagate.- See Also:
Platform.getCommandModifier()
-
tabInserted
public void tabInserted(TabPane tabPane, int index)
Description copied from interface:TabPaneListener
Called when a tab has been inserted into a tab pane's tab sequence.- Specified by:
tabInserted
in interfaceTabPaneListener
- Parameters:
tabPane
- The source of this event.index
- Where the newly inserted tab was placed.
-
previewRemoveTabs
public Vote previewRemoveTabs(TabPane tabPane, int index, int count)
Description copied from interface:TabPaneListener
Called to preview a tab removal.- Specified by:
previewRemoveTabs
in interfaceTabPaneListener
- Parameters:
tabPane
- The component that wants to change.index
- The proposed starting index of the tab or tabs to be removed.count
- The count of tabs to remove.- Returns:
- Whether or not to accept this tab removal (or defer it).
-
removeTabsVetoed
public void removeTabsVetoed(TabPane tabPane, Vote vote)
Description copied from interface:TabPaneListener
Called when a tab removal has been vetoed.- Specified by:
removeTabsVetoed
in interfaceTabPaneListener
- Parameters:
tabPane
- The source of this event.vote
- The vote result that vetoed the tab removal.
-
tabsRemoved
public void tabsRemoved(TabPane tabPane, int index, Sequence<Component> removed)
Description copied from interface:TabPaneListener
Called when a tab has been removed from a tab pane's tab sequence.- Specified by:
tabsRemoved
in interfaceTabPaneListener
- Parameters:
tabPane
- The source of this event.index
- The starting location of the tabs that were removed.removed
- The actual sequence of tab components that were removed.
-
cornerChanged
public void cornerChanged(TabPane tabPane, Component previousCorner)
Description copied from interface:TabPaneListener
Called when a tab pane's corner component has changed.- Specified by:
cornerChanged
in interfaceTabPaneListener
- Parameters:
tabPane
- The component that changed.previousCorner
- What the corner component used to be.
-
tabDataRendererChanged
public void tabDataRendererChanged(TabPane tabPane, Button.DataRenderer previousRenderer)
Description copied from interface:TabPaneListener
Called when a tab pane's tab data renderer has changed.- Specified by:
tabDataRendererChanged
in interfaceTabPaneListener
- Parameters:
tabPane
- The source of this event.previousRenderer
- The previous renderer for the tab data.
-
closeableChanged
public void closeableChanged(TabPane tabPane)
Description copied from interface:TabPaneListener
Called when a tab pane's closeable property has changed.- Specified by:
closeableChanged
in interfaceTabPaneListener
- Parameters:
tabPane
- The component that changed.
-
collapsibleChanged
public void collapsibleChanged(TabPane tabPane)
Description copied from interface:TabPaneListener
Called when a tab pane's collapsible property has changed.- Specified by:
collapsibleChanged
in interfaceTabPaneListener
- Parameters:
tabPane
- The source of this event.
-
previewSelectedIndexChange
public Vote previewSelectedIndexChange(TabPane tabPane, int selectedIndex)
Description copied from interface:TabPaneSelectionListener
Called to preview a selected index change.- Specified by:
previewSelectedIndexChange
in interfaceTabPaneSelectionListener
- Parameters:
tabPane
- The source of the event.selectedIndex
- The index that will be selected.- Returns:
- The vote result as to whether to accept this selected index change.
-
selectedIndexChangeVetoed
public void selectedIndexChangeVetoed(TabPane tabPane, Vote reason)
Description copied from interface:TabPaneSelectionListener
Called when a selected index change has been vetoed.- Specified by:
selectedIndexChangeVetoed
in interfaceTabPaneSelectionListener
- Parameters:
tabPane
- The source of the event.reason
- The reason the event was vetoed.
-
selectedIndexChanged
public void selectedIndexChanged(TabPane tabPane, int previousSelectedIndex)
Description copied from interface:TabPaneSelectionListener
Called when a tab pane's selected index has changed.- Specified by:
selectedIndexChanged
in interfaceTabPaneSelectionListener
- Parameters:
tabPane
- The source of the event.previousSelectedIndex
- If the selection changed directly, contains the index that was previously selected. Otherwise, contains the current selection.
-
tabDataChanged
public void tabDataChanged(TabPane tabPane, Component component, java.lang.Object previousTabData)
Description copied from interface:TabPaneAttributeListener
Called when a tab's tab data attribute has changed.- Specified by:
tabDataChanged
in interfaceTabPaneAttributeListener
- Parameters:
tabPane
- The source of this event.component
- The component whose tab pane data has changed.previousTabData
- What the tab data attribute used to be.
-
tooltipTextChanged
public void tooltipTextChanged(TabPane tabPane, Component component, java.lang.String previousTooltipText)
Description copied from interface:TabPaneAttributeListener
Called when a tab's tooltipText attribute has changed.- Specified by:
tooltipTextChanged
in interfaceTabPaneAttributeListener
- Parameters:
tabPane
- The source of this event.component
- The actual tab component whose tooltip was changed.previousTooltipText
- What the text used to be.
-
-