danger.ui
Class StandardAlertWindow

java.lang.Object
  |
  +--danger.app.Listener
        |
        +--danger.ui.View
              |
              +--danger.ui.Container
                    |
                    +--danger.ui.Window
                          |
                          +--danger.ui.DialogWindow
                                |
                                +--danger.ui.StandardAlertWindow
Direct Known Subclasses:
TextInputAlertWindow

public class StandardAlertWindow
extends DialogWindow

Application interface for alert windows.


Field Summary
protected static int kBottomMargin
           
protected static int kGap3
           
protected static int kIconColWidth
           
protected static int kImageTextGap
           
protected static int kLeftMargin
           
static int kMaxBitmapSize
           
protected static int kMaxTitleHeight
           
protected static int kRightMargin
           
protected static int kTopIconMargin
           
protected static int kTopMargin
           
protected  boolean m_autoDismiss
           
protected  Event m_autoDismissEvent
           
protected  int m_autoDismissMS
           
protected  Timer m_autoDismissTimer
           
protected  boolean m_forceNoButtons
           
protected  boolean m_setBitmapCalled
           
protected  boolean m_systemDialog
           
protected  Bitmap mBitmap
           
protected  Font mFont
           
protected  int mImageViewHeight
           
protected  int mImageViewWidth
           
protected  java.lang.String mMessage
           
protected  boolean mNeedLayout
           
 
Fields inherited from class danger.ui.DialogWindow
kAppDialogStyle, kBottomPosition1, kBottomPosition2, kBottomPosition3, kButtonHeight, kDefaultWindowStyle, kMaxBottomButtons, kMaxButtons, kMinFrameButtonWidth, kSystemDialogStyle, kSystemErrorStyle, kSystemWindowStyle, kTopPosition1, kTopPosition2, m_bottomBorder, m_doAutoSize, m_leftBorder, m_rightBorder, m_topBorder, mBackEvent, mButtonEvents, mButtonIDs, mButtons, mCancelButton, mCancelEvent, mDefaultButton, mDefaultButtonPosition, mDefaultListener, mLayoutButtonsVertically, mListener, mNeedLayoutFrameButtons, mNeedToAddTopFrameButtons, mShortcuts, mTitlebarControls
 
Fields inherited from class danger.ui.Window
mBusyPaintCount, STATE_AUTO_HIDE_IF_IDLE, STATE_DROP_ORPHANED_EVENTS, STATE_FLOATING, STATE_FULLSCREEN
 
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
StandardAlertWindow()
           
StandardAlertWindow(java.lang.String message)
           
StandardAlertWindow(java.lang.String message, boolean showCancel)
           
StandardAlertWindow(java.lang.String title, java.lang.String message)
          Constructs an alert window with the specified message.
StandardAlertWindow(java.lang.String title, java.lang.String message, boolean showCancel)
           
StandardAlertWindow(java.lang.String title, java.lang.String message, boolean showCancel, int windowStyle)
          Constructs an alert window with the specified message.
 
Method Summary
 Button addFrameButton(int position, java.lang.String buttonStr, int flags, int eventType, int data, java.lang.Object arg, char shortcut)
          Add a button to the alert window.
 Button addFrameButton(int position, java.lang.String buttonStr, int flags, int eventType, int data, java.lang.Object arg, char shortcut, int id)
           
 Bitmap getBitmap()
           
protected  int getMaxMessageHeight()
           
 java.lang.String getMessage()
           
 Font getMessageFont()
           
 java.lang.String getSleepScreenMessage()
          Override for system alerts
protected  boolean layout()
           
protected  void layoutBitmap(Rect contentRect)
           
protected  int layoutMessage(int textColLeft, int textColWidth, int textTop, int minBottom)
           
protected  void positionDialog()
           
 boolean receiveEvent(Event e)
          Receive an event from the alert window.
 void setAutoDismiss(int ms, Event event)
           
 void setAutoDismiss(int ms, int event, int eventData, java.lang.Object eventArg, Listener listener)
           
 void setBitmap(Bitmap inBitmap)
           
 void setFont(Font inFont)
          Set the font used in the alert window.
 void setForceNoButtons(boolean noButtons)
           
 void setMessage(java.lang.String msg)
          Set the message for the alert window.
 void setMessageFont(Font inFont)
          Set the font of the message in the alert window.
 void setMessageFormatDate(danger.internal.Date inDate)
           
 void setMessageFormatText(java.lang.String inArg0)
           
 void setMessageFormatText(java.lang.String[] inArgs)
           
 void setMessageFormatText(java.lang.String inArg0, java.lang.String inArg1)
           
 void setMessageFormatText(java.lang.String inArg0, java.lang.String inArg1, java.lang.String inArg2)
           
 void setSystemDialog(boolean flag)
           
 void show()
          Display the alert window.
 
