danger.ui
Class Window

java.lang.Object
  extended by danger.app.Listener
      extended by danger.ui.View
          extended by danger.ui.Container
              extended by danger.ui.Window
Direct Known Subclasses:
BaseMenuWindow, DatePickerWindow, DialogWindow, IconPickerWindow, ListSelectProgressWindow, PickerWindow, ScreenWindow, SliderWindow, SpecialCharacterHelper


public class Window
extends Container

Basic Window object.

Usually, you will instantiate a DialogWindow or ScreenWindow (or some subclass of them) instead. A generic Window object does not have any title bar or frame.


Field Summary
protected  int mBusyPaintCount
          Deprecated. For internal use only.
protected  Listener mDefaultListener
          Deprecated. Use setDefaultListener(danger.app.Listener) instead.
protected static int STATE_AUTO_HIDE_IF_IDLE
           
protected static int STATE_DROP_ORPHANED_EVENTS
           
protected static int STATE_FULLSCREEN
           
protected static int STATE_UNUSED1
           
 
Fields inherited from class danger.ui.View
DEFAULT_SCROLL_FOCUS_MARGIN, FOCUS_DEFAULT, FOCUS_DOWNWARD, FOCUS_LEFTWARD, FOCUS_NONE, FOCUS_RIGHTWARD, FOCUS_UPWARD, mOriginX, mOriginY, mStyle, POSITION_ABOVE, POSITION_ALIGN_BASELINE, POSITION_ALIGN_BOTTOM, POSITION_ALIGN_HORIZONTALLY, POSITION_ALIGN_LEFT, POSITION_ALIGN_PARENT_BOTTOM, POSITION_ALIGN_PARENT_RIGHT, POSITION_ALIGN_RIGHT, POSITION_ALIGN_TOP, POSITION_ALIGN_VERTICALLY, POSITION_BELOW, POSITION_CENTER_HORIZONTALLY, POSITION_CENTER_VERTICALLY, POSITION_TO_LEFT, POSITION_TO_RIGHT, PREFER_DIRECTION_NONE, PREFER_HORIZONTAL_DIRECTION, PREFER_VERTICAL_DIRECTION, STATE_AT_AND_SPACE_PAGE, STATE_CAN_FOCUS, STATE_DEBUG_BOUNDS, STATE_ENABLED, STATE_FOCUSED, STATE_MAKE_DING, STATE_PARTIAL_FOCUS_OK, STATE_TRANSPARENT, STATE_VISIBLE, WIDTH_FILL_TO_RIGHT
 
Constructor Summary
Window()
          Create an application window.
Window(boolean systemWindow, int left, int top, int right, int bottom)
           
Window(boolean systemWindow, Rect r)
           
Window(int left, int top, int right, int bottom)
           
Window(Rect r)
          Create an application window with the given global bounds.
 
Method Summary
 void adjustActionMenuState(Menu actionMenu)
          This method does not get called for Windows which are not ScreenWindows.
 boolean advanceFocus()
          Advances the focus of the current container to the next child view that can handle it.
