danger.ui
Class Container

java.lang.Object
  |
  +--danger.app.Listener
        |
        +--danger.ui.View
              |
              +--danger.ui.Container
Direct Known Subclasses:
BatteryStatusView, Control, RadioStatusView, ScrollView, TitleBar, Window

public class Container
extends View


Fields inherited from class danger.ui.View
mOriginX, mOriginY, mStyle, STATE_CAN_FOCUS, STATE_DEBUG_BOUNDS, STATE_ENABLED, STATE_FOCUSED, STATE_TRANSPARENT, STATE_VISIBLE
 
Constructor Summary
Container()
           
Container(int left, int top, int right, int bottom)
           
Container(Rect r)
           
 
Method Summary
 void addChild(View child)
          Add a View as a child to this View.
 void addChild(View child, int id)
           
 void addChildAt(View child, int index)
           
 boolean advanceFocus()
          Advances the focus of the current container to the next child view that can handle it.
 int childCount()
           
 boolean childIsOnScreen(View child)
           
 void disable()
           
 void enable()
           
 boolean eventKeyDown(char c, Event event)
           
 boolean eventKeyHeld(char c, Event event)
           
 boolean eventKeyRepeat(char c, Event event)
           
 boolean eventKeyUp(char c, Event event)
          Processes key releases directed at this container.
 boolean eventPeriodicPulse(int timestamp)
           
 boolean eventShortcut(char inKey)
           
 boolean eventWidgetDown(int inWidget, Event event)
          Handle the pressing of a device widget
 boolean eventWidgetHeld(int inWhichWidget, Event event)
           
 boolean eventWidgetUp(int inWidget, Event event)
          Handle the release of a device widget
 View getBottomChild()
          Find the child view that has the lowest bottom bound
 View getChildAt(int n)
           
 int getChildIndex(View v)
           
 View getChildWithID(int inID)
           
 View getDescendantWithID(int inID)
           
 View getFirstChild()
          Get the first child of this View.
protected  View getFirstFocusableChild()
           
 View getFocusedChild()
           
 View getLastChild()
          Get the last child of this View.
protected  View getLastFocusableChild()
           
 void hideAllChildren()
           
 void loseFocus()
           
 void moveChildToIndex(View child, int index)
           
 void paint(Pen pen)
          Draw the contents of this View.
 void paintChildren(Pen pen)
           
 boolean receiveEvent(Event e)
          Entry point for event processing.
 void reflowChildren(View inBaseChild, int inAmount)
           
 void removeAllChildren()
           
 void removeChild(View child)
          Removes a child View from this View.
 boolean reverseFocus()
          Reverses the focus of the current container to the previous child view that can handle it.
 void setFocusedChild(View inNewFocus)
           
 void setFocusedChild(View newFocus, boolean inFromAbove)
          Sets the focus for the view container to a specific child object.
 void setWindow(Window inWindow)
           
 void showAllChildren()
           
 void snapToChildren(int inLeft, int inTop, int inRight, int inBottom)
          Reduces the size of this Container so that it exactly fits around its children with no extra space.
 void takeFocus(boolean inFromAbove)
           
 
Methods inherited from class danger.ui.View
clear, copyStyle, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getFrame, getFrame, getHeight, getInterestingRect, getInterestingRect, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getRight, getSibling, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, hide, invalidate, invalidate, invalidate, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, keepRectInView, localToGlobal, localToGlobal, localToWindow, moveBy, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onPeriodicPulse, onRemovedFromParent, onStyleChanged, onWindowPaint, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setBackgroundColor, setBottom, setDebugBounds, setEnabled, setFrame, setHeight, setKeyedValue, setLeft, setOrigin, setOrigin, setPosition, setRight, setSize, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, shouldDropEvent, show, styleIsDefault, willFocusWithin, windowToLocal
 
Methods inherited from class danger.app.Listener
cancelEvents, sendEvent, sendEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Container

public Container()

Container

public Container(Rect r)

Container

public Container(int left,
                 int top,
                 int right,
                 int bottom)
Method Detail

getChildWithID

public View getChildWithID(int inID)

getDescendantWithID

public View getDescendantWithID(int inID)

getBottomChild

public View getBottomChild()
Description copied from class: View
Find the child view that has the lowest bottom bound
Overrides:
getBottomChild in class View

getFirstChild

public View getFirstChild()
Description copied from class: View
Get the first child of this View. If the View is not a Container a UIException will be thrown. If it is a Container but has no children, null will be returned.
Overrides:
getFirstChild in class View

getLastChild

public View getLastChild()
Description copied from class: View
Get the last child of this View. If the View is not a Container a UIException will be thrown. If it is a Container but has no children, null will be returned.
Overrides:
getLastChild in class View

getChildAt

public View getChildAt(int n)

getChildIndex

