Class DialogWindows

java.lang.Object
io.jmix.flowui.DialogWindows

@Component("flowui_DialogWindows") public class DialogWindows extends Object
Provides fluent interface for opening views in dialog windows.
  • Field Details

  • Constructor Details

  • Method Details

    • detail

      public <E, V extends View<?>> DetailWindowBuilder<E,V> detail(View<?> origin, Class<E> entityClass)
      Creates a detail view builder for entity class.

      Example of opening a view for editing an entity:

      
       DialogWindow<CustomerDetailView> dialogWindow = dialogWindows.detail(this, Customer.class)
               .withViewClass(CustomerDetailView.class)
               .editEntity(customer)
               .withAfterCloseListener(closeEvent -> {
                   if (closeEvent.closedWith(StandardOutcome.SAVE)) {
                       Customer editedCustomer = closeEvent.getView().getEditedEntity();
                       // ...
                   }
               })
               .open();
       

      Example of opening a view for creating a new entity instance:

      
       DialogWindow<CustomerDetailView> dialogWindow = dialogWindows.detail(this, Customer.class)
               .withViewClass(CustomerDetailView.class)
               .newEntity()
               .withAfterCloseListener(closeEvent -> {
                   if (closeEvent.closedWith(StandardOutcome.SAVE)) {
                       Customer newCustomer = closeEvent.getView().getEditedEntity();
                       // ...
                   }
               })
               .open();
       
      Parameters:
      origin - calling view
      entityClass - edited entity class
    • detail

      public <E, V extends View<?>> DetailWindowBuilder<E,V> detail(ListDataComponent<E> listDataComponent)
      Creates a detail view builder to edit an entity selected in the list component.
      Parameters:
      listDataComponent - the component which provides a selected entity to edit
      See Also:
    • detail

      public <E, V extends View<?>> DetailWindowBuilder<E,V> detail(EntityPickerComponent<E> picker)
      Creates a detail view builder to edit an entity selected in the picker component.
      Parameters:
      picker - the component which provides an entity to edit
      See Also:
    • lookup

      public <E, V extends View<?>> LookupWindowBuilder<E,V> lookup(View<?> origin, Class<E> entityClass)
      Creates a lookup view builder for an entity class.

      Example of opening a view for selecting an entity:

      
       DialogWindow<CustomerListView> dialogWindow = dialogWindows.lookup(this, Customer.class)
               .withViewClass(CustomerListView.class)
               .withSelectHandler(customers -> {
                   // ...
               })
               .open();
       
      Parameters:
      origin - calling view
      entityClass - entity class
    • lookup

      public <E, V extends View<?>> LookupWindowBuilder<E,V> lookup(ListDataComponent<E> listDataComponent)
      Creates a lookup view builder to select entities and add them to the data container of the list component.
      Parameters:
      listDataComponent - the list component
      See Also:
    • lookup

      public <E, V extends View<?>> LookupWindowBuilder<E,V> lookup(EntityPickerComponent<E> picker)
      Creates a lookup view builder to select an entity and set it to the picker component.
      Parameters:
      picker - the picker component
      See Also:
    • view

      public <V extends View<?>> WindowBuilder<V> view(View<?> origin, Class<V> viewClass)
      Creates a view builder.
      Parameters:
      origin - calling view
      viewClass - opened view class
    • getOpenedDialogWindows

      public OpenedDialogWindows getOpenedDialogWindows()
      Returns:
      the object that provides information about opened dialogs
      Throws:
      IllegalStateException - if OpenedDialogWindows is not available
    • view

      public WindowBuilder<View<?>> view(View<?> origin, String viewId)
      Creates a view builder.
      Parameters:
      origin - calling view
      viewId - id of the opened view (as set in the ViewController annotation)
    • getBeanType

      protected <E> Class<E> getBeanType(ListDataComponent<E> listDataComponent)
    • getBeanType

      protected <E> Class<E> getBeanType(EntityPickerComponent<E> picker)