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.ColorgetColor()java.awt.FontgetFont()java.awt.ColorgetHeadingColor()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.intgetThickness()voidheadingChanged(Separator separator, java.lang.String previousHeading)Called when a separator's heading 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.booleanisFocusable()By default, skins are focusable.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.voidsetColor(java.awt.Color newColor)Sets the color of the Separator's horizontal rule.voidsetColor(java.lang.String colorString)Sets the color of the Separator's horizontal rule.voidsetFont(java.awt.Font newFont)Sets the font used in rendering the Separator's heading.voidsetFont(java.lang.String fontString)Sets the font used in rendering the Separator's heading.voidsetFont(Dictionary<java.lang.String,?> fontDictionary)Sets the font used in rendering the Separator's heading.voidsetHeadingColor(java.awt.Color newHeadingColor)Sets the color of the text in the heading.voidsetHeadingColor(java.lang.String headingColorString)Sets the color of the text in the heading.voidsetPadding(int paddingValue)Sets the amount of space to leave around the Separator's heading, and above and below the entire component.voidsetPadding(java.lang.Number paddingValue)Sets the amount of space to leave around the Separator's heading, and above and below the entire component.voidsetPadding(java.lang.String paddingString)Sets the amount of space to leave around the Separator's heading, and above and below the entire component.voidsetPadding(Dictionary<java.lang.String,?> paddingDictionary)Sets the amount of space to leave around the Separator's heading, and above and below the entire component.voidsetPadding(Sequence<?> paddingSequence)Sets the amount of space to leave around the Separator's heading, and above and below the entire component.voidsetPadding(Insets paddingInsets)Sets the amount of space to leave around the Separator's heading, and above and below the entire component.voidsetThickness(int newThickness)Sets the thickness of the Separator's horizontal rule.voidsetThickness(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: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 classComponentSkin- 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- 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- 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).
-
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.
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkinBy default, skins are focusable.- Specified by:
isFocusablein interfaceSkin- Overrides:
isFocusablein 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:SeparatorListenerCalled when a separator's heading has changed.- Specified by:
headingChangedin interfaceSeparatorListener- Parameters:
separator- The separator that changed.previousHeading- What the heading used to be.
-
-