Package io.jmix.flowui
Interface Dialogs.SideDialogBuilder
- All Superinterfaces:
Dialogs.Closeable<Dialogs.SideDialogBuilder>,Dialogs.HasHeader<Dialogs.SideDialogBuilder>,Dialogs.HasStyle<Dialogs.SideDialogBuilder>
- All Known Implementing Classes:
DialogsImpl.SideDialogBuilderImpl
- Enclosing interface:
- Dialogs
public static interface Dialogs.SideDialogBuilder
extends Dialogs.HasHeader<Dialogs.SideDialogBuilder>, Dialogs.HasStyle<Dialogs.SideDialogBuilder>, Dialogs.Closeable<Dialogs.SideDialogBuilder>
Builder for
SideDialog.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the dialog.booleanbooleanisModal()open()Opens the dialog.withCloseActionListener(com.vaadin.flow.component.ComponentEventListener<SideDialogCloseActionEvent> listener) Sets a listener for the close action event of the dialog.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.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.Methods inherited from interface io.jmix.flowui.Dialogs.Closeable
isCloseOnEsc, isCloseOnOutsideClick, withCloseOnEsc, withCloseOnOutsideClickMethods inherited from interface io.jmix.flowui.Dialogs.HasHeader
getHeader, withHeaderMethods inherited from interface io.jmix.flowui.Dialogs.HasStyle
getClassName, withClassName
-
Method Details
-
withHeaderComponents
Adds components to the header of the dialog.- Parameters:
components- components to add- Returns:
- builder
-
withHeaderProvider
Dialogs.SideDialogBuilder withHeaderProvider(Function<SideDialog, com.vaadin.flow.component.Component> headerProvider) Sets 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(); }- Parameters:
headerProvider- provider for the header component- Returns:
- builder
-
withContentComponents
Adds components to the footer of the dialog.- Parameters:
components- components to add- Returns:
- builder
-
withContentProvider
Dialogs.SideDialogBuilder withContentProvider(Function<SideDialog, com.vaadin.flow.component.Component> contentProvider) Sets 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(); }- Parameters:
contentProvider- provider for the content component- Returns:
- builder
-
withOpenedChangeListener
Dialogs.SideDialogBuilder withOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<SideDialogOpenedChangeEvent> listener) Sets a listener for the opened change event of the dialog.- Parameters:
listener- listener for the opened change event- Returns:
- builder
-
withCloseActionListener
Dialogs.SideDialogBuilder withCloseActionListener(com.vaadin.flow.component.ComponentEventListener<SideDialogCloseActionEvent> listener) Sets a listener for the close action event of the dialog.- Parameters:
listener- listener for the close action event- Returns:
- builder
-
getHorizontalSize
- Returns:
- horizontal size of the dialog or
nullif not set - See Also:
-
withHorizontalSize
Sets the horizontal size of the dialog.- Parameters:
value- the width of the dialog- Returns:
- builder
- See Also:
-
getHorizontalMaxSize
- Returns:
- horizontal max size of the dialog or
nullif not set - See Also:
-
withHorizontalMaxSize
Sets the horizontal max size of the dialog.- Parameters:
value- the maximum width of the dialog- Returns:
- builder
- See Also:
-
getHorizontalMinSize
- Returns:
- horizontal min size of the dialog or
nullif not set - See Also:
-
withHorizontalMinSize
Sets the horizontal min size of the dialog.- Parameters:
value- the minimum width of the dialog- Returns:
- builder
- See Also:
-
getVerticalSize
- Returns:
- vertical size of the dialog or
nullif not set - See Also:
-
withVerticalSize
Sets the vertical size of the dialog.- Parameters:
value- the height of the dialog- Returns:
- builder
- See Also:
-
getVerticalMaxSize
- Returns:
- vertical max size of the dialog or
nullif not set - See Also:
-
withVerticalMaxSize
Sets the vertical max size of the dialog.- Parameters:
value- the maximum height of the dialog- Returns:
- builder
- See Also:
-
getVerticalMinSize
- Returns:
- vertical min size of the dialog or
nullif not set - See Also:
-
withVerticalMinSize
Sets the vertical min size of the dialog.- Parameters:
value- the minimum height of the dialog- Returns:
- builder
- See Also:
-
isFullscreenOnSmallDevices
boolean isFullscreenOnSmallDevices()- Returns:
trueif the dialog is fullscreen on small devices,falseotherwise
-
withFullscreenOnSmallDevices
Sets the fullscreen mode on small devices.- Parameters:
fullscreen- fullscreen option- Returns:
- builder
- See Also:
-
getSideDialogPosition
SideDialogPosition getSideDialogPosition()- Returns:
- position of the dialog
-
withSideDialogPosition
Sets the position of the dialog.- Parameters:
position- position of the dialog- Returns:
- builder
-
getOverlayRole
- Returns:
- overlay role of the dialog or
nullif not set
-
withOverlayRole
Sets the overlay role of the dialog.- Parameters:
role- role to set- Returns:
- builder
-
isModal
boolean isModal()- Returns:
trueif the dialog is modal,falseotherwise
-
withModal
Sets whether the dialog should be modal.- Parameters:
modal- modal option- Returns:
- builder
-
open
SideDialog open()Opens the dialog.- Returns:
- opened dialog
-
build
SideDialog build()Builds the dialog.- Returns:
- created dialog
-