|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.rim.device.api.ui.Field
|
+--net.rim.device.api.ui.Manager
|
+--net.rim.device.api.ui.Screen
|
+--net.rim.device.api.ui.container.PopupScreen
|
+--net.rim.device.api.ui.component.Dialog
Provides a dialog box with predefined configurations.
To get a standard, predefined dialog use alert(java.lang.String),
ask(int), or
inform(java.lang.String).
These pop up a predefined dialog and wait for user input. To get a more
customized dialog, instantiate this class or extend it.
Pressing ESCAPE returns CANCEL, but only if it was one of the
choices specified in the values array.
| Field Summary | ||
static int |
CANCEL
Cancel choice for use in dialogs. |
|
static int |
D_DELETE
Standard delete confirmation dialog. |
|
static int |
D_OK
Standard OK dialog. |
|
static int |
D_SAVE
Standard save prompt dialog. |
|
static int |
D_YES_NO
Standard Yes/No confirmation dialog. |
|
static int |
DELETE
Delete choice for use in dialogs. |
|
static int |
DISCARD
Discard choice for use in dialogs. |
|
static int |
GLOBAL_STATUS
Displays the dialog as a global status. |
|
static int |
LIST
Displays the dialog choices as a list instead of buttons. |
|
static int |
NO
No choice for use in dialogs; same behaviour as CANCEL. |
|
static int |
OK
OK choice for use in dialogs. |
|
static int |
SAVE
Save choice for use in dialogs. |
|
static int |
YES
Yes choice for use in dialogs. |
|
| Fields inherited from class net.rim.device.api.ui.Screen |
DEFAULT_CLOSE, DEFAULT_MENU |
| Fields inherited from class net.rim.device.api.ui.Manager |
BOTTOMMOST, DOWNWARD, HORIZONTAL_SCROLL, HORIZONTAL_SCROLL_MASK, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_MASK, LEAVE_BLANK_SPACE, LEFTMOST, LEFTWARD, NO_HORIZONTAL_SCROLL, NO_HORIZONTAL_SCROLLBAR, NO_VERTICAL_SCROLL, NO_VERTICAL_SCROLLBAR, QUANTA_FONT, RIGHTMOST, RIGHTWARD, TOPMOST, UPWARD, VERTICAL_SCROLL, VERTICAL_SCROLL_MASK, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_MASK |
| Fields inherited from class net.rim.device.api.ui.Field |
EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, READONLY, USE_ALL_HEIGHT, USE_ALL_WIDTH |
| Fields inherited from interface net.rim.device.api.ui.FieldChangeListener |
PROGRAMMATIC |
| Constructor Summary | ||
Dialog(int type,
String message,
int defaultChoice,
Bitmap bitmap,
long style)
Contructs a new Dialog object with provided style. |
||
Dialog(String message,
Object[] choices,
int[] values,
int defaultChoice,
Bitmap bitmap)
Constructs a new Dialog object. |
||
Dialog(String message,
Object[] choices,
int[] values,
int defaultChoice,
Bitmap bitmap,
long style)
Contructs a new Dialog object with provided style. |
||
| Method Summary | ||
void |
add(Field field)
Adds a field to this dialog. |
|
static void |
alert(String message)
Creates an alert dialog. |
|
static int |
ask(int type)
Creates an standard inquiry dialog. |
|
static int |
ask(int type,
String message)
Creates an inquiry dialog with provided message. |
|
static int |
ask(int type,
String message,
int defaultChoice)
Creates an inquiry dialog with provided message. |
|
static int |
ask(String message,
Object[] choices,
int defaultChoice)
Creates an inquiry dialog with provided message and choices. |
|
static int |
ask(String message,
Object[] choices,
int[] values,
int defaultChoice)
Creates an inquiry dialog with provided message, choices, and values. |
|
void |
close()
Implements Screen.close(). |
|
int |
doModal()
Shows a modal dialog. |
|
void |
fieldChanged(Field field,
int context)
Handles button select events for this dialog. |
|
RichTextField |
getLabel()
Retrieves label for the dialog. |
|
int |
getPreferredWidth()
Retrieves this dialog's preferred width. |
|
int |
getSelectedValue()
Returns the value of the currently selected choice. |
|
static void |
inform(String message)
Creates a nofitication dialog with message. |
|
protected boolean |
keyChar(char key,
int status,
int time)
Traps key generation events for this dialog. |
|
protected void |
onDisplay()
Invoked when this dialog is pushed onto the display stack. |
|
protected void |
select()
Activates the currently selected choice. |
|
void |
select(int value)
Activates the choice with the provided value. |
|
void |
setDefault(int defaultChoice)
Sets the default choice. |
|
void |
setDialogClosedListener(DialogClosedListener listener)
Registers a listener for dialog close events. |
|
void |
setEscapeEnabled(boolean escapeEnabled)
Set escape enabled state for this dialog. |
|
void |
show()
Shows a modeless dialog of normal priority. |
|
void |
show(int priority)
Shows a modeless dialog of provided priority. |
|
protected boolean |
trackwheelClick(int status,
int time)
Handles trackwheel click events. |
|
| Methods inherited from class net.rim.device.api.ui.container.PopupScreen |
paint, sublayout |
| Methods inherited from class net.rim.device.api.ui.Manager |
deleteAll, getHorizontalScroll, getVerticalScroll, getVirtualHeight, getVirtualWidth, getVisibleHeight, getVisibleWidth, invalidate, isDownArrowShown, isUpArrowShown, isValidLayout, layout, layoutChild, moveFocus, moveFocus, nextFocus, paintChild, setFocus, setHorizontalScroll, setPositionChild, setScrollListener, setVerticalScroll, setVirtualExtent, subpaint |
| Methods inherited from class net.rim.device.api.ui.Field |
drawFocus, drawHighlightRegion, fieldChangeNotify, focusAdd, focusRemove, getChangeListener, getContextMenu, getCookie, getExtent, getFieldStyle, getFocusListener, getFont, getHeight, getIndex, getLeft, getManager, getOriginal, getPreferredHeight, getScreen, getStyle, getTop, getWidth, isEditable, isPasteable, isSelectable, isSelectionCopyable, isSelectionCutable, isSelectionDeleteable, isVisible, makeContextMenu, onVisibilityChange, paste, select, selectionCopy, selectionCut, selectionDelete, setChangeListener, setCookie, setEditable, setExtent, setFocusListener, setFont, setMuddy, setPosition, updateLayout |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
| Constructor Detail |
public Dialog(String message, Object[] choices, int[] values, int defaultChoice, Bitmap bitmap)
message - Message to show in dialog.choices - Objects selectable by the user; each object is showing
using Object.toString().values - Instead of returning the index selected, doModal()
returns the value associated with this index (useful for adding
CANCEL).defaultChoice - Initial choice selected when the Dialog is shown. If
you provide a non-null values parameter, the default choice must be
present in that array. If the values parameter is null, the default
choice is the index of the initially selected item.bitmap - Image to display in the left side of the dialog.public Dialog(String message, Object[] choices, int[] values, int defaultChoice, Bitmap bitmap, long style)
message - Message to show in dialog.choices - Objects selectable by the user; each object is showing
using Object.toString().values - Instead of returning the index selected, doModal()
returns the value associated with this index (useful for adding
CANCEL).defaultChoice - Initial choice selected when the Dialog is shown. If
you provide a non-null values parameter, the default choice must be
present in that array. If the values parameter is null, the default
choice is the index of the initially selected item.bitmap - Image to display in the left side of the dialog.style - Screen or Manager style.
public Dialog(int type,
String message,
int defaultChoice,
Bitmap bitmap,
long style)
Builds a standard inquiry dialog with your provided message.
| Method Detail |
public static void alert(String message)
This method creates an alert dialog typically used to notify the user of an event or some important information. The dialog uses a exclamation mark bitmap.
message - Text to display in the alert.public static int ask(int type)
This method creates a standard inquiry dialog. The dialog uses a question mark bitmap.
public static int ask(int type,
String message)
Builds a standard inquiry dialog with your provided message. The dialog uses a question mark bitmap.
type - Standard inquiry dialog type: D_OK,
D_SAVE,
D_DELETE,
D_YES_NO.message - Text message to show in dialog.CANCEL, OK, or DELETE are some of the possible return values.
public static int ask(int type,
String message,
int defaultChoice)
Builds a standard inquiry dialog with your provided message. The dialog uses a question mark bitmap.
type - Standard inquiry dialog type: D_OK,
D_SAVE,
D_DELETE,
D_YES_NO.message - Text message to show in dialog.defaultChoice - Initially selected choice.CANCEL, OK, or DELETE are some of the possible return values.public static int ask(String message, Object[] choices, int defaultChoice)
Builds an inquiry dialog from scratch with provided message and choices array. The dialog uses a question mark bitmap.
message - Text message to show in dialog.choices - Choices selectable by the user (show using
Object.toString().defaultChoice - Index of initially selected choice.CANCEL, OK, or DELETE are some of the possible return values.public static int ask(String message, Object[] choices, int[] values, int defaultChoice)
Builds an inquiry dialog from scratch with provided message, and choices and values arrays. The dialog uses a question mark bitmap.
message - Text message to show in dialog.choices - Choices selectable by the user (show using
Object.toString().values - Instead of returning the selected index, doModal()
returns the value associated with this index (useful for adding
CANCEL.defaultChoice - Index of initially selected choice.CANCEL, OK, or DELETE are some of the possible return values.public int doModal()
This method displays this dialog, waits for the user to select a choice, and then removes the dialog.
protected void onDisplay()
The system invokes this method after this dialog is pushed onto the stack and layout has been done, but before any painting occurs.
If no controlled field has the focus, this method attempts to assign the focus to the first field that will accept it, starting with the first field in the delegate manager's field list. Additionally, this method makes the focus visible, and resets scrolling to 0 if possible (ensuring the focussed region stays on the screen).
net.rim.device.api.ui.Screenpublic void show()
This method displays this dialog, but does not wait for user input
before returning. The DialogClosedListener is notified when this
dialog closes.
public void show(int priority)
This method displays this dialog, but does not wait for user input
before returning. The DialogClosedListener is listener when this
dialog closes.
priority - Display priority for this dialog, if it is an
GLOBAL_STATUS screen.public void setDialogClosedListener(DialogClosedListener listener)
Provide a listener object to handle dialog close events for dialogs created modelessly.
listener - Listener object for dialog close events.public void fieldChanged(Field field, int context)
If the provided field is a ButtonField, this method invokes
select() to signal a button push.
fieldChanged in interface FieldChangeListenerfield - Field whose state changed.context - Information specifying the origin of the change.public RichTextField getLabel()
public int getPreferredWidth()
This dialog's manager invokes this method to assist in its layout.
getPreferredWidth in class Fieldpublic static void inform(String message)
This method creates a notification dialog showing the provided message. The dialog uses the "information" bitmap.
message - Text to display in dialog.
protected boolean keyChar(char key,
int status,
int time)
If the character generated is ESCAPE, and this dialog provides a
CANCEL choice, then this method selects that choice.
If the character generated is ENTER, this method selects this dialog's default choice.
If the character generated is a letter, this method does simple prefix searching to find the first choice past the default selection that matches the letter generated. If it finds such a choice, this method then selects that choice.
key - Character generated by the event.status - State of the modifier keys.time - Ticks since device reset.public void select(int value)
This method finds the choice with the provided value, and selects
that choice; then, it closes this dialog. If this dialog was not built
with a range of values, then the value parameter indicates
the index of the choice to select.
value - Value (or choice index) to select.public final void setDefault(int defaultChoice)
defaultChoice - Choice index to set as default.public final void setEscapeEnabled(boolean escapeEnabled)
esacpeEnabled - Provide true if this dialog should support ESCAPE
key handling; otherwise, provide false.
protected boolean trackwheelClick(int status,
int time)
If this dialog was created with the LIST style, this method
allows a trackwheel click to activate the currently selected dialog
choice, consuming the event.
Otherwise, this method does not consume the event.
trackwheelClick in class Screenstatus - Modifier key status.time - Ticks since device reset.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.