Example usage for com.vaadin.ui Alignment MIDDLE_RIGHT

List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_RIGHT.

Prototype

Alignment MIDDLE_RIGHT

To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.

Click Source Link

Usage

From source file:de.fatalix.bookery.AppHeader.java

License:Open Source License

private MHorizontalLayout createSmallNavBar() {
    Button homeButton = new Button("Home", new Button.ClickListener() {
        @Override//from   w  w w .j  av  a  2 s.  c om
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).getNavigator().navigateTo(HomeView.id);
            //bookMenuLayout.setLayoutVisible(true);
        }
    });
    homeButton.addStyleName(ValoTheme.BUTTON_TINY);
    Button plainSearchButton = new Button("einfach stbern", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).getNavigator().navigateTo(SearchView.id + "/author");
        }
    });
    plainSearchButton.addStyleName(ValoTheme.BUTTON_TINY);
    Button newBooks = new Button("neue Bcher", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).getNavigator().navigateTo(SearchView.id + "/author/true");
        }
    });
    newBooks.addStyleName(ValoTheme.BUTTON_TINY);
    Button bestBooks = new Button("Die besten Bcher", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).getNavigator().navigateTo(SearchView.id + "/likes");
        }
    });
    bestBooks.addStyleName(ValoTheme.BUTTON_TINY);

    logoutButton = new Button("Hallo", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).logout();
        }
    });
    logoutButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    logoutButton.addStyleName(ValoTheme.BUTTON_SMALL);

    VerticalLayout buttonLayout = new VerticalLayout(logoutButton);
    buttonLayout.setMargin(false);
    buttonLayout.setSpacing(false);
    buttonLayout.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT);

    MHorizontalLayout layout = new MHorizontalLayout(homeButton, plainSearchButton, newBooks, bestBooks,
            buttonLayout);
    layout.expand(buttonLayout);

    return layout;
}

From source file:de.fatalix.timeline.web.root.block.TimelineEventLayout.java

public TimelineEventLayout() {
    headline = new TextField();
    headline.setInputPrompt("Your event headline...");
    headline.setColumns(31);//from w w  w. j  ava 2 s  . c o m
    headline.setNullRepresentation("");
    text = new TextArea();
    text.setInputPrompt("Your event description...");
    text.setColumns(31);
    text.setRows(10);
    text.setNullRepresentation("");

    startDate = new DateField(null, new Date());
    startDate.setDateFormat("dd-MM-yyyy");
    startDate.setResolution(Resolution.DAY);
    startDate.setDescription("Set the start date of an event.");

    endDate = new DateField();
    endDate.setDateFormat("dd-MM-yyyy");
    endDate.setResolution(Resolution.DAY);
    endDate.setDescription("Set the end date of an event. Optional!");

    deleteButton = new VerticalLayout();
    deleteButton.setWidth(16, Unit.PIXELS);
    deleteButton.setHeight(16, Unit.PIXELS);
    deleteButton.addStyleName("delete");
    deleteButton.setDescription("Click to remove this event");
    deleteButton.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            for (EventDeleteListener listener : listeners) {
                listener.deleteEvent(TimelineEventLayout.this);
            }
        }
    });

    HorizontalLayout dateLayout = new HorizontalLayout();
    dateLayout.setWidth(100, Unit.PERCENTAGE);
    dateLayout.addComponents(startDate, endDate, deleteButton);
    dateLayout.setComponentAlignment(deleteButton, Alignment.MIDDLE_RIGHT);
    this.setMargin(true);
    this.setSpacing(true);
    this.addComponent(headline);
    this.addComponent(text);

    this.addComponent(dateLayout);
}

From source file:de.mendelson.comm.as2.webclient2.AS2WebUI.java

