Example usage for com.vaadin.ui Button setWidth

List of usage examples for com.vaadin.ui Button setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui Button setWidth.

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

From source file:com.github.wolfie.detachedtabs.DetachedTabs.java

License:Open Source License

/**
 * Add a tab/*from w  w  w  . j  a v a2 s  .c o m*/
 * 
 * @param content
 *          The {@link Component} that will be shown once its corresponding
 *          tab is selected.
 * @param caption
 *          The caption for the tab.
 */
public void addTab(final Component content, final String caption) {
    if (content == null || caption == null) {
        throw new NullPointerException("Arguments may not be null");
    }

    final Button button = new NativeButton(caption, tabChangeListener);

    if (orientation == Orientation.HORIZONTAL) {
        button.setHeight("100%");
        button.setWidth(getWidth(), getWidthUnits());
    } else {
        button.setHeight(getHeight(), getHeightUnits());
        button.setWidth("100%");
    }

    layout.addComponent(button);
    buttonComponentMap.put(button, content);
    tabs.add(button);

    adjustTabStyles();

    if (shownTab == null) {
        switchTo(content, button);
    }
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java

License:Apache License

protected final void createButtonLink(final GridLayout panelContent, final String linkText, final Resource icon,
        final ClickListener command, final String description) {
    final GridLayout grid = new GridLayout(2, 1);
    grid.setWidth(100, Unit.PERCENTAGE);
    grid.setHeight(100, Unit.PERCENTAGE);
    grid.setColumnExpandRatio(0, 1);//from w w w  .ja va 2 s  . c o m
    grid.setColumnExpandRatio(1, 2);

    final Button b = new Button(linkText);
    b.setStyleName("link");
    b.addClickListener(command);
    b.setWidth(100, Unit.PERCENTAGE);

    b.setIcon(icon);
    b.setWidth(100, Unit.PERCENTAGE);

    grid.addComponent(b, 0, 0);
    grid.setComponentAlignment(b, Alignment.MIDDLE_LEFT);

    final Label descriptionLabel = new Label(description);
    descriptionLabel.setWidth(100, Unit.PERCENTAGE);
    grid.addComponent(descriptionLabel, 1, 0);
    grid.setComponentAlignment(descriptionLabel, Alignment.MIDDLE_LEFT);

    panelContent.addComponent(grid);
    panelContent.setComponentAlignment(grid, Alignment.MIDDLE_LEFT);
}

From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java

License:Apache License

protected Button addMenuButton(String type, String label, Resource icon, boolean active, float width) {
    Button button = new Button(label);
    button.addStyleName(type);/*from   w  ww  .j  a  v a 2 s .  co m*/
    button.addStyleName(ExplorerLayout.STYLE_MAIN_MENU_BUTTON);
    button.addStyleName(Reindeer.BUTTON_LINK);
    button.setHeight(54, Unit.PIXELS);
    button.setIcon(icon);
    button.setWidth(width, Unit.PIXELS);

    addComponent(button);
    setComponentAlignment(button, Alignment.TOP_CENTER);

    return button;
}

From source file:com.liferay.vaadin.poc.ui.PortletUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    setContent(layout);//from  w  w w  .  j  a  v a 2  s.c  o  m
    notes = new BeanItemContainer<Note>(Note.class);

    notes.addBean(new Note(noteCounter++, new Date(), "example note"));

    table = new Table("Notes", notes);
    table.setVisibleColumns(new Object[] { "time", "text" });
    table.setPageLength(7);
    table.setBuffered(false);
    table.setSelectable(true);
    table.setWidth(100, Unit.PERCENTAGE);

    textField = new TextField("Text");
    textField.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(textField);

    Button addButton = new Button("Add");
    addButton.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(addButton);
    removeButton = new Button("Remove");
    removeButton.setWidth(100, Unit.PERCENTAGE);
    removeButton.setEnabled(false);
    layout.addComponent(removeButton);

    layout.addComponent(table);

    addButton.addClickListener((event) -> {
        notes.addBean(new Note(noteCounter++, new Date(), textField.getValue()));
    });

    removeButton.addClickListener((event) -> {
        if (selectedNote != null) {
            notes.removeItem(selectedNote);
            selectedNote = null;
        }
        removeButton.setEnabled(selectedNote != null);
    });

    // Handle selection change.
    table.addValueChangeListener((event) -> {
        selectedNote = (Note) table.getValue();
        removeButton.setEnabled(selectedNote != null);
    });
}

