Example usage for com.vaadin.ui Button setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:com.esofthead.mycollab.module.project.ui.components.ProjectFollowersComp.java

License:Open Source License

public void displayFollowers(final V bean) {
    this.bean = bean;
    this.removeAllComponents();
    this.withSpacing(true).withMargin(new MarginInfo(false, false, false, true));

    MHorizontalLayout header = new MHorizontalLayout().withSpacing(true);
    Label followerHeader = new Label(
            FontAwesome.EYE.getHtml() + " " + AppContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS),
            ContentMode.HTML);/* w  w w  .ja va  2s .  c o m*/
    followerHeader.setStyleName("info-hdr");
    header.addComponent(followerHeader);

    if (hasEditPermission()) {
        Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        showEditWatchersWindow(bean);

                    }
                });
        editBtn.setStyleName("link");
        editBtn.addStyleName("info-hdr");
        header.addComponent(editBtn);
    }

    this.addComponent(header);
    Label sep = new Label("/");
    sep.setStyleName("info-hdr");
    header.addComponent(sep);

    currentUserFollow = isUserWatching(bean);

    final Button toogleWatching = new Button("");
    toogleWatching.setStyleName("link");
    toogleWatching.addStyleName("info-hdr");
    toogleWatching.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (currentUserFollow) {
                unfollowItem(AppContext.getUsername(), bean);
                currentUserFollow = false;
                toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW));
            } else {
                followItem(AppContext.getUsername(), bean);
                toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW));
                currentUserFollow = true;
            }

            updateTotalFollowers(bean);
        }
    });
    header.addComponent(toogleWatching);

    if (currentUserFollow) {
        toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW));
    } else {
        toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW));
    }

    MVerticalLayout layout = new MVerticalLayout().withWidth("100%").withSpacing(true)
            .withMargin(new MarginInfo(false, false, false, true));
    this.addComponent(layout);

    int totalFollowers = getTotalFollowers(bean);
    followersBtn = new Button(AppContext.getMessage(FollowerI18nEnum.OPT_NUM_FOLLOWERS, totalFollowers),
            new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    if (hasReadPermission()) {
                        showEditWatchersWindow(bean);
                    }

                }
            });
    followersBtn.setStyleName("link");
    layout.addComponent(followersBtn);
}

From source file:com.esofthead.mycollab.module.project.ui.components.TagViewComponent.java

License:Open Source License

private Button createAddTagBtn() {
    final Button addTagBtn = new Button("Add tag", FontAwesome.PLUS_CIRCLE);
    addTagBtn.addClickListener(new Button.ClickListener() {
        @Override/*w w  w .ja va 2s  .  c om*/
        public void buttonClick(Button.ClickEvent clickEvent) {
            TagViewComponent.this.removeComponent(addTagBtn);
            TagViewComponent.this.addComponent(createSaveTagComp());
        }
    });
    addTagBtn.setStyleName("link");
    return addTagBtn;
}

From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogComp.java

License:Open Source License

public void displayTime(final V bean) {
    this.removeAllComponents();
    this.withSpacing(true).withMargin(new MarginInfo(false, false, false, true));

    HorizontalLayout header = new MHorizontalLayout().withSpacing(true).withMargin(false);

    Label dateInfoHeader = new Label(
            FontAwesome.CLOCK_O.getHtml() + " " + AppContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME),
            ContentMode.HTML);//from   ww  w .jav  a 2s  . c o  m
    dateInfoHeader.setStyleName("info-hdr");
    header.addComponent(dateInfoHeader);

    if (hasEditPermission()) {
        Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        showEditTimeWindow(bean);

                    }
                });
        editBtn.setStyleName("link");
        editBtn.addStyleName("info-hdr");
        header.addComponent(editBtn);
    }

    this.addComponent(header);

    MVerticalLayout layout = new MVerticalLayout().withWidth("100%").withSpacing(true)
            .withMargin(new MarginInfo(false, false, false, true));

    double billableHours = getTotalBillableHours(bean);
    double nonBillableHours = getTotalNonBillableHours(bean);
    double remainHours = getRemainedHours(bean);
    layout.addComponent(new Label(
            String.format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS), billableHours)));
    layout.addComponent(new Label(String
            .format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS), nonBillableHours)));
    layout.addComponent(new Label(
            String.format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_REMAIN_HOURS), remainHours)));
    this.addComponent(layout);
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugChartComponent.java

License:Open Source License

private void initUI() {
    final PopupButton bugChartPopup = new PopupButton("");
    bugChartPopup.addStyleName("popuplistindicator");

    final MVerticalLayout filterBtnLayout = new MVerticalLayout().withWidth("200px");

    final Button btnBugByPriority = new Button("Bugs By Priority", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from   w w  w  .j  a  va2  s  .co  m
        public void buttonClick(final ClickEvent event) {
            bugChartPopup.setPopupVisible(false);
            currentReportIndex = 0;
            displayReport();
        }
    });
    btnBugByPriority.setStyleName("link");
    filterBtnLayout.addComponent(btnBugByPriority);

    final Button btnBugByStatus = new Button("Bugs By Status", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            bugChartPopup.setPopupVisible(false);
            currentReportIndex = 1;
            displayReport();
        }
    });
    btnBugByStatus.setStyleName("link");
    filterBtnLayout.addComponent(btnBugByStatus);

    final Button btnBugByResolution = new Button("Bugs By Resolution", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            bugChartPopup.setPopupVisible(false);
            currentReportIndex = 2;
            displayReport();
        }
    });
    btnBugByResolution.setStyleName("link");
    filterBtnLayout.addComponent(btnBugByResolution);

    displayReport();

    bugChartPopup.setContent(filterBtnLayout);
    this.addHeaderElement(bugChartPopup);
    this.setHeaderColor(true);
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugDashboardViewImpl.java

License:Open Source License

private void initHeader() {
    final Label title = new ProjectViewHeader(ProjectTypeConstants.BUG,
            AppContext.getMessage(BugI18nEnum.VIEW_BUG_DASHBOARD_TITLE));
    header.with(title).withAlign(title, Alignment.MIDDLE_LEFT).expand(title);

    final Button createBugBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_BUG),
            new Button.ClickListener() {
                @Override//from   ww w .  j  a v a 2  s. co  m
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null));
                }
            });
    createBugBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    createBugBtn.setIcon(FontAwesome.PLUS);
    final SplitButton controlsBtn = new SplitButton(createBugBtn);
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setWidthUndefined();

    final VerticalLayout btnControlsLayout = new VerticalLayout();
    final Button createComponentBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_COMPONENT),
            new Button.ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    controlsBtn.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new BugComponentEvent.GotoAdd(this, null));
                }
            });
    createComponentBtn.setStyleName("link");
    createComponentBtn
            .setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS));
    btnControlsLayout.addComponent(createComponentBtn);

    final Button createVersionBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_VERSION),
            new Button.ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    controlsBtn.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new BugVersionEvent.GotoAdd(this, null));
                }
            });
    createVersionBtn.setStyleName("link");
    createVersionBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS));
    btnControlsLayout.addComponent(createVersionBtn);

    controlsBtn.setContent(btnControlsLayout);
    header.addComponent(controlsBtn);
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugDisplayWidget.java

License:Open Source License

public void setSearchCriteria(final BugSearchCriteria searchCriteria) {
    this.searchCriteria = searchCriteria;
    if (isDisplayTotalCount) {
        int totalCount = dataList.getTotalCount(searchCriteria);
        String depotTitle = String.format("%s (%d)", title, totalCount);
        this.setTitle(depotTitle);
    }//from  w  w w. j av  a  2s .com
    final SearchRequest<BugSearchCriteria> searchRequest = new SearchRequest<>(searchCriteria, 0,
            BugDisplayWidget.MAX_ITEM_DISPLAY);
    final int displayItemsCount = dataList.setSearchRequest(searchRequest);
    if (displayItemsCount == BugDisplayWidget.MAX_ITEM_DISPLAY) {
        Button moreBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_MORE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        EventBusFactory.getInstance().post(new BugEvent.GotoList(BugDisplayWidget.this,
                                new BugScreenData.Search(constructMoreDisplayFilter())));
                    }
                });
        moreBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        final MVerticalLayout widgetFooter = new MVerticalLayout().withSpacing(false).withWidth("100%");
        widgetFooter.addStyleName("widget-footer");
        widgetFooter.with(moreBtn).withAlign(moreBtn, Alignment.TOP_RIGHT);
        bodyContent.addComponent(widgetFooter);
    }
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugListViewImpl.java

License:Open Source License

private ComponentContainer constructTableActionControls() {
    final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%");

    final Label lbEmpty = new Label("");
    layout.with(lbEmpty).expand(lbEmpty);

    MHorizontalLayout buttonControls = new MHorizontalLayout();
    layout.addComponent(buttonControls);

    Button customizeViewBtn = new Button("", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/* ww w. j a  v a 2 s .c o  m*/
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().addWindow(new BugListCustomizeWindow(BugListView.VIEW_DEF_ID, tableItem));

        }
    });
    customizeViewBtn.setIcon(FontAwesome.COG);
    customizeViewBtn.setDescription("Layout Options");
    customizeViewBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    buttonControls.addComponent(customizeViewBtn);

    PopupButton exportButtonControl = new PopupButton();
    exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK);
    exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK);
    exportButtonControl.setDescription(AppContext.getMessage(FileI18nEnum.EXPORT_FILE));

    VerticalLayout popupButtonsControl = new VerticalLayout();
    exportButtonControl.setContent(popupButtonsControl);

    Button exportPdfBtn = new Button(AppContext.getMessage(FileI18nEnum.PDF));

    StreamWrapperFileDownloader fileDownloader = new StreamWrapperFileDownloader(new StreamResourceFactory() {

        @Override
        public StreamResource getStreamResource() {
            String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null
                    && CurrentProjectVariables.getProject().getName() != null)
                            ? CurrentProjectVariables.getProject().getName()
                            : "");
            BugSearchCriteria searchCriteria = new BugSearchCriteria();
            searchCriteria.setProjectId(
                    new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId()));

            return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title,
                    new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.PDF,
                    ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria, SimpleBug.class),
                    "export.pdf");
        }

    });
    fileDownloader.extend(exportPdfBtn);
    exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
    exportPdfBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportPdfBtn);

    Button exportExcelBtn = new Button(AppContext.getMessage(FileI18nEnum.EXCEL));
    StreamWrapperFileDownloader excelDownloader = new StreamWrapperFileDownloader(new StreamResourceFactory() {

        @Override
        public StreamResource getStreamResource() {
            String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null
                    && CurrentProjectVariables.getProject().getName() != null)
                            ? CurrentProjectVariables.getProject().getName()
                            : "");
            BugSearchCriteria searchCriteria = new BugSearchCriteria();
            searchCriteria.setProjectId(
                    new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId()));

            return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title,
                    new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.EXCEL,
                    ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria, SimpleBug.class),
                    "export.xlsx");
        }
    });
    excelDownloader.extend(exportExcelBtn);
    exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
    exportExcelBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportExcelBtn);

    Button exportCsvBtn = new Button(AppContext.getMessage(FileI18nEnum.CSV));

    StreamWrapperFileDownloader csvFileDownloader = new StreamWrapperFileDownloader(
            new StreamResourceFactory() {

                @Override
                public StreamResource getStreamResource() {
                    String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null
                            && CurrentProjectVariables.getProject().getName() != null)
                                    ? CurrentProjectVariables.getProject().getName()
                                    : "");
                    BugSearchCriteria searchCriteria = new BugSearchCriteria();
                    searchCriteria.setProjectId(new NumberSearchField(SearchField.AND,
                            CurrentProjectVariables.getProject().getId()));

                    return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title,
                            new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.CSV,
                            ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria,
                            SimpleBug.class), "export.csv");
                }
            });
    csvFileDownloader.extend(exportCsvBtn);

    exportCsvBtn.setIcon(FontAwesome.FILE_TEXT_O);
    exportCsvBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportCsvBtn);

    buttonControls.addComponent(exportButtonControl);
    return layout;
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugListWidget.java

License:Open Source License

public BugListWidget(final String title, final String backBtnLabel, final BugSearchCriteria bugSearchCriteria,
        final IBugReportDisplayContainer bugReportDisplayContainer) {
    super(title, new VerticalLayout());

    final VerticalLayout contentLayout = (VerticalLayout) this.bodyContent;
    contentLayout.setSpacing(true);/*from w  w w  .j  a v  a2s  .  c o  m*/
    contentLayout.setWidth("100%");

    final Button backToBugReportsBtn = new Button(backBtnLabel, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            bugReportDisplayContainer.displayBugReports();
        }
    });
    // contentLayout.addComponent(backToBugReportsBtn);
    final VerticalLayout backBtnWrapper = new VerticalLayout();
    backBtnWrapper.setMargin(new MarginInfo(false, false, true, false));

    backToBugReportsBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    backBtnWrapper.addComponent(backToBugReportsBtn);

    this.addComponentAsFirst(backBtnWrapper);

    this.tableItem = new BugTableDisplay(BugTableFieldDef.action,
            Arrays.asList(BugTableFieldDef.summary, BugTableFieldDef.assignUser, BugTableFieldDef.severity,
                    BugTableFieldDef.resolution, BugTableFieldDef.duedate));

    this.tableItem.addTableListener(new TableClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void itemClick(final TableClickEvent event) {
            final SimpleBug bug = (SimpleBug) event.getData();
            if ("summary".equals(event.getFieldName())) {
                EventBusFactory.getInstance().post(new BugEvent.GotoRead(BugListWidget.this, bug.getId()));
            }
        }
    });

    this.tableItem.setWidth("100%");
    contentLayout.addComponent(this.tableItem);

    this.setSearchCriteria(bugSearchCriteria);
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugReadViewImpl.java

License:Open Source License

