Package io.jmix.flowui.impl
Class DialogsImpl.SideDialogBuilderImpl
java.lang.Object
io.jmix.flowui.impl.DialogsImpl.SideDialogBuilderImpl
- All Implemented Interfaces:
Dialogs.Closeable<Dialogs.SideDialogBuilder>,Dialogs.HasHeader<Dialogs.SideDialogBuilder>,Dialogs.HasStyle<Dialogs.SideDialogBuilder>,Dialogs.SideDialogBuilder
- Enclosing class:
- DialogsImpl
Implementation of
Dialogs.SideDialogBuilder that facilitates creating and managing SideDialogs.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<Consumer<SideDialog>>protected List<com.vaadin.flow.component.Component>protected List<com.vaadin.flow.component.Component>protected List<com.vaadin.flow.component.Component>protected SideDialog -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the dialog.protected List<com.vaadin.flow.component.Component>protected SideDialogprotected voidfireDialogOpenedChangeEvent(SideDialogOpenedChangeEvent openedChangeEvent) protected List<com.vaadin.flow.component.Component>Gets the CSS class names for this component.protected List<com.vaadin.flow.component.Component>protected voidinitDialog(SideDialog dialog) booleanbooleanbooleanbooleanisModal()open()Opens the dialog.withClassName(String className) Sets the CSS class names of this component.withCloseActionListener(com.vaadin.flow.component.ComponentEventListener<SideDialogCloseActionEvent> listener) Sets a listener for the close action event of the dialog.withCloseOnEsc(boolean closeOnEsc) Sets whether this dialog can be closed by hitting the esc-key or not.withCloseOnOutsideClick(boolean closeOnOutsideClick) Sets whether this dialog can be closed by clicking outside.withContentComponents(com.vaadin.flow.component.Component... components) Adds components to the footer of the dialog.withContentProvider(Function<SideDialog, com.vaadin.flow.component.Component> contentProvider) Sets a provider for the content component of the dialog.withFooterComponents(com.vaadin.flow.component.Component... components) Adds components to the footer of the dialog.withFooterProvider(Function<SideDialog, com.vaadin.flow.component.Component> footerProvider) Sets a provider for the footer component of the dialog.withFullscreenOnSmallDevices(boolean fullscreen) Sets the fullscreen mode on small devices.withHeader(String header) Sets a header text.withHeaderComponents(com.vaadin.flow.component.Component... components) Adds components to the header of the dialog.withHeaderProvider(Function<SideDialog, com.vaadin.flow.component.Component> headerProvider) Sets a provider for the header component of the dialog.withHorizontalMaxSize(String value) Sets the horizontal max size of the dialog.withHorizontalMinSize(String value) Sets the horizontal min size of the dialog.withHorizontalSize(String value) Sets the horizontal size of the dialog.withModal(boolean modal) Sets whether the dialog should be modal.withOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<SideDialogOpenedChangeEvent> listener) Sets a listener for the opened change event of the dialog.withOverlayRole(String role) Sets the overlay role of the dialog.withSideDialogPosition(SideDialogPosition position) Sets the position of the dialog.withVerticalMaxSize(String value) Sets the vertical max size of the dialog.withVerticalMinSize(String value) Sets the vertical min size of the dialog.withVerticalSize(String value) Sets the vertical size of the dialog.
-
Field Details
-
sideDialog
-
componentConsumers
-
headerComponents
-
contentComponents
-
-
Constructor Details
-
SideDialogBuilderImpl
public SideDialogBuilderImpl()
-
-
Method Details
-
withHeaderComponents
public Dialogs.SideDialogBuilder withHeaderComponents(com.vaadin.flow.component.Component... components) Description copied from interface:Dialogs.SideDialogBuilderAdds components to the header of the dialog.- Specified by:
withHeaderComponentsin interfaceDialogs.SideDialogBuilder- Parameters:
components- components to add- Returns:
- builder
-
withHeaderProvider
public Dialogs.SideDialogBuilder withHeaderProvider(Function<SideDialog, com.vaadin.flow.component.Component> headerProvider) Description copied from interface:Dialogs.SideDialogBuilderSets a provider for the header component of the dialog. The components from the provider are added to the header of the dialog. If the provider returnsnull, no components are added.Usage example:
@Autowired private Dialogs dialogs; @Autowired private UiComponents uiComponents; @Subscribe public void onInit(final InitEvent event) { dialogs.createSideDialog() .withHeaderProvider((sideDialog) -> { HorizontalLayout layout = new HorizontalLayout(); layout.add(new H2("User profile")); JmixButton closeButton = uiComponents.create(JmixButton.class); closeButton.setIcon(JmixFontIcon.CLOSE.create()); closeButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE); closeButton.addClickListener(__ -> sideDialog.close()); layout.add(closeButton); return layout; }) .withContentComponents(createContent()) .withSideDialogPosition(SideDialogPosition.LEFT) .open(); }- Specified by:
withHeaderProviderin interfaceDialogs.SideDialogBuilder- Parameters:
headerProvider- provider for the header component- Returns:
- builder
-
withContentComponents
public Dialogs.SideDialogBuilder withContentComponents(com.vaadin.flow.component.Component... components) Description copied from interface:Dialogs.SideDialogBuilderAdds components to the footer of the dialog.- Specified by:
withContentComponentsin interfaceDialogs.SideDialogBuilder- Parameters:
components- components to add- Returns:
- builder
-
withContentProvider
public Dialogs.SideDialogBuilder withContentProvider(Function<SideDialog, com.vaadin.flow.component.Component> contentProvider) Description copied from interface:Dialogs.SideDialogBuilderSets a provider for the content component of the dialog. The components from the provider are added to the content area of the dialog. If the provider returnsnull, no components are added.Usage example:
@Autowired private Dialogs dialogs; @Autowired private UiComponents uiComponents; @Subscribe("usersDataGrid") public void onUsersDataGridItemDoubleClick(final ItemDoubleClickEvent<User> event) { User user = event.getItem(); dialogs.createSideDialog() .withHeaderProvider(this::createHeader) .withContentProvider(sideDialog -> { FormLayout formLayout = uiComponents.create(FormLayout.class); TypedTextField<String> usernameField = uiComponents.create(TypedTextField.class); usernameField.setValue(user.getUsername()); usernameField.setReadOnly(true); formLayout.addFormItem(usernameField, "Username"); JmixEmailField emailField = uiComponents.create(JmixEmailField.class); emailField.setValue(Strings.nullToEmpty(user.getEmail())); emailField.setReadOnly(true); formLayout.addFormItem(emailField, "Email"); return formLayout; }).open(); }- Specified by:
withContentProviderin interfaceDialogs.SideDialogBuilder- Parameters:
contentProvider- provider for the content component- Returns:
- builder
-
withOpenedChangeListener
public Dialogs.SideDialogBuilder withOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<SideDialogOpenedChangeEvent> listener) Description copied from interface:Dialogs.SideDialogBuilderSets a listener for the opened change event of the dialog.- Specified by:
withOpenedChangeListenerin interfaceDialogs.SideDialogBuilder- Parameters:
listener- listener for the opened change event- Returns:
- builder
-
withCloseActionListener
public Dialogs.SideDialogBuilder withCloseActionListener(com.vaadin.flow.component.ComponentEventListener<SideDialogCloseActionEvent> listener) Description copied from interface:Dialogs.SideDialogBuilderSets a listener for the close action event of the dialog.- Specified by:
withCloseActionListenerin interfaceDialogs.SideDialogBuilder- Parameters:
listener- listener for the close action event- Returns:
- builder
-
getHorizontalSize
- Specified by:
getHorizontalSizein interfaceDialogs.SideDialogBuilder- Returns:
- horizontal size of the dialog or
nullif not set - See Also:
-
withHorizontalSize
Description copied from interface:Dialogs.SideDialogBuilderSets the horizontal size of the dialog.- Specified by:
withHorizontalSizein interfaceDialogs.SideDialogBuilder- Parameters:
value- the width of the dialog- Returns:
- builder
- See Also:
-
getHorizontalMaxSize
- Specified by:
getHorizontalMaxSizein interfaceDialogs.SideDialogBuilder- Returns:
- horizontal max size of the dialog or
nullif not set - See Also:
-
withHorizontalMaxSize
Description copied from interface:Dialogs.SideDialogBuilderSets the horizontal max size of the dialog.- Specified by:
withHorizontalMaxSizein interfaceDialogs.SideDialogBuilder- Parameters:
value- the maximum width of the dialog- Returns:
- builder
- See Also:
-
getHorizontalMinSize
- Specified by:
getHorizontalMinSizein interfaceDialogs.SideDialogBuilder- Returns:
- horizontal min size of the dialog or
nullif not set - See Also:
-
withHorizontalMinSize
Description copied from interface:Dialogs.SideDialogBuilderSets the horizontal min size of the dialog.- Specified by:
withHorizontalMinSizein interfaceDialogs.SideDialogBuilder- Parameters:
value- the minimum width of the dialog- Returns:
- builder
- See Also:
-
getVerticalSize
- Specified by:
getVerticalSizein interfaceDialogs.SideDialogBuilder- Returns:
- vertical size of the dialog or
nullif not set - See Also:
-
withVerticalSize
Description copied from interface:Dialogs.SideDialogBuilderSets the vertical size of the dialog.- Specified by:
withVerticalSizein interfaceDialogs.SideDialogBuilder- Parameters:
value- the height of the dialog- Returns:
- builder
- See Also:
-
getVerticalMaxSize
- Specified by:
getVerticalMaxSizein interfaceDialogs.SideDialogBuilder- Returns:
- vertical max size of the dialog or
nullif not set - See Also:
-
withVerticalMaxSize
Description copied from interface:Dialogs.SideDialogBuilderSets the vertical max size of the dialog.- Specified by:
withVerticalMaxSizein interfaceDialogs.SideDialogBuilder- Parameters:
value- the maximum height of the dialog- Returns:
- builder
- See Also:
-
getVerticalMinSize
- Specified by:
getVerticalMinSizein interfaceDialogs.SideDialogBuilder- Returns:
- vertical min size of the dialog or
nullif not set - See Also:
-
withVerticalMinSize
Description copied from interface:Dialogs.SideDialogBuilderSets the vertical min size of the dialog.- Specified by:
withVerticalMinSizein interfaceDialogs.SideDialogBuilder- Parameters:
value- the minimum height of the dialog- Returns:
- builder
- See Also:
-
isFullscreenOnSmallDevices
public boolean isFullscreenOnSmallDevices()- Specified by:
isFullscreenOnSmallDevicesin interfaceDialogs.SideDialogBuilder- Returns:
trueif the dialog is fullscreen on small devices,falseotherwise
-
withFullscreenOnSmallDevices
Description copied from interface:Dialogs.SideDialogBuilderSets the fullscreen mode on small devices.- Specified by:
withFullscreenOnSmallDevicesin interfaceDialogs.SideDialogBuilder- Parameters:
fullscreen- fullscreen option- Returns:
- builder
- See Also:
-
getSideDialogPosition
- Specified by:
getSideDialogPositionin interfaceDialogs.SideDialogBuilder- Returns:
- position of the dialog
-
withSideDialogPosition
Description copied from interface:Dialogs.SideDialogBuilderSets the position of the dialog.- Specified by:
withSideDialogPositionin interfaceDialogs.SideDialogBuilder- Parameters:
position- position of the dialog- Returns:
- builder
-
getOverlayRole
- Specified by:
getOverlayRolein interfaceDialogs.SideDialogBuilder- Returns:
- overlay role of the dialog or
nullif not set
-
withOverlayRole
Description copied from interface:Dialogs.SideDialogBuilderSets the overlay role of the dialog.- Specified by:
withOverlayRolein interfaceDialogs.SideDialogBuilder- Parameters:
role- role to set- Returns:
- builder
-
isModal
public boolean isModal()- Specified by:
isModalin interfaceDialogs.SideDialogBuilder- Returns:
trueif the dialog is modal,falseotherwise
-
withModal
Description copied from interface:Dialogs.SideDialogBuilderSets whether the dialog should be modal.- Specified by:
withModalin interfaceDialogs.SideDialogBuilder- Parameters:
modal- modal option- Returns:
- builder
-
open
Description copied from interface:Dialogs.SideDialogBuilderOpens the dialog.- Specified by:
openin interfaceDialogs.SideDialogBuilder- Returns:
- opened dialog
-
build
Description copied from interface:Dialogs.SideDialogBuilderBuilds the dialog.- Specified by:
buildin interfaceDialogs.SideDialogBuilder- Returns:
- created dialog
-
isCloseOnOutsideClick
public boolean isCloseOnOutsideClick()- Specified by:
isCloseOnOutsideClickin interfaceDialogs.Closeable<Dialogs.SideDialogBuilder>- Returns:
trueif this dialog can be closed by an outside click,falseotherwise
-
withCloseOnOutsideClick
Description copied from interface:Dialogs.CloseableSets whether this dialog can be closed by clicking outside.By default, the dialog is closable with an outside click.
- Specified by:
withCloseOnOutsideClickin interfaceDialogs.Closeable<Dialogs.SideDialogBuilder>- Parameters:
closeOnOutsideClick-trueto enable closing this dialog with an outside click,falseto disable it- Returns:
- builder
-
isCloseOnEsc
public boolean isCloseOnEsc()- Specified by:
isCloseOnEscin interfaceDialogs.Closeable<Dialogs.SideDialogBuilder>- Returns:
trueif this dialog can be closed with the esc-key,falseotherwise
-
withCloseOnEsc
Description copied from interface:Dialogs.CloseableSets whether this dialog can be closed by hitting the esc-key or not.By default, the dialog is closable with esc.
- Specified by:
withCloseOnEscin interfaceDialogs.Closeable<Dialogs.SideDialogBuilder>- Parameters:
closeOnEsc-trueto enable closing this dialog with the esc-key,falseto disable it- Returns:
- builder
-
withHeader
Description copied from interface:Dialogs.HasHeaderSets a header text.- Specified by:
withHeaderin interfaceDialogs.HasHeader<Dialogs.SideDialogBuilder>- Parameters:
header- header text- Returns:
- builder
-
getHeader
- Specified by:
getHeaderin interfaceDialogs.HasHeader<Dialogs.SideDialogBuilder>- Returns:
- header text
-
withClassName
Description copied from interface:Dialogs.HasStyleSets the CSS class names of this component. This method overwrites any previous set class names.- Specified by:
withClassNamein interfaceDialogs.HasStyle<Dialogs.SideDialogBuilder>- Parameters:
className- a space-separated string of class names to set, ornullto remove all class names
-
getClassName
Description copied from interface:Dialogs.HasStyleGets the CSS class names for this component.- Specified by:
getClassNamein interfaceDialogs.HasStyle<Dialogs.SideDialogBuilder>- Returns:
- a space-separated string of class names, or
nullif there are no class names
-
createSideDialog
-
initDialog
-
headerComponents
-
contentComponents
-
fireDialogOpenedChangeEvent
-