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 class
TerraAccordionSkin.PanelHeader
protected class
TerraAccordionSkin.PanelHeaderSkin
class
TerraAccordionSkin.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 int
getBaseline(int width, int height)
Should be implemented in every subclass.java.awt.Color
getBorderColor()
java.awt.Color
getButtonBackgroundColor()
java.awt.Color
getButtonColor()
java.awt.Font
getButtonFont()
Insets
getButtonPadding()
java.awt.Color
getDisabledButtonColor()
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()
void
headerDataChanged(Accordion accordion, Component component, java.lang.Object previousHeaderData)
Called when a panel's header data attribute has changed.void
headerDataRendererChanged(Accordion accordion, Button.DataRenderer previousHeaderDataRenderer)
Called when an accordion's header data renderer has changed.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.void
panelInserted(Accordion accordion, int index)
Called when a panel has been inserted into a accordion's panel sequence.void
panelsRemoved(Accordion accordion, int index, Sequence<Component> removed)
Called when a panel has been removed from an accordion's panel sequence.Vote
previewSelectedIndexChange(Accordion accordion, int selectedIndex)
Called to preview a selected index change.void
selectedIndexChanged(Accordion accordion, int previousSelectedIndex)
Called when an accordion's selected index has changed.void
selectedIndexChangeVetoed(Accordion accordion, Vote reason)
Called when a selected index change has been vetoed.void
setBorderColor(int borderColor)
void
setBorderColor(java.awt.Color borderColor)
void
setBorderColor(java.lang.String borderColor)
void
setButtonBackgroundColor(int buttonBackgroundColor)
void
setButtonBackgroundColor(java.awt.Color buttonBackgroundColor)
void
setButtonBackgroundColor(java.lang.String buttonBackgroundColor)
void
setButtonColor(int buttonColor)
void
setButtonColor(java.awt.Color buttonColor)
void
setButtonColor(java.lang.String buttonColor)
void
setButtonFont(java.awt.Font buttonFont)
void
setButtonFont(java.lang.String buttonFont)
void
setButtonFont(Dictionary<java.lang.String,?> buttonFont)
void
setButtonPadding(int buttonPadding)
void
setButtonPadding(java.lang.Number padding)
void
setButtonPadding(java.lang.String padding)
void
setButtonPadding(Dictionary<java.lang.String,?> buttonPadding)
void
setButtonPadding(Sequence<?> buttonPadding)
void
setButtonPadding(Insets buttonPadding)
void
setDisabledButtonColor(int disabledButtonColor)
void
setDisabledButtonColor(java.awt.Color disabledButtonColor)
void
setDisabledButtonColor(java.lang.String disabledButtonColor)
void
setPadding(int padding)
void
setPadding(java.lang.Number padding)
void
setPadding(java.lang.String padding)
void
setPadding(Dictionary<java.lang.String,?> padding)
void
setPadding(Sequence<?> padding)
void
setPadding(Insets padding)
void
setSelectionChangeDuration(int selectionChangeDuration)
void
setSelectionChangeRate(int selectionChangeRate)
void
setSize(int width, int height)
Set the final size of the component after layout has finished.void
tooltipTextChanged(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:ComponentSkin
Set the final size of the component after layout has finished.All subclasses must call this superclass method in order to set the
ComponentSkin.width
andComponentSkin.height
values, but may need to do additional calculations before doing so.- Specified by:
setSize
in interfaceConstrainedVisual
- Overrides:
setSize
in 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: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.
-
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_1
toKEYPAD_9
or CommandModifier +1
to9
Select the (enabled) pane at index 0 to 8 respectivelyALT
+UP
Select the next enabled panel.
ALT
+DOWN
Select the previous enabled panel.- 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()
-
panelInserted
public void panelInserted(Accordion accordion, int index)
Description copied from interface:AccordionListener
Called when a panel has been inserted into a accordion's panel sequence.- Specified by:
panelInserted
in 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:AccordionListener
Called when a panel has been removed from an accordion's panel sequence.- Specified by:
panelsRemoved
in 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:AccordionListener
Called when an accordion's header data renderer has changed.- Specified by:
headerDataRendererChanged
in 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:AccordionSelectionListener
Called to preview a selected index change.- Specified by:
previewSelectedIndexChange
in 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:AccordionSelectionListener
Called when a selected index change has been vetoed.- Specified by:
selectedIndexChangeVetoed
in 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:AccordionSelectionListener
Called when an accordion's selected index has changed.- Specified by:
selectedIndexChanged
in 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:AccordionAttributeListener
Called when a panel's header data attribute has changed.- Specified by:
headerDataChanged
in 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:AccordionAttributeListener
Called when a panel's tooltip text has changed.- Specified by:
tooltipTextChanged
in interfaceAccordionAttributeListener
- Parameters:
accordion
- The enclosing accordion that has changed.component
- The child component in question.previousTooltipText
- The previous tooltip text for the component.
-
-