public class InteractionDialog
ImplementsAbstractDialog, Animation, Editable, Iterable<Component>, StyleListener
Unlike a regular dialog the interaction dialog only looks like a dialog, it resides in the layered pane and can be used to implement features where interaction with the background form is still required.
Since this code is designed for interaction all “dialogs” created thru here are modless and never block.
InteractionDialog dlg = new InteractionDialog("Hello");
dlg.setLayout(new BorderLayout());
dlg.add(BorderLayout.CENTER, new Label("Hello Dialog"));
Button close = new Button("Close");
close.addActionListener((ee) -> dlg.dispose());
dlg.addComponent(BorderLayout.SOUTH, close);
Dimension pre = dlg.getContentPane().getPreferredSize();
dlg.show(0, 0, Display.getInstance().getDisplayWidth() - (pre.getWidth() + pre.getWidth() / 6), 0);
Constructors
public InteractionDialog() | Default constructor with no title |
public InteractionDialog(Layout l) | Default constructor with layout |
public InteractionDialog(String title) | Constructor with dialog title |
public InteractionDialog(String title, Layout l) | Constructor with dialog title |
Methods
protected void initComponent() | Allows subclasses to bind functionality that relies on fully initialized and “ready for action” component state |
public boolean isDisposeWhenPointerOutOfBounds() | This flag indicates if the dialog should be disposed if a pointer released event occurred out of the dialog content. |
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. |
public Container getContentPane() | Returns the body of the interaction dialog |
public void setScrollable(boolean scrollable) | The equivalent of calling both setScrollableY and setScrollableX |
public Layout getLayout() | Returns the layout manager responsible for arranging this container. |
public void setLayout(Layout layout) | Sets the layout manager responsible for arranging this container |
public String getTitle() | Gets this dialog title text. |
public void setTitle(String title) | Sets this dialog title text. |
public void addComponent(Component cmp) | Adds a Component to the Container |
public void addComponent(Object constraints, Component cmp) | Adds a Component to the Container |
public void addComponent(int index, Object constraints, Component cmp) | Adds a Component to the Container |
public void addComponent(int index, Component cmp) | This method adds the Component at a specific index location in the Container Components array. |
public void removeAll() | remove all Components from container, notice that removed component might still have a pending repaint in the queue that won’t be removed. |
public void removeComponent(Component cmp) | removes a Component from the Container, notice that removed component might still have a pending repaint in the queue that won’t be removed. |
public Label getTitleComponent() | Gets the label component used to display the title. |
public boolean isTitleCentered() | Returns whether this interaction dialog places its title in the absolute center with the body below it. |
public void setTitleCentered(boolean titleCentered) | Places the title in the absolute center with the body below it. |
public boolean isNativeWindowMode() | The top level this dialog appears on when it is shown. |
public void setNativeWindowMode(boolean nativeWindowMode) | Sets whether this dialog is backed by a real operating system window. |
public Window getNativeWindow() | The window backing this dialog while it is showing. |
protected void initNativeWindow(Window w) | Called once the window backing this dialog has been configured and before it is shown, so an application can adjust it. |
public void setTopLevelHost(TopLevelContainer host) | |
public TopLevelContainer getTopLevelHost() | Returns the top level set with #setTopLevelHost(TopLevelContainer). |
protected void deinitialize() | Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. |
public void resize(int top, int bottom, int left, int right) | Repositions a dialog that is laid out inside a host surface. |
public void 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. |
public void dispose() | Removes the interaction dialog from view |
public void disposeToTheLeft() | Removes the interaction dialog from view with an animation to the left |
public void disposeToTheLeft(Runnable onFinish) | Removes the interaction dialog from view with an animation to the left. |
public void disposeToTheBottom() | Removes the interaction dialog from view with an animation to the bottom |
public void disposeToTheBottom(Runnable onFinish) | Removes the interaction dialog from view with an animation to the bottom |
public void disposeToTheTop() | Removes the interaction dialog from view with an animation to the top |
public void disposeToTheTop(Runnable onFinish) | Removes the interaction dialog from view with an animation to the top. |
public void disposeToTheRight() | Removes the interaction dialog from view with an animation to the right |
public void disposeToTheRight(Runnable onFinish) | Removes the interaction dialog from view with an animation to the right. |
public boolean isShowing() | Will return true if the dialog is currently showing |
public boolean isAnimateShow() | Indicates whether show/dispose should be animated or not. |
public void setAnimateShow(boolean animateShow) | Indicates whether show/dispose should be animated or not. |
public int getAnimationSpeed() | Duration in milliseconds used by the show, dispose and resize animations. |
public void setAnimationSpeed(int animationSpeed) | Sets the duration in milliseconds used by the show, dispose and resize animations, overriding the interactionDialogSpeedInt theme constant. |
public Runnable getShowAnimationSetup() | Callback invoked just before the show animation runs to position the dialog parent at the animation start state. |
public void setShowAnimationSetup(Runnable showAnimationSetup) | Sets a callback that positions the dialog parent at the animation start state, overriding the default show animation. |
public Runnable getDisposeAnimationSetup() | Callback invoked just before the dispose animation runs to position the dialog at the animation end state. |
public void setDisposeAnimationSetup(Runnable disposeAnimationSetup) | Sets a callback that positions the dialog at the animation end state, overriding the default dispose animation. |
public void showPopupDialog(Component c) | A popup dialog is shown with the context of a component and its selection. |
public void showPopupDialog(Component c, boolean bias) | Deprecated A popup dialog is shown with the context of a component and its selection. |
public void showPopupDialog(Rectangle rect) | A popup dialog is shown with the context of a component and its selection. |
public void showPopupDialog(Rectangle rect, boolean bias) | Deprecated A popup dialog is shown with the context of a component and its selection. |
public String getDialogUIID() | Returns the uiid of the dialog |
public void setDialogUIID(String uiid) | Simple setter to set the Dialog uiid |
public Style getDialogStyle() | Simple getter to get the Dialog Style |
public boolean isRepositionAnimation() | Controls the “grow from center / shrink to center” effect used by the show/dispose animation. |
public void setRepositionAnimation(boolean repositionAnimation) | Controls the “grow from center / shrink to center” effect used by the show/dispose animation. |
public boolean isFormMode() | Selects which layered pane hosts the dialog. |
public void setFormMode(boolean formMode) | Selects which layered pane hosts the dialog. |
public static boolean isStackable() | Whether InteractionDialog is in the global “stackable” mode. |
public static void setStackable(boolean stackable) | Opt-in robustness mode for applications that show several InteractionDialogs at the same time (for example a step-by-step walkthrough that highlights different components). |
public void setDialogType(int dialogType) | Sets a dialog sound type (e.g. Dialog#TYPE_INFO). |
public void setTransitions(Transition transition) | No-op for InteractionDialog. |
public void configureCommands(Command[] cmds, boolean commandsAsButtons) | Configures commands for the dialog UI. |
public void setDefaultCommand(Command defaultCommand) | Sets the default command when supported. |
public void setTimeout(long timeout) | Sets timeout in milliseconds after which dialog should close. |
public Command showDialog() | Shows this interaction dialog and blocks until it is disposed. |
Inherited fields
From Component
DEFAULT_CURSOR, CROSSHAIR_CURSOR, TEXT_CURSOR, WAIT_CURSOR, SW_RESIZE_CURSOR, SE_RESIZE_CURSOR, NW_RESIZE_CURSOR, NE_RESIZE_CURSOR, N_RESIZE_CURSOR, S_RESIZE_CURSOR, W_RESIZE_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_Y, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_IMMEDIATELY_DRAG_XY, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_CENTER_OFFSET, BRB_OTHER, CENTER, TOP, LEFT, BOTTOM, RIGHT, BASELINE
Inherited methods
From Container
encloseIn, encloseIn, initLaf, getUIManager, setUIManager, isSurface, add, addAll, add, add, add, add, add, getLeadComponent, setLeadComponent, getLeadParent, keyPressed, keyReleased, invalidate, setShouldLayout, setShouldCalcPreferredSize, getLayoutWidth, getLayoutHeight, applyRTL, constrainWidthWhenScrollable, constrainHeightWhenScrollable, replaceAndWait, replaceAndWait, replace, replaceAndWait, replace, createReplaceTransition, isEnabled, setEnabled, cancelRepaints, flushReplace, revalidateWithAnimationSafety, revalidate, revalidateLater, forceRevalidate, clearClientProperties, paint, paintGlass, layoutContainer, isSafeArea, setSafeArea, isSafeAreaRoot, getSafeAreaRoot, setSafeAreaRoot, getComponentCount, getComponentAt, getComponentIndex, contains, scrollComponentToVisible, getClosestComponentTo, getResponderAt, getComponentAt, findDropTargetAt, pointerPressed, calcPreferredSize, paramString, refreshTheme, isScrollableX, setScrollableX, isScrollableY, setScrollableY, getSideGap, getBottomGap, setCellRenderer, getScrollIncrement, setScrollIncrement, findFirstFocusable, dragInitiated, fireClicked, isSelectableInteraction, getGridPosY, paintComponentBackground, getGridPosX, animateHierarchyAndWait, createAnimateHierarchy, animateHierarchy, animateHierarchyFadeAndWait, createAnimateHierarchyFade, animateHierarchyFade, animateLayoutFadeAndWait, createAnimateLayoutFadeAndWait, animateLayoutFade, createAnimateLayoutFade, animateLayoutAndWait, animateLayout, updateTabIndices, createAnimateLayout, drop, createAnimateMotion, morph, morphAndWait, animateUnlayout, animateUnlayoutAndWait, createAnimateUnlayout, getChildrenAsList, iterator, iterator
From Component
setSameSize, isSetCursorSupported, parsePreferredSize, getDefaultDragTransparency, setDefaultDragTransparency, getEditingDelegate, setEditingDelegate, getCursor, setCursor, showNativeOverlay, hideNativeOverlay, updateNativeOverlay, getNativeOverlay, getAllStyles, getSameWidth, setSameWidth, getSameHeight, setSameHeight, getX, setX, getOuterX, getInnerX, getY, setY, getOuterY, getInnerY, isVisible, setVisible, getClientProperty, stripMarginAndPadding, putClientProperty, getDirtyRegion, setDirtyRegion, isOpaque, setOpaque, getWidth, setWidth, getOuterWidth, getInnerWidth, getHeight, setHeight, getOuterHeight, getInnerHeight, isDragRegion, getDragRegionStatus, getBaseline, getBaselineResizeBehavior, getPreferredSizeStr, setPreferredSizeStr, getPreferredSize, setPreferredSize, getScrollDimension, calcScrollSize, setScrollSize, getPreferredW, setPreferredW, getPreferredH, setPreferredH, getOuterPreferredH, getInnerPreferredH, getOuterPreferredW, getInnerPreferredW, setSize, getUIID, setUIID, setUIIDFinal, setUIID, getInlineAllStyles, setInlineAllStyles, getInlineSelectedStyles, setInlineSelectedStyles, getInlineUnselectedStyles, setInlineUnselectedStyles, getInlineDisabledStyles, setInlineDisabledStyles, getInlinePressedStyles, setInlinePressedStyles, remove, getParent, getOwner, setOwner, isOwnedBy, containsOrOwns, addFocusListener, removeFocusListener, addScrollListener, removeScrollListener, getSelectCommandText, setSelectCommandText, getLabelForComponent, setLabelForComponent, focusGained, focusLost, paintBackgrounds, paintShadows, getAbsoluteX, getAbsoluteY, isInClippingRegion, paintIntersectingComponentsAbove, paintScrollbars, paintScrollbarX, getScrollOpacity, getSelectedRect, paintScrollbarY, paintComponent, paintComponent, getBorder, getScrollable, paintBackground, isScrollable, getScrollX, setScrollX, getScrollY, setScrollY, onScrollX, onScrollY, getDraggedx, getDraggedy, contains, visibleBoundsContains, hasFixedPreferredSize, getBounds, getBounds, getVisibleBounds, getVisibleBounds, isFocusable, setFocusable, onSetFocusable, resetFocusable, getTabIndex, setTabIndex, getPreferredTabIndex, setPreferredTabIndex, isTraversable, setTraversable, handlesInput, setHandlesInput, consumesRawTextInput, hasFocus, setFocus, getComponentForm, getTopLevelContainer, repaint, repaint, longKeyPress, keyRepeated, registerForAnimation, deregisterFromAnimation, getAnimationManager, getScrollAnimationSpeed, setScrollAnimationSpeed, isBlockLead, setBlockLead, isIgnorePointerEvents, setIgnorePointerEvents, isRippleEffect, setRippleEffect, getInlineStylesTheme, setInlineStylesTheme, shouldRenderComponentSelection, isHideInLandscape, setHideInLandscape, createStyleAnimation, isSmoothScrolling, setSmoothScrolling, pointerHover, stopScrollMomentum, pointerHoverReleased, pointerHoverPressed, pinch, pinchReleased, pinch, rotation, isPinchBlocksDragAndDrop, setPinchBlocksDragAndDrop, pointerDragged, getDragImage, getDragTransparency, setDragTransparency, toImage, drawDraggedImage, draggingOver, dragEnter, dragExit, addPullToRefresh, setPullToRefresh, respondsToPointerEvents, pointerDragged, isStickyDrag, pointerPressed, isDragAndDropOperation, pointerReleased, longPointerPress, pointerReleased, setVerticalScrollBounds, setHorizontalScrollBounds, isVScrollThumbGrabbed, isHScrollThumbGrabbed, isVScrollThumbHover, isHScrollThumbHover, isTensileDragEnabled, setTensileDragEnabled, getTextSelectionSupport, addDropListener, removeDropListener, addDragOverListener, removeDragOverListener, isNativeDragSource, setNativeDragSource, getNativeDragOperation, setNativeDragOperation, createNativeDragOperation, isNativeDropTarget, setNativeDropTarget, getAcceptedDropMimeTypes, setAcceptedDropMimeTypes, getAcceptedDropActions, setAcceptedDropActions, canAcceptNativeDrop, nativeDragEnter, nativeDragOver, nativeDragExit, nativeDrop, addNativeDropListener, removeNativeDropListener, addNativeDragOverListener, removeNativeDragOverListener, dragFinished, addDragFinishedListener, addStateChangeListener, removeStateChangeListener, addPointerPressedListener, addLongPressListener, addContextMenuListener, removeContextMenuListener, addMouseWheelListener, removeMouseWheelListener, addStylusListener, removeStylusListener, mouseWheel, paintRippleOverlay, removePointerPressedListener, removeLongPressListener, removeDragFinishedListener, addPointerReleasedListener, removePointerReleasedListener, addPointerDraggedListener, removePointerDraggedListener, getDragSpeed, getStyle, getPressedStyle, setPressedStyle, initUnselectedStyle, initPressedStyle, initDisabledStyle, initSelectedStyle, getUnselectedStyle, setUnselectedStyle, getSelectedStyle, setSelectedStyle, getDisabledStyle, setDisabledStyle, installDefaultPainter, requestFocus, toString, refreshTheme, refreshTheme, isDragActivated, animate, scrollRectToVisible, scrollRectToVisible, paintBorder, paintBorderBackground, isCellRenderer, isScrollVisible, setScrollVisible, setIsScrollVisible, startEditingAsync, stopEditing, isEditing, isEditable, laidOut, isInitialized, setInitialized, styleChanged, getNextFocusDown, setNextFocusDown, getNextFocusUp, setNextFocusUp, getNextFocusLeft, setNextFocusLeft, getNextFocusRight, setNextFocusRight, getName, setName, initCustomStyle, deinitializeCustomStyle, isRTL, setRTL, isTactileTouch, isTactileTouch, setTactileTouch, getPropertyNames, getPropertyTypes, getPropertyTypeNames, getPropertyValue, setPropertyValue, paintLockRelease, paintLock, isSnapToGrid, setSnapToGrid, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, blocksSideSwipe, isFlatten, setFlatten, getTensileLength, setTensileLength, isGrabsPointerEvents, setGrabsPointerEvents, getScrollOpacityChangeSpeed, setScrollOpacityChangeSpeed, growShrink, isAlwaysTensile, setAlwaysTensile, isDraggable, setDraggable, isDropTarget, setDropTarget, isChildOf, isHideInPortrait, setHideInPortrait, getBindablePropertyNames, getBindablePropertyTypes, bindProperty, unbindProperty, getBoundPropertyValue, setBoundPropertyValue, getCloudBoundProperty, setCloudBoundProperty, getCloudDestinationProperty, setCloudDestinationProperty, getComponentState, setComponentState, setHidden, isHidden, setHidden, isHidden, announceForAccessibility, getAccessibilityText, setAccessibilityText, getSemantics, getAccessibilityNode, accessibilityChanged, accessibilityChanged, getTooltip, setTooltip
Constructor details
InteractionDialog
public InteractionDialog()InteractionDialog
public InteractionDialog(Layout l)Parameters
lLayout- layout
InteractionDialog
public InteractionDialog(String title)Parameters
titleString- the title of the dialog
InteractionDialog
public InteractionDialog(String title, Layout l)Parameters
titleString- the title of the dialog
lLayout- the layout for the content pane
Method details
initComponent
protected void initComponent()isDisposeWhenPointerOutOfBounds
public boolean isDisposeWhenPointerOutOfBounds()Returns
setDisposeWhenPointerOutOfBounds
public void setDisposeWhenPointerOutOfBounds(boolean disposeWhenPointerOutOfBounds)getContentPane
public Container getContentPane()Returns
setScrollable
public void setScrollable(boolean scrollable)Parameters
scrollableboolean- whether the component should/could scroll on the X and Y axis
getLayout
public Layout getLayout()Returns
setLayout
public void setLayout(Layout layout)Parameters
layoutLayout- the specified layout manager
getTitle
public String getTitle()setTitle
public void setTitle(String title)Parameters
titleString- the title text.
addComponent
public void addComponent(Component cmp)Parameters
cmpComponent- the component to be added
addComponent
public void addComponent(Object constraints, Component cmp)Parameters
constraintsObject- 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”…
cmpComponent- component to add
addComponent
public void addComponent(int index, Object constraints, Component cmp)Parameters
indexint- location to insert the Component
constraintsObject- 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”…
cmpComponent- component to add
addComponent
public void addComponent(int index, Component cmp)Parameters
indexint- location to insert the Component
cmpComponent- the Component to add
Throws
ArrayIndexOutOfBoundsException- if index is out of bounds
IllegalArgumentException- if Component is already contained or the cmp is a Form Component
removeAll
public void removeAll()removeComponent
public void removeComponent(Component cmp)Parameters
cmpComponent- the removed component
getTitleComponent
public Label getTitleComponent()Returns
isTitleCentered
public boolean isTitleCentered()Returns
setTitleCentered
public void setTitleCentered(boolean titleCentered)Parameters
titleCenteredboolean- true to use the centered title layout
isNativeWindowMode
public boolean isNativeWindowMode()The top level this dialog appears on when it is shown.
A dialog is not attached to anything at the moment #show(int, int, int, int)
runs, so it cannot resolve its own host the way an attached component can. Left
unset it uses the current Form, which is the historical behaviour and the
right answer for an application with one window. Set it to put the dialog on a
Window instead: without it the dialog is added to the main
form’s layered pane, so it appears on the main window while the window that
asked for it is merely dimmed – and in an application with no form at all
there is nothing to resolve and showing it fails.
Returns
setNativeWindowMode
public void setNativeWindowMode(boolean nativeWindowMode)Sets whether this dialog is backed by a real operating system window.
Takes effect the next time the dialog is shown.
Parameters
nativeWindowModeboolean- true to open this dialog in its own window
getNativeWindow
public Window getNativeWindow()Returns
initNativeWindow
protected void initNativeWindow(Window w)Parameters
wWindow- the window about to be shown
setTopLevelHost
public void setTopLevelHost(TopLevelContainer host)getTopLevelHost
public TopLevelContainer getTopLevelHost()#setTopLevelHost(TopLevelContainer).Returns
deinitialize
protected void deinitialize()resize
public void resize(int top, int bottom, int left, int right)Repositions a dialog that is laid out inside a host surface.
The four arguments are margins against that host, so they describe nothing a platform window has: in native window mode the dialog is the content of a window the operating system places, sizes and lets the user drag. This is inert there rather than approximated, which is the same rule the margin arguments to show() follow – and the body below would otherwise rewrite the geometry of the window’s own content pane and animate a layer built on the owner surface, neither of which has anything to do with the dialog the caller is trying to resize.
Parameters
topint- margin from the top of the host
bottomint- margin from the bottom of the host
leftint- margin from the left of the host
rightint- margin from the right of the host
show
public void 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.
Parameters
topint- space in pixels between the top of the screen and the form
bottomint- space in pixels between the bottom of the screen and the form
leftint- space in pixels between the left of the screen and the form
rightint- space in pixels between the right of the screen and the form
dispose
public void dispose()disposeToTheLeft
public void disposeToTheLeft()disposeToTheLeft
public void disposeToTheLeft(Runnable onFinish)Parameters
onFinishRunnable- Callback called when dispose animation is complete.
disposeToTheBottom
public void disposeToTheBottom()disposeToTheBottom
public void disposeToTheBottom(Runnable onFinish)Parameters
onFinishRunnable- Callback called when dispose animation is complete.
disposeToTheTop
public void disposeToTheTop()disposeToTheTop
public void disposeToTheTop(Runnable onFinish)Parameters
onFinishRunnable- Callback called when dispose animation is complete.
disposeToTheRight
public void disposeToTheRight()disposeToTheRight
public void disposeToTheRight(Runnable onFinish)Parameters
onFinishRunnable- Callback called when dispose animation is complete.
isShowing
public boolean isShowing()Returns
isAnimateShow
public boolean isAnimateShow()#show(int, int, int, int) and out on
#dispose() over interactionDialogSpeedInt (default 400ms). When false, both
transitions are immediate. This flag also gates #isRepositionAnimation():
the grow/shrink behavior of repositionAnimation only takes effect when
animateShow is true.Returns
setAnimateShow
public void setAnimateShow(boolean animateShow)#show(int, int, int, int) and out on
#dispose() over interactionDialogSpeedInt (default 400ms). When false, both
transitions are immediate. This flag also gates #setRepositionAnimation(boolean):
the grow/shrink behavior of repositionAnimation only takes effect when
animateShow is true.Parameters
animateShowboolean- the animateShow to set
getAnimationSpeed
public int getAnimationSpeed()interactionDialogSpeedInt theme constant. The default is -1 which means
“defer to the theme constant” (which itself defaults to 400ms).Returns
setAnimationSpeed
public void setAnimationSpeed(int animationSpeed)interactionDialogSpeedInt theme constant. Pass
any value < 0 (typically -1) to revert to the theme constant.Parameters
animationSpeedint- animation duration in ms, or a value < 0 to defer to the theme constant
getShowAnimationSetup
public Runnable getShowAnimationSetup()Callback invoked just before the show animation runs to position the dialog
parent at the animation start state. When set, this replaces the default
#setRepositionAnimation(boolean) behavior (grow from a 1x1 point at the
center, or stay at full size). Inside the callback, manipulate
getParent() bounds (setX/setY/setWidth/setHeight) to define
where the dialog should animate from. The animation will then interpolate
the layered pane layout to the dialog’s final bounds. Pass null (the
default) to use the built-in show animation.
This callback only fires when #isAnimateShow() is true.
This hook is the recommended workaround when using popup dialogs that
render a pointing-arrow border (#showPopupDialog(com.codename1.ui.Component)).
With the built-in “grow from 1x1” animation the dialog is too small for
the arrow image to render until the animation completes; providing a
translate-from-edge setup keeps the dialog at full size for the entire
animation so the arrow is visible throughout. For example, to slide in
from off-screen below:
dlg.setShowAnimationSetup(() -> {
Container parent = dlg.getParent();
parent.setY(Display.getInstance().getDisplayHeight());
});
Returns
setShowAnimationSetup
public void setShowAnimationSetup(Runnable showAnimationSetup)#getShowAnimationSetup()
for details.Parameters
showAnimationSetupRunnable- callback or null to use the built-in show animation
getDisposeAnimationSetup
public Runnable getDisposeAnimationSetup()Callback invoked just before the dispose animation runs to position the
dialog at the animation end state. When set, this replaces the default
#setRepositionAnimation(boolean) behavior (shrink to a 1x1 point at the
dialog center). Inside the callback, manipulate the dialog bounds
(setX/setY/setWidth/setHeight) to define where the dialog should
animate to. Pass null (the default) to use the built-in dispose
animation.
This callback only fires when #isAnimateShow() is true.
Returns
setDisposeAnimationSetup
public void setDisposeAnimationSetup(Runnable disposeAnimationSetup)#getDisposeAnimationSetup()
for details.Parameters
disposeAnimationSetupRunnable- callback or null to use the built-in dispose animation
showPopupDialog
public void showPopupDialog(Component c)#setDisposeWhenPointerOutOfBounds(boolean) to make it dispose
when the user clicks outside the bounds of the popup. 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
cComponent- the context component which is used to position the dialog and can also be pointed at
showPopupDialog
public void showPopupDialog(Component c, boolean bias)bias parameter is not supported for InteractionDialog popups. Use #showPopupDialog(Component) instead.#setDisposeWhenPointerOutOfBounds(boolean) to make it dispose
when the user clicks outside the bounds of the popup. 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
cComponent- the context component which is used to position the dialog and can also be pointed at
biasboolean- directional bias value. This parameter is not supported.
showPopupDialog
public void showPopupDialog(Rectangle rect)#setDisposeWhenPointerOutOfBounds(boolean) to make it dispose
when the user clicks outside the bounds of the popup. 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
rectRectangle- the screen rectangle to which the popup should point
showPopupDialog
public void showPopupDialog(Rectangle rect, boolean bias)bias parameter is not supported for InteractionDialog popups. Use #showPopupDialog(Rectangle) instead.#setDisposeWhenPointerOutOfBounds(boolean) to make it dispose
when the user clicks outside the bounds of the popup. 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
rectRectangle- the screen rectangle to which the popup should point
biasboolean- directional bias value. This parameter is not supported.
getDialogUIID
public String getDialogUIID()Returns
setDialogUIID
public void setDialogUIID(String uiid)Parameters
uiidString- the id for the dialog
getDialogStyle
public Style getDialogStyle()Returns
isRepositionAnimation
public boolean isRepositionAnimation()Controls the “grow from center / shrink to center” effect used by the
show/dispose animation. When true (the default), #show(int, int, int, int)
collapses the dialog to a 1x1 point at the center of its target bounds and
the layered pane’s animation interpolates from that point out to the full
dialog size. #dispose() performs the reverse, shrinking the dialog to a
point before removal. When false, the dialog keeps its full size for the
duration of the animation (only the layered pane’s layout transition runs,
which is typically not visible for a dialog whose bounds do not change).
This flag has no effect when #isAnimateShow() is false, since the
show/dispose animation is skipped entirely in that case.
Returns
setRepositionAnimation
public void setRepositionAnimation(boolean repositionAnimation)Controls the “grow from center / shrink to center” effect used by the
show/dispose animation. When true (the default), #show(int, int, int, int)
collapses the dialog to a 1x1 point at the center of its target bounds and
the layered pane’s animation interpolates from that point out to the full
dialog size. #dispose() performs the reverse, shrinking the dialog to a
point before removal. When false, the dialog keeps its full size for the
duration of the animation (only the layered pane’s layout transition runs,
which is typically not visible for a dialog whose bounds do not change).
This flag has no effect when #isAnimateShow() is false, since the
show/dispose animation is skipped entirely in that case.
Parameters
repositionAnimationboolean- the repositionAnimation to set
isFormMode
public boolean isFormMode()Selects which layered pane hosts the dialog.
When false (the default), the dialog is added to Form#getLayeredPane(),
which sits above the form’s content pane but below the title area, side
menu, and status bar. This is the right choice for most dialogs that
interact with content pane components, and is the historical behavior of
InteractionDialog.
When true, the dialog is added to Form#getFormLayeredPane(Class, boolean),
which sits above the entire form including the title area and side menu.
Use this when the dialog needs to overlay or point at a component that
lives outside the content pane (for example a title bar button or an item
in the side menu). #showPopupDialog(Component) enables this
automatically when it detects that the target component is not inside the
form’s content pane.
In short, leave this at the default unless you observe the dialog being clipped by the title/side menu or you are pointing at a component outside the content pane.
Returns
setFormMode
public void setFormMode(boolean formMode)Selects which layered pane hosts the dialog.
When false (the default), the dialog is added to Form#getLayeredPane(),
which sits above the form’s content pane but below the title area, side
menu, and status bar. This is the right choice for most dialogs that
interact with content pane components, and is the historical behavior of
InteractionDialog.
When true, the dialog is added to Form#getFormLayeredPane(Class, boolean),
which sits above the entire form including the title area and side menu.
Use this when the dialog needs to overlay or point at a component that
lives outside the content pane (for example a title bar button or an item
in the side menu). #showPopupDialog(Component) enables this
automatically when it detects that the target component is not inside the
form’s content pane.
In short, leave this at the default unless you observe the dialog being clipped by the title/side menu or you are pointing at a component outside the content pane.
Parameters
formModeboolean- the formMode to set
isStackable
public static boolean isStackable()InteractionDialog is in the global “stackable” mode. See
#setStackable(boolean).Returns
setStackable
public static void setStackable(boolean stackable)Opt-in robustness mode for applications that show several
InteractionDialogs at the same time (for example a step-by-step
walkthrough that highlights different components).
All InteractionDialog instances share a single layered pane keyed by
the class. In the default (historical) behavior, disposing one dialog
clears that whole layer (removeAll() / layer removal), which also wipes
any sibling dialog still showing in it – so when dialogs overlap one of
them can silently fail to appear (#5193). When stackable mode is enabled
dispose removes only the disposed dialog’s own component; remaining
dialogs stay visible, layered by the order in which #show(int, int, int, int)
was called (later shows render on top). The shared layer container is
removed only once it becomes empty, so layers do not accumulate as
dialogs come and go.
This is a global, app-wide setting (it must be on for every dialog that participates) and defaults to false to preserve backwards compatibility.
Parameters
stackableboolean- true to enable stackable/concurrent dialog support
setDialogType
public void setDialogType(int dialogType)Dialog#TYPE_INFO).setTransitions
public void setTransitions(Transition transition)InteractionDialog. Transitions are not supported; the show
and dispose animations are governed by #setAnimateShow(boolean) and
#setRepositionAnimation(boolean) and run on the host layered pane
rather than as a Form-level transition. The method is provided only to
satisfy the AbstractDialog contract.configureCommands
public void configureCommands(Command[] cmds, boolean commandsAsButtons)setDefaultCommand
public void setDefaultCommand(Command defaultCommand)setTimeout
public void setTimeout(long timeout)showDialog
public Command showDialog()