protected  void autoHide()
           
 boolean autoHideIfIdle()
          Returns true if this window gets auto hidden if its idle for a certain amount of time.
 void autoHideIfIdle(boolean flag)
          Set a flag that controls whether this window auto hides if it has been idle for certain amount of time (15 seconds)
 boolean blocksBackButton()
          Whether the window blocks the system from handling the BACK button being held and thus going into keyguard.
 boolean blocksChooser()
          Whether the window blocks from going to the chooser Some applications, such as security/passcode lock and registration block from going to the chooser when the JUMP button is pressed.
 boolean blocksFloatingControls()
          Whether the window blocks the sound and screen controls.
 boolean blocksKeyGuard()
          Whether the window blocks the device from going into keyguard.
 boolean blocksVolumeButtons()
          Whether the window blocks the external volume buttons.
 void centerHorizontal()
          Horizontally center the window on the screen.
 void centerOnScreen()
          Center the window on the screen, both vertically and horizontally.
 void centerUnderTitleBar()
          Vertically center the window on the section of screen below the title bar.
 void centerVertical()
          Vertically center the window on the screen.
 void disableControlWithID(int id)
          Disable the control with the specified id.
 void dropOrphanedEvents(boolean drop)
          Set a flag that controls whether this window drops orphan events.
 void enableControlWithID(int id)
          Enable the control with the specified id.
 boolean eventWidgetDown(int inWhichWidget, Event event)
          Handle a button down event.
 boolean eventWidgetUp(int inWhichWidget, Event event)
          Handle the release of a device widget
 void forwardQueuedEvents(Window window)
           Forward events that have been queued in this window, to another window.
 Application getApplication()
           
 View getDefaultFocus()
          Returns the default focus as set by setDefaultFocus(danger.ui.View)
 View getDescendantWithID(int inID)
          Get the descendant with the specified id.
 int getIDOfChild(View child)
          Get the id of a child.
 Listener getListener()
           
 String getTitle()
          Gets the title of the window.
 CharSequence getTitleSequence()
          Gets the title of the window.
 Window getWindowBelow()
           
 void hide()
          Mark this view hidden so that it is not displayed.
protected  void hideActiveMenu(boolean onlyIfOrphaned)
           
 void hideControlWithID(int id)
          Hide the control with the specified id.
 int incrementMaxChildID()
          Set the maximum child id for this window to be one more than the old value.
 boolean isActionMenuVisible()
          This method always returns false for Windows which are not ScreenWindows.
 boolean isFullScreen()
           
 boolean isUnresponsive()
          Returns true if this window is currently unresponsive.
protected  void onActivate()
          Called when the window stack changes such that this window is now the active window.
protected  void onDeactivate()
          Called when the window stack changes such that this window is no longer the active window.
protected  void onPeriodicPulse()
          This method is called periodically (every half second) for the frontmost window only.
protected  void onWindowPaint()
          This method is called when the View receives a EventType.EVENT_WINDOW_PAINT event from the window manager.
 void receiveMessage(int inMessage, int inData, Object inArgument)
           
 boolean reverseFocus()
          Reverses the focus of the current container to the previous child view that can handle it.
 void setDefaultFocus(View view)
          Sets the default focus.
 void setDefaultListener(Listener listener)
          Set the default listener.
 void setEventArgForControlWithID(int id, Object eventArg)
          Set the event arg for the control with the specified id.
 void setEventForControlWithID(int id, Event newEvent)
          Set the event for the control with the specified id.
 void setFullScreen(boolean fullScreen)
          Set whether this window is considered "full screen".
 void setMaxChildID(int id)
          Set the maximum child id for this window.
 void setMaxControlID(int id)
          Synonymous with setMaxChildID.
 void setPosition(int x, int y)
          Move this View to a new position specified in its parent's coordinate system.
 void setSize(int width, int height)
          Simultaneously set the width and height of this View.
 void setTitle(CharSequence inTitle)
          Sets the title of the window.
 void setTitle(String inTitle)
          Sets the title of the window.
 void setTitled(boolean titled)
           
 void setTitleFormatDate(Date inDate)
          Set the format date for the title.
 void setTitleFormatText(CharSequence[] inArgs)
          Set the format text for the title.
 void setTitleFormatText(String inArg0)
          Set the format text for the title.
 void setTitleFormatText(String[] inArgs)
          Set the format text for the title.
 void setTitleFormatText(String inArg0, String inArg1)
          Set the format text for the title.
 void setTitleFormatText(String inArg0, String inArg1, String inArg2)
          Set the format text for the title.
protected  boolean shouldDropEvent(Event event)
          This method is called to find out whether an event should be dropped on the floor instead of dispatched.
 void show()
          Mark this view visible.
 void showControlWithID(int id)
          Show the control with the specified id.
 void startQueueingEvents()
           Start queueing key events, in order to forward them to a window to be created later.
 boolean wantsEndButton()
          Whether the window wants to receive END button events instead of page down.
 boolean wantsSendButton()
          Whether the window wants to receive SEND button events instead of page down.
 boolean willPassEventToWindow(Event event, Window window)
          Return whether this window will simply pass the event to the specified window.
 
