Package org.apache.pivot.wtk.skin.terra
Class TerraSpinnerSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.terra.TerraSpinnerSkin
-
- All Implemented Interfaces:
ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,ContainerListener,ContainerMouseListener,Skin,Spinner.Skin,SpinnerListener,SpinnerSelectionListener,Visual
public class TerraSpinnerSkin extends ContainerSkin implements Spinner.Skin, SpinnerListener, SpinnerSelectionListener
Spinner skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTerraSpinnerSkin.SpinButtonSpinner button.protected classTerraSpinnerSkin.SpinButtonImageAbstract base class for button images.protected classTerraSpinnerSkin.SpinButtonSkinSpinner button skin.protected classTerraSpinnerSkin.SpinDownImageprotected classTerraSpinnerSkin.SpinnerContentComponent that holds the content of a spinner.protected classTerraSpinnerSkin.SpinnerContentSkinSpinnerContent skin.protected classTerraSpinnerSkin.SpinUpImage-
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.SpinnerListener
SpinnerListener.Adapter, SpinnerListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.SpinnerSelectionListener
SpinnerSelectionListener.Adapter, SpinnerSelectionListener.Listeners
-
-
Field Summary
Fields Modifier and Type Field Description static intBUTTON_IMAGE_SIZE
-
Constructor Summary
Constructors Constructor Description TerraSpinnerSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcircularChanged(Spinner spinner)Called when a spinner's circular property has changed.voidenabledChanged(Component component)Called when a component's enabled state has changed.intgetBaseline(int width, int height)Should be implemented in every subclass.java.awt.ColorgetBorderColor()java.awt.ColorgetButtonBackgroundColor()java.awt.ColorgetButtonColor()java.awt.ColorgetColor()BoundsgetContentBounds()java.awt.ColorgetDisabledColor()java.awt.FontgetFont()intgetPreferredHeight(int trialWidth)Returns the visual's preferred height given the provided width constraint.intgetPreferredWidth(int trialHeight)Returns the visual's preferred width given the provided height constraint.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.protected voidinvalidateContent()booleanisSizeToContent()voiditemRendererChanged(Spinner spinner, Spinner.ItemRenderer previousItemRenderer)Called when a spinner's item renderer has changed.voidlayout()If the component on which the skin is installed is a container, lays out the container's children.booleanmouseClick(Component component, Mouse.Button button, int x, int y, int count)Called when a mouse button is clicked over a component.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidselectedIndexChanged(Spinner spinner, int previousSelectedIndex)Called when a spinner's selected index has changed.voidselectedItemChanged(Spinner spinner, java.lang.Object previousSelectedItem)Called when a spinners's selected item has changed.voidsetBorderColor(int borderColorIndex)voidsetBorderColor(java.awt.Color borderColor)voidsetBorderColor(java.lang.String borderColorString)voidsetButtonBackgroundColor(int buttonBackgroundColorIndex)voidsetButtonBackgroundColor(java.awt.Color buttonBackgroundColor)voidsetButtonBackgroundColor(java.lang.String buttonBackgroundColorString)voidsetButtonColor(int buttonColorIndex)voidsetButtonColor(java.awt.Color buttonColor)voidsetButtonColor(java.lang.String buttonColorString)voidsetColor(int color)voidsetColor(java.awt.Color color)voidsetColor(java.lang.String color)voidsetDisabledColor(int disabledColorIndex)voidsetDisabledColor(java.awt.Color disabledColor)voidsetDisabledColor(java.lang.String disabledColorString)voidsetFont(java.awt.Font font)voidsetFont(java.lang.String fontString)voidsetFont(Dictionary<java.lang.String,?> fontDictionary)voidsetSize(int width, int height)Set the final size of the component after layout has finished.voidsetSizeToContent(boolean sizeToContent)voidspinnerDataChanged(Spinner spinner, List<?> previousSpinnerData)Called when a spinner's data 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, getColor, getComponent, getFocusRectangleStroke, getHeight, getPreferredSize, 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, 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
-
BUTTON_IMAGE_SIZE
public static final int BUTTON_IMAGE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setSize
public void setSize(int width, int height)Description copied from class:ComponentSkinSet the final size of the component after layout has finished.All subclasses must call this superclass method in order to set the
ComponentSkin.widthandComponentSkin.heightvalues, but may need to do additional calculations before doing so.- Specified by:
setSizein interfaceConstrainedVisual- Overrides:
setSizein classComponentSkin- Parameters:
width- The new (final) width of the component after layout.height- The new (final) height of the component after layout.
-
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.
-
getBaseline
public int getBaseline(int width, int height)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:
width- Constrained width to compute the baseline for.height- 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.
-
enabledChanged
public void enabledChanged(Component component)
Description copied from interface:ComponentStateListenerCalled when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabledflag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()method.- Specified by:
enabledChangedin interfaceComponentStateListener- Overrides:
enabledChangedin classComponentSkin- Parameters:
component- The component whose enabled state is changing.
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListenerCalled when a mouse button is clicked over a component.- Specified by:
mouseClickin interfaceComponentMouseButtonListener- Overrides:
mouseClickin 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:
trueto consume the event;falseto allow it to propagate (default).
-
invalidateContent
protected void invalidateContent()
-
getColor
public java.awt.Color getColor()
-
setColor
public void setColor(java.awt.Color color)
-
setColor
public final void setColor(java.lang.String color)
-
setColor
public final void setColor(int color)
-
getDisabledColor
public java.awt.Color getDisabledColor()
-
setDisabledColor
public void setDisabledColor(java.awt.Color disabledColor)
-
setDisabledColor
public final void setDisabledColor(java.lang.String disabledColorString)
-
setDisabledColor
public final void setDisabledColor(int disabledColorIndex)
-
getBorderColor
public java.awt.Color getBorderColor()
-
setBorderColor
public void setBorderColor(java.awt.Color borderColor)
-
setBorderColor
public final void setBorderColor(java.lang.String borderColorString)
-
setBorderColor
public final void setBorderColor(int borderColorIndex)
-
getButtonColor
public java.awt.Color getButtonColor()
-
setButtonColor
public void setButtonColor(java.awt.Color buttonColor)
-
setButtonColor
public final void setButtonColor(java.lang.String buttonColorString)
-
setButtonColor
public final void setButtonColor(int buttonColorIndex)
-
getButtonBackgroundColor
public java.awt.Color getButtonBackgroundColor()
-
setButtonBackgroundColor
public void setButtonBackgroundColor(java.awt.Color buttonBackgroundColor)
-
setButtonBackgroundColor
public final void setButtonBackgroundColor(java.lang.String buttonBackgroundColorString)
-
setButtonBackgroundColor
public final void setButtonBackgroundColor(int buttonBackgroundColorIndex)
-
getFont
public java.awt.Font getFont()
-
setFont
public void setFont(java.awt.Font font)
-
setFont
public final void setFont(java.lang.String fontString)
-
setFont
public final void setFont(Dictionary<java.lang.String,?> fontDictionary)
-
isSizeToContent
public boolean isSizeToContent()
-
setSizeToContent
public void setSizeToContent(boolean sizeToContent)
-
getContentBounds
public Bounds getContentBounds()
- Specified by:
getContentBoundsin interfaceSpinner.Skin
-
spinnerDataChanged
public void spinnerDataChanged(Spinner spinner, List<?> previousSpinnerData)
Description copied from interface:SpinnerListenerCalled when a spinner's data has changed.- Specified by:
spinnerDataChangedin interfaceSpinnerListener- Parameters:
spinner- The source of this event.previousSpinnerData- What the spinner data used to be.
-
itemRendererChanged
public void itemRendererChanged(Spinner spinner, Spinner.ItemRenderer previousItemRenderer)
Description copied from interface:SpinnerListenerCalled when a spinner's item renderer has changed.- Specified by:
itemRendererChangedin interfaceSpinnerListener- Parameters:
spinner- The source of this event.previousItemRenderer- What the item renderer used to be.
-
circularChanged
public void circularChanged(Spinner spinner)
Description copied from interface:SpinnerListenerCalled when a spinner's circular property has changed.- Specified by:
circularChangedin interfaceSpinnerListener- Parameters:
spinner- The source of this event.
-
selectedIndexChanged
public void selectedIndexChanged(Spinner spinner, int previousSelectedIndex)
Description copied from interface:SpinnerSelectionListenerCalled when a spinner's selected index has changed.- Specified by:
selectedIndexChangedin interfaceSpinnerSelectionListener- Parameters:
spinner- The source of the event.previousSelectedIndex- If the selection changed directly, contains the index that was previously selected. Otherwise, contains the current selection.
-
selectedItemChanged
public void selectedItemChanged(Spinner spinner, java.lang.Object previousSelectedItem)
Description copied from interface:SpinnerSelectionListenerCalled when a spinners's selected item has changed.- Specified by:
selectedItemChangedin interfaceSpinnerSelectionListener- Parameters:
spinner- The source of the event.previousSelectedItem- The item that was previously selected, ornullif the previous selection cannot be determined.
-
-