Application Framework

LinkkiTabLayout

The LinkkiTabLayout is a UI component that gives access to several different views.

sidebar layout

On the left there is a vertical bar containing icons (buttons) for every sheet. The tooltip of the button displays the name of the corresponding sheet. The content of the selected sheet is displayed to the right of the bar.

In order to create a sidebar instantiate the LinkkiTabLayout and add LinkkiTabSheets that can be built using a builder. Every sheet requires an icon, a name and a content supplier (Supplier<Component>). The supplier is called when the sheet is selected for the first time (lazy initialization). This approach only creates the content if it is requested by the user. It also spreads out the component creation, avoiding long loading times at the start.

        tabLayout.addTabSheets(LinkkiTabSheet.builder("CreateReport")
                .caption(VaadinIcon.STAR_HALF_LEFT_O.create())
                .content(this::createReportPage)
                .build(),
                               LinkkiTabSheet.builder("ReportList")
                                       .caption(VaadinIcon.FILE_O.create())
                                       .content(this::createReportListPage)
                                       .build());

Additionally the tab component can implement AfterTabSelectedObserver. Its method afterTabSelected(TabSheetSelectionChangeEvent) is called every time the sheet is selected, that means it gets visible. Use this observer to update your binding context in case of changes to the underlying model while the sheet was not selected.

Using AfterTabSelectedObserver
public class ReportListPage extends AbstractPage implements AfterTabSelectedObserver {

    @Override
    public void afterTabSelected(TabSheetSelectionChangeEvent event) {
        update();
    }

When adding a PMO as tab component with VaadinUiCreator#createComponent(Object, BindingContext) to LinkkiTabSheet, use LinkkiTabSheet#addTabSelectionChangeListener(ComponentEventListener) to add additional listeners afterwards.