org.apache.pivot.wtk.skin.terra
Class TerraScrollBarSkin

java.lang.Object
  extended by org.apache.pivot.wtk.skin.ComponentSkin
      extended by org.apache.pivot.wtk.skin.ContainerSkin
          extended by 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
protected  class TerraScrollBarSkin.AutomaticScroller
          Encapsulates the code needed to perform timer-controlled scrolling.
protected  class TerraScrollBarSkin.Handle
          Scroll bar handle component.
protected  class TerraScrollBarSkin.HandleSkin
          Scroll bar scroll handle component skin.
protected  class TerraScrollBarSkin.ScrollButton
          Scroll bar scroll button component.
protected  class TerraScrollBarSkin.ScrollButtonImage
           
protected  class TerraScrollBarSkin.ScrollButtonSkin
          Scroll bar scroll button component skin.
protected  class TerraScrollBarSkin.ScrollDownImage
           
protected  class TerraScrollBarSkin.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.ScrollBarListener
ScrollBarListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerListener
ContainerListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListener
ContainerMouseListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter
 
Constructor Summary
TerraScrollBarSkin()
           
 
Method Summary
 void blockIncrementChanged(ScrollBar scrollBar, int previousBlockIncrement)
          Called when a scroll bar's block increment has changed.
 void enabledChanged(Component component)
          Propagates the scroll bar's enabled state to the scroll buttons.
 Color getBorderColor()
           
 int getMinimumHandleLength()
           
 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.
 Color getScrollButtonBackgroundColor()
           
 Color getScrollButtonDisabledBackgroundColor()
           
 Color getScrollButtonHighlightedBackgroundColor()
           
 Color getScrollButtonImageColor()
           
 Color getScrollButtonPressedBackgroundColor()
           
 void install(Component component)
          Associates a skin with a component.
 void layout()
          If the component on which the skin is installed is a container, lays out the container's children.
 boolean mouseDown(Component component, Mouse.Button button, int x, int y)
          Initiates automatic block scrolling.
 void mouseOut(Component component)
          Called when the mouse exits a component.
 boolean mouseUp(Component component, Mouse.Button button, int x, int y)
          Cancels automatic block scrolling.
 boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
          Updates the scroll bar's value.
 void orientationChanged(ScrollBar scrollBar, Orientation previousOrientation)
          Called when a scroll bar's orientation has changed.
 void paint(Graphics2D graphics)
          Paints the visual.
 void scopeChanged(ScrollBar scrollBar, int previousStart, int previousEnd, int previousExtent)
          Called when a scroll bar's scope has changed.
 void setBackgroundColor(int backgroundColor)
           
 void setBorderColor(Color borderColor)
           
 void setBorderColor(int borderColor)
           
 void setBorderColor(String borderColor)
           
 void setMinimumHandleLength(int minimumHandleLength)
           
 void setScrollButtonBackgroundColor(Color scrollButtonBackgroundColor)
           
 void setScrollButtonBackgroundColor(int scrollButtonBackgroundColor)
           
 void setScrollButtonBackgroundColor(String scrollButtonBackgroundColor)
           
 void setScrollButtonDisabledBackgroundColor(Color scrollButtonDisabledBackgroundColor)
           
 void setScrollButtonDisabledBackgroundColor(int scrollButtonDisabledBackgroundColor)
           
 void setScrollButtonDisabledBackgroundColor(String scrollButtonDisabledBackgroundColor)
           
 void setScrollButtonHighlightedBackgroundColor(Color scrollButtonHighlightedBackgroundColor)
           
 void setScrollButtonHighlightedBackgroundColor(int scrollButtonHighlightedBackgroundColor)
           
 void setScrollButtonHighlightedBackgroundColor(String scrollButtonHighlightedBackgroundColor)
           
 void setScrollButtonImageColor(Color scrollButtonImageColor)
           
 void setScrollButtonImageColor(int scrollButtonImageColor)
           
 void setScrollButtonImageColor(String scrollButtonImageColor)
           
 void setScrollButtonPressedBackgroundColor(Color scrollButtonPressedBackgroundColor)
           
 void setScrollButtonPressedBackgroundColor(int scrollButtonPressedBackgroundColor)
           
 void setScrollButtonPressedBackgroundColor(String scrollButtonPressedBackgroundColor)
           
 void unitIncrementChanged(ScrollBar scrollBar, int previousUnitIncrement)
          Called when a scroll bar's unit increment has changed.
 void valueChanged(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, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint
 
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
cursorChanged, decodeFont, dragSourceChanged, dropTargetChanged, focusedChanged, getBaseline, getBaseline, getComponent, getHeight, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseMove, mouseOver, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setSize, sizeChanged, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TerraScrollBarSkin

public TerraScrollBarSkin()
Method Detail

install

public void install(Component component)
Description copied from interface: Skin
Associates a skin with a component.

Specified by:
install in interface Skin
Overrides:
install in class ContainerSkin
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 interface ConstrainedVisual
Overrides:
getPreferredWidth in class ContainerSkin
Parameters:
height - The height by which to constrain the preferred width, or -1 for no 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 interface ConstrainedVisual
Overrides:
getPreferredHeight in class ContainerSkin
Parameters:
width - The width by which to constrain the preferred height, or -1 for no constraint.

getPreferredSize

public Dimensions getPreferredSize()
Description copied from interface: ConstrainedVisual
Returns the visual's unconstrained preferred size.

Specified by:
getPreferredSize in interface ConstrainedVisual
Overrides:
getPreferredSize in class ComponentSkin

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.

Specified by:
layout in interface Skin

paint

public void paint(Graphics2D graphics)
Description copied from interface: Visual
Paints the visual.

Specified by:
paint in interface Visual
Overrides:
paint in class ContainerSkin
Parameters:
graphics - The graphics context in which to paint the visual.

setBackgroundColor

public final void setBackgroundColor(int backgroundColor)

getMinimumHandleLength

public int getMinimumHandleLength()

setMinimumHandleLength

public void setMinimumHandleLength(int minimumHandleLength)

getBorderColor

public Color getBorderColor()

setBorderColor

public void setBorderColor(Color borderColor)

setBorderColor

public final void setBorderColor(String borderColor)

setBorderColor

public final void setBorderColor(int borderColor)

getScrollButtonImageColor

public Color getScrollButtonImageColor()

setScrollButtonImageColor

public void setScrollButtonImageColor(Color scrollButtonImageColor)

setScrollButtonImageColor

public final void setScrollButtonImageColor(String scrollButtonImageColor)

setScrollButtonImageColor

public final void setScrollButtonImageColor(int scrollButtonImageColor)

getScrollButtonBackgroundColor

public Color getScrollButtonBackgroundColor()

setScrollButtonBackgroundColor

public void setScrollButtonBackgroundColor(Color scrollButtonBackgroundColor)

setScrollButtonBackgroundColor

public final void setScrollButtonBackgroundColor(String scrollButtonBackgroundColor)

setScrollButtonBackgroundColor

public final void setScrollButtonBackgroundColor(int scrollButtonBackgroundColor)

getScrollButtonDisabledBackgroundColor

public Color getScrollButtonDisabledBackgroundColor()

setScrollButtonDisabledBackgroundColor

public void setScrollButtonDisabledBackgroundColor(Color scrollButtonDisabledBackgroundColor)

setScrollButtonDisabledBackgroundColor

public final void setScrollButtonDisabledBackgroundColor(String scrollButtonDisabledBackgroundColor)

setScrollButtonDisabledBackgroundColor

public final void setScrollButtonDisabledBackgroundColor(int scrollButtonDisabledBackgroundColor)

getScrollButtonPressedBackgroundColor

public Color getScrollButtonPressedBackgroundColor()

setScrollButtonPressedBackgroundColor

public void setScrollButtonPressedBackgroundColor(Color scrollButtonPressedBackgroundColor)

setScrollButtonPressedBackgroundColor

public final void setScrollButtonPressedBackgroundColor(String scrollButtonPressedBackgroundColor)

setScrollButtonPressedBackgroundColor

public final void setScrollButtonPressedBackgroundColor(int scrollButtonPressedBackgroundColor)

getScrollButtonHighlightedBackgroundColor

public Color getScrollButtonHighlightedBackgroundColor()

setScrollButtonHighlightedBackgroundColor

public void setScrollButtonHighlightedBackgroundColor(Color scrollButtonHighlightedBackgroundColor)

setScrollButtonHighlightedBackgroundColor

public final void setScrollButtonHighlightedBackgroundColor(String scrollButtonHighlightedBackgroundColor)

setScrollButtonHighlightedBackgroundColor

public final void setScrollButtonHighlightedBackgroundColor(int scrollButtonHighlightedBackgroundColor)

mouseOut

public void mouseOut(Component component)
Description copied from interface: ComponentMouseListener
Called when the mouse exits a component.

Specified by:
mouseOut in interface ComponentMouseListener
Overrides:
mouseOut in class ComponentSkin

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:
mouseDown in interface ComponentMouseButtonListener
Overrides:
mouseDown in class ComponentSkin
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:
true to consume the event; false to allow it to propagate.

mouseUp

public boolean mouseUp(Component component,
                       Mouse.Button button,
                       int x,
                       int y)
Cancels automatic block scrolling.

Specified by:
mouseUp in interface ComponentMouseButtonListener
Overrides:
mouseUp in class ComponentSkin
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:
true to consume the event; false to allow it to propagate.

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:
mouseWheel in interface ComponentMouseWheelListener
Overrides:
mouseWheel in class ComponentSkin
Parameters:
component - The scroll bar.
scrollType - Unit or block scrolling.
scrollAmount - The amount of scrolling.
wheelRotation - -1 or 1 for 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:
true to consume the event; false to allow it to propagate.

enabledChanged

public void enabledChanged(Component component)
Propagates the scroll bar's enabled state to the scroll buttons.

Specified by:
enabledChanged in interface ComponentStateListener
Overrides:
enabledChanged in class ComponentSkin
Parameters:
component - The scroll bar.

orientationChanged

public void orientationChanged(ScrollBar scrollBar,
                               Orientation previousOrientation)
Description copied from interface: ScrollBarListener
Called when a scroll bar's orientation has changed.

Specified by:
orientationChanged in interface ScrollBarListener

scopeChanged

public void scopeChanged(ScrollBar scrollBar,
                         int previousStart,
                         int previousEnd,
                         int previousExtent)
Description copied from interface: ScrollBarListener
Called when a scroll bar's scope has changed.

Specified by:
scopeChanged in interface ScrollBarListener

unitIncrementChanged

public void unitIncrementChanged(ScrollBar scrollBar,
                                 int previousUnitIncrement)
Description copied from interface: ScrollBarListener
Called when a scroll bar's unit increment has changed.

Specified by:
unitIncrementChanged in interface ScrollBarListener

blockIncrementChanged

public void blockIncrementChanged(ScrollBar scrollBar,
                                  int previousBlockIncrement)
Description copied from interface: ScrollBarListener
Called when a scroll bar's block increment has changed.

Specified by:
blockIncrementChanged in interface ScrollBarListener

valueChanged

public void valueChanged(ScrollBar scrollBar,
                         int previousValue)
Description copied from interface: ScrollBarValueListener
Called when a scroll bar's value has changed.

Specified by:
valueChanged in interface ScrollBarValueListener