private HorizontalLayout createButtonBar() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSizeFull();/*w w  w  .  jav  a2 s.c  om*/
    Button buttonRefresh = new Button("Refresh");
    buttonRefresh.setIcon(new ThemeResource("images/refresh16x16.gif"));
    buttonRefresh.setEnabled(true);
    buttonRefresh.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            AS2WebUI.this.refreshOverviewTableData();
        }
    });
    buttonLayout.addComponent(buttonRefresh);
    this.buttonDetails = new Button("Message details");
    this.buttonDetails.setIcon(new ThemeResource("images/messagedetails16x16.gif"));
    this.buttonDetails.setEnabled(false);
    this.buttonDetails.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            AS2WebUI.this.displayMessageDetailsOfSelectedRow();
        }
    });
    buttonLayout.addComponent(this.buttonDetails);
    this.labelUsername.setWidth(null);
    buttonLayout.addComponent(this.labelUsername);
    buttonLayout.setComponentAlignment(this.labelUsername, Alignment.MIDDLE_RIGHT);
    buttonLayout.setExpandRatio(buttonRefresh, 0.0f);
    buttonLayout.setExpandRatio(this.buttonDetails, 0.0f);
    buttonLayout.setExpandRatio(this.labelUsername, 1.0f);
    return (buttonLayout);
}

From source file:de.mendelson.comm.as2.webclient2.OkDialog.java

public void init() {
    this.setModal(true);
    VerticalLayout okDialogLayout = new VerticalLayout();
    HorizontalLayout contentLayout = new HorizontalLayout();
    AbstractComponent contentPanel = this.getContentPanel();
    contentLayout.addComponent(contentPanel);
    contentLayout.setMargin(true);/*ww  w .ja v  a2 s  .c  om*/
    contentLayout.setSizeFull();
    okDialogLayout.addComponent(contentLayout);
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSizeFull();
    buttonLayout.setMargin(false, true, false, false);
    buttonLayout.addComponent(this.okButton);
    buttonLayout.setComponentAlignment(this.okButton, Alignment.MIDDLE_RIGHT);
    this.okButton.addListener(this);
    okDialogLayout.addComponent(buttonLayout);
    okDialogLayout.setExpandRatio(contentLayout, 1.0f);
    okDialogLayout.setExpandRatio(buttonLayout, 0.0f);
    this.setContent(okDialogLayout);
    this.setHeight(this.height + "px");
    this.setWidth(this.width + "px");
}

From source file:de.metas.ui.web.vaadin.window.editor.FieldEditorsContainer.java

License:Open Source License

private void addChildEditor(final Label label, final Component editorComp,
        final PropertyLayoutInfo layoutInfo) {
    final GridLayout content = getContent();
    int labelColumn = contentNextColumn * 2;
    int labelRow = contentNextRow;

    if (layoutInfo.isNextColumn()) {
        labelColumn = content.getColumns();
        labelRow = 0;//ww w  .j  a  v a2s. c o m
    }

    final int editorRowsSpan = layoutInfo.getRowsSpan();
    final int editorColumnFrom = labelColumn + 1;
    final int editorColumnTo = editorColumnFrom;
    final int editorRowFrom = labelRow;
    final int editorRowTo = editorRowFrom + (editorRowsSpan - 1);
    if (editorColumnTo >= content.getColumns()) {
        content.setColumns(editorColumnTo + 1);
    }
    if (editorRowTo >= content.getRows()) {
        content.setRows(editorRowTo + 1);
    }

    //
    //
    if (label != null) {
        content.addComponent(label, labelColumn, labelRow);
        content.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);
    }
    content.addComponent(editorComp, editorColumnFrom, editorRowFrom, editorColumnTo, editorRowTo);
    content.setComponentAlignment(editorComp, Alignment.MIDDLE_LEFT);
    editorComp.setSizeFull();

    //
    //
    // contentNextColumn;
    contentNextRow = editorRowTo + 1;
}

From source file:de.symeda.sormas.ui.caze.CaseContactsView.java

License:Open Source License

public HorizontalLayout createStatusFilterBar() {
    HorizontalLayout statusFilterLayout = new HorizontalLayout();
    statusFilterLayout.setSpacing(true);
    statusFilterLayout.setWidth("100%");
    statusFilterLayout.addStyleName(CssStyles.VSPACE_3);

    statusButtons = new HashMap<>();

    Button statusAll = new Button(I18nProperties.getCaption(Captions.all), e -> {
        criteria.contactStatus(null);/*from  w  w w. jav  a 2  s.  co  m*/
        navigateTo(criteria);
    });
    CssStyles.style(statusAll, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    statusAll.setCaptionAsHtml(true);
    statusFilterLayout.addComponent(statusAll);
    statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
    activeStatusButton = statusAll;

    for (ContactStatus status : ContactStatus.values()) {
        Button statusButton = new Button(status.toString(), e -> {
            criteria.contactStatus(status);
            navigateTo(criteria);
        });
        statusButton.setData(status);
        CssStyles.style(statusButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER,
                CssStyles.BUTTON_FILTER_LIGHT);
        statusButton.setCaptionAsHtml(true);
        statusFilterLayout.addComponent(statusButton);
        statusButtons.put(statusButton, status.toString());
    }
    statusFilterLayout
            .setExpandRatio(statusFilterLayout.getComponent(statusFilterLayout.getComponentCount() - 1), 1);

    // Bulk operation dropdown
    if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
        statusFilterLayout.setWidth(100, Unit.PERCENTAGE);

        MenuBar bulkOperationsDropdown = new MenuBar();
        MenuItem bulkOperationsItem = bulkOperationsDropdown
                .addItem(I18nProperties.getCaption(Captions.bulkActions), null);

        Command changeCommand = selectedItem -> {
            ControllerProvider.getContactController().showBulkContactDataEditComponent(
                    grid.asMultiSelect().getSelectedItems(), getCaseRef().getUuid());
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H,
                changeCommand);

        Command cancelFollowUpCommand = selectedItem -> {
            ControllerProvider.getContactController()
                    .cancelFollowUpOfAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                        public void run() {
                            grid.deselectAll();
                            grid.reload();
                        }
                    });
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkCancelFollowUp), VaadinIcons.CLOSE,
                cancelFollowUpCommand);

        Command lostToFollowUpCommand = selectedItem -> {
            ControllerProvider.getContactController().setAllSelectedItemsToLostToFollowUp(
                    grid.asMultiSelect().getSelectedItems(), new Runnable() {
                        public void run() {
                            grid.deselectAll();
                            grid.reload();
                        }
                    });
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkLostToFollowUp), VaadinIcons.UNLINK,
                lostToFollowUpCommand);

        Command deleteCommand = selectedItem -> {
            ControllerProvider.getContactController()
                    .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                        public void run() {
                            grid.deselectAll();
                            grid.reload();
                        }
                    });
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH,
                deleteCommand);

        statusFilterLayout.addComponent(bulkOperationsDropdown);
        statusFilterLayout.setComponentAlignment(bulkOperationsDropdown, Alignment.TOP_RIGHT);
        statusFilterLayout.setExpandRatio(bulkOperationsDropdown, 1);
    }

    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EXPORT)) {
        Button exportButton = new Button(I18nProperties.getCaption(Captions.export));
        exportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        exportButton.setIcon(VaadinIcons.DOWNLOAD);

        StreamResource streamResource = new GridExportStreamResource(grid, "sormas_contacts",
                "sormas_contacts_" + DateHelper.formatDateForExport(new Date()) + ".csv");
        FileDownloader fileDownloader = new FileDownloader(streamResource);
        fileDownloader.extend(exportButton);

        statusFilterLayout.addComponent(exportButton);
        statusFilterLayout.setComponentAlignment(exportButton, Alignment.MIDDLE_RIGHT);
        if (!UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
            statusFilterLayout.setExpandRatio(exportButton, 1);
        }
    }

    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_CREATE)) {
        newButton = new Button(
                I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, Captions.contactNewContact));
        newButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        newButton.setIcon(VaadinIcons.PLUS_CIRCLE);
        newButton.addClickListener(e -> ControllerProvider.getContactController().create(this.getCaseRef()));
        statusFilterLayout.addComponent(newButton);
        statusFilterLayout.setComponentAlignment(newButton, Alignment.MIDDLE_RIGHT);
    }

    statusFilterLayout.addStyleName("top-bar");
    activeStatusButton = statusAll;
    return statusFilterLayout;
}