Methods inherited from class danger.ui.Container
addChild, addChild, addChildAt, addChildAt, addFromContainerResource, addFromContainerResource, addFromContainerResource, addFromDialogResource, addFromDialogResource, advanceFocusInWindow, childCount, childIsOnScreen, disable, enable, eventKeyDown, eventKeyHeld, eventKeyRepeat, eventKeyUp, eventPeriodicPulse, eventRawKeyDown, eventRawKeyHeld, eventRawKeyRepeat, eventRawKeyUp, eventShortcut, eventWidgetHeld, focusedDescendantIsValid, getBottomChild, getBottomChild, getChildAt, getChildIndex, getChildWithID, getControlWithID, getFirstChild, getFirstFocusableChild, getFocusableChildInWindow, getFocusedChild, getFocusedLeaf, getInterestingRect, getLastChild, getLastFocusableChild, getLeftMostChild, getNextFocusableChild, getNextFocusableChild, getPageHeight, getPrevFocusableChild, getPrevFocusableChild, getRightMostChild, getRightMostChild, handleButtonShortcut, hideAllChildren, isDescendant, keepRectInView, loseFocus, moveChildToIndex, onChildPositionChanged, onChildSizeChanged, onChildVisibilityChanged, pageToEnd, pageToHome, paint, paintChildren, receiveEvent, reflowChildren, removeAllChildren, removeChild, setFocusedChild, setFocusedChild, setFocusedChild, setFocusedDescendant, setFocusedDescendant, setFocusedDescendant, setFocusToFirstDescendant, setFormatDateForControlWithID, setFormatDateForTextControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setListenerForAllControls, setReflowAdjustHeight, setWindow, showAllChildren, snapHeightToChildren, snapHeightToChildren, snapToChildren, snapWidthToChildren, snapWidthToChildren, takeFocus, willFocusWithin, willFocusWithin
 
Methods inherited from class danger.ui.View
boundsIntersect, boundsIntersect, canLoseFocus, clear, clear, copyStyle, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getFocusTraversalDirection, getFocusTraversalFrom, getFocusTraversalPolicy, getFrame, getFrame, getGlobalBottom, getGlobalLeft, getGlobalRight, getGlobalTop, getHeight, getID, getInterestingRect, getLabelFont, getLabelFont, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getParentContainer, getPartialFocusOK, getRight, getScrollFocusMargin, getSibling, getState, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, globalToLocalH, globalToLocalV, invalidate, invalidate, invalidate, invalidateIndependentOfOrigin, invalidateIndependentOfOrigin, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, isVisibleInHierarchy, isVisibleOnScreen, justSetVisible, localToGlobal, localToGlobal, localToGlobalH, localToGlobalV, localToWindow, moveBy, notifyWhenParentSizeChanges, notifyWhenPositionChanges, notifyWhenSizeChanges, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onEnabledStateChanged, onHide, onPositionChanged, onRemovedFromParent, onShortcut, onShortcut, onShortcutConsumed, onShow, onSizeChanged, onStyleChanged, onViewPositionChanged, onViewSizeChanged, playLimitSound, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setAtAndSpacePage, setBackground, setBackgroundColor, setBottom, setDebugBounds, setDynamicPosition, setDynamicWidth, setEnabled, setFocusTraversalDirection, setFocusTraversalFrom, setFocusTraversalPolicy, setFrame, setHeight, setKeyedValue, setLabelFont, setLeft, setMakeLimitNoise, setOrigin, setOrigin, setPartialFocusOK, setPreferredDirection, setRight, setScrollFocusMargin, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, showContextMenu, styleIsDefault, swapStyleColors, windowToLocal
 
Methods inherited from class danger.app.Listener
cancelEvents, childEventPump, childEventPumpDone, eventProblem, isDispatchingThread, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendLowPriorityEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mDefaultListener

protected Listener mDefaultListener
Deprecated. Use setDefaultListener(danger.app.Listener) instead.

STATE_FULLSCREEN

protected static final int STATE_FULLSCREEN
See Also:
Constant Field Values

STATE_UNUSED1

