com.sun.lwuit
Class Dialog

java.lang.Object
  extended by com.sun.lwuit.Component
      extended by com.sun.lwuit.Container
          extended by com.sun.lwuit.Form
              extended by com.sun.lwuit.Dialog
All Implemented Interfaces:
Animation, StyleListener
Direct Known Subclasses:
VirtualKeyboard

public class Dialog
extends Form

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_NONE
          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.lwuit.Form
focusScrolling
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
Dialog()
          Constructs a Dialog with a title
Dialog(java.lang.String title)
          Constructs a Dialog with a title
 
Method Summary
protected  void actionCommand(Command cmd)
          Invoked to allow subclasses of form to handle a command from one point rather than implementing many command instances
 void addComponent(Component cmp)
          Adds Component to the Form's Content Pane
 void addComponent(int index, Component cmp)
          Adds Component to the Form's Content Pane
 void addComponent(int index, java.lang.Object constraints, Component cmp)
          Adds a Component to the Container
 void addComponent(java.lang.Object constraints, Component cmp)
          Adds a Component to the Container
 boolean animate()
          Allows the animation to reduce "repaint" calls when it returns false.
protected  void autoAdjust(int w, int h)
          Auto adjust size of the dialog.
 void dispose()
          Closes the current form and returns to the previous form, releasing the EDT in the process
 Container getContentPane()
          This method returns the Content pane instance
static java.lang.String getDefaultDialogPosition()
          Default screen orientation position for the upcoming dialog.
static int getDefaultDialogType()
          The default type for dialogs
 Container getDialogComponent()
          Returns the container that actually implements the dialog positioning.
 java.lang.String getDialogPosition()
          Screen orientation position for the upcoming dialog.
 Style getDialogStyle()
          Simple getter to get the Dialog Style
 int getDialogType()
          The type of the dialog can be one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
 java.lang.String getDialogUIID()
          Returns the uiid of the dialog
 Layout getLayout()
          Returns the layout manager responsible for arranging this container
 java.lang.String getTitle()
          Returns the Form title text
 Label getTitleComponent()
          Allows modifying the title attributes beyond style (e.g. setting icon/alignment etc.)
 Style getTitleStyle()
          Returns the style of the title
 boolean isAutoDispose()
          Determines whether the execution of a command on this dialog implicitly disposes the dialog.
static boolean isCommandsAsButtons()
          Places commands as buttons at the bottom of the standard static dialogs rather than as softbuttons.
static boolean isDialogTitleCompatibilityMode()
          Deprecated. this method will be removed and the functionality will be removed in the next version of LWUIT
static boolean isDisableStaticDialogScrolling()
          Allows a developer to indicate his interest that the dialog should no longer scroll on its own but rather rely on the scrolling properties of internal scrollable containers.
 boolean isDisposeWhenPointerOutOfBounds()
          This flag indicates if the dialog should be disposed if a pointer released event occurred out of the dialog content.
 void keyReleased(int keyCode)
          If this Component is focused, the key released event will call this method
protected  void onShow()
          Allows subclasses to bind functionality that occurs when a specific form or dialog appears on the screen
 void placeButtonCommands(Command[] cmds)
          Places the given commands in the dialog command area, this is very useful for touch devices.
 void pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method
 void removeAll()
          Removes all Components from the Content Pane
 void removeComponent(Component cmp)
          Removes a component from the Form's Content Pane
static void setAutoAdjustDialogSize(boolean a)
          Indicates whether LWUIT should try to automatically adjust a showing dialog size when a screen size change event occurs
 void setAutoDispose(boolean autoDispose)
          Determines whether the execution of a command on this dialog implicitly disposes the dialog.
static void setCommandsAsButtons(boolean c)
          Places commands as buttons at the bottom of the standard static dialogs rather than as softbuttons.
static void setDefaultDialogPosition(java.lang.String p)
          Default screen orientation position for the upcoming dialog.
static void setDefaultDialogType(int d)
          The default type for dialogs
 void setDialogPosition(java.lang.String dialogPosition)
          Screen orientation position for the upcoming dialog.
 void setDialogStyle(Style style)
          Simple setter to set the Dialog Style
static void setDialogTitleCompatibilityMode(boolean aDialogTitleCompatibilityMode)
          Deprecated. this method will be removed and the functionality will be removed in the next version of LWUIT
 void setDialogType(int dialogType)
          The type of the dialog can be one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
 void setDialogUIID(java.lang.String uiid)
          Simple setter to set the Dialog uiid
static void setDisableStaticDialogScrolling(boolean d)
          Allows a developer to indicate his interest that the dialog should no longer scroll on its own but rather rely on the scrolling properties of internal scrollable containers.
 void setDisposeWhenPointerOutOfBounds(boolean disposeWhenPointerOutOfBounds)
          This flag indicates if the dialog should be disposed if a pointer released event occurred out of the dialog content.
 void setLayout(Layout layout)
          Sets the layout manager responsible for arranging this container
 void setScrollable(boolean scrollable)
          The equivalent of calling both setScrollableY and setScrollableX
 void setTimeout(long time)
          Indicates the time (in milliseconds) afterwhich the dialog will be disposed implicitly
 void setTitle(java.lang.String title)
          Sets the Form title to the given text
 void setTitleComponent(Label title)
          Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.
 void setTitleComponent(Label title, Transition t)
          Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.
 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(java.lang.String title, Component body, Command[] cmds)
          Shows a modal dialog with the given component as its "body" placed in the center.
static Command show(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String title, java.lang.String text, Command[] cmds, int type, Image icon, long timeout)
          Shows a modal prompt dialog with the given title and text.
static Command show(java.lang.String title, java.lang.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(java.lang.String title, java.lang.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(java.lang.String title, java.lang.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(java.lang.String title, java.lang.String text, int type, Image icon, java.lang.String okText, java.lang.String cancelText)
          Shows a modal prompt dialog with the given title and text.
static boolean show(java.lang.String title, java.lang.String text, int type, Image icon, java.lang.String okText, java.lang.String cancelText, long timeout)
          Shows a modal prompt dialog with the given title and text.
static boolean show(java.lang.String title, java.lang.String text, java.lang.String okText, java.lang.String cancelText)
          Shows a modal prompt dialog with the given title and text.
 void showBack()
          Displays the current form on the screen, this version of the method is useful for "back" navigation since it reverses the direction of the transition.
 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(java.lang.String position, boolean modal)
          Convenience method to show a dialog sized to match its content.
 Command showPopupDialog(Component c)
          A popup dialog is shown with the context of a component and its selection, it is disposed seamlessly if the back button is pressed or if the user touches outside its bounds.
 
Methods inherited from class com.sun.lwuit.Form
addCommand, addCommand, addCommandListener, addGameKeyListener, addKeyListener, addOrientationListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addShowListener, deregisterAnimated, dispatchCommand, findNextFocusHorizontal, findNextFocusVertical, getBackCommand, getClearCommand, getCommand, getCommandCount, getComponentForm, getComponentIndex, getDefaultCommand, getFocused, getGlassPane, getMenuBar, getMenuStyle, getScrollAnimationSpeed, getSoftButton, getSoftButtonCount, getTintColor, getTitleArea, getTransitionInAnimator, getTransitionOutAnimator, hasMedia, hideNotify, isAlwaysTensile, isCyclicFocus, isFocusScrolling, isSingleFocusMode, isSmoothScrolling, keyPressed, keyRepeated, longKeyPress, longPointerPress, onShowCompleted, paint, paintBackground, paramString, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, refreshTheme, registerAnimated, removeAllCommands, removeCommand, removeCommandListener, removeGameKeyListener, removeKeyListener, removeOrientationListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeShowListener, replace, replaceAndWait, scrollComponentToVisible, setAlwaysTensile, setBackCommand, setBgImage, setClearCommand, setCyclicFocus, setDefaultCommand, setFocused, setFocusScrolling, setGlassPane, setMenuBar, setMenuCellRenderer, setMenuTransitions, setRTL, setScrollableX, setScrollableY, setScrollAnimationSpeed, setSmoothScrolling, setTintColor, setTitleStyle, setTransitionInAnimator, setTransitionOutAnimator, setVisible, showNotify, sizeChanged
 
Methods inherited from class com.sun.lwuit.Container
animateLayout, animateLayoutAndWait, applyRTL, calcPreferredSize, contains, dragInitiated, drop, findFirstFocusable, flushReplace, getBottomGap, getComponentAt, getComponentAt, getComponentCount, getGridPosX, getGridPosY, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getScrollIncrement, getSideGap, invalidate, isEnabled, isScrollableX, isScrollableY, layoutContainer, paintGlass, replace, replaceAndWait, replaceAndWait, revalidate, setCellRenderer, setEnabled, setLeadComponent, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, drawDraggedImage, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getDirtyRegion, getDisabledStyle, getDragImage, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getWidth, getVisibleBounds, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollVisible, isSelectableInteraction, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, laidOut, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerPressed, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setWidth, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_NONE

public static final int TYPE_NONE
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set

See Also:
Constant Field Values

TYPE_ALARM

public static final int TYPE_ALARM
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set

See Also:
Constant Field Values

TYPE_CONFIRMATION

public static final int TYPE_CONFIRMATION
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set

See Also:
Constant Field Values

TYPE_ERROR

public static final int TYPE_ERROR
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set

See Also:
Constant Field Values

TYPE_INFO

public static final int TYPE_INFO
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set

See Also:
Constant Field Values

TYPE_WARNING

public static final int TYPE_WARNING
Constant indicating the type of alert to indicate the sound to play or icon if none are explicitly set

See Also:
Constant Field Values
Constructor Detail

Dialog

public Dialog(java.lang.String title)
Constructs a Dialog with a title

Parameters:
title - the title of the dialog

Dialog

public Dialog()
Constructs a Dialog with a title

Method Detail

isDialogTitleCompatibilityMode

public static boolean isDialogTitleCompatibilityMode()
Deprecated. this method will be removed and the functionality will be removed in the next version of LWUIT

Special mode allowing us to transition to the new dialog style approach, setting this to true will cause the dialog title to behave as it did in LWUIT 1.4

Returns:
the dialogTitleCompatibilityMode

setDialogTitleCompatibilityMode

public static void setDialogTitleCompatibilityMode(boolean aDialogTitleCompatibilityMode)
Deprecated. this method will be removed and the functionality will be removed in the next version of LWUIT

Special mode allowing us to transition to the new dialog style approach, setting this to true will cause the dialog title to behave as it did in LWUIT 1.4

Parameters:
aDialogTitleCompatibilityMode - the dialogTitleCompatibilityMode to set

getContentPane

public Container getContentPane()
Description copied from class: Form
This method returns the Content pane instance

Overrides:
getContentPane in class Form
Returns:
a content pane instance

getLayout

public Layout getLayout()
Description copied from class: Container
Returns the layout manager responsible for arranging this container

Overrides:
getLayout in class Form
Returns:
the container layout manager

getTitle

public java.lang.String getTitle()
Description copied from class: Form
Returns the Form title text

Overrides:
getTitle in class Form
Returns:
returns the form title

addComponent

public void addComponent(Component cmp)
Description copied from class: Form
Adds Component to the Form's Content Pane

Overrides:
addComponent in class Form
Parameters:
cmp - the added param

addComponent

public void addComponent(java.lang.Object constraints,
                         Component cmp)
Description copied from class: Container
Adds a Component to the Container

Overrides:
addComponent in class Form
Parameters:
constraints - this method is useful when the Layout requires a constraint such as the BorderLayout. In this case you need to specify an additional data when you add a Component, such as "CENTER", "NORTH"...
cmp - component to add

addComponent

public void addComponent(int index,
                         java.lang.Object constraints,
                         Component cmp)
Description copied from class: Container
Adds a Component to the Container

Overrides:
addComponent in class Form
Parameters:
index - location to insert the Component
constraints - this method is useful when the Layout requires a constraint such as the BorderLayout. In this case you need to specify an additional data when you add a Component, such as "CENTER", "NORTH"...
cmp - component to add

addComponent

public void addComponent(int index,
                         Component cmp)
Description copied from class: Form
Adds Component to the Form's Content Pane

Overrides:
addComponent in class Form
Parameters:
index - location to insert the Component
cmp - the added param

removeAll

public void removeAll()
Description copied from class: Form
Removes all Components from the Content Pane

Overrides:
removeAll in class Form

removeComponent

public void removeComponent(Component cmp)
Description copied from class: Form
Removes a component from the Form's Content Pane

Overrides:
removeComponent in class Form
Parameters:
cmp - the component to be removed

getTitleComponent

public Label getTitleComponent()
Description copied from class: Form
Allows modifying the title attributes beyond style (e.g. setting icon/alignment etc.)

Overrides:
getTitleComponent in class Form
Returns:
the component representing the title for the form

getTitleStyle

public Style getTitleStyle()
Description copied from class: Form
Returns the style of the title

Overrides:
getTitleStyle in class Form
Returns:
the style of the title

setLayout

public void setLayout(Layout layout)
Description copied from class: Container
Sets the layout manager responsible for arranging this container

Overrides:
setLayout in class Form
Parameters:
layout - the specified layout manager

setTitle

public void setTitle(java.lang.String title)
Description copied from class: Form
Sets the Form title to the given text

Overrides:
setTitle in class Form
Parameters:
title - the form title

setTitleComponent

public void setTitleComponent(Label title)
Description copied from class: Form
Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.

Overrides:
setTitleComponent in class Form
Parameters:
title - new title component

getDialogComponent

public Container getDialogComponent()
Returns the container that actually implements the dialog positioning. This container is normally not accessible via the LWUIT API.

Returns:
internal dialog container useful for various calculations.

setTitleComponent

public void setTitleComponent(Label title,
                              Transition t)
Description copied from class: Form
Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects. This version of the method allows special effects for title replacement such as transitions for title entering

Overrides:
setTitleComponent in class Form
Parameters:
title - new title component
t - transition for title replacement

setDialogStyle

public void setDialogStyle(Style style)
Simple setter to set the Dialog Style

Parameters:
style -

setDialogUIID

public void setDialogUIID(java.lang.String uiid)
Simple setter to set the Dialog uiid

Parameters:
uiid - the id for the dialog

getDialogUIID

public java.lang.String getDialogUIID()
Returns the uiid of the dialog

Returns:
the uiid of the dialog

getDialogStyle

public Style getDialogStyle()
Simple getter to get the Dialog Style

Returns:
the style of the dialog

show

public 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. This method will block the calling thread even if the calling thread is the EDT. Notice that this method will not release the block until dispose is called even if show() from another form is called!

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.

Parameters:
top - space in pixels between the top of the screen and the form
bottom - space in pixels between the bottom of the screen and the form
left - space in pixels between the left of the screen and the form
right - space in pixels between the right of the screen and the form
includeTitle - whether the title should hang in the top of the screen or be glued onto the content pane
Returns:
the last command pressed by the user if such a command exists

show

public 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. This method will block the calling thread even if the calling thread is the EDT. Notice that this method will not release the block until dispose is called even if show() from another form is called!

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.

Parameters:
top - space in pixels between the top of the screen and the form
bottom - space in pixels between the bottom of the screen and the form
left - space in pixels between the left of the screen and the form
right - space in pixels between the right of the screen and the form
includeTitle - whether the title should hang in the top of the screen or be glued onto the content pane
modal - indicates the dialog should be modal set to false for modeless dialog which is useful for some use cases
Returns:
the last command pressed by the user if such a command exists

setTimeout

public void setTimeout(long time)
Indicates the time (in milliseconds) afterwhich the dialog will be disposed implicitly

Parameters:
time - a milliseconds time used to dispose the dialog

show

public static boolean show(java.lang.String title,
                           java.lang.String text,
                           int type,
                           Image icon,
                           java.lang.String okText,
                           java.lang.String cancelText)
Shows a modal prompt dialog with the given title and text.

Parameters:
title - The title for the dialog optionally null;
text - the text displayed in the dialog
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
okText - the text to appear in the command dismissing the dialog
cancelText - optionally null for a text to appear in the cancel command for canceling the dialog
Returns:
true if the ok command was pressed or if cancelText is null. False otherwise.

autoAdjust

protected void autoAdjust(int w,
                          int h)
Auto adjust size of the dialog. This method is triggered from a sizeChanged event.

Parameters:
w - width of the screen
h - height of the screen

show

public static boolean show(java.lang.String title,
                           java.lang.String text,
                           int type,
                           Image icon,
                           java.lang.String okText,
                           java.lang.String cancelText,
                           long timeout)
Shows a modal prompt dialog with the given title and text.

Parameters:
title - The title for the dialog optionally null;
text - the text displayed in the dialog
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
okText - the text to appear in the command dismissing the dialog
cancelText - optionally null for a text to appear in the cancel command for canceling the dialog
timeout - a timeout after which null would be returned if timeout is 0 inifinite time is used
Returns:
true if the ok command was pressed or if cancelText is null. False otherwise.

show

public static Command show(java.lang.String title,
                           java.lang.String text,
                           Command[] cmds,
                           int type,
                           Image icon,
                           long timeout)
Shows a modal prompt dialog with the given title and text.

Parameters:
title - The title for the dialog optionally null;
text - the text displayed in the dialog
cmds - commands that are added to the form any click on any command will dispose the form
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
timeout - a timeout after which null would be returned if timeout is 0 inifinite time is used
Returns:
the command pressed by the user

show

public static Command show(java.lang.String title,
                           java.lang.String text,
                           Command defaultCommand,
                           Command[] cmds,
                           int type,
                           Image icon,
                           long timeout)
Shows a modal prompt dialog with the given title and text.

Parameters:
title - The title for the dialog optionally null;
text - the text displayed in the dialog
defaultCommand - command to be assigned as the default command or null
cmds - commands that are added to the form any click on any command will dispose the form
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
timeout - a timeout after which null would be returned if timeout is 0 inifinite time is used
Returns:
the command pressed by the user

show

public static Command show(java.lang.String title,
                           java.lang.String text,
                           Command[] cmds,
                           int type,
                           Image icon,
                           long timeout,
                           Transition transition)
Shows a modal prompt dialog with the given title and text.

Parameters:
title - The title for the dialog optionally null;
text - the text displayed in the dialog
cmds - commands that are added to the form any click on any command will dispose the form
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
timeout - a timeout after which null would be returned if timeout is 0 inifinite time is used
transition - the transition installed when the dialog enters/leaves
Returns:
the command pressed by the user

show

public static Command show(java.lang.String title,
                           java.lang.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.

Parameters:
title - The title for the dialog optionally null;
text - the text displayed in the dialog
defaultCommand - command to be assigned as the default command or null
cmds - commands that are added to the form any click on any command will dispose the form
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
timeout - a timeout after which null would be returned if timeout is 0 inifinite time is used
transition - the transition installed when the dialog enters/leaves
Returns:
the command pressed by the user

show

public static boolean show(java.lang.String title,
                           java.lang.String text,
                           java.lang.String okText,
                           java.lang.String cancelText)
Shows a modal prompt dialog with the given title and text.

Parameters:
title - The title for the dialog optionally null;
text - the text displayed in the dialog
okText - the text to appear in the command dismissing the dialog
cancelText - optionally null for a text to appear in the cancel command for canceling the dialog
Returns:
true if the ok command was pressed or if cancelText is null. False otherwise.

show

public static Command show(java.lang.String title,
                           Component body,
                           Command[] cmds)
Shows a modal dialog with the given component as its "body" placed in the center.

Parameters:
title - title for the dialog
body - component placed in the center of the dialog
cmds - commands that are added to the form any click on any command will dispose the form
Returns:
the command pressed by the user

show

public static Command show(java.lang.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.

Parameters:
title - title for the dialog
body - component placed in the center of the dialog
cmds - commands that are added to the form any click on any command will dispose the form
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
Returns:
the command pressed by the user

show

public static Command show(java.lang.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.

Parameters:
title - title for the dialog
body - component placed in the center of the dialog
cmds - commands that are added to the form any click on any command will dispose the form
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
timeout - a timeout after which null would be returned if timeout is 0 inifinite time is used
Returns:
the command pressed by the user

show

public static Command show(java.lang.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.

Parameters:
title - title for the dialog
body - component placed in the center of the dialog
cmds - commands that are added to the form any click on any command will dispose the form
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
timeout - a timeout after which null would be returned if timeout is 0 inifinite time is used
transition - the transition installed when the dialog enters/leaves
Returns:
the command pressed by the user

placeButtonCommands

public void placeButtonCommands(Command[] cmds)
Places the given commands in the dialog command area, this is very useful for touch devices.

Parameters:
cmds - the commands to place

keyReleased

public void keyReleased(int keyCode)
Description copied from class: Component
If this Component is focused, the key released event will call this method

Overrides:
keyReleased in class Form
Parameters:
keyCode - the key code value to indicate a physical key.

show

public static Command show(java.lang.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.

Parameters:
title - title for the dialog
body - component placed in the center of the dialog
defaultCommand - command to be assigned as the default command or null
cmds - commands that are added to the form any click on any command will dispose the form
type - the type of the alert one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM
icon - the icon for the dialog, can be null
timeout - a timeout after which null would be returned if timeout is 0 inifinite time is used
transition - the transition installed when the dialog enters/leaves
Returns:
the command pressed by the user

onShow

protected void onShow()
Description copied from class: Form
Allows subclasses to bind functionality that occurs when a specific form or dialog appears on the screen

Overrides:
onShow in class Form

showBack

public void showBack()
Description copied from class: Form
Displays the current form on the screen, this version of the method is useful for "back" navigation since it reverses the direction of the transition.

Overrides:
showBack in class Form

setScrollable

public void setScrollable(boolean scrollable)
Description copied from class: Container
The equivalent of calling both setScrollableY and setScrollableX

Overrides:
setScrollable in class Form
Parameters:
scrollable - whether the component should/could scroll on the X and Y axis

show

public void show()
The default version of show modal shows the dialog occupying the center portion of the screen.

Overrides:
show in class Form

showModeless

public void showModeless()
Shows a modeless dialog which is useful for some simpler use cases such as progress indication etc...


showPopupDialog

public Command showPopupDialog(Component c)
A popup dialog is shown with the context of a component and its selection, it is disposed seamlessly if the back button is pressed or if the user touches outside its bounds. It can optionally provide an arrow in the theme to point at the context component. The popup dialog has the PopupDialog style by default.

Parameters:
c - the context component which is used to position the dialog and can also be pointed at
Returns:
the command that might have been triggered by the user within the dialog if commands are placed in the dialog

showPacked

public Command showPacked(java.lang.String position,
                          boolean modal)
Convenience method to show a dialog sized to match its content.

Parameters:
position - one of the values from the BorderLayout class e.g. BorderLayout.CENTER, BorderLayout.NORTH etc.
modal - whether the dialog should be modal or modaless
Returns:
the command selected if the dialog is modal and disposed via a command

dispose

public void dispose()
Closes the current form and returns to the previous form, releasing the EDT in the process


showDialog

public Command showDialog()
Shows a modal dialog and returns the command pressed within the modal dialog

Returns:
last command pressed in the modal dialog

actionCommand

protected void actionCommand(Command cmd)
Invoked to allow subclasses of form to handle a command from one point rather than implementing many command instances

Overrides:
actionCommand in class Form
Parameters:
cmd - the action command

animate

public boolean animate()
Description copied from interface: Animation
Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the Display class.

Specified by:
animate in interface Animation
Overrides:
animate in class Form
Returns:
true if a repaint is desired or false if no repaint is necessary

isAutoDispose

public boolean isAutoDispose()
Determines whether the execution of a command on this dialog implicitly disposes the dialog. This defaults to true which is a sensible default for simple dialogs.

Returns:
true if this dialog disposes on any command

setAutoDispose

public void setAutoDispose(boolean autoDispose)
Determines whether the execution of a command on this dialog implicitly disposes the dialog. This defaults to true which is a sensible default for simple dialogs.

Parameters:
autoDispose - true if this dialog disposes on any command

setDefaultDialogPosition

public static void setDefaultDialogPosition(java.lang.String p)
Default screen orientation position for the upcoming dialog. By default the dialog will be shown at hardcoded coordinates, this method allows us to pack the dialog appropriately in one of the border layout based locations see BorderLayout for futher details.

Parameters:
p - for dialogs on the sceen using BorderLayout orientation tags

getDefaultDialogPosition

public static java.lang.String getDefaultDialogPosition()
Default screen orientation position for the upcoming dialog. By default the dialog will be shown at hardcoded coordinates, this method allows us to pack the dialog appropriately in one of the border layout based locations see BorderLayout for futher details.

Returns:
position for dialogs on the sceen using BorderLayout orientation tags

getDialogType

public int getDialogType()
The type of the dialog can be one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM

Returns:
can be one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM

setDialogType

public void setDialogType(int dialogType)
The type of the dialog can be one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM

Parameters:
dialogType - can be one of TYPE_WARNING, TYPE_INFO, TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARM

setDefaultDialogType

public static void setDefaultDialogType(int d)
The default type for dialogs

Parameters:
d - the default type for the dialog

getDefaultDialogType

public static int getDefaultDialogType()
The default type for dialogs

Returns:
the default type for the dialog

setAutoAdjustDialogSize

public static void setAutoAdjustDialogSize(boolean a)
Indicates whether LWUIT should try to automatically adjust a showing dialog size when a screen size change event occurs

Parameters:
a - true to indicate that LWUIT should make a "best effort" to resize the dialog

setDisableStaticDialogScrolling

public static void setDisableStaticDialogScrolling(boolean d)
Allows a developer to indicate his interest that the dialog should no longer scroll on its own but rather rely on the scrolling properties of internal scrollable containers. This flag only affects the static show methods within this class.

Parameters:
d - indicates whether scrolling should be active or not

isDisableStaticDialogScrolling

public static boolean isDisableStaticDialogScrolling()
Allows a developer to indicate his interest that the dialog should no longer scroll on its own but rather rely on the scrolling properties of internal scrollable containers. This flag only affects the static show methods within this class.

Returns:
true if scrolling should be activated, false otherwise

setCommandsAsButtons

public static void setCommandsAsButtons(boolean c)
Places commands as buttons at the bottom of the standard static dialogs rather than as softbuttons. This is especially appropriate for devices such as touch devices and devices without the common softbuttons (e.g. blackberries). The default value is false

Parameters:
c - true to place commands as buttons and not as softbutton keys

isCommandsAsButtons

public static boolean isCommandsAsButtons()
Places commands as buttons at the bottom of the standard static dialogs rather than as softbuttons. This is especially appropriate for devices such as touch devices and devices without the common softbuttons (e.g. blackberries). The default value is false

Returns:
true if commands are placed as buttons and not as softbutton keys

setDisposeWhenPointerOutOfBounds

public void setDisposeWhenPointerOutOfBounds(boolean disposeWhenPointerOutOfBounds)
This flag indicates if the dialog should be disposed if a pointer released event occurred out of the dialog content.

Parameters:
disposeWhenPointerOutOfBounds -

isDisposeWhenPointerOutOfBounds

public boolean isDisposeWhenPointerOutOfBounds()
This flag indicates if the dialog should be disposed if a pointer released event occurred out of the dialog content.

Returns:
true if the dialog should dispose

pointerReleased

public void pointerReleased(int x,
                            int y)
Description copied from class: Component
If this Component is focused, the pointer released event will call this method

Overrides:
pointerReleased in class Form
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

getDialogPosition

public java.lang.String getDialogPosition()
Screen orientation position for the upcoming dialog. By default the dialog will be shown at hardcoded coordinates, this method allows us to pack the dialog appropriately in one of the border layout based locations see BorderLayout for futher details.

Returns:
the dialogPosition

setDialogPosition

public void setDialogPosition(java.lang.String dialogPosition)
Screen orientation position for the upcoming dialog. By default the dialog will be shown at hardcoded coordinates, this method allows us to pack the dialog appropriately in one of the border layout based locations see BorderLayout for futher details.

Parameters:
dialogPosition - the dialogPosition to set