From source file:de.symeda.sormas.ui.contact.ContactVisitsView.java

License:Open Source License

public HorizontalLayout createTopBar() {
    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setSpacing(true);/*from   w  ww  . j  a  v a  2  s  .com*/
    topLayout.setWidth(100, Unit.PERCENTAGE);

    //      statusButtons = new HashMap<>();
    //
    //      Button contactButton = new Button(I18nProperties.getCaption(Captions.contactRelated), e -> {
    //         grid.reload(getContactRef());
    //         processStatusChangeVisuals(e.getButton());
    //      });
    //      CssStyles.style(contactButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    //      contactButton.setCaptionAsHtml(true);
    //      topLayout.addComponent(contactButton);
    //      statusButtons.put(contactButton, I18nProperties.getCaption(Captions.contactRelated));
    //
    //      Button personButton = new Button(I18nProperties.getCaption(Captions.contactPersonVisits), e -> {
    //         ContactDto contact = FacadeProvider.getContactFacade().getContactByUuid(getContactRef().getUuid());
    //         grid.reload(contact.getPerson());
    //         processStatusChangeVisuals(e.getButton());
    //      });
    //      CssStyles.style(personButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER, CssStyles.BUTTON_FILTER_LIGHT);
    //      personButton.setCaptionAsHtml(true);
    //      topLayout.addComponent(personButton);
    //      statusButtons.put(personButton, I18nProperties.getCaption(Captions.contactPersonVisits));

    //      topLayout.setExpandRatio(topLayout.getComponent(topLayout.getComponentCount()-1), 1);

    // Bulk operation dropdown
    if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
        topLayout.setWidth(100, Unit.PERCENTAGE);

        MenuBar bulkOperationsDropdown = new MenuBar();
        MenuItem bulkOperationsItem = bulkOperationsDropdown
                .addItem(I18nProperties.getCaption(Captions.bulkActions), null);

        Command deleteCommand = selectedItem -> {
            ControllerProvider.getVisitController()
                    .deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
                        public void run() {
                            grid.deselectAll();
                            grid.reload();
                        }
                    });
        };
        bulkOperationsItem.addItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH,
                deleteCommand);

        topLayout.addComponent(bulkOperationsDropdown);
        topLayout.setComponentAlignment(bulkOperationsDropdown, Alignment.TOP_RIGHT);
        topLayout.setExpandRatio(bulkOperationsDropdown, 1);
    }

    if (UserProvider.getCurrent().hasUserRight(UserRight.VISIT_CREATE)) {
        newButton = new Button(I18nProperties.getCaption(Captions.visitNewVisit));
        newButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        newButton.setIcon(VaadinIcons.PLUS_CIRCLE);
        newButton.addClickListener(e -> {
            ControllerProvider.getVisitController().createVisit(this.getContactRef(), r -> grid.reload());
        });
        topLayout.addComponent(newButton);
        topLayout.setComponentAlignment(newButton, Alignment.MIDDLE_RIGHT);
    }

    topLayout.addStyleName(CssStyles.VSPACE_3);
    //      activeStatusButton = contactButton;
    return topLayout;
}

From source file:de.symeda.sormas.ui.dashboard.diagram.AbstractEpiCurveComponent.java

License:Open Source License

private HorizontalLayout createHeader() {
    HorizontalLayout epiCurveHeaderLayout = new HorizontalLayout();
    epiCurveHeaderLayout.setWidth(100, Unit.PERCENTAGE);
    epiCurveHeaderLayout.setSpacing(true);
    CssStyles.style(epiCurveHeaderLayout, CssStyles.VSPACE_4);

    epiCurveLabel = new Label(I18nProperties.getString(Strings.headingEpiCurve));
    epiCurveLabel.setSizeUndefined();/*from   w ww .  j  a va 2s.  c  om*/
    CssStyles.style(epiCurveLabel, CssStyles.H2, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE);

    epiCurveHeaderLayout.addComponent(epiCurveLabel);
    epiCurveHeaderLayout.setComponentAlignment(epiCurveLabel, Alignment.BOTTOM_LEFT);
    epiCurveHeaderLayout.setExpandRatio(epiCurveLabel, 1);

    // "Expand" and "Collapse" buttons
    Button expandEpiCurveButton = new Button("", VaadinIcons.EXPAND);
    CssStyles.style(expandEpiCurveButton, CssStyles.BUTTON_SUBTLE);
    expandEpiCurveButton.addStyleName(CssStyles.VSPACE_NONE);
    Button collapseEpiCurveButton = new Button("", VaadinIcons.COMPRESS);
    CssStyles.style(collapseEpiCurveButton, CssStyles.BUTTON_SUBTLE);
    collapseEpiCurveButton.addStyleName(CssStyles.VSPACE_NONE);

    expandEpiCurveButton.addClickListener(e -> {
        externalExpandListener.accept(true);
        epiCurveHeaderLayout.removeComponent(expandEpiCurveButton);
        epiCurveHeaderLayout.addComponent(collapseEpiCurveButton);
        epiCurveHeaderLayout.setComponentAlignment(collapseEpiCurveButton, Alignment.MIDDLE_RIGHT);
    });
    collapseEpiCurveButton.addClickListener(e -> {
        externalExpandListener.accept(false);
        epiCurveHeaderLayout.removeComponent(collapseEpiCurveButton);
        epiCurveHeaderLayout.addComponent(expandEpiCurveButton);
        epiCurveHeaderLayout.setComponentAlignment(expandEpiCurveButton, Alignment.MIDDLE_RIGHT);
    });
    epiCurveHeaderLayout.addComponent(expandEpiCurveButton);
    epiCurveHeaderLayout.setComponentAlignment(expandEpiCurveButton, Alignment.MIDDLE_RIGHT);

    return epiCurveHeaderLayout;
}

From source file:de.symeda.sormas.ui.dashboard.diagram.AbstractEpiCurveComponent.java

License:Open Source License

