Package org.apache.pivot.wtk.skin.terra
Class TerraScrollBarSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.terra.TerraScrollBarSkin
-
- All Implemented Interfaces:
ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,ContainerListener,ContainerMouseListener,ScrollBarListener,ScrollBarValueListener,Skin,Visual
public class TerraScrollBarSkin extends ContainerSkin implements ScrollBarListener, ScrollBarValueListener
Scroll bar skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTerraScrollBarSkin.AutomaticScrollerEncapsulates the code needed to perform timer-controlled scrolling.protected classTerraScrollBarSkin.HandleScroll bar handle component.protected classTerraScrollBarSkin.HandleSkinScroll bar scroll handle component skin.protected classTerraScrollBarSkin.ScrollButtonScroll bar scroll button component.protected classTerraScrollBarSkin.ScrollButtonImageprotected classTerraScrollBarSkin.ScrollButtonSkinScroll bar scroll button component skin.protected classTerraScrollBarSkin.ScrollDownImageprotected classTerraScrollBarSkin.ScrollUpImage-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
-
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.ScrollBarListener
ScrollBarListener.Adapter, ScrollBarListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ScrollBarValueListener
ScrollBarValueListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description TerraScrollBarSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidblockIncrementChanged(ScrollBar scrollBar, int previousBlockIncrement)Called when a scroll bar's block increment has changed.voidenabledChanged(Component component)Propagates the scroll bar's enabled state to the scroll buttons.java.awt.ColorgetBorderColor()intgetMinimumHandleLength()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.java.awt.ColorgetScrollButtonBackgroundColor()java.awt.ColorgetScrollButtonDisabledBackgroundColor()java.awt.ColorgetScrollButtonHighlightedBackgroundColor()java.awt.ColorgetScrollButtonImageColor()java.awt.ColorgetScrollButtonPressedBackgroundColor()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.booleanmouseDown(Component component, Mouse.Button button, int x, int y)Initiates automatic block scrolling.voidmouseOut(Component component)Called when the mouse exits a component.booleanmouseUp(Component component, Mouse.Button button, int x, int y)Cancels automatic block scrolling.booleanmouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)Updates the scroll bar's value.voidorientationChanged(ScrollBar scrollBar, Orientation previousOrientation)Called when a scroll bar's orientation has changed.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidscopeChanged(ScrollBar scrollBar, int previousStart, int previousEnd, int previousExtent)Called when a scroll bar's scope has changed.voidsetBorderColor(int borderColor)voidsetBorderColor(java.awt.Color borderColor)voidsetBorderColor(java.lang.String borderColor)voidsetMinimumHandleLength(int minimumHandleLength)voidsetScrollButtonBackgroundColor(int scrollButtonBackgroundColor)voidsetScrollButtonBackgroundColor(java.awt.Color scrollButtonBackgroundColor)voidsetScrollButtonBackgroundColor(java.lang.String scrollButtonBackgroundColor)voidsetScrollButtonDisabledBackgroundColor(int scrollButtonDisabledBackgroundColor)voidsetScrollButtonDisabledBackgroundColor(java.awt.Color scrollButtonDisabledBackgroundColor)voidsetScrollButtonDisabledBackgroundColor(java.lang.String scrollButtonDisabledBackgroundColor)voidsetScrollButtonHighlightedBackgroundColor(int scrollButtonHighlightedBackgroundColor)voidsetScrollButtonHighlightedBackgroundColor(java.awt.Color scrollButtonHighlightedBackgroundColor)voidsetScrollButtonHighlightedBackgroundColor(java.lang.String scrollButtonHighlightedBackgroundColor)voidsetScrollButtonImageColor(int scrollButtonImageColor)voidsetScrollButtonImageColor(java.awt.Color scrollButtonImageColor)voidsetScrollButtonImageColor(java.lang.String scrollButtonImageColor)voidsetScrollButtonPressedBackgroundColor(int scrollButtonPressedBackgroundColor)voidsetScrollButtonPressedBackgroundColor(java.awt.Color scrollButtonPressedBackgroundColor)voidsetScrollButtonPressedBackgroundColor(java.lang.String scrollButtonPressedBackgroundColor)voidunitIncrementChanged(ScrollBar scrollBar, int previousUnitIncrement)Called when a scroll bar's unit increment has changed.voidvalueChanged(ScrollBar scrollBar, int previousValue)Called when a scroll bar's value 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, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseMove, mouseOver, 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 height)
Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidthin interfaceConstrainedVisual- Overrides:
getPreferredWidthin classContainerSkin- 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- Overrides:
getPreferredHeightin classContainerSkin- 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.- Specified by:
paintin interfaceVisual- Overrides:
paintin classContainerSkin- Parameters:
graphics- The graphics context in which to paint the visual.
-
getMinimumHandleLength
public int getMinimumHandleLength()
-
setMinimumHandleLength
public void setMinimumHandleLength(int minimumHandleLength)
-
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)
-
getScrollButtonImageColor
public java.awt.Color getScrollButtonImageColor()
-
setScrollButtonImageColor
public void setScrollButtonImageColor(java.awt.Color scrollButtonImageColor)
-
setScrollButtonImageColor
public final void setScrollButtonImageColor(java.lang.String scrollButtonImageColor)
-
setScrollButtonImageColor
public final void setScrollButtonImageColor(int scrollButtonImageColor)
-
getScrollButtonBackgroundColor
public java.awt.Color getScrollButtonBackgroundColor()
-
setScrollButtonBackgroundColor
public void setScrollButtonBackgroundColor(java.awt.Color scrollButtonBackgroundColor)
-
setScrollButtonBackgroundColor
public final void setScrollButtonBackgroundColor(java.lang.String scrollButtonBackgroundColor)
-
setScrollButtonBackgroundColor
public final void setScrollButtonBackgroundColor(int scrollButtonBackgroundColor)
-
getScrollButtonDisabledBackgroundColor
public java.awt.Color getScrollButtonDisabledBackgroundColor()
-
setScrollButtonDisabledBackgroundColor
public void setScrollButtonDisabledBackgroundColor(java.awt.Color scrollButtonDisabledBackgroundColor)
-
setScrollButtonDisabledBackgroundColor
public final void setScrollButtonDisabledBackgroundColor(java.lang.String scrollButtonDisabledBackgroundColor)
-
setScrollButtonDisabledBackgroundColor
public final void setScrollButtonDisabledBackgroundColor(int scrollButtonDisabledBackgroundColor)
-
getScrollButtonPressedBackgroundColor
public java.awt.Color getScrollButtonPressedBackgroundColor()
-
setScrollButtonPressedBackgroundColor
public void setScrollButtonPressedBackgroundColor(java.awt.Color scrollButtonPressedBackgroundColor)
-
setScrollButtonPressedBackgroundColor
public final void setScrollButtonPressedBackgroundColor(java.lang.String scrollButtonPressedBackgroundColor)
-
setScrollButtonPressedBackgroundColor
public final void setScrollButtonPressedBackgroundColor(int scrollButtonPressedBackgroundColor)
-
getScrollButtonHighlightedBackgroundColor
public java.awt.Color getScrollButtonHighlightedBackgroundColor()
-
setScrollButtonHighlightedBackgroundColor
public void setScrollButtonHighlightedBackgroundColor(java.awt.Color scrollButtonHighlightedBackgroundColor)
-
setScrollButtonHighlightedBackgroundColor
public final void setScrollButtonHighlightedBackgroundColor(java.lang.String scrollButtonHighlightedBackgroundColor)
-
setScrollButtonHighlightedBackgroundColor
public final void setScrollButtonHighlightedBackgroundColor(int scrollButtonHighlightedBackgroundColor)
-
mouseOut
public void mouseOut(Component component)
Description copied from interface:ComponentMouseListenerCalled when the mouse exits a component.Default is to do nothing.
- Specified by:
mouseOutin interfaceComponentMouseListener- Overrides:
mouseOutin classComponentSkin- Parameters:
component- Component that has now lost the mouse pointer.
-
mouseDown
public boolean mouseDown(Component component, Mouse.Button button, int x, int y)
Initiates automatic block scrolling. This only happens if the handle is visible since whether the user clicked before or after the handle determines the direction of the scrolling.- Specified by:
mouseDownin interfaceComponentMouseButtonListener- Overrides:
mouseDownin classComponentSkin- Parameters:
component- The scroll bar.button- The button that was pressed.x- The x-coordinate of the event in the scroll bar's coordinate space.y- The y-coordinate of the event in the scroll bar's coordinate space.- Returns:
trueto consume the event;falseto allow it to propagate (default).
-
mouseUp
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
Cancels automatic block scrolling.- Specified by:
mouseUpin interfaceComponentMouseButtonListener- Overrides:
mouseUpin classComponentSkin- Parameters:
component- The scroll bar.button- The button that was released.x- The x-coordinate of the event in the scroll bar's coordinate space.y- The y-coordinate of the event in the scroll bar's coordinate space.- Returns:
trueto consume the event;falseto allow it to propagate (default).
-
mouseWheel
public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
Updates the scroll bar's value.- Specified by:
mouseWheelin interfaceComponentMouseWheelListener- Overrides:
mouseWheelin classComponentSkin- Parameters:
component- The scroll bar.scrollType- Unit or block scrolling.scrollAmount- The amount of scrolling.wheelRotation--1or1for backward or forward scrolling, respectively.x- The x-coordinate of the event in the scroll bar's coordinate space.y- The y-coordinate of the event in the scroll bar's coordinate space.- Returns:
trueto consume the event;falseto allow it to propagate.
-
enabledChanged
public void enabledChanged(Component component)
Propagates the scroll bar's enabled state to the scroll buttons.- Specified by:
enabledChangedin interfaceComponentStateListener- Overrides:
enabledChangedin classComponentSkin- Parameters:
component- The scroll bar.
-
orientationChanged
public void orientationChanged(ScrollBar scrollBar, Orientation previousOrientation)
Description copied from interface:ScrollBarListenerCalled when a scroll bar's orientation has changed.- Specified by:
orientationChangedin interfaceScrollBarListener- Parameters:
scrollBar- The scroll bar that changed orientation.previousOrientation- The previous orientation.
-
scopeChanged
public void scopeChanged(ScrollBar scrollBar, int previousStart, int previousEnd, int previousExtent)
Description copied from interface:ScrollBarListenerCalled when a scroll bar's scope has changed.- Specified by:
scopeChangedin interfaceScrollBarListener- Parameters:
scrollBar- The scroll bar that changed.previousStart- The previous start value.previousEnd- The previous end value.previousExtent- The previous scroll bar extent value.
-
unitIncrementChanged
public void unitIncrementChanged(ScrollBar scrollBar, int previousUnitIncrement)
Description copied from interface:ScrollBarListenerCalled when a scroll bar's unit increment has changed.- Specified by:
unitIncrementChangedin interfaceScrollBarListener- Parameters:
scrollBar- The scroll bar that changed.previousUnitIncrement- The previous unit increment value.
-
blockIncrementChanged
public void blockIncrementChanged(ScrollBar scrollBar, int previousBlockIncrement)
Description copied from interface:ScrollBarListenerCalled when a scroll bar's block increment has changed.- Specified by:
blockIncrementChangedin interfaceScrollBarListener- Parameters:
scrollBar- The scroll bar that changed.previousBlockIncrement- The previous block increment value.
-
valueChanged
public void valueChanged(ScrollBar scrollBar, int previousValue)
Description copied from interface:ScrollBarValueListenerCalled when a scroll bar's value has changed.- Specified by:
valueChangedin interfaceScrollBarValueListener- Parameters:
scrollBar- The scroll bar that is changing.previousValue- The previous value of this scroll bar.
-
-