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! Events are still performed thanks
to the Display.invokeAndBlock(java.lang.Runnable)
capability of the
Display
class.
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!
It's important to style a Dialog
using getDialogStyle()
or
setDialogUIID(java.lang.String)
methods rather than styling the dialog object directly.
The Dialog
class also includes support for popup dialog which is a dialog type that is positioned
next to a component or screen area and points an arrow at that location.
Typical dialog usage looks like this:
See this sample for showing a dialog at the bottom of the screen:
Form.TabIterator
Modifier and Type | Field and Description |
---|---|
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
|
focusScrolling
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR
Constructor and Description |
---|
Dialog()
Constructs a Dialog
|
Dialog(Layout lm)
Constructs a Dialog with a layout
|
Dialog(String title)
Constructs a Dialog with a title
|
Dialog(String title,
Layout lm)
Constructs a Dialog with a title
|
Modifier and Type | Method and Description |
---|---|
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,
Object constraints,
Component cmp)
Adds a Component to the Container
|
void |
addComponent(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
|
float |
getBlurBackgroundRadius()
Dialog background can be blurred using a Gaussian blur effect, this sets the radius of the Gaussian
blur.
|
Container |
getContentPane()
This method returns the Content pane instance
|
static float |
getDefaultBlurBackgroundRadius()
Dialog background can be blurred using a Gaussian blur effect, this sets the radius of the Gaussian
blur.
|
static 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.
|
String |
getDialogPosition()
Screen orientation position for the upcoming dialog.
|
Dimension |
getDialogPreferredSize()
Returns the preferred size of the dialog, this allows developers to position a dialog
manually in arbitrary positions.
|
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
|
String |
getDialogUIID()
Returns the uiid of the dialog
|
Layout |
getLayout()
Returns the layout manager of the form's content pane.
|
Boolean |
getPopupDirectionBiasPortrait()
Indicates if we want to enforce directional bias for the popup dialog.
|
String |
getTitle()
Returns the Form title text
|
Label |
getTitleComponent()
Allows modifying the title attributes beyond style (e.g.
|
Style |
getTitleStyle()
Returns the style of the title
|
void |
growOrShrink()
Allows a dialog component to grow or shrink to its new preferred size
|
protected void |
initGlobalToolbar()
Overriden to disable the toolbar in dialogs
Allows subclasses to disable the global toolbar for a specific form by overriding this method |
protected void |
initLaf(UIManager uim)
Initialize the default transition for the dialogs overriding the forms
transition
|
static boolean |
isAutoAdjustDialogSize()
Indicates whether Codename One should try to automatically adjust a showing dialog size
when a screen size change event occurs
|
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 |
isDefaultDisposeWhenPointerOutOfBounds()
The default pointer out of bounds dispose behavior, notice that
this only applies to dialogs and not popup dialogs where this is
always true by default
|
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)
Deprecated.
this method shouldn't be invoked externally, it should have been private
|
void |
pointerPressed(int x,
int y)
If this Component is focused, the pointer pressed event
will call this method
|
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 Codename One 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.
|
void |
setBlurBackgroundRadius(float blurBackgroundRadius)
Dialog background can be blurred using a Gaussian blur effect, this sets the radius of the Gaussian
blur.
|
static void |
setCommandsAsButtons(boolean c)
Places commands as buttons at the bottom of the standard static dialogs rather than
as softbuttons.
|
static void |
setDefaultBlurBackgroundRadius(float aDefaultBlurBackgroundRadius)
Dialog background can be blurred using a Gaussian blur effect, this sets the radius of the Gaussian
blur.
|
static void |
setDefaultDialogPosition(String p)
Default screen orientation position for the upcoming dialog.
|
static void |
setDefaultDialogType(int d)
The default type for dialogs
|
static void |
setDefaultDisposeWhenPointerOutOfBounds(boolean aDefaultDisposeWhenPointerOutOfBounds)
The default pointer out of bounds dispose behavior, notice that
this only applies to dialogs and not popup dialogs where this is
always true by default
|
void |
setDialogPosition(String dialogPosition)
Screen orientation position for the upcoming dialog.
|
void |
setDialogStyle(Style style)
Simple setter to set the Dialog Style
|
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(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 |
setPopupDirectionBiasPortrait(Boolean popupDirectionBiasPortrait)
Indicates if we want to enforce directional bias for the popup dialog.
|
void |
setPreviousForm(Form previousForm)
When the dialog is disposed this form will show.
|
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(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 |
setUIIDByPopupPosition(boolean b)
Allows to use the UIIDs "PopupContentPaneDownwards",
"PopupContentPaneUpwards", "PopupContentPaneRight",
"PopupContentPaneLeft" (instead of the default UIID "PopupContentPane")
to style the PopupDialog more accurately based on the position of the
dialog popup compared to the context component.
|
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)
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)
Deprecated.
use the version that doesn't accept the include title, the includeTitle
feature is no longer supported
|
Command |
show(int top,
int bottom,
int left,
int right,
boolean includeTitle,
boolean modal)
Deprecated.
use showAtPosition, the includeTitle flag is no longer supported
|
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 body,
Command... cmds)
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 |
showAtPosition(int top,
int bottom,
int left,
int right,
boolean modal)
This method shows the form as a modal alert allowing us to produce a behavior
of an alert/dialog box.
|
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(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.
|
Command |
showPopupDialog(Rectangle rect)
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.
|
Command |
showStetched(String position,
boolean modal)
Deprecated.
due to typo use showStretched instead
|
Command |
showStretched(String position,
boolean modal)
Convenience method to show a dialog stretched to one of the sides
|
boolean |
wasDisposedDueToOutOfBoundsTouch()
Returns true if a dialog that was disposed did it because of a pointer out of bounds
|
boolean |
wasDisposedDueToRotation()
Returns true if the dialog was disposed automatically due to device rotation
|
addCommand, addCommand, addCommandListener, addComponentAwaitingRelease, addGameKeyListener, addKeyListener, addOrientationListener, addPasteListener, addShowListener, addSizeChangedListener, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, clearComponentsAwaitingRelease, createStatusBar, deregisterAnimated, dispatchCommand, dispatchPaste, findCurrentlyEditingComponent, findNextFocusHorizontal, findNextFocusVertical, getAnimationManager, getBackCommand, getClearCommand, getCommand, getCommandCount, getComponentForm, getComponentIndex, getCurrentInputDevice, getDefaultCommand, getDragRegionStatus, getEditOnShow, getFocused, getFormLayeredPane, getFormLayeredPaneIfExists, getGlassPane, getInvisibleAreaUnderVKB, getLayeredPane, getLayeredPane, getLayeredPane, getLayeredPaneIfExists, getMenuBar, getMenuStyle, getNextComponent, getPreviousComponent, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSafeArea, getScrollAnimationSpeed, getSideGap, getSoftButton, getSoftButtonCount, getSourceCommand, getTabIterator, getTextSelection, getTintColor, getTitleArea, getToolbar, getTransitionInAnimator, getTransitionOutAnimator, getUIManager, grabAnimationLock, hasMedia, hideNotify, isAlwaysTensile, isCyclicFocus, isDragRegion, isEditing, isEnableCursors, isFocusScrolling, isFormBottomPaddingEditingMode, isMinimizeOnBack, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSingleFocusMode, isSmoothScrolling, keyPressed, keyRepeated, longKeyPress, longPointerPress, onShowCompleted, paint, paintBackground, paintScrollbars, paramString, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, refreshTheme, registerAnimated, releaseAnimationLock, removeAllCommands, removeAllShowListeners, removeCommand, removeCommandListener, removeComponentAwaitingRelease, removeGameKeyListener, removeKeyListener, removeOrientationListener, removePasteListener, removeShowListener, removeSizeChangedListener, replace, replaceAndWait, resumeDragAfterScrolling, scrollComponentToVisible, setAllowEnableLayoutOnPaint, setAlwaysTensile, setBackCommand, setBackCommand, setBgImage, setClearCommand, setCurrentInputDevice, setCyclicFocus, setDefaultCommand, setEditOnShow, setEnableCursors, setFocused, setFocusScrolling, setFormBottomPaddingEditingMode, setGlassPane, setMenuBar, setMenuCellRenderer, setMenuTransitions, setMinimizeOnBack, setOverrideInvisibleAreaUnderVKB, setPropertyValue, setRTL, setSafeAreaChanged, setScrollableX, setScrollableY, setScrollAnimationSpeed, setScrollVisible, setSmoothScrolling, setSourceCommand, setTintColor, setTitleStyle, setToolbar, setToolBar, setTransitionInAnimator, setTransitionOutAnimator, setUIManager, setVisible, shouldPaintStatusBar, shouldSendPointerReleaseToOtherForm, showNotify, sizeChanged, stopEditing
add, add, add, add, add, add, addAll, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getGridPosX, getGridPosY, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isSelectableInteraction, isSurface, iterator, iterator, layoutContainer, morph, morphAndWait, paintBorderBackground, paintComponentBackground, paintGlass, replace, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, setCellRenderer, setEnabled, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, updateTabIndices
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEditable, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isSetCursorSupported, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, laidOut, onScrollX, onScrollY, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setSameHeight, setSameSize, setSameWidth, setScrollOpacityChangeSpeed, setScrollSize, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUnselectedStyle, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains
public static final int TYPE_NONE
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
public Dialog(String title)
title
- the title of the dialogpublic Dialog(String title, Layout lm)
title
- the title of the dialoglm
- the layout for the dialogpublic Dialog()
public Dialog(Layout lm)
lm
- the layout managerpublic static boolean isDefaultDisposeWhenPointerOutOfBounds()
public static void setDefaultDisposeWhenPointerOutOfBounds(boolean aDefaultDisposeWhenPointerOutOfBounds)
aDefaultDisposeWhenPointerOutOfBounds
- the defaultDisposeWhenPointerOutOfBounds to setpublic void setPreviousForm(Form previousForm)
previousForm
- the previous formprotected final void initGlobalToolbar()
initGlobalToolbar
in class Form
public Container getContentPane()
Form
getContentPane
in class Form
public Layout getLayout()
getLayout
in class Form
For the actual layout of the form.
public String getTitle()
public void addComponent(Component cmp)
addComponent
in class Form
cmp
- the added parampublic void addComponent(Object constraints, Component cmp)
addComponent
in class Form
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 addpublic void addComponent(int index, Object constraints, Component cmp)
addComponent
in class Form
index
- location to insert the Componentconstraints
- 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 addpublic void addComponent(int index, Component cmp)
addComponent
in class Form
index
- location to insert the Componentcmp
- the added parampublic void removeAll()
public void removeComponent(Component cmp)
removeComponent
in class Form
cmp
- the component to be removedpublic Label getTitleComponent()
getTitleComponent
in class Form
public Style getTitleStyle()
getTitleStyle
in class Form
public void setLayout(Layout layout)
public void setTitle(String title)
public void setTitleComponent(Label title)
setTitleComponent
in class Form
title
- new title componentpublic Container getDialogComponent()
public void setTitleComponent(Label title, Transition t)
setTitleComponent
in class Form
title
- new title componentt
- transition for title replacementpublic void setDialogStyle(Style style)
style
- public void setDialogUIID(String uiid)
uiid
- the id for the dialogpublic String getDialogUIID()
public Style getDialogStyle()
protected void initLaf(UIManager uim)
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 panepublic Command show(int top, int bottom, int left, int right)
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.
See this sample for showing a dialog at the bottom of the screen: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 formpublic 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 casespublic Command showAtPosition(int top, int bottom, int left, int right, 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 formmodal
- indicates the dialog should be modal set to false for modeless dialog
which is useful for some use casespublic 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 dialogprotected void autoAdjust(int w, int h)
w
- width of the screenh
- height of the screenpublic 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 inifinite time is usedpublic 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 inifinite time is usedpublic 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 inifinite time is usedpublic 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 inifinite time is usedtransition
- the transition installed when the dialog enters/leavespublic 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 inifinite time is usedtransition
- the transition installed when the dialog enters/leavespublic 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 dialogpublic 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 formpublic static Command show(String title, String body, Command... cmds)
title
- title for the dialogbody
- text placed in the center of the dialogcmds
- commands that are added to the form any click on any command
will dispose the formpublic 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 nullpublic 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 inifinite time is usedpublic 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/leavespublic void placeButtonCommands(Command[] cmds)
cmds
- the commands to placepublic void keyReleased(int keyCode)
keyReleased
in class Form
keyCode
- the key code value to indicate a physical key.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 inifinite time is usedtransition
- the transition installed when the dialog enters/leavesprotected void onShow()
public void showBack()
public void setScrollable(boolean scrollable)
setScrollable
in class Form
scrollable
- whether the component should/could scroll on the
X and Y axispublic void show()
public void showModeless()
public Command showPopupDialog(Component c)
c
- the context component which is used to position the dialog and can also be pointed atpublic Command showPopupDialog(Rectangle rect)
rect
- the screen rectangle to which the popup should pointpublic 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 or modalesspublic Command showStretched(String position, boolean modal)
position
- one of the values from the BorderLayout class except for center e.g. BorderLayout.NORTH, BorderLayout.EAST etc.modal
- whether the dialog should be modal or modalesspublic Command showStetched(String position, boolean modal)
position
- one of the values from the BorderLayout class except for center e.g. BorderLayout.NORTH, BorderLayout.EAST etc.modal
- whether the dialog should be modal or modalesspublic Dimension getDialogPreferredSize()
public void dispose()
public Command showDialog()
protected void actionCommand(Command cmd)
actionCommand
in class Form
cmd
- the action commandpublic boolean animate()
Display
class.public boolean isAutoDispose()
public void setAutoDispose(boolean autoDispose)
autoDispose
- true if this dialog disposes on any commandpublic static void setDefaultDialogPosition(String p)
p
- for dialogs on the sceen using BorderLayout orientation tagspublic static String getDefaultDialogPosition()
public int getDialogType()
public void setDialogType(int dialogType)
dialogType
- can be one of TYPE_WARNING, TYPE_INFO,
TYPE_ERROR, TYPE_CONFIRMATION or TYPE_ALARMpublic static void setDefaultDialogType(int d)
d
- the default type for the dialogpublic static int getDefaultDialogType()
public static void setAutoAdjustDialogSize(boolean a)
a
- true to indicate that Codename One should make a "best effort" to resize the dialogpublic static boolean isAutoAdjustDialogSize()
public static void setDisableStaticDialogScrolling(boolean d)
d
- indicates whether scrolling should be active or notpublic static boolean isDisableStaticDialogScrolling()
public static void setCommandsAsButtons(boolean c)
c
- true to place commands as buttons and not as softbutton keyspublic static boolean isCommandsAsButtons()
public void setDisposeWhenPointerOutOfBounds(boolean disposeWhenPointerOutOfBounds)
disposeWhenPointerOutOfBounds
- public boolean isDisposeWhenPointerOutOfBounds()
public void pointerReleased(int x, int y)
pointerReleased
in class Form
x
- the pointer x coordinatey
- the pointer y coordinatepublic void pointerPressed(int x, int y)
pointerPressed
in class Form
x
- the pointer x coordinatey
- the pointer y coordinatepublic boolean wasDisposedDueToOutOfBoundsTouch()
public String getDialogPosition()
public void setDialogPosition(String dialogPosition)
dialogPosition
- the dialogPosition to setpublic void growOrShrink()
public Boolean getPopupDirectionBiasPortrait()
public void setPopupDirectionBiasPortrait(Boolean popupDirectionBiasPortrait)
popupDirectionBiasPortrait
- the popupDirectionBiasPortrait to setpublic boolean wasDisposedDueToRotation()
public float getBlurBackgroundRadius()
public void setBlurBackgroundRadius(float blurBackgroundRadius)
dialogBlurRadiusInt
blurBackgroundRadius
- the blurBackgroundRadius to setpublic static float getDefaultBlurBackgroundRadius()
public static void setDefaultBlurBackgroundRadius(float aDefaultBlurBackgroundRadius)
dialogBlurRadiusInt
aDefaultBlurBackgroundRadius
- the defaultBlurBackgroundRadius to setpublic void setUIIDByPopupPosition(boolean b)
b
- to enable