Example usage for com.vaadin.ui Button addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.etest.view.tq.TQCoverageWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);//from www.j  a va 2 s.c  o  m

    int itemNo = 1;
    Label caseTopic;
    Label stem;
    Map<Integer, Map<Integer, Integer>> tqCoverage = tq.getTQCoverage(getTQCoverageId());
    for (Map.Entry<Integer, Map<Integer, Integer>> tqCases : tqCoverage.entrySet()) {
        Integer tqCaseId = tqCases.getKey();

        caseTopic = new Label();
        caseTopic.setValue(ccs.getCellCaseById(tqCaseId).getCaseTopic());
        caseTopic.setContentMode(ContentMode.HTML);
        form.addComponent(caseTopic);

        Map<Integer, Integer> value = tqCases.getValue();
        for (Map.Entry<Integer, Integer> itemIds : value.entrySet()) {
            Integer itemId = itemIds.getKey();
            Integer itemKeyId = itemIds.getValue();

            List<String> keyList = k.getAllItemKey(itemId);
            if (keyList.isEmpty()) {
                ShowErrorNotification
                        .error("No Item Key was found for STEM: \n" + cis.getCellItemById(itemId).getItem());
                return null;
            }

            stem = new Label();
            //                stem.setValue(itemNo+". "+cis.getCellItemById(itemId).getItem().replace("{key}", keyList.get(0)));
            stem.setValue(itemNo + ". "
                    + cis.getCellItemById(itemId).getItem().replace("{key}", k.getItemKeyById(itemKeyId)));
            stem.setContentMode(ContentMode.HTML);
            form.addComponent(stem);

            GridLayout glayout = new GridLayout(2, 2);
            glayout.setWidth("100%");
            glayout.setSpacing(true);

            glayout.addComponent(new Label("A) " + cis.getCellItemById(itemId).getOptionA(), ContentMode.HTML),
                    0, 0);
            glayout.addComponent(new Label("C) " + cis.getCellItemById(itemId).getOptionC(), ContentMode.HTML),
                    0, 1);
            glayout.addComponent(new Label("B) " + cis.getCellItemById(itemId).getOptionB(), ContentMode.HTML),
                    1, 0);
            glayout.addComponent(new Label("D) " + cis.getCellItemById(itemId).getOptionD(), ContentMode.HTML),
                    1, 1);
            form.addComponent(glayout);

            itemNo++;
        }
    }

    HorizontalLayout h = new HorizontalLayout();
    h.setWidth("100%");

    Button delete = new Button("DELETE");
    delete.setWidth("200px");
    delete.setIcon(FontAwesome.TRASH_O);
    delete.addStyleName(ValoTheme.BUTTON_PRIMARY);
    delete.addStyleName(ValoTheme.BUTTON_SMALL);
    delete.addClickListener(buttonClickListener);
    h.addComponent(delete);

    Button approve = new Button("APPROVE");
    approve.setWidth("200px");
    approve.setIcon(FontAwesome.THUMBS_UP);
    approve.addStyleName(ValoTheme.BUTTON_PRIMARY);
    approve.addStyleName(ValoTheme.BUTTON_SMALL);
    approve.addClickListener(buttonClickListener);
    h.addComponent(approve);

    if (tq.isTQCoverageApproved(getTQCoverageId())) {
        approve.setVisible(false);
    } else {
        approve.setVisible(true);
    }

    form.addComponent(h);

    return form;
}

From source file:com.etest.view.tq.TQCoverageWindow.java

Window confirmDeleteWindow() {
    Window sub = new Window("TQ Coverage");
    sub.setWidth("250px");
    sub.setResizable(false);/*  w  w  w .  j av a 2 s .  c  om*/
    sub.setModal(true);
    sub.center();

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);

    Button delete = new Button("DELETE TQ?");
    delete.setWidth("100%");
    delete.setIcon(FontAwesome.TRASH_O);
    delete.addStyleName(ValoTheme.BUTTON_PRIMARY);
    delete.addStyleName(ValoTheme.BUTTON_SMALL);
    delete.addClickListener((Button.ClickEvent event) -> {
        boolean result = tq.deleteTQCoverage(getTQCoverageId());
        if (result) {
            sub.close();
            close();
        }
    });
    v.addComponent(delete);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.etest.view.tq.TQListUI.java

