org.apache.pivot.wtk.skin
Class ComponentSkin

java.lang.Object
  extended by org.apache.pivot.wtk.skin.ComponentSkin
All Implemented Interfaces:
ComponentKeyListener, ComponentListener, ComponentMouseButtonListener, ComponentMouseListener, ComponentMouseWheelListener, ComponentStateListener, ComponentTooltipListener, ConstrainedVisual, Skin, Visual
Direct Known Subclasses:
ActivityIndicatorSkin, ButtonSkin, ChartViewSkin, ContainerSkin, GridPaneFillerSkin, ImageViewSkin, LabelSkin, MovieViewSkin, SeparatorSkin, TablePaneFillerSkin, TerraListViewSkin, TerraMeterSkin, TerraRollupSkin.RollupButtonSkin, TerraScrollBarSkin.HandleSkin, TerraScrollBarSkin.ScrollButtonSkin, TerraScrollPaneCornerSkin, TerraSliderSkin.ThumbSkin, TerraSpinnerSkin.SpinButtonSkin, TerraSpinnerSkin.SpinnerContentSkin, TerraSplitPaneSkin.SplitterShadowSkin, TerraSplitPaneSkin.SplitterSkin, TerraTableViewHeaderSkin, TerraTableViewSkin, TerraTextInputSkin, TerraTreeViewSkin, TextAreaSkin

public abstract class ComponentSkin
extends Object
implements Skin, ComponentListener, ComponentStateListener, ComponentMouseListener, ComponentMouseButtonListener, ComponentMouseWheelListener, ComponentKeyListener, ComponentTooltipListener

Abstract base class for component skins.


Nested Class Summary
 
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
ComponentSkin()
           
 
Method Summary
 void cursorChanged(Component componentArgument, Cursor previousCursor)
          Called when a component's cursor has changed.
static Font decodeFont(String value)
          Interpret a string as a font specification
 void dragSourceChanged(Component componentArgument, DragSource previousDragSource)
          Called when a component's drag source has changed.
 void dropTargetChanged(Component componentArgument, DropTarget previousDropTarget)
          Called when a component's drop target has changed.
 void enabledChanged(Component componentArgument)
          Called when a component's enabled state has changed.
 void focusedChanged(Component componentArgument, Component obverseComponent)
          Called when a component's focused state has changed.
 int getBaseline()
          Returns the visual's baseline.
 int getBaseline(int widthArgument, int heightArgument)
          Returns the baseline for a given width and height.
 Component getComponent()
          Returns the component with which a skin is associated.
 int getHeight()
          Returns the visual's height.
 Dimensions getPreferredSize()
          Returns the visual's unconstrained preferred size.
 int getWidth()
          Returns the visual's width.
 void heightLimitsChanged(Component componentArgument, int previousMinimumHeight, int previousMaximumHeight)
          Called when a component's preferred height limits have changed.
 void install(Component componentArgument)
          Associates a skin with a component.
protected  void invalidateComponent()
           
 boolean isFocusable()
          By default, skins are focusable.
 boolean isOpaque()
          By default, skins are assumed to be opaque.
 boolean keyPressed(Component componentArgument, int keyCode, Keyboard.KeyLocation keyLocation)
          TAB Transfers focus forwards
TAB + SHIFT Transfers focus backwards
 boolean keyReleased(Component componentArgument, int keyCode, Keyboard.KeyLocation keyLocation)
          Called when a key has been released.
 boolean keyTyped(Component componentArgument, char character)
          Called when a key has been typed.
 void locationChanged(Component componentArgument, int previousX, int previousY)
          Called when a component's location has changed.
 void menuHandlerChanged(Component componentArgument, MenuHandler previousMenuHandler)
          Called when a component's context menu handler has changed.
 boolean mouseClick(Component componentArgument, Mouse.Button button, int x, int y, int count)
          Called when a mouse button is clicked over a component.
 boolean mouseDown(Component componentArgument, Mouse.Button button, int x, int y)
          Called when a mouse button is pressed over a component.
 boolean mouseMove(Component componentArgument, int x, int y)
          Called when the mouse is moved over a component.
 void mouseOut(Component componentArgument)
          Called when the mouse exits a component.
 void mouseOver(Component componentArgument)
          Called when the mouse enters a component.
 boolean mouseUp(Component componentArgument, Mouse.Button button, int x, int y)
          Called when a mouse button is released over a component.
 boolean mouseWheel(Component componentArgument, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
          Called when the mouse wheel is scrolled over a component.
 void nameChanged(Component componentArgument, String previousName)
          Called when a component's name has changed.
 void parentChanged(Component componentArgument, Container previousParent)
          Called when a component's parent has changed (when the component is either added to or removed from a container).
 void preferredSizeChanged(Component componentArgument, int previousPreferredWidth, int previousPreferredHeight)
          Called when a component's preferred size has changed.
protected  void repaintComponent()
           
protected  void repaintComponent(boolean immediate)
           
protected  void repaintComponent(Bounds area)
           
protected  void repaintComponent(int x, int y, int widthArgument, int heightArgument)
           
protected  void repaintComponent(int x, int y, int widthArgument, int heightArgument, boolean immediate)
           
 void setSize(int width, int height)
          Sets the visual's render size.
 void sizeChanged(Component componentArgument, int previousWidth, int previousHeight)
          Called when a component's size has changed.
 void tooltipDelayChanged(Component componentArgument, int previousTooltipDelay)
          Called when a component's tooltip delay has changed.
 void tooltipTextChanged(Component componentArgument, String previousTooltipText)
          Called when a component's tooltip text has changed.
 void tooltipTriggered(Component componentArgument, int x, int y)
          Called when a tooltip has been triggered over a component.
 void visibleChanged(Component componentArgument)
          Called when a component's visible flag has changed.
 void widthLimitsChanged(Component componentArgument, int previousMinimumWidth, int previousMaximumWidth)
          Called when a component's preferred width limits have changed.
 
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.Skin
layout
 
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
getPreferredHeight, getPreferredWidth
 
Methods inherited from interface org.apache.pivot.wtk.Visual
paint
 

Constructor Detail

ComponentSkin

public ComponentSkin()
Method Detail

getWidth

public int getWidth()
Description copied from interface: Visual
Returns the visual's width.

Specified by:
getWidth in interface Visual

getHeight

public int getHeight()
Description copied from interface: Visual
Returns the visual's height.

Specified by:
getHeight in interface Visual

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

getPreferredSize

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

Specified by:
getPreferredSize in interface ConstrainedVisual

getBaseline

public final int getBaseline()
Description copied from interface: Visual
Returns the visual's baseline.

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

getBaseline

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

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

install

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

Specified by:
install in interface Skin
Parameters:
componentArgument - The component to which the skin is being attached.

getComponent

public Component getComponent()
Description copied from interface: Skin
Returns the component with which a skin is associated.

Specified by:
getComponent in interface Skin

isFocusable

public boolean isFocusable()
By default, skins are focusable.

Specified by:
isFocusable in interface Skin
Returns:
true if this skin is focusable; false, otherwise.

isOpaque

public boolean isOpaque()
By default, skins are assumed to be opaque.

Specified by:
isOpaque in interface Skin
Returns:
true if this skin is opaque; false if any part of it is transparent or translucent.

parentChanged

public void parentChanged(Component componentArgument,
                          Container previousParent)
Description copied from interface: ComponentListener
Called when a component's parent has changed (when the component is either added to or removed from a container).

Specified by:
parentChanged in interface ComponentListener

sizeChanged

public void sizeChanged(Component componentArgument,
                        int previousWidth,
                        int previousHeight)
Description copied from interface: ComponentListener
Called when a component's size has changed.

Specified by:
sizeChanged in interface ComponentListener

preferredSizeChanged

public void preferredSizeChanged(Component componentArgument,
                                 int previousPreferredWidth,
                                 int previousPreferredHeight)
Description copied from interface: ComponentListener
Called when a component's preferred size has changed.

Specified by:
preferredSizeChanged in interface ComponentListener

widthLimitsChanged

public void widthLimitsChanged(Component componentArgument,
                               int previousMinimumWidth,
                               int previousMaximumWidth)
Description copied from interface: ComponentListener
Called when a component's preferred width limits have changed.

Specified by:
widthLimitsChanged in interface ComponentListener

heightLimitsChanged

public void heightLimitsChanged(Component componentArgument,
                                int previousMinimumHeight,
                                int previousMaximumHeight)
Description copied from interface: ComponentListener
Called when a component's preferred height limits have changed.

Specified by:
heightLimitsChanged in interface ComponentListener

locationChanged

public void locationChanged(Component componentArgument,
                            int previousX,
                            int previousY)
Description copied from interface: ComponentListener
Called when a component's location has changed.

Specified by:
locationChanged in interface ComponentListener

visibleChanged

public void visibleChanged(Component componentArgument)
Description copied from interface: ComponentListener
Called when a component's visible flag has changed.

Specified by:
visibleChanged in interface ComponentListener

cursorChanged

public void cursorChanged(Component componentArgument,
                          Cursor previousCursor)
Description copied from interface: ComponentListener
Called when a component's cursor has changed.

Specified by:
cursorChanged in interface ComponentListener

tooltipTextChanged

public void tooltipTextChanged(Component componentArgument,
                               String previousTooltipText)
Description copied from interface: ComponentListener
Called when a component's tooltip text has changed.

Specified by:
tooltipTextChanged in interface ComponentListener

tooltipDelayChanged

public void tooltipDelayChanged(Component componentArgument,
                                int previousTooltipDelay)
Description copied from interface: ComponentListener
Called when a component's tooltip delay has changed.

Specified by:
tooltipDelayChanged in interface ComponentListener

dragSourceChanged

public void dragSourceChanged(Component componentArgument,
                              DragSource previousDragSource)
Description copied from interface: ComponentListener
Called when a component's drag source has changed.

Specified by:
dragSourceChanged in interface ComponentListener

dropTargetChanged

public void dropTargetChanged(Component componentArgument,
                              DropTarget previousDropTarget)
Description copied from interface: ComponentListener
Called when a component's drop target has changed.

Specified by:
dropTargetChanged in interface ComponentListener

menuHandlerChanged

public void menuHandlerChanged(Component componentArgument,
                               MenuHandler previousMenuHandler)
Description copied from interface: ComponentListener
Called when a component's context menu handler has changed.

Specified by:
menuHandlerChanged in interface ComponentListener

nameChanged

public void nameChanged(Component componentArgument,
                        String previousName)
Description copied from interface: ComponentListener
Called when a component's name has changed.

Specified by:
nameChanged in interface ComponentListener

enabledChanged

public void enabledChanged(Component componentArgument)
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
Parameters:
componentArgument - The component whose enabled state is changing.

focusedChanged

public void focusedChanged(Component componentArgument,
                           Component obverseComponent)
Description copied from interface: ComponentStateListener
Called when a component's focused state has changed.

This will be called both when a component gains focus and when it loses focus. The currently focused component has already been set when this method is called, so that the new state of the component can be determined by calling the Component.isFocused() method.

Specified by:
focusedChanged in interface ComponentStateListener
Parameters:
componentArgument - The component that is either gaining focus or the one that previously had focus and is now losing it.
obverseComponent - If the component is gaining focus, this is the component that is losing focus. If the component is losing focus this is the component that is gaining the focus instead.

mouseMove

public boolean mouseMove(Component componentArgument,
                         int x,
                         int y)
Description copied from interface: ComponentMouseListener
Called when the mouse is moved over a component.

Specified by:
mouseMove in interface ComponentMouseListener
Returns:
true to consume the event; false to allow it to propagate.

mouseOver

public void mouseOver(Component componentArgument)
Description copied from interface: ComponentMouseListener
Called when the mouse enters a component.

Specified by:
mouseOver in interface ComponentMouseListener

mouseOut

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

Specified by:
mouseOut in interface ComponentMouseListener

mouseDown

public boolean mouseDown(Component componentArgument,
                         Mouse.Button button,
                         int x,
                         int y)
Description copied from interface: ComponentMouseButtonListener
Called when a mouse button is pressed over a component.

Specified by:
mouseDown in interface ComponentMouseButtonListener
Returns:
true to consume the event; false to allow it to propagate.

mouseUp

public boolean mouseUp(Component componentArgument,
                       Mouse.Button button,
                       int x,
                       int y)
Description copied from interface: ComponentMouseButtonListener
Called when a mouse button is released over a component.

Specified by:
mouseUp in interface ComponentMouseButtonListener
Returns:
true to consume the event; false to allow it to propagate.

mouseClick

public boolean mouseClick(Component componentArgument,
                          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
Returns:
true to consume the event; false to allow it to propagate.

mouseWheel

public boolean mouseWheel(Component componentArgument,
                          Mouse.ScrollType scrollType,
                          int scrollAmount,
                          int wheelRotation,
                          int x,
                          int y)
Description copied from interface: ComponentMouseWheelListener
Called when the mouse wheel is scrolled over a component.

Specified by:
mouseWheel in interface ComponentMouseWheelListener
Returns:
true to consume the event; false to allow it to propagate.

keyTyped

public boolean keyTyped(Component componentArgument,
                        char character)
Description copied from interface: ComponentKeyListener
Called when a key has been typed.

Specified by:
keyTyped in interface ComponentKeyListener
Returns:
true to consume the event; false to allow it to propagate.

keyPressed

public boolean keyPressed(Component componentArgument,
                          int keyCode,
                          Keyboard.KeyLocation keyLocation)
TAB Transfers focus forwards
TAB + SHIFT Transfers focus backwards

Specified by:
keyPressed in interface ComponentKeyListener
Returns:
true to consume the event; false to allow it to propagate.

keyReleased

public boolean keyReleased(Component componentArgument,
                           int keyCode,
                           Keyboard.KeyLocation keyLocation)
Description copied from interface: ComponentKeyListener
Called when a key has been released.

Specified by:
keyReleased in interface ComponentKeyListener
Returns:
true to consume the event; false to allow it to propagate.

tooltipTriggered

public void tooltipTriggered(Component componentArgument,
                             int x,
                             int y)
Description copied from interface: ComponentTooltipListener
Called when a tooltip has been triggered over a component.

Specified by:
tooltipTriggered in interface ComponentTooltipListener

invalidateComponent

protected void invalidateComponent()

repaintComponent

protected void repaintComponent()

repaintComponent

protected void repaintComponent(boolean immediate)

repaintComponent

protected void repaintComponent(Bounds area)

repaintComponent

protected void repaintComponent(int x,
                                int y,
                                int widthArgument,
                                int heightArgument)

repaintComponent

protected void repaintComponent(int x,
                                int y,
                                int widthArgument,
                                int heightArgument,
                                boolean immediate)

decodeFont

public static Font decodeFont(String value)
Interpret a string as a font specification

Parameters:
value - Either a JSON dictionary describing a font relative to the current theme, or one of the standard Java font specifications.