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 component, 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 component, DragSource previousDragSource)
          Called when a component's drag source has changed.
 void dropTargetChanged(Component component, DropTarget previousDropTarget)
          Called when a component's drop target has changed.
 void enabledChanged(Component component)
          Called when a component's enabled state has changed.
 void focusedChanged(Component component, Component obverseComponent)
          Called when a component's focused state has changed.
 int getBaseline()
          Returns the visual's baseline.
 int getBaseline(int width, int height)
          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 component, int previousMinimumHeight, int previousMaximumHeight)
          Called when a component's preferred height limits have changed.
 void install(Component component)
          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 component, int keyCode, Keyboard.KeyLocation keyLocation)
          TAB Transfers focus forwards
TAB + SHIFT Transfers focus backwards
 boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
          Called when a key has been released.
 boolean keyTyped(Component component, char character)
          Called when a key has been typed.
 void locationChanged(Component component, int previousX, int previousY)
          Called when a component's location has changed.
 void menuHandlerChanged(Component component, MenuHandler previousMenuHandler)
          Called when a component's context menu handler has changed.
 boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
          Called when a mouse button is clicked over a component.
 boolean mouseDown(Component component, Mouse.Button button, int x, int y)
          Called when a mouse button is pressed over a component.
 boolean mouseMove(Component component, int x, int y)
          Called when the mouse is moved over a component.
 void mouseOut(Component component)
          Called when the mouse exits a component.
 void mouseOver(Component component)
          Called when the mouse enters a component.
 boolean mouseUp(Component component, Mouse.Button button, int x, int y)
          Called when a mouse button is released over a component.
 boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
          Called when the mouse wheel is scrolled over a component.
 void nameChanged(Component component, String previousName)
          Called when a component's name has changed.
 void parentChanged(Component component, 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 component, 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 width, int height)
           
protected  void repaintComponent(int x, int y, int width, int height, boolean immediate)
           
 void setSize(int width, int height)
          Sets the visual's render size.
 void sizeChanged(Component component, int previousWidth, int previousHeight)
          Called when a component's size has changed.
 void tooltipDelayChanged(Component component, int previousTooltipDelay)
          Called when a component's tooltip delay has changed.
 void tooltipTextChanged(Component component, String previousTooltipText)
          Called when a component's tooltip text has changed.
 void tooltipTriggered(Component component, int x, int y)
          Called when a tooltip has been triggered over a component.
 void visibleChanged(Component component)
          Called when a component's visible flag has changed.
 void widthLimitsChanged(Component component, 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 width,
                       int height)
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 component)
Description copied from interface: Skin
Associates a skin with a component.

Specified by:
install in interface Skin
Parameters:
component - 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 component,
                          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 component,
                        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 component,
                                 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 component,
                               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 component,
                                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 component,
                            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 component)
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 component,
                          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 component,
                               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 component,
                                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 component,
                              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 component,
                              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 component,
                               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 component,
                        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 component)
Description copied from interface: ComponentStateListener
Called when a component's enabled state has changed.

Specified by:
enabledChanged in interface ComponentStateListener

focusedChanged

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

Specified by:
focusedChanged in interface ComponentStateListener

mouseMove

public boolean mouseMove(Component component,
                         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 component)
Description copied from interface: ComponentMouseListener
Called when the mouse enters a component.

Specified by:
mouseOver in interface ComponentMouseListener

mouseOut

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

Specified by:
mouseOut in interface ComponentMouseListener

mouseDown

public boolean mouseDown(Component component,
                         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 component,
                       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 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
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)
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 component,
                        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 component,
                          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 component,
                           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 component,
                             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 width,
                                int height)

repaintComponent

protected void repaintComponent(int x,
                                int y,
                                int width,
                                int height,
                                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.