Package io.jmix.flowui.view
Class AbstractDialogWindow<V extends View<?>>
java.lang.Object
io.jmix.flowui.view.AbstractDialogWindow<V>
- Type Parameters:
V- the type of view to be displayed in the dialog
- All Implemented Interfaces:
com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
DialogWindow,DialogWindow
public class AbstractDialogWindow<V extends View<?>>
extends Object
implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasStyle, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
A base class representing a generic dialog window that can display a view.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassName(String className) voidaddClassNames(String... classNames) com.vaadin.flow.shared.RegistrationaddDraggedListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.dialog.Dialog.DialogDraggedEvent> listener) Adds a listener that is called after user finishes dragging the dialog.com.vaadin.flow.shared.RegistrationaddResizeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.dialog.Dialog.DialogResizeEvent> listener) Adds a listener that is called after user finishes resizing the dialog.voidaddThemeName(String themeName) voidaddThemeNames(String... themeNames) voidprotected voidapplyDialogModeSettings(V view) voidclose()Requests closing the dialog.voidclose(boolean force) Requests closing the dialog.protected voidprotected voidprotected com.vaadin.flow.component.dialog.Dialogprotected com.vaadin.flow.component.button.Buttonprotected com.vaadin.flow.component.html.Divprotected com.vaadin.flow.component.ComponentcreateViewWrapper(V view) com.vaadin.flow.dom.ClassListcom.vaadin.flow.dom.Elementprotected EventHubprotected com.vaadin.flow.component.HasComponentsprotected com.vaadin.flow.component.HasComponentsOptional<com.vaadin.flow.component.Unit>getLeft()Gets the left position of the overlay.com.vaadin.flow.dom.StylegetStyle()com.vaadin.flow.dom.ThemeListgetTop()Gets the top position of the overlay.getView()getWidth()Optional<com.vaadin.flow.component.Unit>booleanhasClassName(String className) booleanhasThemeName(String themeName) protected voidinitDialog(com.vaadin.flow.component.dialog.Dialog dialog) protected voidbooleanbooleanbooleanSets whether dialog is enabled to be dragged by the user or not.booleanisModal()booleanprotected Messagesmessages()protected voidonCloseButtonClicked(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event) protected voidonDialogCloseAction(com.vaadin.flow.component.dialog.Dialog.DialogCloseActionEvent event) voidopen()Opens the dialog.protected voidpostInitDialog(com.vaadin.flow.component.dialog.Dialog dialog) protected <E> voidbooleanremoveClassName(String className) voidremoveClassNames(String... classNames) booleanremoveThemeName(String themeName) voidremoveThemeNames(String... themeNames) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetClassName(String className) voidsetClassName(String className, boolean set) voidsetCloseOnEsc(boolean closeOnEsc) Sets whether this dialog can be closed by hitting the esc-key or not.voidsetCloseOnOutsideClick(boolean closeOnOutsideClick) Sets whether this dialog can be closed by clicking outside of it or not.voidsetDraggable(boolean draggable) voidsetHeight(float height, com.vaadin.flow.component.Unit unit) voidvoidvoidSets the distance of the overlay from the left of its container.voidsetMaxHeight(float maxHeight, com.vaadin.flow.component.Unit unit) voidsetMaxHeight(String maxHeight) voidsetMaxWidth(float maxWidth, com.vaadin.flow.component.Unit unit) voidsetMaxWidth(String maxWidth) voidsetMinHeight(float minHeight, com.vaadin.flow.component.Unit unit) voidsetMinHeight(String minHeight) voidsetMinWidth(float minWidth, com.vaadin.flow.component.Unit unit) voidsetMinWidth(String minWidth) voidsetModal(boolean modal) Sets whether component will open modal or modeless dialog.voidsetResizable(boolean resizable) Sets whether dialog can be resized by user or not.voidvoidvoidsetThemeName(String themeName) voidsetThemeName(String themeName, boolean set) voidSets the top position of the overlay.protected voidsetValueIfPresent(String value, Consumer<String> setter) voidsetWidth(float width, com.vaadin.flow.component.Unit unit) voidvoidprotected UiComponents
-
Field Details
-
BASE_CLASS_NAME
- See Also:
-
dialog
protected com.vaadin.flow.component.dialog.Dialog dialog -
view
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
headerContent
protected com.vaadin.flow.component.orderedlayout.HorizontalLayout headerContent
-
-
Constructor Details
-
AbstractDialogWindow
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
initView
-
createDialog
protected com.vaadin.flow.component.dialog.Dialog createDialog() -
initDialog
protected void initDialog(com.vaadin.flow.component.dialog.Dialog dialog) -
getHeaderContent
protected com.vaadin.flow.component.HasComponents getHeaderContent() -
onDialogCloseAction
protected void onDialogCloseAction(com.vaadin.flow.component.dialog.Dialog.DialogCloseActionEvent event) -
postInitDialog
protected void postInitDialog(com.vaadin.flow.component.dialog.Dialog dialog) -
applyDialogModeSettings
-
setValueIfPresent
-
createHeaderCloseButton
@Nullable protected com.vaadin.flow.component.button.Button createHeaderCloseButton() -
onCloseButtonClicked
protected void onCloseButtonClicked(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event) -
createHeaderWrapper
protected com.vaadin.flow.component.html.Div createHeaderWrapper() -
createViewWrapper
-
publish
-
getView
- Returns:
- a view witch is opened in this dialog window
-
open
public void open()Opens the dialog. -
close
public void close()Requests closing the dialog. -
close
public void close(boolean force) Requests closing the dialog.- Parameters:
force-trueto close the dialog without checking the state (e.g. unsaved changes),falseotherwise.
-
closeInternal
protected void closeInternal() -
getElement
public com.vaadin.flow.dom.Element getElement()- Specified by:
getElementin interfacecom.vaadin.flow.component.HasElement
-
addDraggedListener
public com.vaadin.flow.shared.Registration addDraggedListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.dialog.Dialog.DialogDraggedEvent> listener) Adds a listener that is called after user finishes dragging the dialog. It is called only if dragging is enabled.Note: By default, the component will sync the top/left values after every dragging.
- Parameters:
listener- the listener to add- Returns:
- a Registration for removing the event listener
- See Also:
-
addResizeListener
public com.vaadin.flow.shared.Registration addResizeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.dialog.Dialog.DialogResizeEvent> listener) Adds a listener that is called after user finishes resizing the dialog. It is called only if resizing is enabled (seesetResizable(boolean).Note: By default, the component will sync the width/height and top/left values after every resizing.
- Parameters:
listener- the listener to add- Returns:
- registration for removal of listener
-
isCloseOnEsc
public boolean isCloseOnEsc()- Returns:
- whether this dialog can be closed by hitting the esc-key or not.
-
setCloseOnEsc
public void setCloseOnEsc(boolean closeOnEsc) Sets whether this dialog can be closed by hitting the esc-key or not.- Parameters:
closeOnEsc-trueto enable closing this dialog with the esc-key,falseto disable it
-
isCloseOnOutsideClick
public boolean isCloseOnOutsideClick()- Returns:
- whether this dialog can be closed by clicking outside of it or not.
-
setCloseOnOutsideClick
public void setCloseOnOutsideClick(boolean closeOnOutsideClick) Sets whether this dialog can be closed by clicking outside of it or not.- Parameters:
closeOnOutsideClick-trueto enable closing this dialog with an outside click,falseto disable it
-
isModal
public boolean isModal()- Returns:
- whether component is set as modal or modeless dialog.
-
setModal
public void setModal(boolean modal) Sets whether component will open modal or modeless dialog.- Parameters:
modal-falseto enable dialog to open as modeless modal,trueotherwise
-
isDraggable
public boolean isDraggable()Sets whether dialog is enabled to be dragged by the user or not.- Returns:
- whether dialog is enabled to be dragged or not.
-
setDraggable
public void setDraggable(boolean draggable) - Parameters:
draggable-trueto enable dragging of the dialog,falseotherwise
-
isResizable
public boolean isResizable()- Returns:
- whether dialog is enabled to be resized or not.
-
setResizable
public void setResizable(boolean resizable) Sets whether dialog can be resized by user or not.- Parameters:
resizable-trueto enabled resizing of the dialog,falseotherwise.
-
getLeft
Gets the left position of the overlay.- Returns:
- the left position of the overlay
-
setLeft
Sets the distance of the overlay from the left of its container. If a unitless number is provided, pixels are assumed.Note that the overlay left edge may not be the same as the viewport left edge (e.g. the
Lumotheme defines some spacing to prevent the overlay from stretching all the way to the left of the viewport).- Parameters:
left- the left position of the overlay
-
getTop
Gets the top position of the overlay.- Returns:
- the top position of the overlay
-
setTop
Sets the top position of the overlay. If a unitless number is provided, pixels are assumed.Note that the overlay top edge may not be the same as the viewport top edge (e.g. the
Lumotheme defines some spacing to prevent the overlay from stretching all the way to the top of the viewport).- Parameters:
top- the top position of the overlay
-
setWidth
- Specified by:
setWidthin interfacecom.vaadin.flow.component.HasSize
-
setWidth
public void setWidth(float width, com.vaadin.flow.component.Unit unit) - Specified by:
setWidthin interfacecom.vaadin.flow.component.HasSize
-
setMinWidth
- Specified by:
setMinWidthin interfacecom.vaadin.flow.component.HasSize
-
setMinWidth
public void setMinWidth(float minWidth, com.vaadin.flow.component.Unit unit) - Specified by:
setMinWidthin interfacecom.vaadin.flow.component.HasSize
-
setMaxWidth
- Specified by:
setMaxWidthin interfacecom.vaadin.flow.component.HasSize
-
setMaxWidth
public void setMaxWidth(float maxWidth, com.vaadin.flow.component.Unit unit) - Specified by:
setMaxWidthin interfacecom.vaadin.flow.component.HasSize
-
getWidth
- Specified by:
getWidthin interfacecom.vaadin.flow.component.HasSize
-
getMinWidth
- Specified by:
getMinWidthin interfacecom.vaadin.flow.component.HasSize
-
getMaxWidth
- Specified by:
getMaxWidthin interfacecom.vaadin.flow.component.HasSize
-
getWidthUnit
- Specified by:
getWidthUnitin interfacecom.vaadin.flow.component.HasSize
-
setHeight
- Specified by:
setHeightin interfacecom.vaadin.flow.component.HasSize
-
setHeight
public void setHeight(float height, com.vaadin.flow.component.Unit unit) - Specified by:
setHeightin interfacecom.vaadin.flow.component.HasSize
-
setMinHeight
- Specified by:
setMinHeightin interfacecom.vaadin.flow.component.HasSize
-
setMinHeight
public void setMinHeight(float minHeight, com.vaadin.flow.component.Unit unit) - Specified by:
setMinHeightin interfacecom.vaadin.flow.component.HasSize
-
setMaxHeight
- Specified by:
setMaxHeightin interfacecom.vaadin.flow.component.HasSize
-
setMaxHeight
public void setMaxHeight(float maxHeight, com.vaadin.flow.component.Unit unit) - Specified by:
setMaxHeightin interfacecom.vaadin.flow.component.HasSize
-
getHeight
- Specified by:
getHeightin interfacecom.vaadin.flow.component.HasSize
-
getMinHeight
- Specified by:
getMinHeightin interfacecom.vaadin.flow.component.HasSize
-
getMaxHeight
- Specified by:
getMaxHeightin interfacecom.vaadin.flow.component.HasSize
-
getHeightUnit
- Specified by:
getHeightUnitin interfacecom.vaadin.flow.component.HasSize
-
setSizeFull
public void setSizeFull()- Specified by:
setSizeFullin interfacecom.vaadin.flow.component.HasSize
-
setWidthFull
public void setWidthFull()- Specified by:
setWidthFullin interfacecom.vaadin.flow.component.HasSize
-
setHeightFull
public void setHeightFull()- Specified by:
setHeightFullin interfacecom.vaadin.flow.component.HasSize
-
setSizeUndefined
public void setSizeUndefined()- Specified by:
setSizeUndefinedin interfacecom.vaadin.flow.component.HasSize
-
addThemeName
- Specified by:
addThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
removeThemeName
- Specified by:
removeThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
setThemeName
- Specified by:
setThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
getThemeName
- Specified by:
getThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
getThemeNames
public com.vaadin.flow.dom.ThemeList getThemeNames()- Specified by:
getThemeNamesin interfacecom.vaadin.flow.component.HasTheme
-
setThemeName
- Specified by:
setThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
hasThemeName
- Specified by:
hasThemeNamein interfacecom.vaadin.flow.component.HasTheme
-
addThemeNames
- Specified by:
addThemeNamesin interfacecom.vaadin.flow.component.HasTheme
-
removeThemeNames
- Specified by:
removeThemeNamesin interfacecom.vaadin.flow.component.HasTheme
-
addClassName
- Specified by:
addClassNamein interfacecom.vaadin.flow.component.HasStyle
-
removeClassName
- Specified by:
removeClassNamein interfacecom.vaadin.flow.component.HasStyle
-
setClassName
- Specified by:
setClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getClassName
- Specified by:
getClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getClassNames
public com.vaadin.flow.dom.ClassList getClassNames()- Specified by:
getClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
setClassName
- Specified by:
setClassNamein interfacecom.vaadin.flow.component.HasStyle
-
hasClassName
- Specified by:
hasClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getStyle
public com.vaadin.flow.dom.Style getStyle()- Specified by:
getStylein interfacecom.vaadin.flow.component.HasStyle
-
addClassNames
- Specified by:
addClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
removeClassNames
- Specified by:
removeClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
getEventHub
-
messages
-
uiComponents
-