|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.lwuit.Component
com.sun.dtv.lwuit.Container
com.sun.dtv.lwuit.Form
com.sun.dtv.lwuit.Dialog
public class Dialog
A dialog is a form that occupies a part of the screen and appears as a modal entity to the developer. Dialogs allow us to prompt users for information and rely on the information being available on the next line after the show method.
Modality indicates that a dialog will block the calling thread even if the calling thread is the EDT. Notice that a dialog will not release the block until dispose is called even if show() from another form is called!
To determine the size of the dialog use the show method that accepts 4 integer values, notice that these values accept margin from the four sides rather than x, y, width and height values!
To style the dialog you would usually want to style the content pane rather than the dialog itself.
Field Summary | |
---|---|
static int |
TYPE_ALARM
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set. |
static int |
TYPE_CONFIRMATION
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set. |
static int |
TYPE_ERROR
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set. |
static int |
TYPE_INFO
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set. |
static int |
TYPE_WARNING
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set. |
Fields inherited from class com.sun.dtv.lwuit.Component |
---|
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
Fields inherited from interface com.sun.dtv.ui.Animated |
---|
ALTERNATING, LOOP, REPEATING |
Constructor Summary | |
---|---|
Dialog()
Constructs a Dialog with a title. |
|
Dialog(String title)
Constructs a Dialog with a title. |
Method Summary | |
---|---|
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false. |
void |
dispose()
Closes the current form and returns to the previous form, releasing the EDT in the process. |
static String |
getDefaultDialogPosition()
Default screen orientation position for the upcoming dialog. |
Style |
getDialogStyle()
Simple getter to get the Dialog Style. |
boolean |
isAutoDispose()
Determines whether the execution of a command on this dialog implicitly disposes the dialog. |
void |
refreshTheme()
Makes sure the component is up to date with the current style object. |
void |
setAutoDispose(boolean autoDispose)
Determines whether the execution of a command on this dialog implicitly disposes the dialog. |
static void |
setDefaultDialogPosition(String p)
Default screen orientation position for the upcoming dialog. |
void |
setDialogStyle(Style style)
Simple setter to set the Dialog Style. |
void |
setTimeout(long time)
Indicates the time (in milliseconds) after which the dialog will be disposed implicitly. |
void |
show()
The default version of show modal shows the dialog occupying the center portion of the screen. |
Command |
show(int top,
int bottom,
int left,
int right,
boolean includeTitle)
This method shows the form as a modal alert allowing us to produce a behavior of an alert/dialog box. |
Command |
show(int top,
int bottom,
int left,
int right,
boolean includeTitle,
boolean modal)
This method shows the form as a modal alert allowing us to produce a behavior of an alert/dialog box. |
static Command |
show(String title,
Component body,
Command[] cmds)
Shows a modal dialog with the given component as its "body" placed in the center. |
static Command |
show(String title,
Component body,
Command[] cmds,
int type,
Image icon)
Shows a modal dialog with the given component as its "body" placed in the center. |
static Command |
show(String title,
Component body,
Command[] cmds,
int type,
Image icon,
long timeout)
Shows a modal dialog with the given component as its "body" placed in the center. |
static Command |
show(String title,
Component body,
Command[] cmds,
int type,
Image icon,
long timeout,
Transition transition)
Shows a modal dialog with the given component as its "body" placed in the center. |
static Command |
show(String title,
Component body,
Command defaultCommand,
Command[] cmds,
int type,
Image icon,
long timeout,
Transition transition)
Shows a modal dialog with the given component as its "body" placed in the center. |
static Command |
show(String title,
String text,
Command[] cmds,
int type,
Image icon,
long timeout)
Shows a modal prompt dialog with the given title and text. |
static Command |
show(String title,
String text,
Command[] cmds,
int type,
Image icon,
long timeout,
Transition transition)
Shows a modal prompt dialog with the given title and text. |
static Command |
show(String title,
String text,
Command defaultCommand,
Command[] cmds,
int type,
Image icon,
long timeout)
Shows a modal prompt dialog with the given title and text. |
static Command |
show(String title,
String text,
Command defaultCommand,
Command[] cmds,
int type,
Image icon,
long timeout,
Transition transition)
Shows a modal prompt dialog with the given title and text. |
static boolean |
show(String title,
String text,
int type,
Image icon,
String okText,
String cancelText)
Shows a modal prompt dialog with the given title and text. |
static boolean |
show(String title,
String text,
int type,
Image icon,
String okText,
String cancelText,
long timeout)
Shows a modal prompt dialog with the given title and text. |
static boolean |
show(String title,
String text,
String okText,
String cancelText)
Shows a modal prompt dialog with the given title and text. |
Command |
showDialog()
Shows a modal dialog and returns the command pressed within the modal dialog. |
void |
showModeless()
Shows a modeless dialog which is useful for some simpler use cases such as progress indication etc... |
Command |
showPacked(String position,
boolean modal)
Convenience method to show a dialog sized to match its content. |
Methods inherited from class com.sun.dtv.lwuit.Container |
---|
contains, doLayout, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getLayout, getLayoutHeight, getLayoutWidth, getMatte, invalidate, isScrollableX, isScrollableY, layoutContainer, revalidate, setCellRenderer, setMatte |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_ALARM
public static final int TYPE_CONFIRMATION
public static final int TYPE_ERROR
public static final int TYPE_INFO
public static final int TYPE_WARNING
Constructor Detail |
---|
public Dialog(String title)
title
- the title of the dialogpublic Dialog()
Method Detail |
---|
public void setDialogStyle(Style style)
Component
!
While setStyle influences the style of the whole screen, this method
refers to the style of the content pane, where all the elements of the dialog
are visible.
style
- the stylegetDialogStyle()
,
Component.setStyle(com.sun.dtv.lwuit.plaf.Style)
public Style getDialogStyle()
Component
!
While getStyle returns the style of the whole screen, this method
refers to the style of the content pane, where all the elements of the dialog
are visible.
setDialogStyle(com.sun.dtv.lwuit.plaf.Style)
,
Component.getStyle()
public Command show(int top, int bottom, int left, int right, boolean includeTitle)
Modal dialogs Allow the forms "content" to "hang in mid air" this is especially useful for dialogs where you would want the underlying form to "peek" from behind the form.
top
- space in pixels between the top of the screen and the formbottom
- space in pixels between the bottom of the screen and the formleft
- space in pixels between the left of the screen and the formright
- space in pixels between the right of the screen and the formincludeTitle
- whether the title should hang in the top of the screen or
be glued onto the content pane
public Command show(int top, int bottom, int left, int right, boolean includeTitle, boolean modal)
Modal dialogs Allow the forms "content" to "hang in mid air" this is especially useful for dialogs where you would want the underlying form to "peek" from behind the form.
top
- space in pixels between the top of the screen and the formbottom
- space in pixels between the bottom of the screen and the formleft
- space in pixels between the left of the screen and the formright
- space in pixels between the right of the screen and the formincludeTitle
- whether the title should hang in the top of the screen or
be glued onto the content panemodal
- indicates the dialog should be modal set to false for modeless dialog
which is useful for some use cases
public void setTimeout(long time)
time
- a milliseconds time used to dispose the dialogpublic static boolean show(String title, String text, int type, Image icon, String okText, String cancelText)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nullokText
- the text to appear in the command dismissing the dialogcancelText
- optionally null for a text to appear in the cancel command
for canceling the dialog
public static boolean show(String title, String text, int type, Image icon, String okText, String cancelText, long timeout)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nullokText
- the text to appear in the command dismissing the dialogcancelText
- optionally null for a text to appear in the cancel command
for canceling the dialogtimeout
- a timeout after which null would be returned if timeout is 0 infinite time is used
public static Command show(String title, String text, Command[] cmds, int type, Image icon, long timeout)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 infinite time is used
public static Command show(String title, String text, Command defaultCommand, Command[] cmds, int type, Image icon, long timeout)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogdefaultCommand
- command to be assigned as the default command or nullcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 infinite time is used
public static Command show(String title, String text, Command[] cmds, int type, Image icon, long timeout, Transition transition)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 infinite time is usedtransition
- the transition installed when the dialog enters/leaves
public static Command show(String title, String text, Command defaultCommand, Command[] cmds, int type, Image icon, long timeout, Transition transition)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogdefaultCommand
- command to be assigned as the default command or nullcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 infinite time is usedtransition
- the transition installed when the dialog enters/leaves
public static boolean show(String title, String text, String okText, String cancelText)
title
- The title for the dialog optionally null;text
- the text displayed in the dialogokText
- the text to appear in the command dismissing the dialogcancelText
- optionally null for a text to appear in the cancel command
for canceling the dialog
public static Command show(String title, Component body, Command[] cmds)
title
- title for the dialogbody
- component placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the form
public static Command show(String title, Component body, Command[] cmds, int type, Image icon)
title
- title for the dialogbody
- component placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be null
public static Command show(String title, Component body, Command[] cmds, int type, Image icon, long timeout)
title
- title for the dialogbody
- component placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 infinite time is used
public static Command show(String title, Component body, Command[] cmds, int type, Image icon, long timeout, Transition transition)
title
- title for the dialogbody
- component placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 infinite time is usedtransition
- the transition installed when the dialog enters/leaves
public static Command show(String title, Component body, Command defaultCommand, Command[] cmds, int type, Image icon, long timeout, Transition transition)
title
- title for the dialogbody
- component placed in the center of the dialogdefaultCommand
- command to be assigned as the default command or nullcmds
- commands that are added to the form any click on any command
will dispose the formtype
- the type of the alert one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMicon
- the icon for the dialog, can be nulltimeout
- a timeout after which null would be returned if timeout is 0 infinite time is usedtransition
- the transition installed when the dialog enters/leaves
public void show()
show
in class Form
public void showModeless()
public Command showPacked(String position, boolean modal)
position
- one of the values from the BorderLayout class e.g. BorderLayout.CENTER, BorderLayout.NORTH etc.modal
- whether the dialog should be modal
public void dispose()
public void refreshTheme()
Component
refreshTheme
in class Form
public Command showDialog()
public boolean animate()
Animation
animate
in interface Animation
animate
in class Component
public boolean isAutoDispose()
public void setAutoDispose(boolean autoDispose)
autoDispose
- auto disposed statepublic static void setDefaultDialogPosition(String p)
p
- default dialog positiongetDefaultDialogPosition()
public static String getDefaultDialogPosition()
setDefaultDialogPosition(java.lang.String)
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |