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

Builder for SideDialog.
  • Method Details

    • withHeaderComponents

      Dialogs.SideDialogBuilder withHeaderComponents(com.vaadin.flow.component.Component... components)
      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 returns null, 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

      Dialogs.SideDialogBuilder withContentComponents(com.vaadin.flow.component.Component... components)
      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 returns null, 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
    • withFooterComponents

      Dialogs.SideDialogBuilder withFooterComponents(com.vaadin.flow.component.Component... components)
      Adds components to the footer of the dialog.
      Parameters:
      components - components to add
      Returns:
      builder
    • withFooterProvider

      Dialogs.SideDialogBuilder withFooterProvider(Function<SideDialog,com.vaadin.flow.component.Component> footerProvider)
      Sets a provider for the footer component of the dialog. The components from the provider are added to the footer of the dialog. If the provider returns null, no components are added.

      Usage example:

       @Autowired
       private Dialogs dialogs;
       @Autowired
       private UiComponents uiComponents;
      
       @Subscribe
       public void onInit(final InitEvent event) {
           dialogs.createSideDialog()
                   .withHeaderProvider(this::createHeader)
                   .withContentComponents(createContent())
                   .withFooterProvider(sideDialog -> {
                       JmixButton okButton = uiComponents.create(JmixButton.class);
                       okButton.addClickListener(__ -> sideDialog.close());
      
                       HorizontalLayout layout = new HorizontalLayout();
                       layout.add(okButton);
                       return layout;
                   })
                   .withSideDialogPosition(SideDialogPosition.LEFT)
                   .open();
       }
       
      Parameters:
      footerProvider - provider for the footer 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

      @Nullable String getHorizontalSize()
      Returns:
      horizontal size of the dialog or null if not set
      See Also:
    • withHorizontalSize

      Dialogs.SideDialogBuilder withHorizontalSize(@Nullable String value)
      Sets the horizontal size of the dialog.
      Parameters:
      value - the width of the dialog
      Returns:
      builder
      See Also:
    • getHorizontalMaxSize

      @Nullable String getHorizontalMaxSize()
      Returns:
      horizontal max size of the dialog or null if not set
      See Also:
    • withHorizontalMaxSize

      Dialogs.SideDialogBuilder withHorizontalMaxSize(@Nullable String value)
      Sets the horizontal max size of the dialog.
      Parameters:
      value - the maximum width of the dialog
      Returns:
      builder
      See Also:
    • getHorizontalMinSize

      @Nullable String getHorizontalMinSize()
      Returns:
      horizontal min size of the dialog or null if not set
      See Also:
    • withHorizontalMinSize

      Dialogs.SideDialogBuilder withHorizontalMinSize(@Nullable String value)
      Sets the horizontal min size of the dialog.
      Parameters:
      value - the minimum width of the dialog
      Returns:
      builder
      See Also:
    • getVerticalSize

      @Nullable String getVerticalSize()
      Returns:
      vertical size of the dialog or null if not set
      See Also:
    • withVerticalSize

      Dialogs.SideDialogBuilder withVerticalSize(@Nullable String value)
      Sets the vertical size of the dialog.
      Parameters:
      value - the height of the dialog
      Returns:
      builder
      See Also:
    • getVerticalMaxSize

      @Nullable String getVerticalMaxSize()
      Returns:
      vertical max size of the dialog or null if not set
      See Also:
    • withVerticalMaxSize

      Dialogs.SideDialogBuilder withVerticalMaxSize(@Nullable String value)
      Sets the vertical max size of the dialog.
      Parameters:
      value - the maximum height of the dialog
      Returns:
      builder
      See Also:
    • getVerticalMinSize

      @Nullable String getVerticalMinSize()
      Returns:
      vertical min size of the dialog or null if not set
      See Also:
    • withVerticalMinSize

      Dialogs.SideDialogBuilder withVerticalMinSize(@Nullable String value)
      Sets the vertical min size of the dialog.
      Parameters:
      value - the minimum height of the dialog
      Returns:
      builder
      See Also:
    • isFullscreenOnSmallDevices

      boolean isFullscreenOnSmallDevices()
      Returns:
      true if the dialog is fullscreen on small devices, false otherwise
    • withFullscreenOnSmallDevices

      Dialogs.SideDialogBuilder withFullscreenOnSmallDevices(boolean fullscreen)
      Sets the fullscreen mode on small devices.
      Parameters:
      fullscreen - fullscreen option
      Returns:
      builder
      See Also:
    • getSideDialogPosition

      SideDialogPosition getSideDialogPosition()
      Returns:
      position of the dialog
    • withSideDialogPosition

      Dialogs.SideDialogBuilder withSideDialogPosition(SideDialogPosition position)
      Sets the position of the dialog.
      Parameters:
      position - position of the dialog
      Returns:
      builder
    • getOverlayRole

      @Nullable String getOverlayRole()
      Returns:
      overlay role of the dialog or null if not set
    • withOverlayRole

      Dialogs.SideDialogBuilder withOverlayRole(String role)
      Sets the overlay role of the dialog.
      Parameters:
      role - role to set
      Returns:
      builder
    • isModal

      boolean isModal()
      Returns:
      true if the dialog is modal, false otherwise
    • withModal

      Dialogs.SideDialogBuilder withModal(boolean modal)
      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