protected static final int STATE_UNUSED1
See Also:
Constant Field Values

STATE_DROP_ORPHANED_EVENTS

protected static final int STATE_DROP_ORPHANED_EVENTS
See Also:
Constant Field Values

STATE_AUTO_HIDE_IF_IDLE

protected static final int STATE_AUTO_HIDE_IF_IDLE
See Also:
Constant Field Values

mBusyPaintCount

protected int mBusyPaintCount
Deprecated. For internal use only.
Constructor Detail

Window

public Window()

Create an application window.

The window will be positioned at (0,0) and cover the entire screen.


Window

public Window(Rect r)

Create an application window with the given global bounds.


Window

public Window(boolean systemWindow,
              Rect r)

Window

public Window(int left,
              int top,
              int right,
              int bottom)

Window

public Window(boolean systemWindow,
              int left,
              int top,
              int right,
              int bottom)
Method Detail

setPosition

public void setPosition(int x,
                        int y)
Description copied from class: View
Move this View to a new position specified in its parent's coordinate system.

Overrides:
setPosition in class View

setSize

public void setSize(int width,
                    int height)
Description copied from class: View
Simultaneously set the width and height of this View.

Overrides:
setSize in class View

show

public void show()
Description copied from class: View
Mark this view visible. It will only be displayed if its parent is also displayed, or if it is a Window. If this view was not already visible, this method will call View.onShow() as the last thing it does before returning. If you wish to have special behavior when a view becomes visible, it is recommended that you override that method. In a future revision of the library, it is likely that this method will be final.

Overrides:
show in class View

hide

public void hide()
Description copied from class: View
Mark this view hidden so that it is not displayed. If this is a Container, then none of the children will be displayed, either. However, this method does not mark the children as hidden - it simply means they won't be displayed. If this view was not already hidden, this method will call View.onHide() as the last thing it does before returning. If you wish to have special behavior when a view becomes hidden, it is recommended that you override that method. In a future revision of the library, it is likely that this method will be final.

Overrides:
hide in class View

setDefaultFocus

public void setDefaultFocus(View view)
Sets the default focus. Call this instead of setFocusedChild, so that the view will be given focus whenever show() is called. Pass in null if you do not want the focus to change when show() is called.

Parameters:
view - the view to set the focus to whenever show() is called.

getDefaultFocus

public View getDefaultFocus()
Returns the default focus as set by setDefaultFocus(danger.ui.View)


advanceFocus

public boolean advanceFocus()
Description copied from class: Container
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. This method is called when the user advances the focus by using the scroll wheel (not available on all devices).

Overrides:
advanceFocus in class Container

reverseFocus

public boolean reverseFocus()
Description copied from class: Container
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.

Overrides:
reverseFocus in class Container

hideActiveMenu

protected void hideActiveMenu(boolean onlyIfOrphaned)

onWindowPaint

protected final void onWindowPaint()
Description copied from class: View
This method is called when the View receives a EventType.EVENT_WINDOW_PAINT event from the window manager. This really only makes sense for Windows, not other views.

Overrides:
onWindowPaint in class View

onPeriodicPulse

protected final void onPeriodicPulse()
Description copied from class: View
This method is called periodically (every half second) for the frontmost window only.

Overrides:
onPeriodicPulse in class View

willPassEventToWindow

public boolean willPassEventToWindow(Event event,
                                     Window window)
Return whether this window will simply pass the event to the specified window. This is used by shouldDropEvent(danger.app.Event) when determining whether to drop an event. An event is usually sent to the frontmost window. In some cases, however, another window becomes frontmost before the event is handled. In this case, this method will be called with the event in question, and the current frontmost window. If this method returns true, then the event is not dropped. If it returns false, then the event is dropped. This default implementation always returns false.


shouldDropEvent

protected final boolean shouldDropEvent(Event event)
Description copied from class: View
This method is called to find out whether an event should be dropped on the floor instead of dispatched. It is used by Window to keep queued UI events from getting to a window after it has ceased to be the frontmost window.

Overrides:
shouldDropEvent in class View

eventWidgetDown

public boolean eventWidgetDown(int inWhichWidget,
                               Event event)
