Package io.jmix.ui

Class ScreenBuilders

java.lang.Object
io.jmix.ui.ScreenBuilders

@Component("ui_ScreenBuilders") public class ScreenBuilders extends Object
  • Field Details

  • Constructor Details

    • ScreenBuilders

      public ScreenBuilders()
  • Method Details

    • editor

      public <E> EditorBuilder<E> editor(Class<E> entityClass, FrameOwner origin)
      Creates a screen builder.

      Example of building a screen for editing an entity:

      
       SomeCustomerEditor screen = screenBuilders.editor(Customer.class, this)
               .withScreen(SomeCustomerEditor.class)
               .withListComponent(customersTable)
               .editEntity(customersTable.getSingleSelected())
               .build();
       

      Example of building a screen for creating a new entity instance:

      
       SomeCustomerEditor screen = screenBuilders.editor(Customer.class, this)
               .withScreen(SomeCustomerEditor.class)
               .withListComponent(customersTable)
               .newEntity()
               .build();
       
      Parameters:
      entityClass - edited entity class
      origin - invoking screen
      See Also:
    • editor

      public <E> EditorBuilder<E> editor(ListComponent<E> listComponent)
      Creates a screen builder using list component.

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

      
       SomeCustomerEditor screen = screenBuilders.editor(customersTable)
                .withScreen(SomeCustomerEditor.class)
                .build();
       

      Example of building a screen for creating a new entity instance:

      
       SomeCustomerEditor screen = screenBuilders.editor(customersTable)
                .withScreen(SomeCustomerEditor.class)
                .newEntity()
                .build();
       
      Parameters:
      listComponent - Table, DataGrid or another component containing the list of entities
      See Also:
    • editor

      public <E> EditorBuilder<E> editor(EntityPicker<E> field)
      Creates a screen builder using EntityPicker component.

      Example of building a screen for editing a currently set value:

      
       SomeCustomerEditor screen = screenBuilders.editor(customerPicker)
                .withScreen(SomeCustomerEditor.class)
                .build();
       

      Example of building a screen for creating a new entity instance:

      
       SomeCustomerEditor screen = screenBuilders.editor(customerPicker)
                .withScreen(SomeCustomerEditor.class)
                .newEntity()
                .build();
       
      Parameters:
      field - EntityPicker, EntityComboBox or another picker component
      See Also:
    • lookup

      public <E> LookupBuilder<E> lookup(Class<E> entityClass, FrameOwner origin)
      Creates a screen builder.

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

      
       SomeCustomerListScreen screen = screenBuilders.lookup(Customer.class, this)
               .withScreen(SomeCustomerListScreen.class)
               .withOpenMode(OpenMode.DIALOG)
               .withContainer(customersDc)
               .build();
       

      Example of building a lookup screen with custom select handler:

      
       SomeCustomerListScreen screen = screenBuilders.lookup(Customer.class, this)
               .withScreen(SomeCustomerListScreen.class)
               .withOpenMode(OpenMode.DIALOG)
               .withSelectHandler(customers -> {
                   // customers contains selected values
               })
               .build();
       
      Type Parameters:
      E - type of entity
      Parameters:
      entityClass - entity class
      origin - invoking screen
    • lookup

      public <E> LookupBuilder<E> lookup(ListComponent<E> listComponent)
      Creates a screen builder using list component.

      Example of building a lookup screen for adding row to table / tree component:

      
       SomeCustomerListScreen screen = screenBuilders.lookup(customersTable)
               .withScreen(SomeCustomerListScreen.class)
               .build();
       
      Type Parameters:
      E - type of entity
      Parameters:
      listComponent - Table, DataGrid or another component containing the list of entities
      See Also:
    • lookup

      public <E> LookupBuilder<E> lookup(EntityPicker<E> field)
      Creates a screen builder using EntityPicker component.

      Example of building a lookup screen for setting value to EntityPicker:

      
       SomeCustomerListScreen screen = screenBuilders.lookup(customerPicker)
               .withScreen(SomeCustomerListScreen.class)
               .build();
       
      Type Parameters:
      E - type of entity
      Parameters:
      field - EntityPicker, EntityComboBox or another picker component
      See Also:
    • lookup

      public <E> LookupBuilder<E> lookup(TagPicker<E> field)
      Creates a screen builder using TagPicker component.

      Example of building a lookup screen for setting value to TagPicker:

      
       SomeCustomerListScreen screen = screenBuilders.lookup(customerTagPicker)
               .withScreen(SomeCustomerListScreen.class)
               .build();
       
      Type Parameters:
      E - type of entity
      Parameters:
      field - TagPicker
      Returns:
      instance of lookup builder
      See Also:
    • screen

      public ScreenBuilder screen(FrameOwner origin)
      Creates a screen builder.

      Example of building a screen:

      
       SomeScreen screen = screenBuilders.screen(this)
               .withScreen(SomeScreen.class)
               .build();
       
      Parameters:
      origin - invoking screen