@JsModule(value="./flow-component-renderer.js") public class Dialog extends GeneratedVaadinDialog<Dialog> implements HasComponents, 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(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. |
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 |
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 |
isOpened()
Gets the open state from the dialog.
|
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 |
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)
Sets the height of the component.
|
void |
setOpened(boolean opened)
Opens or closes the dialog.
|
void |
setWidth(String value)
Sets the width of the component.
|
getAriaLabelString, isOpenedBoolean, setAriaLabeladdListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, addComponentAsFirstisEnabled, setEnabledgetElementgetMaxHeight, getMaxWidth, getMinHeight, getMinWidth, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidthFullpublic 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 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 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 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 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 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 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 nullCopyright © 2020. All rights reserved.