Package org.apache.pivot.wtk.skin.terra
Class TerraSliderSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.SliderSkin
-
- org.apache.pivot.wtk.skin.terra.TerraSliderSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,ContainerListener
,ContainerMouseListener
,Skin
,SliderListener
,SliderValueListener
,Visual
public class TerraSliderSkin extends SliderSkin
Terra slider skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TerraSliderSkin.Thumb
Slider thumb component.protected class
TerraSliderSkin.ThumbSkin
Slider thumb skin.-
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.SliderListener
SliderListener.Adapter, SliderListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.SliderValueListener
SliderValueListener.Listeners
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_WIDTH
static int
MINIMUM_THUMB_HEIGHT
static int
MINIMUM_THUMB_WIDTH
-
Constructor Summary
Constructors Constructor Description TerraSliderSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Color
getButtonBackgroundColor()
java.awt.Color
getButtonBorderColor()
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
getThumbHeight()
int
getThumbWidth()
int
getTickSpacing()
java.awt.Color
getTrackColor()
int
getTrackWidth()
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.void
layout()
If the component on which the skin is installed is a container, lays out the container's children.boolean
mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Called when a mouse button is clicked over a component.void
orientationChanged(Slider slider)
Called when a sliders's orientation has changed.void
paint(java.awt.Graphics2D graphics)
Paints the visual.void
rangeChanged(Slider slider, int previousStart, int previousEnd)
Called when a slider's range has changed.void
setButtonBackgroundColor(int buttonBackgroundColorIndex)
void
setButtonBackgroundColor(java.awt.Color buttonBackgroundColorValue)
void
setButtonBackgroundColor(java.lang.String buttonBackgroundColorString)
void
setButtonBorderColor(int buttonBorderColorIndex)
void
setButtonBorderColor(java.awt.Color buttonBorderColorValue)
void
setButtonBorderColor(java.lang.String buttonBorderColorString)
void
setThumbHeight(int thumbHeightValue)
void
setThumbHeight(java.lang.Number thumbHeightValue)
void
setThumbWidth(int thumbWidthValue)
void
setThumbWidth(java.lang.Number thumbWidthValue)
void
setTickSpacing(int tickSpacingValue)
Set the tick spacing value along the slider axis.void
setTickSpacing(java.lang.Number tickSpacingValue)
void
setTrackColor(int trackColorIndex)
void
setTrackColor(java.awt.Color trackColorValue)
void
setTrackColor(java.lang.String trackColorString)
void
setTrackWidth(int trackWidthValue)
void
setTrackWidth(java.lang.Number trackWidthValue)
void
valueChanged(Slider slider, int previousValue)
Called when a slider's value has changed.-
Methods inherited from class org.apache.pivot.wtk.skin.SliderSkin
getSlider
-
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, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, 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
-
-
-
-
Field Detail
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTH
- See Also:
- Constant Field Values
-
MINIMUM_THUMB_WIDTH
public static final int MINIMUM_THUMB_WIDTH
- See Also:
- Constant Field Values
-
MINIMUM_THUMB_HEIGHT
public static final int MINIMUM_THUMB_HEIGHT
- See Also:
- Constant Field Values
-
-
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 classSliderSkin
- 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
- Overrides:
getPreferredWidth
in classContainerSkin
- 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
- Overrides:
getPreferredHeight
in classContainerSkin
- 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.- Specified by:
paint
in interfaceVisual
- Overrides:
paint
in classContainerSkin
- Parameters:
graphics
- The graphics context in which to paint the visual.
-
getTrackColor
public java.awt.Color getTrackColor()
-
setTrackColor
public void setTrackColor(java.awt.Color trackColorValue)
-
setTrackColor
public final void setTrackColor(java.lang.String trackColorString)
-
setTrackColor
public final void setTrackColor(int trackColorIndex)
-
getButtonBackgroundColor
public java.awt.Color getButtonBackgroundColor()
-
setButtonBackgroundColor
public void setButtonBackgroundColor(java.awt.Color buttonBackgroundColorValue)
-
setButtonBackgroundColor
public final void setButtonBackgroundColor(java.lang.String buttonBackgroundColorString)
-
setButtonBackgroundColor
public final void setButtonBackgroundColor(int buttonBackgroundColorIndex)
-
getButtonBorderColor
public java.awt.Color getButtonBorderColor()
-
setButtonBorderColor
public void setButtonBorderColor(java.awt.Color buttonBorderColorValue)
-
setButtonBorderColor
public final void setButtonBorderColor(java.lang.String buttonBorderColorString)
-
setButtonBorderColor
public final void setButtonBorderColor(int buttonBorderColorIndex)
-
getTrackWidth
public int getTrackWidth()
-
setTrackWidth
public void setTrackWidth(int trackWidthValue)
-
setTrackWidth
public void setTrackWidth(java.lang.Number trackWidthValue)
-
getThumbWidth
public int getThumbWidth()
-
setThumbWidth
public void setThumbWidth(int thumbWidthValue)
-
setThumbWidth
public void setThumbWidth(java.lang.Number thumbWidthValue)
-
getThumbHeight
public int getThumbHeight()
-
setThumbHeight
public void setThumbHeight(int thumbHeightValue)
-
setThumbHeight
public void setThumbHeight(java.lang.Number thumbHeightValue)
-
getTickSpacing
public int getTickSpacing()
-
setTickSpacing
public void setTickSpacing(int tickSpacingValue)
Set the tick spacing value along the slider axis.- Parameters:
tickSpacingValue
- An integer number of pixels to use to space out the tick marks along the axis. Less or equal zero implies don't draw tick marks.
-
setTickSpacing
public void setTickSpacing(java.lang.Number tickSpacingValue)
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is clicked over a component.- Specified by:
mouseClick
in interfaceComponentMouseButtonListener
- Overrides:
mouseClick
in classComponentSkin
- Parameters:
component
- Component user the mouse pointer.button
- Which mouse button was clicked.x
- X position of the mouse.y
- Y position of the mouse.count
- Number of clicks (1 = single click, 2 = double click, etc.).- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
rangeChanged
public void rangeChanged(Slider slider, int previousStart, int previousEnd)
Description copied from interface:SliderListener
Called when a slider's range has changed.- Parameters:
slider
- The slider that has changed.previousStart
- The previous start of the slider's range.previousEnd
- The previous end value.
-
orientationChanged
public void orientationChanged(Slider slider)
Description copied from interface:SliderListener
Called when a sliders's orientation has changed.- Parameters:
slider
- The source of the event.
-
valueChanged
public void valueChanged(Slider slider, int previousValue)
Description copied from interface:SliderValueListener
Called when a slider's value has changed.- Parameters:
slider
- The slider whose value has changed.previousValue
- What the previous value was.
-
-