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 classTerraTabPaneSkin.SelectionChangeTransitionSelection change transition.classTerraTabPaneSkin.TabButtonTab button component.classTerraTabPaneSkin.TabButtonSkinTab 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 voidcloseableChanged(TabPane tabPane)Called when a tab pane's closeable property has changed.voidcollapsibleChanged(TabPane tabPane)Called when a tab pane's collapsible property has changed.voidcornerChanged(TabPane tabPane, Component previousCorner)Called when a tab pane's corner component has changed.java.awt.ColorgetActiveTabColor()intgetBaseline(int width, int height)Should be implemented in every subclass.java.awt.ColorgetBorderColor()java.awt.ColorgetButtonColor()java.awt.FontgetButtonFont()InsetsgetButtonPadding()intgetButtonSpacing()java.awt.ColorgetInactiveBorderColor()java.awt.ColorgetInactiveTabColor()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.intgetSelectionChangeDuration()intgetSelectionChangeRate()OrientationgetTabOrientation()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.booleankeyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)Key presses have no effect if the event has already been consumed.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.VotepreviewRemoveTabs(TabPane tabPane, int index, int count)Called to preview a tab removal.VotepreviewSelectedIndexChange(TabPane tabPane, int selectedIndex)Called to preview a selected index change.voidremoveTabsVetoed(TabPane tabPane, Vote vote)Called when a tab removal has been vetoed.voidselectedIndexChanged(TabPane tabPane, int previousSelectedIndex)Called when a tab pane's selected index has changed.voidselectedIndexChangeVetoed(TabPane tabPane, Vote reason)Called when a selected index change has been vetoed.voidsetActiveTabColor(java.lang.Object colorValue)voidsetBorderColor(java.lang.Object colorValue)voidsetButtonColor(java.lang.Object colorValue)voidsetButtonCornerRadius(int radiusValue)voidsetButtonCornerRadius(java.lang.Number radiusValue)voidsetButtonCornerRadius(java.lang.String radiusString)voidsetButtonFont(java.lang.Object fontValue)voidsetButtonPadding(java.lang.Object buttonPaddingValue)voidsetButtonSpacing(int spacingValue)voidsetInactiveBorderColor(java.lang.Object colorValue)voidsetInactiveTabColor(java.lang.Object colorValue)voidsetPadding(java.lang.Object paddingValue)voidsetSelectionChangeDuration(int durationValue)voidsetSelectionChangeRate(int rateValue)voidsetTabOrientation(Orientation orientationValue)voidtabDataChanged(TabPane tabPane, Component component, java.lang.Object previousTabData)Called when a tab's tab data attribute has changed.voidtabDataRendererChanged(TabPane tabPane, Button.DataRenderer previousRenderer)Called when a tab pane's tab data renderer has changed.voidtabInserted(TabPane tabPane, int index)Called when a tab has been inserted into a tab pane's tab sequence.voidtabsRemoved(TabPane tabPane, int index, Sequence<Component> removed)Called when a tab has been removed from a tab pane's tab sequence.voidtooltipTextChanged(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: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.
-
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_1toKEYPAD_9
or CommandModifier +1to9Select 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:
keyPressedin interfaceComponentKeyListener- Overrides:
keyPressedin 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:
trueto consume the event;falseto allow it to propagate.- See Also:
Platform.getCommandModifier()
-
tabInserted
public void tabInserted(TabPane tabPane, int index)
Description copied from interface:TabPaneListenerCalled when a tab has been inserted into a tab pane's tab sequence.- Specified by:
tabInsertedin 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:TabPaneListenerCalled to preview a tab removal.- Specified by:
previewRemoveTabsin 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:TabPaneListenerCalled when a tab removal has been vetoed.- Specified by:
removeTabsVetoedin 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:TabPaneListenerCalled when a tab has been removed from a tab pane's tab sequence.- Specified by:
tabsRemovedin 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:TabPaneListenerCalled when a tab pane's corner component has changed.- Specified by:
cornerChangedin 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:TabPaneListenerCalled when a tab pane's tab data renderer has changed.- Specified by:
tabDataRendererChangedin 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:TabPaneListenerCalled when a tab pane's closeable property has changed.- Specified by:
closeableChangedin interfaceTabPaneListener- Parameters:
tabPane- The component that changed.
-
collapsibleChanged
public void collapsibleChanged(TabPane tabPane)
Description copied from interface:TabPaneListenerCalled when a tab pane's collapsible property has changed.- Specified by:
collapsibleChangedin interfaceTabPaneListener- Parameters:
tabPane- The source of this event.
-
previewSelectedIndexChange
public Vote previewSelectedIndexChange(TabPane tabPane, int selectedIndex)
Description copied from interface:TabPaneSelectionListenerCalled to preview a selected index change.- Specified by:
previewSelectedIndexChangein 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:TabPaneSelectionListenerCalled when a selected index change has been vetoed.- Specified by:
selectedIndexChangeVetoedin 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:TabPaneSelectionListenerCalled when a tab pane's selected index has changed.- Specified by:
selectedIndexChangedin 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:TabPaneAttributeListenerCalled when a tab's tab data attribute has changed.- Specified by:
tabDataChangedin 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:TabPaneAttributeListenerCalled when a tab's tooltipText attribute has changed.- Specified by:
tooltipTextChangedin interfaceTabPaneAttributeListener- Parameters:
tabPane- The source of this event.component- The actual tab component whose tooltip was changed.previousTooltipText- What the text used to be.
-
-