Migration to CUBA 7 API: Optional Components Migration

Please note that your entire codebase should work on the new version of the framework only with minor changes listed in the release notes, i.e. you don’t need to migrate existing screens on the new API, but if you want, the following guide may be helpful.

Table of Contents

Migration to CUBA 7 API: Screens
Migration to CUBA 7 API: Browser / Lookup Screens
Migration to CUBA 7 API: Editor Screens
Migration to CUBA 7 API: Required Components Migration
Migration to CUBA 7 API: Optional Components Migration

Deprecated components

OptionsGroup is deprecated and split into two separate components:

  • RadioButtonGroup allows a user to select a single value from a list of options using radio buttons.
  • CheckBoxGroup allows a user to select multiple values from a list of options using checkboxes.

Listeners

Any listener can be replaced by a method with the @Subscribe annotation.

Before

@Inject
private TextField<String> textField;

@Subscribe
private void onInit(InitEvent event) {
    textField.addValueChangeListener(valueChangeEvent -> {
       ... 
    });
}

After

@Subscribe("textField")
private void onTextFieldValueChange(HasValue.ValueChangeEvent<String> event) {
    ...
}

Providers and Handlers

Providers and Handlers listener can be replaced by a method with the @Install annotation.

Before

@Inject
private GroupTable<Product> productsTable;

@Subscribe
private void onInit(InitEvent event) {
    productsTable.addStyleProvider((entity, property) -> {
        ...
    });
}

After

@Install(to = "productsTable", subject = "styleProvider")
private String productsTableStyleProvider(Product entity, String property) {
    ...
}
3 Likes