org.apache.pivot.wtk
Class Container

java.lang.Object
  extended by org.apache.pivot.wtk.Component
      extended by org.apache.pivot.wtk.Container
All Implemented Interfaces:
Iterable<Component>, org.apache.pivot.collections.Sequence<Component>, ConstrainedVisual, Visual
Direct Known Subclasses:
Accordion, Border, BoxPane, Calendar, CardPane, ColorChooser, Display, Expander, FileBrowser, FillPane, FlowPane, Form, GridPane, Menu, MenuBar, Panel, Rollup, ScrollBar, Slider, Spinner, SplitPane, StackPane, TablePane, TabPane, TextPane, Viewport, Window

public abstract class Container
extends Component
implements org.apache.pivot.collections.Sequence<Component>, Iterable<Component>

Abstract base class for containers.


Nested Class Summary
static interface Container.EDT_Checker
           
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
org.apache.pivot.collections.Sequence.Tree<T>
 
Constructor Summary
Container()
           
 
Method Summary
 int add(Component component)
           
protected  void assertEventDispatchThread()
           
static void assertEventDispatchThread(Component component)
           
 void clear()
          Propagates clear operation to subcomponents.
 boolean containsFocus()
          Tests whether this container is an ancestor of the currently focused component.
protected  void descendantAdded(Component descendant)
           
protected  void descendantGainedFocus(Component descendant, Component previousFocusedComponent)
           
protected  void descendantLostFocus(Component descendant)
           
protected  void descendantRemoved(Component descendant)
           
 Component get(int index)
           
 Component getComponentAt(int x, int y)
           
 org.apache.pivot.util.ListenerList<ContainerListener> getContainerListeners()
           
 org.apache.pivot.util.ListenerList<ContainerMouseListener> getContainerMouseListeners()
           
 Component getDescendantAt(int x, int y)
           
 FocusTraversalPolicy getFocusTraversalPolicy()
          Returns this container's focus traversal policy.
 int getLength()
           
 Component getNamedComponent(String name)
           
 int indexOf(Component component)
           
 void insert(Component component, int index)
           
 boolean isAncestor(Component component)
          Tests if this container is an ancestor of a given component.
 Iterator<Component> iterator()
           
protected  void layout()
          Called to lay out the component.
 void load(Object context)
          Propagates binding to subcomponents.
protected  boolean mouseClick(Mouse.Button button, int x, int y, int count)
           
protected  boolean mouseDown(Mouse.Button button, int x, int y)
           
protected  boolean mouseMove(int x, int y)
           
protected  void mouseOut()
           
protected  boolean mouseUp(Mouse.Button button, int x, int y)
           