From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorViewImpl.java

License:Apache License

private Button initializeButton(final String buttonKey, int tabIndex) {
    Button result = new Button(presenter.translate("button." + buttonKey + ".caption"));
    result.setDescription(presenter.translate("button." + buttonKey + ".description"));
    result.setIcon(FontAwesome.valueOf(presenter.translate("button." + buttonKey + ".icon")));
    result.setWidth(100f, PERCENTAGE);
    result.setTabIndex(tabIndex);//from   w  ww .  j a v  a 2  s  .c o  m

    return result;
}

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

License:Open Source License

public CasesView() {
    super(VIEW_NAME);
    originalViewTitle = getViewTitleLabel().getValue();

    criteria = ViewModelProviders.of(CasesView.class).get(CaseCriteria.class);
    if (criteria.getArchived() == null) {
        criteria.archived(false);/*w  w  w .j a  va  2s  .  c om*/
    }

    grid = new CaseGrid();
    grid.setCriteria(criteria);
    gridLayout = new VerticalLayout();
    gridLayout.addComponent(createFilterBar());
    gridLayout.addComponent(createStatusFilterBar());
    gridLayout.addComponent(grid);
    gridLayout.setMargin(true);
    gridLayout.setSpacing(false);
    gridLayout.setSizeFull();
    gridLayout.setExpandRatio(grid, 1);
    gridLayout.setStyleName("crud-main-layout");

    grid.getDataProvider().addDataProviderListener(e -> updateStatusButtons());

    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_IMPORT)) {
        Button importButton = new Button(I18nProperties.getCaption(Captions.actionImport));
        importButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        importButton.setIcon(VaadinIcons.UPLOAD);
        importButton.addClickListener(e -> {
            Window popupWindow = VaadinUiUtil.showPopupWindow(new CaseImportLayout());
            popupWindow.setCaption(I18nProperties.getString(Strings.headingImportCases));
            popupWindow.addCloseListener(c -> {
                grid.reload();
            });
        });
        addHeaderComponent(importButton);
    }

    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EXPORT)) {
        PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export));
        exportButton.setId("export");
        exportButton.setIcon(VaadinIcons.DOWNLOAD);
        VerticalLayout exportLayout = new VerticalLayout();
        exportLayout.setSpacing(true);
        exportLayout.setMargin(true);
        exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
        exportLayout.setWidth(200, Unit.PIXELS);
        exportButton.setContent(exportLayout);
        addHeaderComponent(exportButton);

        Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic));
        basicExportButton.setId("basicExport");
        basicExportButton.setDescription(I18nProperties.getString(Strings.infoBasicExport));
        basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        basicExportButton.setIcon(VaadinIcons.TABLE);
        basicExportButton.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(basicExportButton);

        StreamResource streamResource = new GridExportStreamResource(grid, "sormas_cases",
                "sormas_cases_" + DateHelper.formatDateForExport(new Date()) + ".csv");
        FileDownloader fileDownloader = new FileDownloader(streamResource);
        fileDownloader.extend(basicExportButton);

        Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed));
        extendedExportButton.setId("extendedExport");
        extendedExportButton.setDescription(I18nProperties.getString(Strings.infoDetailedExport));
        extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        extendedExportButton.setIcon(VaadinIcons.FILE_TEXT);
        extendedExportButton.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(extendedExportButton);

        StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource(
                CaseExportDto.class,
                (Integer start, Integer max) -> FacadeProvider.getCaseFacade()
                        .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max),
                (propertyId, type) -> {
                    String caption = I18nProperties.getPrefixCaption(CaseExportDto.I18N_PREFIX, propertyId,
                            I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId,
                                    I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId,
                                            I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, propertyId,
                                                    I18nProperties.getPrefixCaption(EpiDataDto.I18N_PREFIX,
                                                            propertyId,
                                                            I18nProperties.getPrefixCaption(
                                                                    HospitalizationDto.I18N_PREFIX,
                                                                    propertyId))))));
                    if (Date.class.isAssignableFrom(type)) {
                        caption += " (" + DateHelper.getLocalShortDatePattern() + ")";
                    }
                    return caption;
                }, "sormas_cases_" + DateHelper.formatDateForExport(new Date()) + ".csv");
        new FileDownloader(extendedExportStreamResource).extend(extendedExportButton);

        Button sampleExportButton = new Button(I18nProperties.getCaption(Captions.exportSamples));
        sampleExportButton.setId("sampleExport");
        sampleExportButton.setDescription(I18nProperties.getString(Strings.infoSampleExport));
        sampleExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        sampleExportButton.setIcon(VaadinIcons.FILE_TEXT);
        sampleExportButton.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(sampleExportButton);

        StreamResource sampleExportStreamResource = DownloadUtil.createCsvExportStreamResource(
                SampleExportDto.class,
                (Integer start, Integer max) -> FacadeProvider.getSampleFacade()
                        .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max),
                (propertyId, type) -> {
                    String caption = I18nProperties.getPrefixCaption(SampleExportDto.I18N_PREFIX, propertyId,
                            I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, propertyId,
                                    I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId,
                                            I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId,
                                                    I18nProperties.getPrefixCaption(
                                                            AdditionalTestDto.I18N_PREFIX, propertyId)))));
                    if (Date.class.isAssignableFrom(type)) {
                        caption += " (" + DateHelper.getLocalShortDatePattern() + ")";
                    }
                    return caption;
                }, "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv");
        new FileDownloader(sampleExportStreamResource).extend(sampleExportButton);

        // Warning if no filters have been selected
        Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters), ContentMode.HTML);
        warningLabel.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(warningLabel);
        warningLabel.setVisible(false);

        exportButton.addClickListener(e -> {
            warningLabel.setVisible(!criteria.hasAnyFilterActive());
        });
    }

    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_MERGE)) {
        Button mergeDuplicatesButton = new Button(I18nProperties.getCaption(Captions.caseMergeDuplicates));
        mergeDuplicatesButton.setId("mergeDuplicates");
        mergeDuplicatesButton.setIcon(VaadinIcons.COMPRESS_SQUARE);
        mergeDuplicatesButton
                .addClickListener(e -> ControllerProvider.getCaseController().navigateToMergeCasesView());
        addHeaderComponent(mergeDuplicatesButton);
    }

    if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_CREATE)) {
        createButton = new Button(I18nProperties.getCaption(Captions.caseNewCase));
        createButton.setId("create");
        createButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        createButton.setIcon(VaadinIcons.PLUS_CIRCLE);
        createButton.addClickListener(e -> ControllerProvider.getCaseController().create());
        addHeaderComponent(createButton);
    }

    addComponent(gridLayout);
}

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

