Search in sources :

Example 1 with UiComponents

use of io.jmix.ui.UiComponents in project jmix-docs by Haulmont.

the class HasBanner method initBanner.

@Subscribe
default void initBanner(Screen.InitEvent event) {
    // <1>
    ApplicationContext applicationContext = Extensions.getApplicationContext(event.getSource());
    // <2>
    UiComponents uiComponents = applicationContext.getBean(UiComponents.class);
    // <3>
    Label<String> banner = uiComponents.create(Label.TYPE_STRING);
    banner.setStyleName(ThemeClassNames.LABEL_H2);
    banner.setValue("Hello, world!");
    // <4>
    event.getSource().getWindow().add(banner, 0);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) UiComponents(io.jmix.ui.UiComponents) Subscribe(io.jmix.ui.screen.Subscribe)

Aggregations

UiComponents (io.jmix.ui.UiComponents)1 Subscribe (io.jmix.ui.screen.Subscribe)1 ApplicationContext (org.springframework.context.ApplicationContext)1