private HorizontalLayout createFooter() {
    HorizontalLayout epiCurveFooterLayout = new HorizontalLayout();
    epiCurveFooterLayout.setWidth(100, Unit.PERCENTAGE);
    epiCurveFooterLayout.setSpacing(true);
    CssStyles.style(epiCurveFooterLayout, CssStyles.VSPACE_4);

    // Grouping//  ww w. j av  a  2s .co m
    PopupButton groupingDropdown = new PopupButton(I18nProperties.getCaption(Captions.dashboardGrouping));
    CssStyles.style(groupingDropdown, CssStyles.BUTTON_SUBTLE);
    {
        VerticalLayout groupingLayout = new VerticalLayout();
        groupingLayout.setMargin(true);
        groupingLayout.setSizeUndefined();
        groupingDropdown.setContent(groupingLayout);

        // Grouping option group
        OptionGroup groupingSelect = new OptionGroup();
        groupingSelect.setWidth(100, Unit.PERCENTAGE);
        groupingSelect.addItems((Object[]) EpiCurveGrouping.values());
        groupingSelect.setValue(epiCurveGrouping);
        groupingSelect.addValueChangeListener(e -> {
            epiCurveGrouping = (EpiCurveGrouping) e.getProperty().getValue();
            clearAndFillEpiCurveChart();
        });
        groupingLayout.addComponent(groupingSelect);

        // "Always show at least 7 entries" checkbox
        CheckBox minimumEntriesCheckbox = new CheckBox(
                I18nProperties.getCaption(Captions.dashboardShowMinimumEntries));
        CssStyles.style(minimumEntriesCheckbox, CssStyles.VSPACE_NONE);
        minimumEntriesCheckbox.setValue(showMinimumEntries);
        minimumEntriesCheckbox.addValueChangeListener(e -> {
            showMinimumEntries = (boolean) e.getProperty().getValue();
            clearAndFillEpiCurveChart();
        });
        groupingLayout.addComponent(minimumEntriesCheckbox);

        groupingDropdown.setContent(groupingLayout);
    }
    epiCurveFooterLayout.addComponent(groupingDropdown);
    epiCurveFooterLayout.setComponentAlignment(groupingDropdown, Alignment.MIDDLE_RIGHT);
    epiCurveFooterLayout.setExpandRatio(groupingDropdown, 1);

    // Epi curve mode
    AbstractComponent epiCurveModeSelector = createEpiCurveModeSelector();
    epiCurveFooterLayout.addComponent(epiCurveModeSelector);
    epiCurveFooterLayout.setComponentAlignment(epiCurveModeSelector, Alignment.MIDDLE_RIGHT);
    epiCurveFooterLayout.setExpandRatio(epiCurveModeSelector, 0);

    return epiCurveFooterLayout;
}

From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java

License:Open Source License

private HorizontalLayout createHeader() {
    HorizontalLayout mapHeaderLayout = new HorizontalLayout();
    mapHeaderLayout.setWidth(100, Unit.PERCENTAGE);
    mapHeaderLayout.setSpacing(true);//from w ww . j  a  v a 2s  .c om
    CssStyles.style(mapHeaderLayout, CssStyles.VSPACE_4);

    Label mapLabel = new Label();
    if (dashboardDataProvider.getDashboardType() == DashboardType.SURVEILLANCE) {
        mapLabel.setValue(I18nProperties.getString(Strings.headingCaseStatusMap));
    } else {
        mapLabel.setValue(I18nProperties.getString(Strings.headingContactMap));
    }
    mapLabel.setSizeUndefined();
    CssStyles.style(mapLabel, CssStyles.H2, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE);

    mapHeaderLayout.addComponent(mapLabel);
    mapHeaderLayout.setComponentAlignment(mapLabel, Alignment.BOTTOM_LEFT);
    mapHeaderLayout.setExpandRatio(mapLabel, 1);

    // "Expand" and "Collapse" buttons
    Button expandMapButton = new Button("", VaadinIcons.EXPAND);
    CssStyles.style(expandMapButton, CssStyles.BUTTON_SUBTLE);
    expandMapButton.addStyleName(CssStyles.VSPACE_NONE);
    Button collapseMapButton = new Button("", VaadinIcons.COMPRESS);
    CssStyles.style(collapseMapButton, CssStyles.BUTTON_SUBTLE);
    collapseMapButton.addStyleName(CssStyles.VSPACE_NONE);

    expandMapButton.addClickListener(e -> {
        externalExpandListener.accept(true);
        mapHeaderLayout.removeComponent(expandMapButton);
        mapHeaderLayout.addComponent(collapseMapButton);
        mapHeaderLayout.setComponentAlignment(collapseMapButton, Alignment.MIDDLE_RIGHT);
    });
    collapseMapButton.addClickListener(e -> {
        externalExpandListener.accept(false);
        mapHeaderLayout.removeComponent(collapseMapButton);
        mapHeaderLayout.addComponent(expandMapButton);
        mapHeaderLayout.setComponentAlignment(expandMapButton, Alignment.MIDDLE_RIGHT);
    });
    mapHeaderLayout.addComponent(expandMapButton);
    mapHeaderLayout.setComponentAlignment(expandMapButton, Alignment.MIDDLE_RIGHT);

    return mapHeaderLayout;
}