License:Open Source License

@SuppressWarnings("unchecked")
private void updateFollowUpStatusComponents() {

    getContent().removeComponent(CANCEL_OR_RESUME_FOLLOW_UP_BTN_LOC);
    getContent().removeComponent(LOST_FOLLOW_UP_BTN_LOC);

    Field<FollowUpStatus> statusField = (Field<FollowUpStatus>) getField(ContactDto.FOLLOW_UP_STATUS);
    boolean followUpVisible = getValue() != null && statusField.isVisible();
    if (followUpVisible && UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EDIT)) {
        FollowUpStatus followUpStatus = statusField.getValue();
        if (followUpStatus == FollowUpStatus.FOLLOW_UP) {

            Button cancelButton = new Button(I18nProperties.getCaption(Captions.contactCancelFollowUp));
            cancelButton.setWidth(100, Unit.PERCENTAGE);
            cancelButton.addClickListener(new ClickListener() {
                @Override/*from  w  w  w.  j  av  a2 s.  c om*/
                public void buttonClick(ClickEvent event) {
                    Field<FollowUpStatus> statusField = (Field<FollowUpStatus>) getField(
                            ContactDto.FOLLOW_UP_STATUS);
                    statusField.setReadOnly(false);
                    statusField.setValue(FollowUpStatus.CANCELED);
                    statusField.setReadOnly(true);
                    updateFollowUpStatusComponents();
                }
            });
            getContent().addComponent(cancelButton, CANCEL_OR_RESUME_FOLLOW_UP_BTN_LOC);

            Button lostButton = new Button(I18nProperties.getCaption(Captions.contactLostToFollowUp));
            lostButton.setWidth(100, Unit.PERCENTAGE);
            lostButton.addClickListener(new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    Field<FollowUpStatus> statusField = (Field<FollowUpStatus>) getField(
                            ContactDto.FOLLOW_UP_STATUS);
                    statusField.setReadOnly(false);
                    statusField.setValue(FollowUpStatus.LOST);
                    statusField.setReadOnly(true);
                    updateFollowUpStatusComponents();
                }
            });
            getContent().addComponent(lostButton, LOST_FOLLOW_UP_BTN_LOC);

        } else if (followUpStatus == FollowUpStatus.CANCELED || followUpStatus == FollowUpStatus.LOST) {

            Button resumeButton = new Button(I18nProperties.getCaption(Captions.contactResumeFollowUp));
            resumeButton.addStyleName(CssStyles.FORCE_CAPTION);
            resumeButton.setWidth(100, Unit.PERCENTAGE);
            resumeButton.addClickListener(new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    Field<FollowUpStatus> statusField = (Field<FollowUpStatus>) getField(
                            ContactDto.FOLLOW_UP_STATUS);
                    statusField.setReadOnly(false);
                    statusField.setValue(FollowUpStatus.FOLLOW_UP);
                    statusField.setReadOnly(true);
                    updateFollowUpStatusComponents();
                }
            });
            getContent().addComponent(resumeButton, CANCEL_OR_RESUME_FOLLOW_UP_BTN_LOC);
        }
    }
}

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