Handle a button down event.

Overrides:
eventWidgetDown in class Container
Parameters:
inWhichWidget - the widget that went up
Returns:
whether or not the event was consumed

eventWidgetUp

public boolean eventWidgetUp(int inWhichWidget,
                             Event event)
Description copied from class: Container
Handle the release of a device widget

Overrides:
eventWidgetUp in class Container
Parameters:
inWhichWidget - the widget that went down
Returns:
whether or not the event was consumed

forwardQueuedEvents

public void forwardQueuedEvents(Window window)

Forward events that have been queued in this window, to another window.

You can use this to improve the responsiveness of your application when the user uses a menu shortcut to create a new window and then types quickly, before the window is visible. Use MenuItem.queueEventsOnActivation(danger.ui.Window) to specify menu items which cause this behavior. Once you have created the window, use this method to send the queued events to the newly created window.

Since:
3.0

startQueueingEvents

public void startQueueingEvents()

Start queueing key events, in order to forward them to a window to be created later.

The most common use of this method is in conjunction with MenuItem.queueEventsOnActivation(danger.ui.Window). If a menu item creates a new screen window, and then the screen window immediately creates a dialog, you can call this method on the screen window to queue events. Then, when the dialog is created, you can forward those events to the dialog.

Important: if you use this method, you must call forwardQueuedEvents(danger.ui.Window). Until you do, any key events that would otherwise go to this window will not be handled.

Since:
3.0

receiveMessage

public void receiveMessage(int inMessage,
                           int inData,
                           Object inArgument)

adjustActionMenuState

public void adjustActionMenuState(Menu actionMenu)
This method does not get called for Windows which are not ScreenWindows.

See Also:
ScreenWindow.adjustActionMenuState()

isActionMenuVisible

public boolean isActionMenuVisible()
This method always returns false for Windows which are not ScreenWindows.

See Also:
ScreenWindow.adjustActionMenuState()

centerOnScreen

public void centerOnScreen()
Center the window on the screen, both vertically and horizontally.


centerHorizontal

public void centerHorizontal()
Horizontally center the window on the screen. This does not affect the vertical position of the window.


centerVertical

public void centerVertical()
Vertically center the window on the screen. This does not affect the horizontal position of the window.


centerUnderTitleBar

public void centerUnderTitleBar()
Vertically center the window on the section of screen below the title bar. Calling this method will position the window slightly below where it would be positioned by a call to centerVertical(). This does not affect the horizontal position of the window.


getApplication

public Application getApplication()

getListener

public final Listener getListener()

isFullScreen

public boolean isFullScreen()

setFullScreen

public void setFullScreen(boolean fullScreen)
Set whether this window is considered "full screen". This means nothing in particular to this class, but subclasses may use this to alter their behavior, and, in particular, ScreenWindow does.

Parameters:
fullScreen - whether this window should be "full screen"

setTitled

public void setTitled(boolean titled)

setTitle

public void setTitle(String inTitle)
Sets the title of the window. This base window class implementation does nothing. See DialogWindow and ScreenWindow.


setTitle

public void setTitle(CharSequence inTitle)
Sets the title of the window. This base window class implementation calls setTitle(String). See DialogWindow and ScreenWindow.


getTitle

public String getTitle()
Gets the title of the window. This base window class implementation always returns null. See DialogWindow and ScreenWindow.


getTitleSequence

public CharSequence getTitleSequence()
Gets the title of the window. This base window class implementation calls getTitle(). See DialogWindow and ScreenWindow.


getWindowBelow

public Window getWindowBelow()

blocksChooser

public boolean blocksChooser()
Whether the window blocks from going to the chooser Some applications, such as security/passcode lock and registration block from going to the chooser when the JUMP button is pressed.

Returns:
A boolean containing true if the application blocks the chooser.

blocksFloatingControls

public boolean blocksFloatingControls()
Whether the window blocks the sound and screen controls. In some cases, we want to prevent the sound and screen controls from showing up. For example, in PDM when an app is being committed to flash, a progress bar is displayed. This progress bar is drawn by native code. The controls will trash the progress bar if visible.