private void displayWorkflowControl() {
    if (BugStatus.Open.name().equals(this.beanItem.getStatus())
            || BugStatus.ReOpened.name().equals(this.beanItem.getStatus())) {
        this.bugWorkflowControl.removeAllComponents();
        final ButtonGroup navButton = new ButtonGroup();
        final Button startProgressBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_START_PROGRESS),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override//w  ww.j av a  2 s .c  o  m
                    public void buttonClick(final ClickEvent event) {
                        beanItem.setStatus(BugStatus.InProgress.name());
                        final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class);
                        bugService.updateSelectiveWithSession(beanItem, AppContext.getUsername());
                        displayWorkflowControl();
                    }
                });
        startProgressBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(startProgressBtn);

        final Button resolveBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_RESOLVED),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        UI.getCurrent().addWindow(new ResolvedInputWindow(BugReadViewImpl.this, beanItem));
                    }
                });
        resolveBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(resolveBtn);

        final Button wontFixBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_WONTFIX),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        UI.getCurrent().addWindow(new WontFixExplainWindow(BugReadViewImpl.this, beanItem));
                    }
                });
        wontFixBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(wontFixBtn);
        this.bugWorkflowControl.addComponent(navButton);
    } else if (BugStatus.InProgress.name().equals(this.beanItem.getStatus())) {
        this.bugWorkflowControl.removeAllComponents();
        final ButtonGroup navButton = new ButtonGroup();
        final Button stopProgressBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_STOP_PROGRESS),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        beanItem.setStatus(BugStatus.Open.name());
                        final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class);
                        bugService.updateSelectiveWithSession(beanItem, AppContext.getUsername());
                        displayWorkflowControl();
                    }
                });
        stopProgressBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(stopProgressBtn);

        final Button resolveBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_RESOLVED),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        UI.getCurrent().addWindow(new ResolvedInputWindow(BugReadViewImpl.this, beanItem));
                    }
                });
        resolveBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(resolveBtn);
        this.bugWorkflowControl.addComponent(navButton);
    } else if (BugStatus.Verified.name().equals(this.beanItem.getStatus())) {
        this.bugWorkflowControl.removeAllComponents();
        final ButtonGroup navButton = new ButtonGroup();
        final Button reopenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        UI.getCurrent().addWindow(new ReOpenWindow(BugReadViewImpl.this, beanItem));
                    }
                });
        reopenBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(reopenBtn);

        this.bugWorkflowControl.addComponent(navButton);
    } else if (BugStatus.Resolved.name().equals(this.beanItem.getStatus())) {
        this.bugWorkflowControl.removeAllComponents();
        final ButtonGroup navButton = new ButtonGroup();
        final Button reopenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        UI.getCurrent().addWindow(new ReOpenWindow(BugReadViewImpl.this, beanItem));
                    }
                });
        reopenBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(reopenBtn);

        final Button approveNCloseBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_APPROVE_CLOSE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        UI.getCurrent().addWindow(new ApproveInputWindow(BugReadViewImpl.this, beanItem));
                    }
                });
        approveNCloseBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(approveNCloseBtn);
        this.bugWorkflowControl.addComponent(navButton);
    } else if (BugStatus.Resolved.name().equals(this.beanItem.getStatus())) {
        this.bugWorkflowControl.removeAllComponents();
        final ButtonGroup navButton = new ButtonGroup();
        final Button reopenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        UI.getCurrent().addWindow(new ReOpenWindow(BugReadViewImpl.this, beanItem));
                    }
                });
        reopenBtn.setStyleName(UIConstants.THEME_BROWN_LINK);
        navButton.addButton(reopenBtn);

        this.bugWorkflowControl.addComponent(navButton);
    }
    this.bugWorkflowControl.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createButtonControls() {
    ProjectPreviewFormControlsGenerator<SimpleBug> bugPreviewFormControls = new ProjectPreviewFormControlsGenerator<>(
            previewForm);/*from   ww w .ja  va2  s . c om*/
    MButton linkBtn = new MButton("Link", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            UI.getCurrent().addWindow(new LinkIssueWindow(beanItem));
        }
    }).withIcon(FontAwesome.LINK);
    linkBtn.addStyleName("black");
    bugPreviewFormControls.addOptionButton(linkBtn);

    final HorizontalLayout topPanel = bugPreviewFormControls.createButtonControls(
            ProjectPreviewFormControlsGenerator.ADD_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED,
            ProjectRolePermissionCollections.BUGS);

    final Button assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    UI.getCurrent().addWindow(new AssignBugWindow(BugReadViewImpl.this, beanItem));
                }
            });
    assignBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    assignBtn.setIcon(FontAwesome.SHARE);

    assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    this.bugWorkflowControl = new HorizontalLayout();
    this.bugWorkflowControl.setMargin(false);
    this.bugWorkflowControl.addStyleName("workflow-controls");

    bugPreviewFormControls.insertToControlBlock(bugWorkflowControl);
    bugPreviewFormControls.insertToControlBlock(assignBtn);
    topPanel.setSizeUndefined();

    return topPanel;
}