Package org.apache.pivot.wtk.skin.terra
Class TerraAccordionSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.terra.TerraAccordionSkin
-
- All Implemented Interfaces:
AccordionAttributeListener,AccordionListener,AccordionSelectionListener,ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,ContainerListener,ContainerMouseListener,Skin,Visual
public class TerraAccordionSkin extends ContainerSkin implements AccordionListener, AccordionSelectionListener, AccordionAttributeListener
Accordion skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTerraAccordionSkin.PanelHeaderprotected classTerraAccordionSkin.PanelHeaderSkinclassTerraAccordionSkin.SelectionChangeTransition-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.AccordionAttributeListener
AccordionAttributeListener.Adapter, AccordionAttributeListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.AccordionListener
AccordionListener.Adapter, AccordionListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.AccordionSelectionListener
AccordionSelectionListener.Adapter, AccordionSelectionListener.Listeners
-
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
-
-
Constructor Summary
Constructors Constructor Description TerraAccordionSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBaseline(int width, int height)Should be implemented in every subclass.java.awt.ColorgetBorderColor()java.awt.ColorgetButtonBackgroundColor()java.awt.ColorgetButtonColor()java.awt.FontgetButtonFont()InsetsgetButtonPadding()java.awt.ColorgetDisabledButtonColor()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()voidheaderDataChanged(Accordion accordion, Component component, java.lang.Object previousHeaderData)Called when a panel's header data attribute has changed.voidheaderDataRendererChanged(Accordion accordion, Button.DataRenderer previousHeaderDataRenderer)Called when an accordion's header data renderer has changed.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.voidpanelInserted(Accordion accordion, int index)Called when a panel has been inserted into a accordion's panel sequence.voidpanelsRemoved(Accordion accordion, int index, Sequence<Component> removed)Called when a panel has been removed from an accordion's panel sequence.VotepreviewSelectedIndexChange(Accordion accordion, int selectedIndex)Called to preview a selected index change.voidselectedIndexChanged(Accordion accordion, int previousSelectedIndex)Called when an accordion's selected index has changed.voidselectedIndexChangeVetoed(Accordion accordion, Vote reason)Called when a selected index change has been vetoed.voidsetBorderColor(int borderColor)voidsetBorderColor(java.awt.Color borderColor)voidsetBorderColor(java.lang.String borderColor)voidsetButtonBackgroundColor(int buttonBackgroundColor)voidsetButtonBackgroundColor(java.awt.Color buttonBackgroundColor)voidsetButtonBackgroundColor(java.lang.String buttonBackgroundColor)voidsetButtonColor(int buttonColor)voidsetButtonColor(java.awt.Color buttonColor)voidsetButtonColor(java.lang.String buttonColor)voidsetButtonFont(java.awt.Font buttonFont)voidsetButtonFont(java.lang.String buttonFont)voidsetButtonFont(Dictionary<java.lang.String,?> buttonFont)voidsetButtonPadding(int buttonPadding)voidsetButtonPadding(java.lang.Number padding)voidsetButtonPadding(java.lang.String padding)voidsetButtonPadding(Dictionary<java.lang.String,?> buttonPadding)voidsetButtonPadding(Sequence<?> buttonPadding)voidsetButtonPadding(Insets buttonPadding)voidsetDisabledButtonColor(int disabledButtonColor)voidsetDisabledButtonColor(java.awt.Color disabledButtonColor)voidsetDisabledButtonColor(java.lang.String disabledButtonColor)voidsetPadding(int padding)voidsetPadding(java.lang.Number padding)voidsetPadding(java.lang.String padding)voidsetPadding(Dictionary<java.lang.String,?> padding)voidsetPadding(Sequence<?> padding)voidsetPadding(Insets padding)voidsetSelectionChangeDuration(int selectionChangeDuration)voidsetSelectionChangeRate(int selectionChangeRate)voidsetSize(int width, int height)Set the final size of the component after layout has finished.voidtooltipTextChanged(Accordion accordion, Component component, java.lang.String previousTooltipText)Called when a panel's tooltip text has changed.-
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, 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
-
setSize
public void setSize(int width, int height)Description copied from class:ComponentSkinSet the final size of the component after layout has finished.All subclasses must call this superclass method in order to set the
ComponentSkin.widthandComponentSkin.heightvalues, but may need to do additional calculations before doing so.- Specified by:
setSizein interfaceConstrainedVisual- Overrides:
setSizein classComponentSkin- Parameters:
width- The new (final) width of the component after layout.height- The new (final) height of the component after layout.
-
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.
-
getPadding
public Insets getPadding()
-
setPadding
public void setPadding(Insets padding)
-
setPadding
public final void setPadding(Dictionary<java.lang.String,?> padding)
-
setPadding
public final void setPadding(Sequence<?> padding)
-
setPadding
public final void setPadding(int padding)
-
setPadding
public final void setPadding(java.lang.Number padding)
-
setPadding
public final void setPadding(java.lang.String padding)
-
getButtonFont
public java.awt.Font getButtonFont()
-
setButtonFont
public void setButtonFont(java.awt.Font buttonFont)
-
setButtonFont
public final void setButtonFont(java.lang.String buttonFont)
-
setButtonFont
public final void setButtonFont(Dictionary<java.lang.String,?> buttonFont)
-
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)
-
getButtonColor
public java.awt.Color getButtonColor()
-
setButtonColor
public void setButtonColor(java.awt.Color buttonColor)
-
setButtonColor
public final void setButtonColor(java.lang.String buttonColor)
-
setButtonColor
public final void setButtonColor(int buttonColor)
-
getDisabledButtonColor
public java.awt.Color getDisabledButtonColor()
-
setDisabledButtonColor
public void setDisabledButtonColor(java.awt.Color disabledButtonColor)
-
setDisabledButtonColor
public final void setDisabledButtonColor(java.lang.String disabledButtonColor)
-
setDisabledButtonColor
public final void setDisabledButtonColor(int disabledButtonColor)
-
getButtonBackgroundColor
public java.awt.Color getButtonBackgroundColor()
-
setButtonBackgroundColor
public void setButtonBackgroundColor(java.awt.Color buttonBackgroundColor)
-
setButtonBackgroundColor
public final void setButtonBackgroundColor(java.lang.String buttonBackgroundColor)
-
setButtonBackgroundColor
public final void setButtonBackgroundColor(int buttonBackgroundColor)
-
getButtonPadding
public Insets getButtonPadding()
-
setButtonPadding
public void setButtonPadding(Insets buttonPadding)
-
setButtonPadding
public final void setButtonPadding(Dictionary<java.lang.String,?> buttonPadding)
-
setButtonPadding
public final void setButtonPadding(Sequence<?> buttonPadding)
-
setButtonPadding
public final void setButtonPadding(int buttonPadding)
-
setButtonPadding
public final void setButtonPadding(java.lang.Number padding)
-
setButtonPadding
public final void setButtonPadding(java.lang.String padding)
-
getSelectionChangeDuration
public int getSelectionChangeDuration()
-
setSelectionChangeDuration
public void setSelectionChangeDuration(int selectionChangeDuration)
-
getSelectionChangeRate
public int getSelectionChangeRate()
-
setSelectionChangeRate
public void setSelectionChangeRate(int selectionChangeRate)
-
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) pane at index 0 to 8 respectivelyALT+UPSelect the next enabled panel.
ALT+DOWNSelect the previous enabled panel.- 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()
-
panelInserted
public void panelInserted(Accordion accordion, int index)
Description copied from interface:AccordionListenerCalled when a panel has been inserted into a accordion's panel sequence.- Specified by:
panelInsertedin interfaceAccordionListener- Parameters:
accordion- The accordion that has changed.index- The index of the newly inserted panel.
-
panelsRemoved
public void panelsRemoved(Accordion accordion, int index, Sequence<Component> removed)
Description copied from interface:AccordionListenerCalled when a panel has been removed from an accordion's panel sequence.- Specified by:
panelsRemovedin interfaceAccordionListener- Parameters:
accordion- The accordion that has changed.index- The starting index of the panel(s) that were removed.removed- The sequence of removed panels.
-
headerDataRendererChanged
public void headerDataRendererChanged(Accordion accordion, Button.DataRenderer previousHeaderDataRenderer)
Description copied from interface:AccordionListenerCalled when an accordion's header data renderer has changed.- Specified by:
headerDataRendererChangedin interfaceAccordionListener- Parameters:
accordion- The accordion that was changed.previousHeaderDataRenderer- The previous version of the header data renderer.
-
previewSelectedIndexChange
public Vote previewSelectedIndexChange(Accordion accordion, int selectedIndex)
Description copied from interface:AccordionSelectionListenerCalled to preview a selected index change.- Specified by:
previewSelectedIndexChangein interfaceAccordionSelectionListener- Parameters:
accordion- The source of the event.selectedIndex- The index that will be selected.- Returns:
- The consensus vote as to whether to allow the selected index change.
-
selectedIndexChangeVetoed
public void selectedIndexChangeVetoed(Accordion accordion, Vote reason)
Description copied from interface:AccordionSelectionListenerCalled when a selected index change has been vetoed.- Specified by:
selectedIndexChangeVetoedin interfaceAccordionSelectionListener- Parameters:
accordion- The source of the event.reason- The reason the event was vetoed.
-
selectedIndexChanged
public void selectedIndexChanged(Accordion accordion, int previousSelectedIndex)
Description copied from interface:AccordionSelectionListenerCalled when an accordion's selected index has changed.- Specified by:
selectedIndexChangedin interfaceAccordionSelectionListener- Parameters:
accordion- The source of the event.previousSelectedIndex- If the selection changed directly, contains the index that was previously selected. Otherwise, contains the current selection.
-
headerDataChanged
public void headerDataChanged(Accordion accordion, Component component, java.lang.Object previousHeaderData)
Description copied from interface:AccordionAttributeListenerCalled when a panel's header data attribute has changed.- Specified by:
headerDataChangedin interfaceAccordionAttributeListener- Parameters:
accordion- The enclosing accordion that has changed.component- The child component in question.previousHeaderData- The previous header data for this component.
-
tooltipTextChanged
public void tooltipTextChanged(Accordion accordion, Component component, java.lang.String previousTooltipText)
Description copied from interface:AccordionAttributeListenerCalled when a panel's tooltip text has changed.- Specified by:
tooltipTextChangedin interfaceAccordionAttributeListener- Parameters:
accordion- The enclosing accordion that has changed.component- The child component in question.previousTooltipText- The previous tooltip text for the component.
-
-