Methods inherited from class danger.ui.DialogWindow
activateFrameButton, addBottomFrameButton, addChild, addFrameButton, addFrameButton, addFrameButton, addTopFrameButton, computeTitleWidth, convertShortcutKeyToButtonIndex, drawDialogStyleFrame, drawFrame, drawSystemWindowStyleFrame, eventWidgetUp, getChildWithID, getContentRect, getDefaultFrameButton, getFrameButtonWithID, getIcon, getTitle, getTitleBarHeight, getTitleFont, handleShortcutKey, hide, initTitleBarControlList, layoutBottomFrameButtonsVertically, layoutFrame, layoutFrameButtons, layoutTopFrameButtons, newButtonWithShortcut, paint, positionBottomButtons, positionFrameButtons, positionTopButtons, setAutoSize, setBackEvent, setCancelButtonEvent, setCancelButtonShortcutBitmap, setContentSize, setDefaultFrameButton, setDefaultFrameButton, setDefaultListener, setDrawBottomFrame, setEventForControlWithID, setEventForFrameButtonWithID, setFocusedChild, setFrameButtonShortcut, setIcon, setIconVerticalOffset, setListener, setNoDefaultFrameButton, setShowCancel, setSize, setTitle, setTitleFormatDate, setTitleFormatText, setTitleFormatText, setTitleFormatText, setTitleFormatText, setWindowStyle, snapToChildren, snapToChildren
 
Methods inherited from class danger.ui.Window
addFromDialogResource, addFromDialogResource, addToChildIDList, addToChildIDList, adjustActionMenuState, autoHide, autoHideIfIdle, autoHideIfIdle, blocksChooser, centerHorizontal, centerOnScreen, centerUnderTitleBar, centerVertical, disableControlWithID, dropOrphanedEvents, enableControlWithID, getApplication, getControlWithID, getDescendantWithID, getExplicitIDOfChild, getIDOfChild, getListener, getWindowBelow, hideActiveMenu, hideControlWithID, isActionMenuVisible, isFloating, isFullScreen, isUnresponsive, onPeriodicPulse, onWindowPaint, receiveMessage, removeChildFromIDList, setFloating, setFormatDateForControlWithID, setFormatDateForTextControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setListenerForAllControls, setMaxChildID, setMaxControlID, setPosition, setTitled, shouldDropEvent, showControlWithID
 
Methods inherited from class danger.ui.Container
addChild, addChildAt, advanceFocus, childCount, childIsOnScreen, disable, enable, eventKeyDown, eventKeyHeld, eventKeyRepeat, eventKeyUp, eventPeriodicPulse, eventShortcut, eventWidgetDown, eventWidgetHeld, getBottomChild, getChildAt, getChildIndex, getFirstChild, getFirstFocusableChild, getFocusedChild, getLastChild, getLastFocusableChild, hideAllChildren, loseFocus, moveChildToIndex, paintChildren, reflowChildren, removeAllChildren, removeChild, reverseFocus, setFocusedChild, setWindow, showAllChildren, takeFocus
 
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, invalidate, invalidate, invalidate, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, keepRectInView, localToGlobal, localToGlobal, localToWindow, moveBy, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onRemovedFromParent, onStyleChanged, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setBackgroundColor, setBottom, setDebugBounds, setEnabled, setFrame, setHeight, setKeyedValue, setLeft, setOrigin, setOrigin, setRight, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, 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
 

Field Detail

mFont

protected Font mFont

mMessage

protected java.lang.String mMessage

mBitmap

protected Bitmap mBitmap

m_setBitmapCalled

protected boolean m_setBitmapCalled

mImageViewWidth

protected int mImageViewWidth

mImageViewHeight

protected int mImageViewHeight

mNeedLayout

protected boolean mNeedLayout

m_systemDialog

protected boolean m_systemDialog

m_forceNoButtons

protected boolean m_forceNoButtons

m_autoDismissEvent

protected Event m_autoDismissEvent

m_autoDismiss

protected boolean m_autoDismiss

m_autoDismissMS

protected int m_autoDismissMS

m_autoDismissTimer

protected Timer m_autoDismissTimer

kMaxBitmapSize

public static final int kMaxBitmapSize

kIconColWidth

protected static final int kIconColWidth

kTopIconMargin

protected static final int kTopIconMargin

kImageTextGap

protected static final int kImageTextGap

kTopMargin

protected static final int kTopMargin

kLeftMargin

protected static final int kLeftMargin

kRightMargin

protected static final int kRightMargin

kBottomMargin

protected static final int kBottomMargin

kGap3

protected static final int kGap3

kMaxTitleHeight

protected static final int kMaxTitleHeight
Constructor Detail