protected  boolean mouseWheel(Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
           
 void move(int from, int to)
          Moves a component within the component sequence.
 void paint(Graphics2D graphics)
          Paints the component.
 int remove(Component component)
           
 org.apache.pivot.collections.Sequence<Component> remove(int index, int count)
           
 org.apache.pivot.collections.Sequence<Component> removeAll()
           
 boolean requestFocus()
          Requests that focus be given to this container.
static void setEventDispatchThreadChecker(Container.EDT_Checker runnable)
           
 void setFocusTraversalPolicy(FocusTraversalPolicy focusTraversalPolicy)
          Sets this container's focus traversal policy.
protected  void setParent(Container parent)
           
 void setVisible(boolean visible)
          Sets the component's visibility.
 void store(Object context)
          Propagates binding to subcomponents.
 Component transferFocus(Component component, FocusTraversalDirection direction)
          Transfers focus to the next focusable component.
 Component update(int index, Component component)
           
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, contains, getAncestor, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getComponentStyleListeners, getComponentTooltipListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipDelay, getTooltipText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, invalidate, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseOver, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setCursor, setDragSource, setDropTarget, setEnabled, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setSkin, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setWidth, setWidthLimits, setWidthLimits, setX, setY, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Container

public Container()
Method Detail

add

public final int add(Component component)
Specified by:
add in interface org.apache.pivot.collections.Sequence<Component>

insert

public void insert(Component component,
                   int index)
Specified by:
insert in interface org.apache.pivot.collections.Sequence<Component>

update

public Component update(int index,
                        Component component)
Specified by:
update in interface org.apache.pivot.collections.Sequence<Component>

remove

public final int remove(Component component)
Specified by:
remove in interface org.apache.pivot.collections.Sequence<Component>

remove

public org.apache.pivot.collections.Sequence<Component> remove(int index,
                                                               int count)
Specified by:
remove in interface org.apache.pivot.collections.Sequence<Component>

removeAll

public final org.apache.pivot.collections.Sequence<Component> removeAll()

move

public void move(int from,
                 int to)
Moves a component within the component sequence.

Parameters:
from -
to -

get

public Component get(int index)
Specified by:
get in interface org.apache.pivot.collections.Sequence<Component>

indexOf

public int indexOf(Component component)
Specified by:
indexOf in interface org.apache.pivot.collections.Sequence<Component>

getLength

public int getLength()
Specified by:
getLength in interface org.apache.pivot.collections.Sequence<Component>

iterator

public Iterator<Component> iterator()
Specified by:
iterator in interface Iterable<Component>

setParent

protected void setParent(Container parent)
Overrides:
setParent in class Component

getComponentAt

public Component getComponentAt(int x,
                                int y)

getDescendantAt

public Component getDescendantAt(int x,
                                 int y)

getNamedComponent

public Component getNamedComponent(String name)

setVisible

public void setVisible(boolean visible)
Description copied from class: Component
Sets the component's visibility.

Overrides:
setVisible in class Component
Parameters:
visible - true if the component should be painted; false, otherwise.

layout

protected void layout()
Description copied from class: Component
Called to lay out the component.

Overrides:
layout in class Component

paint

public void paint(Graphics2D graphics)
Description copied from class: Component
Paints the component. Delegates to the skin.

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

isAncestor

public boolean isAncestor(Component component)
Tests if this container is an ancestor of a given component. A container is considered to be its own ancestor.

Parameters:
component - The component to test.
Returns:
true if this container is an ancestor of component; false otherwise.

requestFocus

public boolean requestFocus()
Requests that focus be given to this container. If this container is not focusable, this requests that focus be set to the first focusable descendant in this container.

Overrides:
requestFocus in class Component
Returns:
The component that got the focus, or null if the focus request was denied

transferFocus

public Component transferFocus(Component component,
                               FocusTraversalDirection direction)
Transfers focus to the next focusable component.

Parameters:
component - The component from which focus will be transferred.
direction - The direction in which to transfer focus.

getFocusTraversalPolicy

public FocusTraversalPolicy getFocusTraversalPolicy()
Returns this container's focus traversal policy.


setFocusTraversalPolicy

public void setFocusTraversalPolicy(FocusTraversalPolicy focusTraversalPolicy)
Sets this container's focus traversal policy.

Parameters:
focusTraversalPolicy - The focus traversal policy to use with this container.

containsFocus

public boolean containsFocus()
Tests whether this container is an ancestor of the currently focused component.

Returns:
true if a component is focused and this container is an ancestor of the component; false, otherwise.

descendantAdded

protected void descendantAdded(Component descendant)

descendantRemoved

protected void descendantRemoved(Component descendant)

descendantGainedFocus

protected void descendantGainedFocus(Component descendant,
                                     Component previousFocusedComponent)

descendantLostFocus

protected void descendantLostFocus(Component descendant)

load

public void load(Object context)
Propagates binding to subcomponents.

Overrides:
load in class Component
Parameters:
context -

store

public void store(Object context)
Propagates binding to subcomponents.

Overrides:
store in class Component
Parameters:
context -

clear

public void clear()
Propagates clear operation to subcomponents.

Overrides:
clear in class Component

mouseMove

protected boolean mouseMove(int x,
                            int y)
Overrides:
mouseMove in class Component

mouseOut

protected void mouseOut()
Overrides:
mouseOut in class Component

mouseDown

protected boolean mouseDown(Mouse.Button button,
                            int x,
                            int y)
Overrides:
mouseDown in class Component

mouseUp

protected boolean mouseUp(Mouse.Button button,
                          int x,
                          int y)
Overrides:
mouseUp in class Component

mouseClick

protected boolean mouseClick(Mouse.Button button,
                             int x,
                             int y,
                             int count)
Overrides:
mouseClick in class Component

mouseWheel

protected boolean mouseWheel(Mouse.ScrollType scrollType,
                             int scrollAmount,
                             int wheelRotation,
                             int x,
                             int y)
Overrides:
mouseWheel in class Component

getContainerListeners

public org.apache.pivot.util.ListenerList<ContainerListener> getContainerListeners()

getContainerMouseListeners

public org.apache.pivot.util.ListenerList<ContainerMouseListener> getContainerMouseListeners()

assertEventDispatchThread

protected final void assertEventDispatchThread()

assertEventDispatchThread

public static final void assertEventDispatchThread(Component component)

setEventDispatchThreadChecker

public static final void setEventDispatchThreadChecker(Container.EDT_Checker runnable)