public Table populateDataTable() {
    removeAllItems();/*from  w ww .  ja v a 2 s.c  o  m*/
    int i = 0;
    for (TQCoverage t : tq.getAllTQCoverage()) {
        VerticalLayout v = new VerticalLayout();
        v.setWidth("100%");

        Button view = new Button("view");
        view.setSizeFull();
        view.setData(t.getTqCoverageId());
        view.setIcon(FontAwesome.VIDEO_CAMERA);
        view.addStyleName(ValoTheme.BUTTON_LINK);
        view.addStyleName(ValoTheme.BUTTON_TINY);
        view.addStyleName(ValoTheme.BUTTON_QUIET);
        view.addStyleName("button-container");
        view.addClickListener(remarksBtnClickListener);
        v.addComponent(view);
        v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);

        Button approve = new Button("status");
        approve.setSizeFull();
        approve.setData(t.getTqCoverageId());
        approve.addStyleName(ValoTheme.BUTTON_LINK);
        approve.addStyleName(ValoTheme.BUTTON_TINY);
        approve.addStyleName(ValoTheme.BUTTON_QUIET);
        approve.addStyleName("button-container");
        v.addComponent(approve);
        v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT);

        //            Button print = new Button("print");
        //            print.setSizeFull();
        //            print.setData(t.getTqCoverageId());  
        //            print.setIcon(FontAwesome.PRINT);
        //            print.addStyleName(ValoTheme.BUTTON_LINK);
        //            print.addStyleName(ValoTheme.BUTTON_TINY);
        //            print.addStyleName(ValoTheme.BUTTON_QUIET);
        //            print.addStyleName("button-container");
        //            print.addClickListener(remarksBtnClickListener);
        //            v.addComponent(print);
        //            v.setComponentAlignment(print, Alignment.MIDDLE_LEFT);

        if (t.getStatus() == 0) {
            approve.setIcon(FontAwesome.THUMBS_DOWN);
            //                print.setVisible(false);
        } else {
            approve.setIcon(FontAwesome.THUMBS_UP);
            //                print.setVisible(true);
        }

        addItem(new Object[] { t.getExamTitle(), cs.getCurriculumById(t.getCurriculumId()).getSubject(),
                t.getDateCreated(), t.getTotalHoursCoverage(), t.getTotalItems(), v }, i);
        i++;
    }
    setPageLength(size());

    return this;
}

From source file:com.expressui.core.view.export.ExportForm.java

License:Open Source License

@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);//from w  w  w  . jav a2 s .  c  o  m
    footerLayout.setMargin(true);

    Button closeButton = new Button(uiMessageSource.getMessage("exportForm.close"), this, "close");
    closeButton.setDescription(uiMessageSource.getToolTip("exportForm.close.toolTip"));
    closeButton.setIcon(new ThemeResource("../expressui/icons/16/delete.png"));
    closeButton.addStyleName("small default");
    footerLayout.addComponent(closeButton);

    exportButton = new Button(uiMessageSource.getMessage("exportForm.export"));
    exportButton.setDescription(uiMessageSource.getToolTip("exportForm.export.toolTip"));
    exportButton.setIcon(new ThemeResource("../expressui/icons/16/excel.bmp"));
    exportButton.addStyleName("small default");
    footerLayout.addComponent(exportButton);
}

From source file:com.expressui.core.view.form.ResultsConnectedEntityForm.java

License:Open Source License

private HorizontalLayout createNavigationFormLayout() {
    HorizontalLayout navigationFormLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout");
    navigationFormLayout.setDebugId(id);
    navigationFormLayout.setSizeUndefined();

    VerticalLayout previousButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout");
    previousButtonLayout.setDebugId(id);

    previousButtonLayout.setSizeUndefined();
    previousButtonLayout.setMargin(false);
    previousButtonLayout.setSpacing(false);
    Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();//from ww w .j a  va 2 s. c o  m
    previousButtonLayout.addComponent(spaceLabel);

    Button previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png"));

    if (entityForm.getViewableToManyRelationships().size() == 0) {
        HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout();
        id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout,
                "previousButtonHorizontalLayout");
        previousButtonHorizontalLayout.setDebugId(id);
        previousButtonHorizontalLayout.setSizeUndefined();
        Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        horizontalSpaceLabel.setSizeUndefined();
        previousButtonHorizontalLayout.addComponent(previousButton);
        previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
        previousButtonLayout.addComponent(previousButtonHorizontalLayout);
    } else {
        previousButtonLayout.addComponent(previousButton);
    }

    navigationFormLayout.addComponent(previousButtonLayout);
    navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT);

    navigationFormLayout.addComponent(entityForm);

    VerticalLayout nextButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout");
    nextButtonLayout.setDebugId(id);
    nextButtonLayout.setSizeUndefined();
    nextButtonLayout.setMargin(false);
    nextButtonLayout.setSpacing(false);
    spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);
    nextButtonLayout.addComponent(spaceLabel);

    Button nextButton = new Button(null, this, "nextItem");
    nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png"));

    HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout");
    nextButtonHorizontalLayout.setDebugId(id);
    nextButtonHorizontalLayout.setSizeUndefined();
    Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
    horizontalSpaceLabel.setSizeUndefined();
    nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
    nextButtonHorizontalLayout.addComponent(nextButton);

    nextButtonLayout.addComponent(nextButtonHorizontalLayout);
    navigationFormLayout.addComponent(nextButtonLayout);
    navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT);

    navigationFormLayout.setSpacing(false);
    navigationFormLayout.setMargin(false);

    return navigationFormLayout;
}

