Package org.apache.pivot.wtk.skin
Class BorderSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.BorderSkin
-
- All Implemented Interfaces:
BorderListener,ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,ContainerListener,ContainerMouseListener,Skin,Visual
- Direct Known Subclasses:
TerraBorderSkin
public class BorderSkin extends ContainerSkin implements BorderListener
Border skin.TODO Add styles to support different border styles (e.g. inset, outset) or create subclasses for these border types.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.BorderListener
BorderListener.Adapter, BorderListener.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 BorderSkin()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontentChanged(Border border, Component previousContent)Called when a border's content component has changed.intgetBaseline(int trialWidth, int trialHeight)Should be implemented in every subclass.java.awt.ColorgetColor()CornerRadiigetCornerRadii()java.awt.FontgetFont()InsetsgetPadding()intgetPreferredHeight(int trialWidth)Returns the visual's preferred height given the provided width constraint.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.intgetPreferredWidth(int trialHeight)Returns the visual's preferred width given the provided height constraint.intgetThickness()java.awt.ColorgetTitleColor()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.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.lang.Object colorValue)Sets the color of the border.voidsetCornerRadii(java.lang.Object cornerRadiiValues)Sets the radii of the Border's corners.voidsetFont(java.lang.Object fontValue)Sets the font used in rendering the title.voidsetPadding(java.lang.Object paddingValues)Sets the amount of space to leave between the edge of the Border and its content.voidsetThickness(int thicknessValue)Sets the thickness of the border.voidsetThickness(java.lang.Number thicknessValue)Sets the thickness of the border.voidsetTitleColor(java.lang.Object colorValue)Sets the color for the border title.voidtitleChanged(Border border, java.lang.String previousTitle)Called when a border'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, enabledChanged, 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: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 trialHeight)
Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidthin interfaceConstrainedVisual- Overrides:
getPreferredWidthin classContainerSkin- Parameters:
trialHeight- 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 trialWidth)
Description copied from interface:ConstrainedVisualReturns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeightin interfaceConstrainedVisual- Overrides:
getPreferredHeightin classContainerSkin- Parameters:
trialWidth- 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 trialWidth, int trialHeight)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:
trialWidth- Constrained width to compute the baseline for.trialHeight- 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.
-
getFont
public java.awt.Font getFont()
- Returns:
- The font used in rendering the title.
-
setFont
public void setFont(java.lang.Object fontValue)
Sets the font used in rendering the title.- Parameters:
fontValue- The new font to use for the border title of a type supported byComponentSkin.fontFromObject(java.lang.Object).
-
getColor
public java.awt.Color getColor()
- Returns:
- The color of the border.
-
setColor
public void setColor(java.lang.Object colorValue)
Sets the color of the border.- Parameters:
colorValue- The new color for the border.
-
getTitleColor
public java.awt.Color getTitleColor()
- Returns:
- The color for the title on the border.
-
setTitleColor
public void setTitleColor(java.lang.Object colorValue)
Sets the color for the border title.- Parameters:
colorValue- The new color for the title.
-
getThickness
public int getThickness()
- Returns:
- The thickness of the border.
-
setThickness
public void setThickness(int thicknessValue)
Sets the thickness of the border.- Parameters:
thicknessValue- The border thickness (in pixels).
-
setThickness
public void setThickness(java.lang.Number thicknessValue)
Sets the thickness of the border.- Parameters:
thicknessValue- The border thickness (integer value in pixels).
-
getPadding
public Insets getPadding()
- Returns:
- The amount of space between the edge of the Border and its content.
-
setPadding
public void setPadding(java.lang.Object paddingValues)
Sets the amount of space to leave between the edge of the Border and its content.- Parameters:
paddingValues- The set of padding values of any type supported byInsets.fromObject(java.lang.Object).
-
getCornerRadii
public CornerRadii getCornerRadii()
- Returns:
- A
CornerRadii, describing the radius of each of the Border's corners.
-
setCornerRadii
public void setCornerRadii(java.lang.Object cornerRadiiValues)
Sets the radii of the Border's corners.- Parameters:
cornerRadiiValues- The radii for each of the corners of any type supported byCornerRadii.fromObject(java.lang.Object).
-
titleChanged
public void titleChanged(Border border, java.lang.String previousTitle)
Description copied from interface:BorderListenerCalled when a border's title has changed.- Specified by:
titleChangedin interfaceBorderListener- Parameters:
border- The border component that has changed.previousTitle- The previous title for the border.
-
contentChanged
public void contentChanged(Border border, Component previousContent)
Description copied from interface:BorderListenerCalled when a border's content component has changed.- Specified by:
contentChangedin interfaceBorderListener- Parameters:
border- The border that has changed.previousContent- The previous content of the border.
-
-