License:Open Source License

public ContactsView() {
    super(VIEW_NAME);

    originalViewTitle = getViewTitleLabel().getValue();

    criteria = ViewModelProviders.of(ContactsView.class).get(ContactCriteria.class);
    if (criteria.getArchived() == null) {
        criteria.archived(false);//w ww  .j  a v a  2s .  c o  m
    }

    grid = new ContactGrid();
    grid.setCriteria(criteria);
    gridLayout = new VerticalLayout();
    gridLayout.addComponent(createFilterBar());
    gridLayout.addComponent(createStatusFilterBar());
    gridLayout.addComponent(grid);
    gridLayout.setMargin(true);
    gridLayout.setSpacing(false);
    gridLayout.setSizeFull();
    gridLayout.setExpandRatio(grid, 1);
    gridLayout.setStyleName("crud-main-layout");
    grid.getDataProvider().addDataProviderListener(e -> updateStatusButtons());

    if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EXPORT)) {

        PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export));
        exportButton.setIcon(VaadinIcons.DOWNLOAD);
        VerticalLayout exportLayout = new VerticalLayout();
        exportLayout.setSpacing(true);
        exportLayout.setMargin(true);
        exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
        exportLayout.setWidth(200, Unit.PIXELS);
        exportButton.setContent(exportLayout);
        addHeaderComponent(exportButton);

        Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic));
        basicExportButton.setDescription(I18nProperties.getDescription(Descriptions.descExportButton));
        basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        basicExportButton.setIcon(VaadinIcons.TABLE);
        basicExportButton.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(basicExportButton);

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

        Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed));
        extendedExportButton
                .setDescription(I18nProperties.getDescription(Descriptions.descDetailedExportButton));
        extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        extendedExportButton.setIcon(VaadinIcons.FILE_TEXT);
        extendedExportButton.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(extendedExportButton);

        StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource(
                ContactExportDto.class,
                (Integer start, Integer max) -> FacadeProvider.getContactFacade()
                        .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max),
                (propertyId, type) -> {
                    String caption = I18nProperties.getPrefixCaption(ContactExportDto.I18N_PREFIX, propertyId,
                            I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, propertyId,
                                    I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId,
                                            I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId,
                                                    I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX,
                                                            propertyId,
                                                            I18nProperties.getPrefixCaption(
                                                                    HospitalizationDto.I18N_PREFIX,
                                                                    propertyId))))));
                    if (Date.class.isAssignableFrom(type)) {
                        caption += " (" + DateHelper.getLocalShortDatePattern() + ")";
                    }
                    return caption;
                }, "sormas_contacts_" + DateHelper.formatDateForExport(new Date()) + ".csv");
        new FileDownloader(extendedExportStreamResource).extend(extendedExportButton);

        // Warning if no filters have been selected
        Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters));
        warningLabel.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(warningLabel);
        warningLabel.setVisible(false);

        exportButton.addClickListener(e -> {
            warningLabel.setVisible(!criteria.hasAnyFilterActive());
        });
    }

    addComponent(gridLayout);
}

