Class ViewBuilders

java.lang.Object
io.jmix.tabbedmode.ViewBuilders

@Component("tabmod_ViewBuilders") public class ViewBuilders extends Object
Provides a fluent interface for opening views.
  • Field Details

  • Constructor Details

  • Method Details

    • detail

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

      Example of opening a view for editing an entity:

      
       viewBuilders.detail(this, User.class)
               .editEntity(user)
               .open();
       

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

      
       viewBuilders.detail(this, User.class)
               .newEntity()
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      origin - calling view
      entityClass - edited entity class
      Returns:
      detail view builder
      See Also:
    • detail

      public <E> DetailViewBuilder<E,?> detail(View<?> origin, Class<E> entityClass, String viewId)
      Creates a detail view builder for entity class. The opened view is defined by the passed view id.

      Example of opening a view for editing an entity:

      
       viewBuilders.detail(this, User.class, "User.detail")
               .editEntity(user)
               .open();
       

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

      
       viewBuilders.detail(this, User.class, "User.detail")
               .newEntity()
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      origin - calling view
      entityClass - edited entity class
      viewId - opened view id
      Returns:
      detail view builder
      See Also:
    • detail

      public <E, V extends View<?>> DetailViewBuilder<E,V> detail(View<?> origin, Class<E> entityClass, Class<V> viewClass)
      Creates a detail view builder for entity class. The opened view is defined by the passed view class.

      Example of opening a view for editing an entity:

      
       viewBuilders.detail(this, User.class, UserDetailView.class)
               .editEntity(user)
               .withAfterCloseListener(closeEvent -> {
                   if (closeEvent.closedWith(StandardOutcome.SAVE)) {
                       User editedEntity = closeEvent.getSource().getEditedEntity();
                       // ...
                   }
               })
               .open();
       

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

      
       viewBuilders.detail(this, User.class, UserDetailView.class)
               .newEntity()
               .withAfterCloseListener(closeEvent -> {
                   if (closeEvent.closedWith(StandardOutcome.SAVE)) {
                       User editedEntity = closeEvent.getSource().getEditedEntity();
                       // ...
                   }
               })
               .open();
       
      Type Parameters:
      E - entity type
      V - view type
      Parameters:
      origin - calling view
      entityClass - edited entity class
      viewClass - opened view class
      Returns:
      detail view builder
      See Also:
    • detail

      public <E> DetailViewBuilder<E,?> detail(ListDataComponent<E> listDataComponent)
      Creates a detail view builder using the list component.

      Example of building a view for editing a currently selected entity:

      
       viewBuilders.detail(usersDataGrid)
               .open();
       
      Example of building a view for creating a new entity instance:
      
       viewBuilders.detail(usersDataGrid)
               .newEntity()
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      listDataComponent - a component containing the list of entities
      Returns:
      detail view builder
      See Also:
    • detail

      public <E> DetailViewBuilder<E,?> detail(ListDataComponent<E> listDataComponent, String viewId)
      Creates a detail view builder using the list component. The opened view is defined by the passed view id.

      Example of building a view for editing a currently selected entity:

      
       viewBuilders.detail(usersDataGrid, "User.detail")
               .open();
       
      Example of building a view for creating a new entity instance:
      
       viewBuilders.detail(usersDataGrid, "User.detail")
               .newEntity()
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      listDataComponent - a component containing the list of entities
      viewId - opened view id
      Returns:
      detail view builder
      See Also:
    • detail

      public <E, V extends View<?>> DetailViewBuilder<E,V> detail(ListDataComponent<E> listDataComponent, Class<V> viewClass)
      Creates a detail view builder using the list component. The opened view is defined by the passed view class.

      Example of building a view for editing a currently selected entity:

      
       viewBuilders.detail(usersDataGrid, UserDetailView.class)
               .withAfterCloseListener(closeEvent -> {
                   if (closeEvent.closedWith(StandardOutcome.SAVE)) {
                       User editedEntity = closeEvent.getSource().getEditedEntity();
                       // ...
                   }
               })
               .open();
       
      Example of building a view for creating a new entity instance:
      
       viewBuilders.detail(usersDataGrid, UserDetailView.class)
               .newEntity()
               .withAfterCloseListener(closeEvent -> {
                   if (closeEvent.closedWith(StandardOutcome.SAVE)) {
                       User editedEntity = closeEvent.getSource().getEditedEntity();
                       // ...
                   }
               })
               .open();
       
      Type Parameters:
      E - entity type
      V - view type
      Parameters:
      listDataComponent - a component containing the list of entities
      viewClass - opened view class
      Returns:
      detail view builder
      See Also:
    • initDetailBuilder

      protected <E, V extends View<?>> void initDetailBuilder(DetailViewBuilder<E,V> builder, ListDataComponent<E> listDataComponent)
    • detail

      public <E> DetailViewBuilder<E,?> detail(EntityPickerComponent<E> picker)
      Creates a detail view builder using the entity picker component.

      Example of building a view for editing a currently selected entity:

      
       viewBuilders.detail(userPicker)
               .open();
       
      Example of building a view for creating a new entity instance:
      
       viewBuilders.detail(userPicker)
               .newEntity()
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      picker - entity picker component
      Returns:
      detail view builder
      See Also:
    • detail

      public <E> DetailViewBuilder<E,?> detail(EntityPickerComponent<E> picker, String viewId)
      Creates a detail view builder using the entity picker component. The opened view is defined by the passed view id.

      Example of building a view for editing a currently selected entity:

      
       viewBuilders.detail(userPicker, "User. detail")
               .open();
       
      Example of building a view for creating a new entity instance:
      
       viewBuilders.detail(userPicker, "User. detail")
               .newEntity()
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      picker - entity picker component
      viewId - opened view id
      Returns:
      detail view builder
      See Also:
    • detail

      public <E, V extends View<?>> DetailViewBuilder<E,V> detail(EntityPickerComponent<E> picker, Class<V> viewClass)
      Creates a detail view builder using the entity picker component. The opened view is defined by the passed view class.

      Example of building a view for editing a currently selected entity:

      
       viewBuilders.detail(userPicker, UserDetailView.class)
               .withAfterCloseListener(closeEvent -> {
                   if (closeEvent.closedWith(StandardOutcome.SAVE)) {
                       User editedEntity = closeEvent.getSource().getEditedEntity();
                       // ...
                   }
               })
               .open();
       
      Example of building a view for creating a new entity instance:
      
       viewBuilders.detail(userPicker, UserDetailView.class)
               .newEntity()
               .withAfterCloseListener(closeEvent -> {
                   if (closeEvent.closedWith(StandardOutcome.SAVE)) {
                       User editedEntity = closeEvent.getSource().getEditedEntity();
                       // ...
                   }
               })
               .open();
       
      Type Parameters:
      E - entity type
      V - view type
      Parameters:
      picker - entity picker component
      viewClass - opened view class
      Returns:
      detail view builder
      See Also:
    • initDetailBuilder

      protected <E, V extends View<?>> void initDetailBuilder(DetailViewBuilder<E,V> builder, com.vaadin.flow.component.HasValue<?,E> valueComponent)
    • lookup

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

      Example of building a lookup view for adding an instance to a data container:

      
       viewBuilders.lookup(this, User.class)
               .withContainer(usersDc)
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      origin - calling view
      entityClass - entity class
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E> LookupViewBuilder<E,?> lookup(View<?> origin, Class<E> entityClass, String viewId)
      Creates a lookup view builder for entity class. The opened view is defined by the passed view id.

      Example of building a lookup view for adding an instance to a data container:

      
       viewBuilders.lookup(this, User.class, "User.list")
               .withContainer(usersDc)
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      origin - calling view
      entityClass - entity class
      viewId - opened view id
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E, V extends View<?>> LookupViewBuilder<E,V> lookup(View<?> origin, Class<E> entityClass, Class<V> viewClass)
      Creates a lookup view builder for entity class. The opened view is defined by the passed view class.

      Example of building a lookup view for adding an instance to a data container:

      
       viewBuilders.lookup(this, User.class, UserListView.class)
               .withContainer(usersDc)
               .open();
       
      Type Parameters:
      E - entity type
      V - view type
      Parameters:
      origin - calling view
      entityClass - entity class
      viewClass - opened view class
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E> LookupViewBuilder<E,?> lookup(ListDataComponent<E> listDataComponent)
      Creates a lookup view builder using the list component.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(usersDataGrid)
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      listDataComponent - a component containing the list of entities
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E> LookupViewBuilder<E,?> lookup(ListDataComponent<E> listDataComponent, String viewId)
      Creates a lookup view builder using the list component. The opened view is defined by the passed view id.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(usersDataGrid, "User.list")
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      listDataComponent - a component containing the list of entities
      viewId - opened view id
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E, V extends View<?>> LookupViewBuilder<E,V> lookup(ListDataComponent<E> listDataComponent, Class<V> viewClass)
      Creates a lookup view builder using the list component. The opened view is defined by the passed view class.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(usersDataGrid, UserListView.class)
               .open();
       
      Type Parameters:
      E - entity type
      V - view type
      Parameters:
      listDataComponent - a component containing the list of entities
      viewClass - opened view class
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E> LookupViewBuilder<E,?> lookup(EntityPickerComponent<E> picker)
      Creates a lookup view builder using the entity picker component.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(userPicker)
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      picker - entity picker component
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E> LookupViewBuilder<E,?> lookup(EntityPickerComponent<E> picker, String viewId)
      Creates a lookup view builder using the entity picker component. The opened view is defined by the passed view id.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(userPicker, "User.list")
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      picker - entity picker component
      viewId - opened view id
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E, V extends View<?>> LookupViewBuilder<E,V> lookup(EntityPickerComponent<E> picker, Class<V> viewClass)
      Creates a lookup view builder using the entity picker component. The opened view is defined by the passed view class.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(userPicker, UserListView.class)
               .open();
       
      Type Parameters:
      E - entity type
      V - view type
      Parameters:
      picker - entity picker component
      viewClass - opened view class
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E> LookupViewBuilder<E,?> lookup(EntityMultiPickerComponent<E> picker)
      Creates a lookup view builder using the entity multi picker component.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(usersPicker)
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      picker - entity multi picker component
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E> LookupViewBuilder<E,?> lookup(EntityMultiPickerComponent<E> picker, String viewId)
      Creates a lookup view builder using the entity multi picker component. The opened view is defined by the passed view id.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(usersPicker, "User.list")
               .open();
       
      Type Parameters:
      E - entity type
      Parameters:
      picker - entity multi picker component
      viewId - opened view id
      Returns:
      lookup builder
      See Also:
    • lookup

      public <E, V extends View<?>> LookupViewBuilder<E,V> lookup(EntityMultiPickerComponent<E> picker, Class<V> viewClass)
      Creates a lookup view builder using the entity multi picker component. The opened view is defined by the passed view class.

      Example of building a lookup view for adding an instance to a list component:

      
       viewBuilders.lookup(usersPicker, UserListView.class)
               .open();
       
      Type Parameters:
      E - entity type
      V - view type
      Parameters:
      picker - entity multi picker component
      viewClass - opened view class
      Returns:
      lookup builder
      See Also:
    • view

      public <V extends View<?>> ViewBuilder<V> view(View<?> origin, Class<V> viewClass)
      Creates a view builder. The opened view is defined by the passed view class.

      Example of opening a view:

      
       viewBuilders.view(this, SandboxView.class)
                       .open();
       
      Type Parameters:
      V - view type
      Parameters:
      origin - calling view
      viewClass - opened view class
      Returns:
      view builder
    • view

      public ViewBuilder<?> view(View<?> origin, String viewId)
      Creates a view builder. The opened view is defined by the passed view id.

      Example of opening a view:

      
       viewBuilders.view(this, "FooView")
                       .open();
       
      Parameters:
      origin - calling view
      viewId - opened view id
      Returns:
      view builder
    • getBeanType

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

      protected <E> Class<E> getBeanType(SupportsMetaClass component)
    • openView

      protected void openView(ViewOpeningContext context)