Returns:
A boolean containing true if the application blocks the user from showing the sound and screen controls.

blocksBackButton

public boolean blocksBackButton()
Whether the window blocks the system from handling the BACK button being held and thus going into keyguard. A game or some other app where the BACK button is used as a control needs to let the user hold the BACK button without the system going into keyguard.

Returns:
A boolean containing true if the application blocks the system from going into keyguard when BACK is held.

blocksVolumeButtons

public boolean blocksVolumeButtons()
Whether the window blocks the external volume buttons.

Returns:
A boolean containing true if the application blocks the user from using the volume buttons.

blocksKeyGuard

public boolean blocksKeyGuard()
Whether the window blocks the device from going into keyguard. Sometimes we want to prevent the device from keyguarding. One example of this is when the catalog is installing software on the device.

Returns:
A boolean containing true if the application blocks the device from keyguarding.

wantsSendButton

public boolean wantsSendButton()
Whether the window wants to receive SEND button events instead of page down.

Returns:
A boolean containing true if the window wants to receive EVENT_WIDGET_{DOWN,UP}(DEVICE_BUTTON_SEND) for the SEND button instead of EVENT_WIDGET_DOWN(DEVICE_WHEEL_PAGE_DOWN)

wantsEndButton

public boolean wantsEndButton()
Whether the window wants to receive END button events instead of page down.

Returns:
A boolean containing true if the window wants to receive EVENT_WIDGET_{DOWN,UP}(DEVICE_BUTTON_END) for the END button instead of EVENT_WIDGET_UP(DEVICE_WHEEL_PAGE_UP)

dropOrphanedEvents

public void dropOrphanedEvents(boolean drop)
Set a flag that controls whether this window drops orphan events. Orphan events are "UI events" that get dispatched for this window, at a time when it no longer is the active window. These include EVENT_WIDGET_UP, EVENT_WIDGET_DOWN, KEY_UP, KEY_DOWN and their variants/shortcuts.


isUnresponsive

public boolean isUnresponsive()
Returns true if this window is currently unresponsive.


autoHideIfIdle

public void autoHideIfIdle(boolean flag)
Set a flag that controls whether this window auto hides if it has been idle for certain amount of time (15 seconds)


autoHideIfIdle

public boolean autoHideIfIdle()
Returns true if this window gets auto hidden if its idle for a certain amount of time.


autoHide

protected void autoHide()

setMaxControlID

public void setMaxControlID(int id)
Synonymous with setMaxChildID.

See Also:
setMaxChildID(int)

enableControlWithID

public void enableControlWithID(int id)
Enable the control with the specified id. This is equivalent to calling Container.getControlWithID(int) and then calling Container.enable().

Parameters:
id - the id of the control as specified in the resource file, or in the call to Container.addChild(danger.ui.View).

disableControlWithID

public void disableControlWithID(int id)
Disable the control with the specified id. This is equivalent to calling Container.getControlWithID(int) and then calling Container.disable().

Parameters:
id - the id of the control as specified in the resource file, or in the call to Container.addChild(danger.ui.View).

showControlWithID

public void showControlWithID(int id)
Show the control with the specified id. This is equivalent to calling Container.getControlWithID(int) and then calling View.show().

Parameters:
id - the id of the control as specified in the resource file, or in the call to Container.addChild(danger.ui.View).

hideControlWithID

public void hideControlWithID(int id)
Hide the control with the specified id. This is equivalent to calling Container.getControlWithID(int) and then calling View.hide().

Parameters:
id - the id of the control as specified in the resource file, or in the call to Container.addChild(danger.ui.View).

setDefaultListener

public void setDefaultListener(Listener listener)
Set the default listener. This method only specifies the default listener for subsequent calls to setEventForControlWithID(int, danger.app.Event) where the event has a null listener.

Parameters:
listener - the listener to use

setEventForControlWithID

public void setEventForControlWithID(int id,
                                     Event newEvent)
Set the event for the control with the specified id. This is basically equivalent to calling Container.getControlWithID(int) and then calling Control.setEvent(danger.app.Event). If the event has a null listener, then the event is replaced by one whose listener is the one set in setDefaultListener(danger.app.Listener).