From source file:com.expressui.core.view.form.SearchForm.java

License:Open Source License

@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);/*from ww w .j  ava2s .co  m*/
    footerLayout.setMargin(true);

    Button clearButton = new Button(uiMessageSource.getMessage("searchForm.clear"), this, "clear");
    clearButton.setDescription(uiMessageSource.getToolTip("searchForm.clear.toolTip"));
    clearButton.setIcon(new ThemeResource("../expressui/icons/16/clear.png"));
    clearButton.addStyleName("small default");
    footerLayout.addComponent(clearButton);

    Button searchButton = new Button(uiMessageSource.getMessage("searchForm.search"), this, "search");
    searchButton.setDescription(uiMessageSource.getToolTip("searchForm.search.toolTip"));
    searchButton.setIcon(new ThemeResource("../expressui/icons/16/search.png"));
    searchButton.addStyleName("small default");
    footerLayout.addComponent(searchButton);
}

From source file:com.expressui.core.view.results.Results.java

License:Open Source License

private HorizontalLayout createNavigationLine() {

    HorizontalLayout resultCountDisplay = new HorizontalLayout();
    setDebugId(resultCountDisplay, "resultCountDisplay");
    firstResultTextField = createFirstResultTextField();
    firstResultTextField.addStyleName("small");
    firstResultTextField.setSizeUndefined();
    resultCountDisplay.addComponent(firstResultTextField);
    resultCountLabel = new Label("", Label.CONTENT_XHTML);
    resultCountLabel.setSizeUndefined();
    resultCountLabel.addStyleName("small");
    resultCountDisplay.addComponent(resultCountLabel);

    Label spaceLabel = new Label(" &nbsp; ", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();/*from w  ww .ja v a 2  s . c o  m*/
    resultCountDisplay.addComponent(spaceLabel);

    Button refreshButton = new Button(null, getResultsTable(), "refresh");
    refreshButton.setDescription(uiMessageSource.getToolTip("results.refresh.toolTip"));
    refreshButton.setSizeUndefined();
    refreshButton.addStyleName("borderless");
    refreshButton.setIcon(new ThemeResource("../expressui/icons/16/refresh-blue.png"));
    resultCountDisplay.addComponent(refreshButton);

    HorizontalLayout navigationButtons = new HorizontalLayout();
    setDebugId(navigationButtons, "navigationButtons");
    navigationButtons.setMargin(false, true, false, false);
    navigationButtons.setSpacing(true);

    String perPageText = uiMessageSource.getMessage("results.pageSize");
    pageSizeMenu = new Select();
    pageSizeMenu.addStyleName("small");
    List<Integer> pageSizeOptions = applicationProperties.getPageSizeOptions();
    for (Integer pageSizeOption : pageSizeOptions) {
        pageSizeMenu.addItem(pageSizeOption);
        pageSizeMenu.setItemCaption(pageSizeOption, pageSizeOption + " " + perPageText);
    }
    pageSizeMenu.setFilteringMode(Select.FILTERINGMODE_OFF);
    pageSizeMenu.setNewItemsAllowed(false);
    pageSizeMenu.setNullSelectionAllowed(false);
    pageSizeMenu.setImmediate(true);
    pageSizeMenu.setWidth(8, UNITS_EM);
    navigationButtons.addComponent(pageSizeMenu);

    firstButton = new Button(null, getResultsTable(), "firstPage");
    firstButton.setDescription(uiMessageSource.getToolTip("results.first.toolTip"));
    firstButton.setSizeUndefined();
    firstButton.addStyleName("borderless");
    firstButton.setIcon(new ThemeResource("../expressui/icons/16/first.png"));
    navigationButtons.addComponent(firstButton);

    previousButton = new Button(null, getResultsTable(), "previousPage");
    previousButton.setDescription(uiMessageSource.getToolTip("results.previous.toolTip"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png"));
    navigationButtons.addComponent(previousButton);

    nextButton = new Button(null, getResultsTable(), "nextPage");
    nextButton.setDescription(uiMessageSource.getToolTip("results.next.toolTip"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png"));
    navigationButtons.addComponent(nextButton);

    lastButton = new Button(null, getResultsTable(), "lastPage");
    lastButton.setDescription(uiMessageSource.getToolTip("results.last.toolTip"));
    lastButton.setSizeUndefined();
    lastButton.addStyleName("borderless");
    lastButton.setIcon(new ThemeResource("../expressui/icons/16/last.png"));
    navigationButtons.addComponent(lastButton);

    excelButton = new Button(null, this, "openExportForm");
    excelButton.setDescription(uiMessageSource.getToolTip("results.excel.toolTip"));
    excelButton.setSizeUndefined();
    excelButton.addStyleName("borderless");
    excelButton.setIcon(new ThemeResource("../expressui/icons/16/excel.bmp"));
    navigationButtons.addComponent(excelButton);
    exportForm.setExportButtonListener(this, "exportToExcel");

    HorizontalLayout navigationLine = new HorizontalLayout();
    setDebugId(navigationLine, "navigationLine");
    navigationLine.setSizeUndefined();
    navigationLine.setMargin(true, false, true, false);

    navigationLine.addComponent(resultCountDisplay);
    navigationLine.setComponentAlignment(resultCountDisplay, Alignment.BOTTOM_LEFT);

    spaceLabel = new Label("", Label.CONTENT_XHTML);
    spaceLabel.setWidth(2, Sizeable.UNITS_EM);
    navigationLine.addComponent(spaceLabel);

    navigationLine.addComponent(navigationButtons);
    navigationLine.setComponentAlignment(navigationButtons, Alignment.BOTTOM_RIGHT);

    return navigationLine;
}

From source file:com.fnc.view.ui.AlphaListMainUI.java

Button alphaListButton() {
    Button button = new Button("ALPHA LIST");
    button.setWidth("100%");
    button.setIcon(FontAwesome.SPINNER);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        status.setValue(" Loading...");
        current = 0.0;/*from   w w  w .  j  av a  2 s . c o  m*/
        dataSize = es.getEmployeeByBranch(getBranchId()).size();
        populateDataGrid();
    });

    return button;
}

From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java

Button button() {
    Button button = new Button("ALPHA LIST");
    button.setWidth("100%");
    button.setIcon(FontAwesome.SPINNER);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        status.setValue(" Loading...");
        current = 0.0;/* w w w  .  j a v a2 s . c  o m*/
        //            dataSize = es.getEmployeeByBranch(getBranchId()).size();
        //            populateDataGrid();
    });

    return button;
}

From source file:com.freebox.engeneering.application.web.layout.HeaderController.java

License:Apache License

/**
 * Loads data into the form when system enters 'loadData' state.
 *
 * @param event -  the state event.//from   ww w.  j a va 2  s .c  om
 */
@SuppressWarnings("rawtypes")
@OnEnterState(StateConstants.PROFILE)
public void buildHeader(StateEvent event) {
    clearView(event);
    HorizontalLayout top = super.getView();
    final Label title = new Label("My Freebox Manager");
    title.setSizeUndefined();
    title.addStyleName("h1");
    top.addComponent(title);
    top.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    top.setExpandRatio(title, 1);

    Button notify = new Button();
    notify.setDescription("Notifications");
    notify.addStyleName("notifications");
    notify.addStyleName("unread");
    notify.addStyleName("icon-only");
    notify.addStyleName("icon-bell");
    top.addComponent(notify);
    top.setComponentAlignment(notify, Alignment.MIDDLE_LEFT);

    Button edit = new Button();
    edit.addStyleName("icon-edit");
    edit.addStyleName("icon-only");
    edit.setDescription("Edit Dashboard");
    top.addComponent(edit);
    top.setComponentAlignment(edit, Alignment.MIDDLE_LEFT);

    Button downloadB = new Button();
    downloadB.addStyleName("icon-edit");
    downloadB.addStyleName("icon-only");
    downloadB.setDescription("Tlcharger un fichier");
    top.addComponent(downloadB);
    top.setComponentAlignment(downloadB, Alignment.MIDDLE_LEFT);

}