@JsModule(value="./flow-component-renderer.js") public class Dialog extends GeneratedVaadinDialog<Dialog> implements HasComponents, HasSize, HasTheme
<vaadin-dialog> element.| Modifier and Type | Class and Description |
|---|---|
static class |
Dialog.DialogCloseActionEvent
`vaadin-dialog-close-action` is sent when the user clicks outside the
overlay or presses the escape key.
|
static class |
Dialog.DialogResizeEvent
`resize` event is sent when the user finishes resizing the overlay.
|
GeneratedVaadinDialog.OpenedChangeEvent<R extends GeneratedVaadinDialog<R>>| Constructor and Description |
|---|
Dialog()
Creates an empty dialog.
|
Dialog(Component... components)
Creates a dialog with given components inside.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Component... components)
Adds the given components into this dialog.
|
Registration |
addAttachListener(ComponentEventListener<AttachEvent> listener)
Adds a attach listener to this component.
|
void |
addComponentAtIndex(int index,
Component component)
Adds the given component into this dialog at the given index.
|
Registration |
addDetachListener(ComponentEventListener<DetachEvent> listener)
Adds a detach listener to this component.
|
Registration |
addDialogCloseActionListener(ComponentEventListener<Dialog.DialogCloseActionEvent> listener)
Add a listener that controls whether the dialog should be closed or not.
|
Registration |
addOpenedChangeListener(ComponentEventListener<GeneratedVaadinDialog.OpenedChangeEvent<Dialog>> listener)
Add a lister for event fired by the
opened-changed events. |
Registration |
addResizeListener(ComponentEventListener<Dialog.DialogResizeEvent> listener)
Adds a listener that is called after user finishes resizing the overlay.
|
void |
addThemeVariants(DialogVariant... variants)
Adds theme variants to the component.
|
void |
close()
Closes the dialog.
|
Stream<Component> |
getChildren()
Gets the child components of this component.
|
String |
getHeight()
Gets the height defined for the component.
|
String |
getMaxHeight()
Gets the max-height defined for the component.
|
String |
getMaxWidth()
Gets the max-width defined for the component.
|
String |
getMinHeight()
Gets the min-height defined for the component.
|
String |
getMinWidth()
Gets the min-width defined for the component.
|
String |
getWidth()
Gets the width defined for the component.
|
boolean |
isCloseOnEsc()
Gets whether this dialog can be closed by hitting the esc-key or not.
|
boolean |
isCloseOnOutsideClick()
Gets whether this dialog can be closed by clicking outside of it or not.
|
boolean |
isDraggable()
Gets whether dialog is enabled to be dragged or not.
|
boolean |
isModal()
Gets whether component is set as modal or modeless dialog.
|
boolean |
isOpened()
Gets the open state from the dialog.
|
boolean |
isResizable()
Gets whether dialog is enabled to be resized or not.
|
protected void |
onAttach(AttachEvent attachEvent)
Called when the component is attached to a UI.
|
void |
open()
Opens the dialog.
|
void |
remove(Component... components)
Removes the given child components from this component.
|
void |
removeAll()
Removes all contents from this component, this includes child components,
text content as well as child elements that have been added directly to
this component using the
Element API. |
void |
removeThemeVariants(DialogVariant... variants)
Removes theme variants from the component.
|
void |
setCloseOnEsc(boolean closeOnEsc)
Sets whether this dialog can be closed by hitting the esc-key or not.
|
void |
setCloseOnOutsideClick(boolean closeOnOutsideClick)
Sets whether this dialog can be closed by clicking outside of it or not.
|
void |
setDraggable(boolean draggable)
Sets whether dialog is enabled to be dragged by the user or not.
|
void |
setHeight(String value)
Sets the height of the component.
|
void |
setMaxHeight(String value)
Sets the max-height of the component.
|
void |
setMaxWidth(String value)
Sets the max-width of the component.
|
void |
setMinHeight(String value)
Sets the min-height of the component.
|
void |
setMinWidth(String value)
Sets the min-width of the component.
|
void |
setModal(boolean modal)
Sets whether component will open modal or modeless dialog.
|
void |
setOpened(boolean opened)
Opens or closes the dialog.
|
void |
setResizable(boolean resizable)
Sets whether dialog can be resized by user or not.
|
void |
setWidth(String value)
Sets the width of the component.
|
getAriaLabelString, isOpenedBoolean, setAriaLabeladdListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, addComponentAsFirstisEnabled, setEnabledgetElementgetCssSize, getHeightUnit, getWidthUnit, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFulladdThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNamepublic Dialog()
public Dialog(Component... components)
components - the components inside the dialogadd(Component...)public void setWidth(String value)
HasSizeThe width should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided width value is null then width is
removed.
public void setMinWidth(String value)
HasSizeThe width should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided minWidth value is null then min-width
is removed.
setMinWidth in interface HasSizevalue - the min-width value (if null, the property will
be removed)public void setMaxWidth(String value)
HasSizeThe width should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided maxWidth value is null then max-width
is removed.
setMaxWidth in interface HasSizevalue - the max-width value (if null, the property will
be removed)public void setHeight(String value)
HasSizeThe height should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided height value is null then height is
removed.
public void setMinHeight(String value)
HasSizeThe height should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided minHeight value is null then
min-height is removed.
setMinHeight in interface HasSizevalue - the min-height value (if null, the property will
be removed)public void setMaxHeight(String value)
HasSizeThe height should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided maxHeight value is null then
max-height is removed.
setMaxHeight in interface HasSizevalue - the max-height value (if null, the property will
be removed)public String getWidth()
HasSize
Note that this does not return the actual size of the component but the
width which has been set using HasSize.setWidth(String).
public String getMinWidth()
HasSize
Note that this does not return the actual size of the component but the
min-width which has been set using HasSize.setMinWidth(String).
getMinWidth in interface HasSizepublic String getMaxWidth()
HasSize
Note that this does not return the actual size of the component but the
max-width which has been set using HasSize.setMaxWidth(String).
getMaxWidth in interface HasSizepublic String getHeight()
HasSize
Note that this does not return the actual size of the component but the
height which has been set using HasSize.setHeight(String).
public String getMinHeight()
HasSize
Note that this does not return the actual size of the component but the
min-height which has been set using HasSize.setMinHeight(String).
getMinHeight in interface HasSizepublic String getMaxHeight()
HasSize
Note that this does not return the actual size of the component but the
max-height which has been set using HasSize.setMaxHeight(String).
getMaxHeight in interface HasSizepublic Registration addDialogCloseActionListener(ComponentEventListener<Dialog.DialogCloseActionEvent> listener)
The listener is informed when the user wants to close the dialog by
clicking outside the dialog, or by pressing escape. Then you can decide
whether to close or to keep opened the dialog. It means that dialog won't
be closed automatically unless you call close() method
explicitly in the listener implementation.
NOTE: adding this listener changes behavior of the dialog. Dialog is
closed automatically in case there are no any close listeners. And the
close() method should be called explicitly to close the dialog
in case there are close listeners.
listener - close()public Registration addResizeListener(ComponentEventListener<Dialog.DialogResizeEvent> listener)
setResizable(boolean)).
Note: By default, the component will sync the width/height values after every resizing.
listener - public void add(Component... components)
The elements in the DOM will not be children of the
<vaadin-dialog> element, but will be inserted into an overlay
that is attached into the <body>.
add in interface HasComponentscomponents - the components to addpublic void remove(Component... components)
HasComponentsremove in interface HasComponentscomponents - the components to removepublic void removeAll()
HasComponentsElement API. it also removes the
children that were added only at the client-side.removeAll in interface HasComponentspublic void addComponentAtIndex(int index,
Component component)
The element in the DOM will not be child of the <vaadin-dialog>
element, but will be inserted into an overlay that is attached into the
<body>.
addComponentAtIndex in interface HasComponentsindex - the index, where the component will be added.component - the component to addpublic boolean isCloseOnEsc()
By default, the dialog is closable with esc.
true if this dialog can be closed with the esc-key,
false otherwisepublic void setCloseOnEsc(boolean closeOnEsc)
By default, the dialog is closable with esc.
closeOnEsc - true to enable closing this dialog with the esc-key,
false to disable itpublic boolean isCloseOnOutsideClick()
By default, the dialog is closable with an outside click.
true if this dialog can be closed by an outside click,
false otherwisepublic void setCloseOnOutsideClick(boolean closeOnOutsideClick)
By default, the dialog is closable with an outside click.
closeOnOutsideClick - true to enable closing this dialog with an outside
click, false to disable itpublic void open()
Note: You don't need to add the dialog component anywhere before opening
it. Since <vaadin-dialog>'s location in the DOM doesn't really
matter, opening a dialog will automatically add it to the <body>
if necessary.
public void close()
Note: This method also removes the dialog component from the DOM after closing it, unless you have added the component manually.
public void setModal(boolean modal)
Note: When dialog is set to be modeless, then it's up to you to provide
means for it to be closed (eg. a button that calls
close()). The reason being that a modeless dialog allows
user to interact with the interface under it and won't be closed by
clicking outside or the ESC key.
modal - false to enable dialog to open as modeless modal,
true otherwise.public boolean isModal()
true if modal dialog (default), false otherwise.public void setDraggable(boolean draggable)
To allow an element inside the dialog to be dragged by the user (for
instance, a header inside the dialog), a class "draggable" can be
added to it (see HasStyle.addClassName(String)).
Note: If draggable is enabled and dialog is opened without first being explicitly attached to a parent, then it won't restore its last position in the case the user closes and opens it again. Reason being that a self attached dialog is removed from the DOM when it's closed and position is not synched.
draggable - true to enable dragging of the dialog, false
otherwisepublic boolean isDraggable()
true if dragging is enabled, false otherwise
(default).public void setResizable(boolean resizable)
resizable - true to enabled resizing of the dialog, false
otherwise.public boolean isResizable()
true if resizing is enabled, falsoe otherwiser
(default).public void setOpened(boolean opened)
Note: You don't need to add the dialog component anywhere before opening
it. Since <vaadin-dialog>'s location in the DOM doesn't really
matter, opening a dialog will automatically add it to the <body>
if necessary.
setOpened in class GeneratedVaadinDialog<Dialog>opened - true to open the dialog, false to close itpublic boolean isOpened()
opened property from the dialogpublic Stream<Component> getChildren()
Component
The default implementation finds child components by traversing each
child Element tree.
If the component is injected to a PolymerTemplate using the
@Id annotation the getChildren method will only return
children added from the server side and will not return any children
declared in the template file.
getChildren in class ComponentIdpublic Registration addOpenedChangeListener(ComponentEventListener<GeneratedVaadinDialog.OpenedChangeEvent<Dialog>> listener)
opened-changed events.addOpenedChangeListener in class GeneratedVaadinDialog<Dialog>listener - the listenerRegistration for removing the event listenerpublic Registration addAttachListener(ComponentEventListener<AttachEvent> listener)
Note: To listen for opening the dialog, you should use
addOpenedChangeListener(ComponentEventListener).
addAttachListener in interface AttachNotifierlistener - the listener to add, not nullpublic Registration addDetachListener(ComponentEventListener<DetachEvent> listener)
Note: To listen for closing the dialog, you should use
addOpenedChangeListener(ComponentEventListener), as the
component is not necessarily removed from the DOM when closing.
addDetachListener in interface DetachNotifierlistener - the listener to add, not nullprotected void onAttach(AttachEvent attachEvent)
ComponentThe default implementation does nothing.
This method is invoked before the AttachEvent is fired for the
component.
public void addThemeVariants(DialogVariant... variants)
variants - theme variants to addpublic void removeThemeVariants(DialogVariant... variants)
variants - theme variants to removeCopyright © 2025. All rights reserved.