From source file:de.symeda.sormas.ui.samples.SamplesView.java

License:Open Source License

public SamplesView() {
    super(VIEW_NAME);

    sampleListComponent = new SampleGridComponent(getViewTitleLabel(), this);
    setSizeFull();/* w  w  w  . j a  va  2s  .  co  m*/
    addComponent(sampleListComponent);

    if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_EXPORT)) {
        PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export));
        exportButton.setIcon(VaadinIcons.DOWNLOAD);
        VerticalLayout exportLayout = new VerticalLayout();
        exportLayout.setSpacing(true);
        exportLayout.setMargin(true);
        exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
        exportLayout.setWidth(200, Unit.PIXELS);
        exportButton.setContent(exportLayout);
        addHeaderComponent(exportButton);

        Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic));
        basicExportButton.setDescription(I18nProperties.getString(Strings.infoBasicExport));
        basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        basicExportButton.setIcon(VaadinIcons.TABLE);
        basicExportButton.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(basicExportButton);

        StreamResource streamResource = new GridExportStreamResource(sampleListComponent.getGrid(),
                "sormas_samples", "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv",
                SampleGrid.EDIT_BTN_ID);
        FileDownloader fileDownloader = new FileDownloader(streamResource);
        fileDownloader.extend(basicExportButton);

        Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed));
        extendedExportButton.setDescription(I18nProperties.getString(Strings.infoDetailedExport));
        extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
        extendedExportButton.setIcon(VaadinIcons.FILE_TEXT);
        extendedExportButton.setWidth(100, Unit.PERCENTAGE);
        exportLayout.addComponent(extendedExportButton);

        StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource(
                SampleExportDto.class,
                (Integer start, Integer max) -> FacadeProvider.getSampleFacade().getExportList(
                        UserProvider.getCurrent().getUuid(), sampleListComponent.getGrid().getCriteria(), start,
                        max),
                (propertyId, type) -> {
                    String caption = I18nProperties.getPrefixCaption(SampleExportDto.I18N_PREFIX, propertyId,
                            I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, propertyId,
                                    I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId,
                                            I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId,
                                                    I18nProperties.getPrefixCaption(
                                                            AdditionalTestDto.I18N_PREFIX, propertyId)))));
                    if (Date.class.isAssignableFrom(type)) {
                        caption += " (" + DateHelper.getLocalShortDatePattern() + ")";
                    }
                    return caption;
                }, "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv");
        new FileDownloader(extendedExportStreamResource).extend(extendedExportButton);
    }
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.process.navigation.NavigationViewImpl.java

License:Open Source License

/**
 * Diese Methode fuegt der Navigation einen Navigationsbutton hinzu und registriert
 * einen passenden ClickListener auf ihn.
 * //  w w  w .  ja  v  a 2 s.  c o  m
 * @param value Der Prozessschritt, der durch den Navigationsbutton repraesentiert werden soll.
 * @author Julius Hacker
 */
@Override
public void addNavigationButton(final NavigationSteps navigationStep) {
    //this.innerlayout.addComponent(arrow);
    Button navigationButton = new Button(navigationStep.getCaption());
    this.navigationButtons.put(navigationStep, navigationButton);

    navigationButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7411091035775152765L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.showStep(navigationStep);
        }
    });

    navigationButton.setEnabled(false);
    navigationButton.setWidth(Sizeable.SIZE_UNDEFINED, 5);
    this.innerlayout.addComponent(navigationButton);
    this.innerlayout.setComponentAlignment(navigationButton, Alignment.BOTTOM_CENTER);

}