Package org.apache.pivot.wtk.skin.terra
Class TerraExpanderSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.ExpanderSkin
-
- org.apache.pivot.wtk.skin.terra.TerraExpanderSkin
-
- All Implemented Interfaces:
ButtonPressListener
,ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,ContainerListener
,ContainerMouseListener
,ExpanderListener
,Skin
,Visual
public class TerraExpanderSkin extends ExpanderSkin implements ButtonPressListener
Terra expander skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TerraExpanderSkin.ButtonImage
protected class
TerraExpanderSkin.CollapseImage
protected class
TerraExpanderSkin.ExpandImage
class
TerraExpanderSkin.ExpandTransition
Expand/collapse transition.class
TerraExpanderSkin.ShadeButton
Expander shade button component.class
TerraExpanderSkin.ShadeButtonSkin
Expander shade button component 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.ButtonPressListener
ButtonPressListener.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
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ExpanderListener
ExpanderListener.Adapter, ExpanderListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description TerraExpanderSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buttonPressed(Button button)
Listener for expander button events.void
collapsibleChanged(Expander expander)
Called when an expander's collapsible flag has changed.void
contentChanged(Expander expander, Component previousContent)
Called when an expander's content component has changed.void
enabledChanged(Component component)
Called when a component's enabled state has changed.void
expandedChanged(Expander expander)
Called when an expander's expanded state has changed.void
expandedChangeVetoed(Expander expander, Vote reason)
Called when an expanded change event has been vetoed.int
getBaseline(int width, int height)
Should be implemented in every subclass.java.awt.Color
getBorderColor()
java.awt.Color
getDisabledShadeButtonColor()
int
getExpandDuration()
int
getExpandRate()
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.java.awt.Color
getShadeButtonColor()
java.awt.Color
getTitleBarBackgroundColor()
java.awt.Color
getTitleBarBorderColor()
java.awt.Color
getTitleBarColor()
java.awt.Font
getTitleBarFont()
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.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
previewExpandedChange(Expander expander)
Called to preview an expanded change event.void
setBorderColor(int borderColor)
void
setBorderColor(java.awt.Color borderColor)
void
setBorderColor(java.lang.String borderColor)
void
setDisabledShadeButtonColor(int disabledShadeButtonColor)
void
setDisabledShadeButtonColor(java.awt.Color disabledShadeButtonColor)
void
setDisabledShadeButtonColor(java.lang.String disabledShadeButtonColor)
void
setExpandDuration(int expandDuration)
void
setExpandRate(int expandRate)
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
setShadeButtonColor(int shadeButtonColor)
void
setShadeButtonColor(java.awt.Color shadeButtonColor)
void
setShadeButtonColor(java.lang.String shadeButtonColor)
void
setTitleBarBackgroundColor(int titleBarBackgroundColor)
void
setTitleBarBackgroundColor(java.awt.Color titleBarBackgroundColor)
void
setTitleBarBackgroundColor(java.lang.String titleBarBackgroundColor)
void
setTitleBarBorderColor(int titleBarBorderColor)
void
setTitleBarBorderColor(java.awt.Color titleBarBorderColor)
void
setTitleBarBorderColor(java.lang.String titleBarBorderColor)
void
setTitleBarColor(int titleBarColor)
void
setTitleBarColor(java.awt.Color titleBarColor)
void
setTitleBarColor(java.lang.String titleBarColor)
void
setTitleBarFont(java.awt.Font titleBarFont)
void
setTitleBarFont(java.lang.String titleBarFont)
void
setTitleBarFont(Dictionary<java.lang.String,?> titleBarFont)
void
titleChanged(Expander expander, java.lang.String previousTitle)
Called when an expander's title 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, focusedChanged, fontFromObject, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, 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 classExpanderSkin
- 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.
-
getTitleBarFont
public java.awt.Font getTitleBarFont()
-
setTitleBarFont
public void setTitleBarFont(java.awt.Font titleBarFont)
-
setTitleBarFont
public final void setTitleBarFont(java.lang.String titleBarFont)
-
setTitleBarFont
public final void setTitleBarFont(Dictionary<java.lang.String,?> titleBarFont)
-
getTitleBarColor
public java.awt.Color getTitleBarColor()
-
setTitleBarColor
public void setTitleBarColor(java.awt.Color titleBarColor)
-
setTitleBarColor
public final void setTitleBarColor(java.lang.String titleBarColor)
-
setTitleBarColor
public final void setTitleBarColor(int titleBarColor)
-
getTitleBarBackgroundColor
public java.awt.Color getTitleBarBackgroundColor()
-
setTitleBarBackgroundColor
public void setTitleBarBackgroundColor(java.awt.Color titleBarBackgroundColor)
-
setTitleBarBackgroundColor
public final void setTitleBarBackgroundColor(java.lang.String titleBarBackgroundColor)
-
setTitleBarBackgroundColor
public final void setTitleBarBackgroundColor(int titleBarBackgroundColor)
-
getTitleBarBorderColor
public java.awt.Color getTitleBarBorderColor()
-
setTitleBarBorderColor
public void setTitleBarBorderColor(java.awt.Color titleBarBorderColor)
-
setTitleBarBorderColor
public final void setTitleBarBorderColor(java.lang.String titleBarBorderColor)
-
setTitleBarBorderColor
public final void setTitleBarBorderColor(int titleBarBorderColor)
-
getShadeButtonColor
public java.awt.Color getShadeButtonColor()
-
setShadeButtonColor
public void setShadeButtonColor(java.awt.Color shadeButtonColor)
-
setShadeButtonColor
public final void setShadeButtonColor(java.lang.String shadeButtonColor)
-
setShadeButtonColor
public final void setShadeButtonColor(int shadeButtonColor)
-
getDisabledShadeButtonColor
public java.awt.Color getDisabledShadeButtonColor()
-
setDisabledShadeButtonColor
public void setDisabledShadeButtonColor(java.awt.Color disabledShadeButtonColor)
-
setDisabledShadeButtonColor
public final void setDisabledShadeButtonColor(java.lang.String disabledShadeButtonColor)
-
setDisabledShadeButtonColor
public final void setDisabledShadeButtonColor(int disabledShadeButtonColor)
-
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)
-
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)
-
getExpandDuration
public int getExpandDuration()
-
setExpandDuration
public void setExpandDuration(int expandDuration)
-
getExpandRate
public int getExpandRate()
-
setExpandRate
public void setExpandRate(int expandRate)
-
buttonPressed
public void buttonPressed(Button button)
Listener for expander button events.- Specified by:
buttonPressed
in interfaceButtonPressListener
- Parameters:
button
- The source of the button event.
-
enabledChanged
public void enabledChanged(Component component)
Called when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabled
flag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()
method.- Specified by:
enabledChanged
in interfaceComponentStateListener
- Overrides:
enabledChanged
in classComponentSkin
- Parameters:
component
- The component whose enabled state is changing.
-
titleChanged
public void titleChanged(Expander expander, java.lang.String previousTitle)
Called when an expander's title has changed.- Specified by:
titleChanged
in interfaceExpanderListener
- Overrides:
titleChanged
in classExpanderSkin
- Parameters:
expander
- The expander that has changed.previousTitle
- The previous title for the expander.
-
collapsibleChanged
public void collapsibleChanged(Expander expander)
Called when an expander's collapsible flag has changed.- Specified by:
collapsibleChanged
in interfaceExpanderListener
- Overrides:
collapsibleChanged
in classExpanderSkin
- Parameters:
expander
- The expander that has changed.
-
previewExpandedChange
public Vote previewExpandedChange(Expander expander)
Called to preview an expanded change event.- Specified by:
previewExpandedChange
in interfaceExpanderListener
- Overrides:
previewExpandedChange
in classExpanderSkin
- Parameters:
expander
- The expander that is about to expand or collapse.- Returns:
- The consensus vote as to whether to allow the change.
-
expandedChangeVetoed
public void expandedChangeVetoed(Expander expander, Vote reason)
Called when an expanded change event has been vetoed.- Specified by:
expandedChangeVetoed
in interfaceExpanderListener
- Overrides:
expandedChangeVetoed
in classExpanderSkin
- Parameters:
expander
- The expander that is not going to change.reason
- The consensus vote that disallowed the change.
-
expandedChanged
public void expandedChanged(Expander expander)
Called when an expander's expanded state has changed.- Specified by:
expandedChanged
in interfaceExpanderListener
- Overrides:
expandedChanged
in classExpanderSkin
- Parameters:
expander
- The expander that has now expanded or collapsed.
-
contentChanged
public void contentChanged(Expander expander, Component previousContent)
Called when an expander's content component has changed.- Specified by:
contentChanged
in interfaceExpanderListener
- Overrides:
contentChanged
in classExpanderSkin
- Parameters:
expander
- The expander that has changed content.previousContent
- The previous content of the expander.
-
-