Screens and Fragments

A screen is a main unit of Jmix UI. It contains visual components, data containers, and non-visual components. A screen can be displayed inside the main application window either in a tab or as a modal dialog.

The main part of the screen is a Java or Groovy class called controller. A layout of the screen is usually defined in an XML file called descriptor.

In order to show a screen, the framework creates a new instance of the Window visual component, connects the window with the screen controller and loads the screen layout components as child components of the window. After that, the screen’s window is added to the main application window.

A fragment is another UI building block that can be used as a part of screens and other fragments. It is very similar to screen internally but has a specific lifecycle and the Fragment visual component instead of Window at the root of the components tree. Fragments also have controllers and XML descriptors.