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

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.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
protected  class TerraSpinnerSkin.SpinButton
          Spinner button.
protected  class TerraSpinnerSkin.SpinButtonImage
          Abstract base class for button images.
protected  class TerraSpinnerSkin.SpinButtonSkin
          Spinner button skin.
protected  class TerraSpinnerSkin.SpinDownImage
           
protected  class TerraSpinnerSkin.SpinnerContent
          Component that holds the content of a spinner.
protected  class TerraSpinnerSkin.SpinnerContentSkin
          SpinnerContent skin.
protected  class TerraSpinnerSkin.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.SpinnerListener
SpinnerListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.SpinnerSelectionListener
SpinnerSelectionListener.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
 
Field Summary
static int BUTTON_IMAGE_SIZE
           
 
Constructor Summary
TerraSpinnerSkin()
           
 
Method Summary
 void circularChanged(Spinner spinner)
          Called when a spinner's circular property has changed.
 void enabledChanged(Component component)
          Called when a component's enabled state has changed.
 int getBaseline(int width, int height)
          Returns the baseline for a given width and height.
 Color getBorderColor()
           
 Color getButtonBackgroundColor()
           
 Color getButtonColor()
           
 Color getColor()
           
 Bounds getContentBounds()
           
 Color getDisabledColor()
           
 Font getFont()
           
 int getPreferredHeight(int width)
          Returns the visual's preferred height given the provided width constraint.
 int getPreferredWidth(int height)
          Returns the visual's preferred width given the provided height constraint.
 void install(Component component)
          Associates a skin with a component.
protected  void invalidateContent()
           
 boolean isSizeToContent()
           
 void itemRendererChanged(Spinner spinner, Spinner.ItemRenderer previousItemRenderer)
          Called when a spinner's item renderer has changed.
 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 paint(Graphics2D graphics)
          Paints the visual.
 void selectedIndexChanged(Spinner spinner, int previousSelectedIndex)
          Called when a spinner's selected index has changed.
 void selectedItemChanged(Spinner spinner, Object previousSelectedItem)
          Called when a spinners's selected item has changed.
 void setBorderColor(Color borderColor)
           
 void setBorderColor(String borderColor)
           
 void setButtonBackgroundColor(Color buttonBackgroundColor)
           
 void setButtonBackgroundColor(String buttonBackgroundColor)
           
 void setButtonColor(String buttonColor)
           
 void setButtonImageColor(Color buttonColor)
           
 void setColor(Color color)
           
 void setColor(String color)
           
 void setDisabledColor(Color disabledColor)
           
 void setDisabledColor(String disabledColor)
           
 void setFont(Dictionary<String,?> font)
           
 void setFont(Font font)
           
 void setFont(String font)
           
 void setSize(int width, int height)
          Sets the visual's render size.
 void setSizeToContent(boolean sizeToContent)
           
 void spinnerDataChanged(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, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint
 
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
cursorChanged, decodeFont, dragSourceChanged, dropTargetChanged, focusedChanged, getBaseline, getComponent, getHeight, getPreferredSize, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, sizeChanged, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUTTON_IMAGE_SIZE

public static final int BUTTON_IMAGE_SIZE
See Also:
Constant Field Values
Constructor Detail

TerraSpinnerSkin

public TerraSpinnerSkin()
Method Detail

setSize

public void setSize(int width,
                    int height)
Description copied from interface: ConstrainedVisual
Sets the visual's render size.

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

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.

getBaseline

public int getBaseline(int width,
                       int height)
Description copied from interface: ConstrainedVisual
Returns the baseline for a given width and height.

Specified by:
getBaseline in interface ConstrainedVisual
Overrides:
getBaseline in class ComponentSkin
Returns:
The baseline relative to the origin of this visual, or -1 if this visual does not have a baseline.

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.

enabledChanged

public void enabledChanged(Component component)
Description copied from interface: ComponentStateListener
Called when a component's enabled state has changed.

Called both when the component is enabled and when it is disabled. The component's enabled flag has already been set when this method is called so the new state can be determined by calling the Component.isEnabled() method.

Specified by:
enabledChanged in interface ComponentStateListener
Overrides:
enabledChanged in class ComponentSkin
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: ComponentMouseButtonListener
Called when a mouse button is clicked over a component.

Specified by:
mouseClick in interface ComponentMouseButtonListener
Overrides:
mouseClick in class ComponentSkin
Returns:
true to consume the event; false to allow it to propagate.

invalidateContent

protected void invalidateContent()

getColor

public Color getColor()

setColor

public void setColor(Color color)

setColor

public final void setColor(String color)

getDisabledColor

public Color getDisabledColor()

setDisabledColor

public void setDisabledColor(Color disabledColor)

setDisabledColor

public final void setDisabledColor(String disabledColor)

getBorderColor

public Color getBorderColor()

setBorderColor

public void setBorderColor(Color borderColor)

setBorderColor

public final void setBorderColor(String borderColor)

getButtonColor

public Color getButtonColor()

setButtonImageColor

public void setButtonImageColor(Color buttonColor)

setButtonColor

public final void setButtonColor(String buttonColor)

getButtonBackgroundColor

public Color getButtonBackgroundColor()

setButtonBackgroundColor

public void setButtonBackgroundColor(Color buttonBackgroundColor)

setButtonBackgroundColor

public final void setButtonBackgroundColor(String buttonBackgroundColor)

getFont

public Font getFont()

setFont

public void setFont(Font font)

setFont

public final void setFont(String font)

setFont

public final void setFont(Dictionary<String,?> font)

isSizeToContent

public boolean isSizeToContent()

setSizeToContent

public void setSizeToContent(boolean sizeToContent)

getContentBounds

public Bounds getContentBounds()
Specified by:
getContentBounds in interface Spinner.Skin

spinnerDataChanged

public void spinnerDataChanged(Spinner spinner,
                               List<?> previousSpinnerData)
Description copied from interface: SpinnerListener
Called when a spinner's data has changed.

Specified by:
spinnerDataChanged in interface SpinnerListener

itemRendererChanged

public void itemRendererChanged(Spinner spinner,
                                Spinner.ItemRenderer previousItemRenderer)
Description copied from interface: SpinnerListener
Called when a spinner's item renderer has changed.

Specified by:
itemRendererChanged in interface SpinnerListener

circularChanged

public void circularChanged(Spinner spinner)
Description copied from interface: SpinnerListener
Called when a spinner's circular property has changed.

Specified by:
circularChanged in interface SpinnerListener

selectedIndexChanged

public void selectedIndexChanged(Spinner spinner,
                                 int previousSelectedIndex)
Description copied from interface: SpinnerSelectionListener
Called when a spinner's selected index has changed.

Specified by:
selectedIndexChanged in interface SpinnerSelectionListener
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,
                                Object previousSelectedItem)
Description copied from interface: SpinnerSelectionListener
Called when a spinners's selected item has changed.

Specified by:
selectedItemChanged in interface SpinnerSelectionListener
Parameters:
spinner - The source of the event.
previousSelectedItem - The item that was previously selected, or null if the previous selection cannot be determined.