Parameters:
id - the id of the control as specified in the resource file, or in the call to Container.addChild(danger.ui.View).

setEventArgForControlWithID

public void setEventArgForControlWithID(int id,
                                        Object eventArg)
Set the event arg for the control with the specified id. This is basically equivalent to calling Container.getControlWithID(int) and then calling Control.setEventArg(java.lang.Object). This call does not affect any of the other event parameters.

Parameters:
id - the id of the control as specified in the resource file, or in the call to Container.addChild(danger.ui.View).

setMaxChildID

public void setMaxChildID(int id)
Set the maximum child id for this window. You *must* call this method (or setMaxControlID(int), which is equivalent) before calling Container.addChild(danger.ui.View) with an id. It is an error to call Container.addChild(danger.ui.View) with a value greater than that specified in this method. It is also illegal to call Container.addChild(danger.ui.View) with such an id, for any container which is a descendant of this window. Note that if you are only creating a window from a resource and not calling Container.addChild(danger.ui.View) manually, then you do not not have to manually call this method because it is called for you automatically.

Parameters:
id - the maximum child id

incrementMaxChildID

public int incrementMaxChildID()
Set the maximum child id for this window to be one more than the old value. Returns the largest id that you can subsequently use for this window.

Since:
3.0
See Also:
setMaxChildID(int)

getDescendantWithID

public View getDescendantWithID(int inID)
Get the descendant with the specified id. This method returns the descendant (direct or otherwise) with the specified id, or null if no such descendant exists.

Overrides:
getDescendantWithID in class Container
Parameters:
inID - the id of the descendant

getIDOfChild

public int getIDOfChild(View child)
Get the id of a child. This method returns the id of the specified child, or 0 if the child does not have an id. child must be a descendant of this window. Since it does not have to be a direct descendant, this method would be more aptly named getIDOfDescendant.

Parameters:
child - the child to get the id of

setTitleFormatText

public void setTitleFormatText(String inArg0)
Set the format text for the title. The argument will be substituted for any instance of ^0 in the title. For example, if the dialog title is currently: "Delete '^0' Folder" and you call setTitleFormatText("Buddies"), then the title will become "Delete 'Buddies' Folder".

Parameters:
inArg0 - the argument to replace ^0 with.
See Also:
StringFormat

setTitleFormatText

public void setTitleFormatText(String inArg0,
                               String inArg1)
Set the format text for the title. See setTitleFormatText(String inArg0).

Parameters:
inArg0 - the argument to replace ^0 with.
inArg1 - the argument to replace ^1 with.
See Also:
StringFormat

setTitleFormatText

public void setTitleFormatText(String inArg0,
                               String inArg1,
                               String inArg2)
Set the format text for the title. See setTitleFormatText(String inArg0).

Parameters:
inArg0 - the argument to replace ^0 with.
inArg1 - the argument to replace ^1 with.
inArg2 - the argument to replace ^2 with.
See Also:
StringFormat

setTitleFormatText

public void setTitleFormatText(String[] inArgs)
Set the format text for the title. See setTitleFormatText(String inArg0).

Parameters:
inArgs - the arguments to replace ^0, ^1, etc. with
See Also:
StringFormat

setTitleFormatText

public void setTitleFormatText(CharSequence[] inArgs)
Set the format text for the title. See setTitleFormatText(String inArg0).

Parameters:
inArgs - the arguments to replace ^0, ^1, etc. with
See Also:
StringFormat

setTitleFormatDate

public void setTitleFormatDate(Date inDate)
Set the format date for the title. The date will be substituted for the appropriate text in the title. For example, if the dialog title is currently: "h:mm", and you pass in the date (which happens to be 5:21pm), then the title will become "5:21". See DateFormat for a description of the different text you can use.

Parameters:
inDate - the date to replace ^0, ^1, etc. with
See Also:
DateFormat

onActivate

protected void onActivate()
Called when the window stack changes such that this window is now the active window.


onDeactivate

protected void onDeactivate()
Called when the window stack changes such that this window is no longer the active window.