Package org.apache.pivot.wtk.skin
Class SeparatorSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.SeparatorSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,SeparatorListener
,Skin
,Visual
- Direct Known Subclasses:
TerraSeparatorSkin
public class SeparatorSkin extends ComponentSkin implements SeparatorListener
Separator skin.
-
-
Nested Class Summary
-
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.SeparatorListener
SeparatorListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description SeparatorSkin()
Construct and set defaults.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Color
getColor()
java.awt.Font
getFont()
java.awt.Color
getHeadingColor()
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
getThickness()
void
headingChanged(Separator separator, java.lang.String previousHeading)
Called when a separator's heading 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
isFocusable()
By default, skins are focusable.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
setColor(java.awt.Color newColor)
Sets the color of the Separator's horizontal rule.void
setColor(java.lang.String colorString)
Sets the color of the Separator's horizontal rule.void
setFont(java.awt.Font newFont)
Sets the font used in rendering the Separator's heading.void
setFont(java.lang.String fontString)
Sets the font used in rendering the Separator's heading.void
setFont(Dictionary<java.lang.String,?> fontDictionary)
Sets the font used in rendering the Separator's heading.void
setHeadingColor(java.awt.Color newHeadingColor)
Sets the color of the text in the heading.void
setHeadingColor(java.lang.String headingColorString)
Sets the color of the text in the heading.void
setPadding(int paddingValue)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.void
setPadding(java.lang.Number paddingValue)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.void
setPadding(java.lang.String paddingString)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.void
setPadding(Dictionary<java.lang.String,?> paddingDictionary)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.void
setPadding(Sequence<?> paddingSequence)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.void
setPadding(Insets paddingInsets)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.void
setThickness(int newThickness)
Sets the thickness of the Separator's horizontal rule.void
setThickness(java.lang.Number newThickness)
Sets the thickness of the Separator's horizontal rule.-
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, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, isOpaque, 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 classComponentSkin
- 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
- 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
- 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)
.
-
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.
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkin
By default, skins are focusable.- Specified by:
isFocusable
in interfaceSkin
- Overrides:
isFocusable
in classComponentSkin
- Returns:
false
; spacers are not focusable.
-
getFont
public java.awt.Font getFont()
- Returns:
- The font used in rendering the Separator's heading.
-
setFont
public void setFont(java.awt.Font newFont)
Sets the font used in rendering the Separator's heading.- Parameters:
newFont
- The new font for the heading.
-
setFont
public final void setFont(java.lang.String fontString)
Sets the font used in rendering the Separator's heading.- Parameters:
fontString
- A font specification.
-
setFont
public final void setFont(Dictionary<java.lang.String,?> fontDictionary)
Sets the font used in rendering the Separator's heading.- Parameters:
fontDictionary
- A dictionarydescribing a font
.
-
getColor
public java.awt.Color getColor()
- Returns:
- The color of the Separator's horizontal rule.
-
setColor
public void setColor(java.awt.Color newColor)
Sets the color of the Separator's horizontal rule.- Parameters:
newColor
- The new color for the horizontal rule.
-
setColor
public final void setColor(java.lang.String colorString)
Sets the color of the Separator's horizontal rule.- Parameters:
colorString
- Any of the color values recognized by Pivot.
-
getHeadingColor
public java.awt.Color getHeadingColor()
- Returns:
- The color of the text in the heading.
-
setHeadingColor
public void setHeadingColor(java.awt.Color newHeadingColor)
Sets the color of the text in the heading.- Parameters:
newHeadingColor
- The new color for the heading text.
-
setHeadingColor
public final void setHeadingColor(java.lang.String headingColorString)
Sets the color of the text in the heading.- Parameters:
headingColorString
- Any of the color values recognized by Pivot.
-
getThickness
public int getThickness()
- Returns:
- The thickness of the Separator's horizontal rule.
-
setThickness
public void setThickness(int newThickness)
Sets the thickness of the Separator's horizontal rule.- Parameters:
newThickness
- The new rule thickness (in pixels).
-
setThickness
public final void setThickness(java.lang.Number newThickness)
Sets the thickness of the Separator's horizontal rule.- Parameters:
newThickness
- The new integer value for the rule thickness (in pixels).
-
getPadding
public Insets getPadding()
- Returns:
- The amount of space surrounding (left/right) the Separator's heading, and above and below the entire component.
-
setPadding
public void setPadding(Insets paddingInsets)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.- Parameters:
paddingInsets
- The new padding values.
-
setPadding
public final void setPadding(Dictionary<java.lang.String,?> paddingDictionary)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.- Parameters:
paddingDictionary
- A dictionary with keys in the set {left, top, bottom, right}.
-
setPadding
public final void setPadding(Sequence<?> paddingSequence)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.- Parameters:
paddingSequence
- A sequence of values in the order of [top, left, bottom, right].
-
setPadding
public final void setPadding(int paddingValue)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.- Parameters:
paddingValue
- The new single padding value for all areas.
-
setPadding
public final void setPadding(java.lang.Number paddingValue)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.- Parameters:
paddingValue
- The new integer value to use for padding in all areas.
-
setPadding
public final void setPadding(java.lang.String paddingString)
Sets the amount of space to leave around the Separator's heading, and above and below the entire component.- Parameters:
paddingString
- A string containing an integer or a JSON dictionary with keys left, top, bottom, and/or right.
-
headingChanged
public void headingChanged(Separator separator, java.lang.String previousHeading)
Description copied from interface:SeparatorListener
Called when a separator's heading has changed.- Specified by:
headingChanged
in interfaceSeparatorListener
- Parameters:
separator
- The separator that changed.previousHeading
- What the heading used to be.
-
-