@HtmlImport(value="flow-component-renderer.html") public class Dialog extends GeneratedVaadinDialog<Dialog> implements com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasSize
<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.
|
GeneratedVaadinDialog.OpenedChangeEvent<R extends GeneratedVaadinDialog<R>>| Constructor and Description |
|---|
Dialog()
Creates an empty dialog.
|
Dialog(com.vaadin.flow.component.Component... components)
Creates a dialog with given components inside.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(com.vaadin.flow.component.Component... components)
Adds the given components into this dialog.
|
com.vaadin.flow.shared.Registration |
addAttachListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.AttachEvent> listener) |
void |
addComponentAtIndex(int index,
com.vaadin.flow.component.Component component)
Adds the given component into this dialog at the given index.
|
com.vaadin.flow.shared.Registration |
addDetachListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.DetachEvent> listener) |
com.vaadin.flow.shared.Registration |
addDialogCloseActionListener(com.vaadin.flow.component.ComponentEventListener<Dialog.DialogCloseActionEvent> listener)
Add a listener that controls whether the dialog should be closed or not.
|
com.vaadin.flow.shared.Registration |
addOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinDialog.OpenedChangeEvent<Dialog>> listener)
Add a lister for event fired by the
opened-changed events. |
void |
close()
Closes the dialog.
|
Stream<com.vaadin.flow.component.Component> |
getChildren() |
String |
getHeight() |
String |
getWidth() |
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 |
isOpened()
Gets the open state from the dialog.
|
void |
open()
Opens the dialog.
|
void |
remove(com.vaadin.flow.component.Component... components) |
void |
removeAll() |
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 |
setHeight(String value) |
void |
setOpened(boolean opened)
Opens or closes the dialog.
|
void |
setWidth(String value) |
getAriaLabelString, isOpenedBoolean, setAriaLabeladdListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisiblepublic Dialog()
public Dialog(com.vaadin.flow.component.Component... components)
components - the components inside the dialogadd(Component...)public void setWidth(String value)
setWidth in interface com.vaadin.flow.component.HasSizepublic void setHeight(String value)
setHeight in interface com.vaadin.flow.component.HasSizepublic String getWidth()
getWidth in interface com.vaadin.flow.component.HasSizepublic String getHeight()
getHeight in interface com.vaadin.flow.component.HasSizepublic com.vaadin.flow.shared.Registration addDialogCloseActionListener(com.vaadin.flow.component.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 void add(com.vaadin.flow.component.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 com.vaadin.flow.component.HasComponentscomponents - the components to addpublic void remove(com.vaadin.flow.component.Component... components)
remove in interface com.vaadin.flow.component.HasComponentspublic void removeAll()
removeAll in interface com.vaadin.flow.component.HasComponentspublic void addComponentAtIndex(int index,
com.vaadin.flow.component.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 com.vaadin.flow.component.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 it's not yet attached anywhere.
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 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 it's not yet attached anywhere.
setOpened in class GeneratedVaadinDialog<Dialog>opened - true to open the dialog, false to close itpublic boolean isOpened()
opened property from the dialogpublic Stream<com.vaadin.flow.component.Component> getChildren()
getChildren in class com.vaadin.flow.component.Componentpublic com.vaadin.flow.shared.Registration addOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinDialog.OpenedChangeEvent<Dialog>> listener)
opened-changed events.addOpenedChangeListener in class GeneratedVaadinDialog<Dialog>listener - the listenerRegistration for removing the event listenerpublic com.vaadin.flow.shared.Registration addAttachListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.AttachEvent> listener)
Note: To listen for opening the dialog, you should use
addOpenedChangeListener(ComponentEventListener).
addAttachListener in interface com.vaadin.flow.component.AttachNotifierpublic com.vaadin.flow.shared.Registration addDetachListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.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 com.vaadin.flow.component.DetachNotifierCopyright © 2018. All rights reserved.