public int getChildIndex(View v)

childCount

public int childCount()

addChild

public void addChild(View child)
Description copied from class: View
Add a View as a child to this View. A UIException will be thrown if the proposed parent is not a container or if the proposed child is attached to some other View already
Overrides:
addChild in class View

addChild

public void addChild(View child,
                     int id)

addChildAt

public void addChildAt(View child,
                       int index)

removeChild

public void removeChild(View child)
Description copied from class: View
Removes a child View from this View. A UIException will be thrown if this View is not a container or does not contain the specified child
Overrides:
removeChild in class View

removeAllChildren

public void removeAllChildren()

moveChildToIndex

public void moveChildToIndex(View child,
                             int index)

showAllChildren

public void showAllChildren()

hideAllChildren

public void hideAllChildren()

paint

public void paint(Pen pen)
Description copied from class: View
Draw the contents of this View. This method is called by the graphics system when the View needs to be repainted. A Pen will be provided which is appropriately clipped and translated for drawing on this View.
Overrides:
paint in class View

paintChildren

public void paintChildren(Pen pen)

receiveEvent

public boolean receiveEvent(Event e)
Description copied from class: Listener
Entry point for event processing. Default behaviour is to do nothing and return false. Normally this method is called from a Dispatcher when it discovers an Event in its queue that is targetted at this Listener.
Overrides:
receiveEvent in class Listener

eventWidgetDown

public boolean eventWidgetDown(int inWidget,
                               Event event)
Handle the pressing of a device widget
Overrides:
eventWidgetDown in class View
Parameters:
inWidget - the widget that went up
Returns:
whether or not the event was consumed

eventWidgetUp

public boolean eventWidgetUp(int inWidget,
                             Event event)
Handle the release of a device widget
Overrides:
eventWidgetUp in class View
Parameters:
inWidget - the widget that went down
Returns:
whether or not the event was consumed

eventWidgetHeld

public boolean eventWidgetHeld(int inWhichWidget,
                               Event event)
Overrides:
eventWidgetHeld in class View

eventShortcut

public boolean eventShortcut(char inKey)
Overrides:
eventShortcut in class View

eventKeyDown

public boolean eventKeyDown(char c,
                            Event event)
Overrides:
eventKeyDown in class View

eventKeyRepeat

public boolean eventKeyRepeat(char c,
                              Event event)
Overrides:
eventKeyRepeat in class View

eventKeyUp

public boolean eventKeyUp(char c,
                          Event event)
Processes key releases directed at this container.
Overrides:
eventKeyUp in class View
Parameters:
c - the character being released.

eventKeyHeld

public boolean eventKeyHeld(char c,
                            Event event)
Overrides:
eventKeyHeld in class View

eventPeriodicPulse

public boolean eventPeriodicPulse(int timestamp)
Overrides:
eventPeriodicPulse in class View

getFocusedChild

public View getFocusedChild()
Overrides:
getFocusedChild in class View

setFocusedChild

public void setFocusedChild(View newFocus,
                            boolean inFromAbove)
Sets the focus for the view container to a specific child object. If the View is not a child of this container or if it can't assume focus then nothing happens. If the child view already has focus then nothing happens.
Parameters:
newFocus - the child which should assume focus.

setWindow

public void setWindow(Window inWindow)
Overrides:
setWindow in class View

setFocusedChild

public void setFocusedChild(View inNewFocus)

advanceFocus

public boolean advanceFocus()
Advances the focus of the current container to the next child view that can handle it. If there are less than two children then nothing happens since there are no new children to accept the focus.

reverseFocus

public boolean reverseFocus()
Reverses the focus of the current container to the previous child view that can handle it. If there are less than two children then nothing happens since there are no children to accept the focus.

reflowChildren

public void reflowChildren(View inBaseChild,
                           int inAmount)
Overrides:
reflowChildren in class View

childIsOnScreen

public boolean childIsOnScreen(View child)
Overrides:
childIsOnScreen in class View

snapToChildren

public void snapToChildren(int inLeft,
                           int inTop,
                           int inRight,
                           int inBottom)
Reduces the size of this Container so that it exactly fits around its children with no extra space. It then expands the size of the Container by the passed-in margin quantities.
Parameters:
inLeft - left margin
inTop - top margin
inRight - right margin
inBottom - bottom margin

enable

public void enable()
Overrides:
enable in class View

disable

public void disable()
Overrides:
disable in class View

getFirstFocusableChild

protected View getFirstFocusableChild()

getLastFocusableChild

protected View getLastFocusableChild()

takeFocus

public void takeFocus(boolean inFromAbove)
Overrides:
takeFocus in class View

loseFocus

public void loseFocus()
Overrides:
loseFocus in class View


Danger Confidential. Copyright © 2000-2003, Danger Inc.