org.apache.pivot.wtk.skin
Class ContainerSkin

java.lang.Object
  extended by org.apache.pivot.wtk.skin.ComponentSkin
      extended by org.apache.pivot.wtk.skin.ContainerSkin
All Implemented Interfaces:
ComponentKeyListener, ComponentListener, ComponentMouseButtonListener, ComponentMouseListener, ComponentMouseWheelListener, ComponentStateListener, ComponentTooltipListener, ConstrainedVisual, ContainerListener, ContainerMouseListener, Skin, Visual
Direct Known Subclasses:
BorderSkin, BoxPaneSkin, CalendarSkin, CardPaneSkin, ColorChooserSkin, DisplaySkin, ExpanderSkin, FileBrowserSkin, FillPaneSkin, FlowPaneSkin, GridPaneSkin, PanelSkin, RollupSkin, ScrollPaneSkin, SliderSkin, StackPaneSkin, TablePaneSkin, TabPaneSkin, TerraAccordionSkin, TerraFormSkin, TerraMenuBarSkin, TerraMenuSkin, TerraPanoramaSkin, TerraScrollBarSkin, TerraSpinnerSkin, TerraSplitPaneSkin, TextPaneSkin, WindowSkin

public abstract class ContainerSkin
extends ComponentSkin
implements ContainerListener, ContainerMouseListener

Abstract base class for container skins.


Nested Class Summary
static class ContainerSkin.IndexFocusTraversalPolicy
          Focus traversal policy that determines traversal order based on the order of components in the container's component sequence.
 
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
 
Constructor Summary
ContainerSkin()
           
 
Method Summary
 void componentInserted(Container container, int index)
          Called when a component has been inserted into a container's component sequence.
 void componentMoved(Container container, int from, int to)
          Called when a component has moved from one z-index to another within a container.
 void componentsRemoved(Container container, int index, Sequence<Component> removed)
          Called when components have been removed from a container's component sequence.
 void focusTraversalPolicyChanged(Container container, FocusTraversalPolicy previousFocusTraversalPolicy)
          Called when a container's focus traversal policy has changed.
 Color getBackgroundColor()
          Returns the color of the container's background if a solid color has been set as the background; otherwise null.
 Paint getBackgroundPaint()
          Returns the Paint object used to paint the background of the container
 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.
 boolean isFocusable()
          By default, skins are focusable.
 boolean isOpaque()
          By default, skins are assumed to be opaque.
 boolean mouseDown(Container container, Mouse.Button button, int x, int y)
          Called when the mouse is pressed over a container.
 boolean mouseMove(Container container, int x, int y)
          Called when the mouse is moved over a container.
 boolean mouseUp(Container container, Mouse.Button button, int x, int y)
          Called when the mouse is released over a container.
 boolean mouseWheel(Container container, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
          Called when the mouse wheel is scrolled over a container.
 void paint(Graphics2D graphics)
          Paints the visual.
 void setBackgroundColor(Color backgroundColor)
          Sets the background of the container to a solid color.
 void setBackgroundColor(String backgroundColor)
          Sets the background of the container to a solid color.
 void setBackgroundPaint(Dictionary<String,?> backgroundPaint)
          Sets the object used to paint the background of the container.
 void setBackgroundPaint(Paint backgroundPaint)
          Sets the object used to paint the background of the container.
 void setBackgroundPaint(String backgroundPaint)
          Sets the object used to paint the background of the container.
 
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
cursorChanged, decodeFont, dragSourceChanged, dropTargetChanged, enabledChanged, focusedChanged, getBaseline, getBaseline, getComponent, getHeight, getPreferredSize, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setSize, sizeChanged, 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.Skin
layout
 

Constructor Detail

ContainerSkin

public ContainerSkin()
Method Detail

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 ComponentSkin
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
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
Parameters:
width - The width by which to constrain the preferred height, or -1 for no constraint.

paint

public void paint(Graphics2D graphics)
Description copied from interface: Visual
Paints the visual.

Specified by:
paint in interface Visual
Parameters:
graphics - The graphics context in which to paint the visual.

isFocusable

public boolean isFocusable()
Description copied from class: ComponentSkin
By default, skins are focusable.

Specified by:
isFocusable in interface Skin
Overrides:
isFocusable in class ComponentSkin
Returns:
false; by default, containers are not focusable.

isOpaque

public boolean isOpaque()
Description copied from class: ComponentSkin
By default, skins are assumed to be opaque.

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

getBackgroundPaint

public Paint getBackgroundPaint()
Returns the Paint object used to paint the background of the container


setBackgroundPaint

public void setBackgroundPaint(Paint backgroundPaint)
Sets the object used to paint the background of the container.

Parameters:
backgroundPaint - The Paint object

setBackgroundPaint

public final void setBackgroundPaint(String backgroundPaint)
Sets the object used to paint the background of the container.

Parameters:
backgroundPaint - A string recognized by Pivot as a Color or Paint value.

setBackgroundPaint

public final void setBackgroundPaint(Dictionary<String,?> backgroundPaint)
Sets the object used to paint the background of the container.

Parameters:
backgroundPaint - A dictionary containing a Paint description.

getBackgroundColor

public Color getBackgroundColor()
Returns the color of the container's background if a solid color has been set as the background; otherwise null.


setBackgroundColor

public void setBackgroundColor(Color backgroundColor)
Sets the background of the container to a solid color.


setBackgroundColor

public final void setBackgroundColor(String backgroundColor)
Sets the background of the container to a solid color.

Parameters:
backgroundColor - Any of the color values recognized by Pivot.

componentInserted

public void componentInserted(Container container,
                              int index)
Description copied from interface: ContainerListener
Called when a component has been inserted into a container's component sequence.

Specified by:
componentInserted in interface ContainerListener

componentsRemoved

public void componentsRemoved(Container container,
                              int index,
                              Sequence<Component> removed)
Description copied from interface: ContainerListener
Called when components have been removed from a container's component sequence.

Specified by:
componentsRemoved in interface ContainerListener

componentMoved

public void componentMoved(Container container,
                           int from,
                           int to)
Description copied from interface: ContainerListener
Called when a component has moved from one z-index to another within a container.

Specified by:
componentMoved in interface ContainerListener

focusTraversalPolicyChanged

public void focusTraversalPolicyChanged(Container container,
                                        FocusTraversalPolicy previousFocusTraversalPolicy)
Description copied from interface: ContainerListener
Called when a container's focus traversal policy has changed.

Specified by:
focusTraversalPolicyChanged in interface ContainerListener

mouseMove

public boolean mouseMove(Container container,
                         int x,
                         int y)
Description copied from interface: ContainerMouseListener
Called when the mouse is moved over a container.

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

mouseDown

public boolean mouseDown(Container container,
                         Mouse.Button button,
                         int x,
                         int y)
Description copied from interface: ContainerMouseListener
Called when the mouse is pressed over a container.

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

mouseUp

public boolean mouseUp(Container container,
                       Mouse.Button button,
                       int x,
                       int y)
Description copied from interface: ContainerMouseListener
Called when the mouse is released over a container.

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

mouseWheel

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

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