StandardAlertWindow

public StandardAlertWindow()

StandardAlertWindow

public StandardAlertWindow(java.lang.String message)

StandardAlertWindow

public StandardAlertWindow(java.lang.String title,
                           java.lang.String message)
Constructs an alert window with the specified message. Creates an alert window with the message specified. The new alert window is not displayed until its Show method is called. The alert window will be a standard window containing the cancel (X) control. The window will also contain an OK button.
Parameters:
message - A String containing the alert message to be displayed.

StandardAlertWindow

public StandardAlertWindow(java.lang.String message,
                           boolean showCancel)

StandardAlertWindow

public StandardAlertWindow(java.lang.String title,
                           java.lang.String message,
                           boolean showCancel)

StandardAlertWindow

public StandardAlertWindow(java.lang.String title,
                           java.lang.String message,
                           boolean showCancel,
                           int windowStyle)
Constructs an alert window with the specified message. Creates an alert window with the message specified. The new alert window is not displayed until its Show method is called. If the systemDialog parameter is set to true, the window will be a system dialog and will not contain the cancel (X) control. If the system dialog parameter is false, the alert window will be a standard window. The window will also contain an OK button.
Parameters:
message - A String containing the alert message to be displayed.
Method Detail

setBitmap

public void setBitmap(Bitmap inBitmap)

getBitmap

public Bitmap getBitmap()

setMessage

public void setMessage(java.lang.String msg)
Set the message for the alert window. This method sets the message that will be displayed in the alert window. Use this method before calling the Show method to display the window.
Parameters:
msg - A String containing the message to be displayed in the alert window.

getMessage

public java.lang.String getMessage()

setMessageFont

public void setMessageFont(Font inFont)
Set the font of the message in the alert window. This method sets the font of the message that will be displayed in the alert window.
Parameters:
inFont - A font object.

getMessageFont

public Font getMessageFont()

addFrameButton

public Button addFrameButton(int position,
                             java.lang.String buttonStr,
                             int flags,
                             int eventType,
                             int data,
                             java.lang.Object arg,
                             char shortcut)
Add a button to the alert window. Adds a new button to the alert window. Up to three buttons can be defined. By default, the buttons are laid out across the bottom of the window in order from right to left. The first two buttons are right justified and the third is left justified. To have the buttons layed out vertically, see the LayoutButtonsVertically method.

addFrameButton

public Button addFrameButton(int position,
                             java.lang.String buttonStr,
                             int flags,
                             int eventType,
                             int data,
                             java.lang.Object arg,
                             char shortcut,
                             int id)

setSystemDialog

public void setSystemDialog(boolean flag)

setForceNoButtons

public void setForceNoButtons(boolean noButtons)

setAutoDismiss

public void setAutoDismiss(int ms,
                           int event,
                           int eventData,
                           java.lang.Object eventArg,
                           Listener listener)

setAutoDismiss

public void setAutoDismiss(int ms,
                           Event event)

getMaxMessageHeight

protected int getMaxMessageHeight()

layoutBitmap

protected void layoutBitmap(Rect contentRect)

layoutMessage

protected int layoutMessage(int textColLeft,
                            int textColWidth,
                            int textTop,
                            int minBottom)

layout

protected boolean layout()

receiveEvent

public boolean receiveEvent(Event e)
Receive an event from the alert window. Called whenever the alert window receives an event. The default behavior is to create and send an event to the listener for the alert window. Override this method to receive and process the events yourself.
Overrides:
receiveEvent in class DialogWindow
Parameters:
e - An Event containing the event received.

show

public void show()
Display the alert window. Called to actually display the alert window. Alert windows are not displayed until you call this method.
Overrides:
show in class DialogWindow

positionDialog

protected void positionDialog()
Overrides:
positionDialog in class DialogWindow

setFont

public void setFont(Font inFont)
Set the font used in the alert window. Call this method to change the font used for the alert window. By default the alert window uses the system font.
Parameters:
inFont - A Font containing a reference to the desired font for the alert window.

getSleepScreenMessage

public java.lang.String getSleepScreenMessage()
Description copied from class: DialogWindow
Override for system alerts
Overrides:
getSleepScreenMessage in class DialogWindow

setMessageFormatText

public void setMessageFormatText(java.lang.String inArg0)

setMessageFormatText

public void setMessageFormatText(java.lang.String inArg0,
                                 java.lang.String inArg1)

setMessageFormatText

public void setMessageFormatText(java.lang.String inArg0,
                                 java.lang.String inArg1,
                                 java.lang.String inArg2)

setMessageFormatText

public void setMessageFormatText(java.lang.String[] inArgs)

setMessageFormatDate

public void setMessageFormatDate(danger.internal.Date inDate)


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