Example usage for com.vaadin.ui Button Button

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

Introduction

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

Prototype

public Button(Resource icon, ClickListener listener) 

Source Link

Document

Creates a new push button with a click listener.

Usage

From source file:com.esofthead.mycollab.module.project.view.page.PageReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createButtonControls() {
    ProjectPreviewFormControlsGenerator<Page> pagesPreviewForm = new ProjectPreviewFormControlsGenerator<>(
            previewForm);//  w  w w. j  ava  2 s .  c om
    final HorizontalLayout topPanel = pagesPreviewForm.createButtonControls(
            ProjectPreviewFormControlsGenerator.ADD_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED,
            ProjectRolePermissionCollections.PAGES);

    exportPdfBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF),
            FontAwesome.EXTERNAL_LINK);
    exportPdfBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    FileDownloader fileDownloader = new FileDownloader(getPDFStream());
    fileDownloader.extend(exportPdfBtn);

    pagesPreviewForm.insertToControlBlock(exportPdfBtn);

    return topPanel;
}

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

License:Open Source License

public ProjectBreadcrumb() {
    this.setShowAnimationSpeed(Breadcrumb.AnimSpeed.SLOW);
    this.setHideAnimationSpeed(Breadcrumb.AnimSpeed.SLOW);
    this.setUseDefaultClickBehaviour(false);
    homeBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/* w  w w .j  av a  2s . com*/
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this,
                    new PageActionChain(new ProjectScreenData.Goto(project.getId()))));
        }
    });
    this.addLink(homeBtn);
}

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

License:Open Source License

public void gotoMessage(Message message) {
    this.select(0);
    this.addLink(new Button(AppContext.getMessage(BreadcrumbI18nEnum.MESSAGES), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*w  w  w. ja  v  a2  s.  c  o  m*/
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new MessageEvent.GotoList(this, null));
        }
    }));
    this.setLinkEnabled(true, 1);
    this.addLink(generateBreadcrumbLink(message.getTitle()));
    AppContext.addFragment(ProjectLinkGenerator.generateMessagePreviewLink(project.getId(), message.getId()),
            AppContext.getMessage(BreadcrumbI18nEnum.FRA_MESSAGE_READ, message.getTitle()));
}

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

License:Open Source License

public void gotoRiskRead(Risk risk) {
    this.select(0);
    this.addLink(new Button(AppContext.getMessage(BreadcrumbI18nEnum.RISKS), new GotoRiskListListener()));
    this.setLinkEnabled(true, 1);
    this.addLink(generateBreadcrumbLink(risk.getRiskname()));
    AppContext.addFragment(ProjectLinkGenerator.generateRiskPreviewLink(project.getId(), risk.getId()),
            AppContext.getMessage(BreadcrumbI18nEnum.FRA_RISK_READ, risk.getRiskname()));
}

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

License:Open Source License

public void gotoRiskEdit(final Risk risk) {
    this.select(0);
    this.addLink(new Button(AppContext.getMessage(BreadcrumbI18nEnum.RISKS), new GotoRiskListListener()));
    this.setLinkEnabled(true, 1);
    this.addLink(generateBreadcrumbLink(risk.getRiskname(), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from www .j  av a 2 s.  c o m
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new RiskEvent.GotoRead(this, risk.getId()));
        }
    }));
    this.addLink(new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT)));
    AppContext.addFragment(ProjectLinkGenerator.generateRiskEditLink(project.getId(), risk.getId()),
            AppContext.getMessage(BreadcrumbI18nEnum.FRA_RISK_EDIT, risk.getRiskname()));
}

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

License:Open Source License

public void gotoRiskAdd() {
    this.select(0);
    this.addLink(new Button(AppContext.getMessage(BreadcrumbI18nEnum.RISKS), new GotoRiskListListener()));
    this.setLinkEnabled(true, 1);
    this.addLink(new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD)));
    AppContext.addFragment(ProjectLinkGenerator.generateRiskAddLink(project.getId()),
            AppContext.getMessage(BreadcrumbI18nEnum.FRA_RISK_NEW));
}

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

License:Open Source License

public void gotoMilestoneRead(Milestone milestone) {
    this.select(0);
    this.addLink(new Button(AppContext.getMessage(BreadcrumbI18nEnum.PHASES), new GotoMilestoneListListener()));
    this.setLinkEnabled(true, 1);
    this.addLink(generateBreadcrumbLink(milestone.getName()));
    AppContext.addFragment(/*from   w  ww  . j a  v  a  2  s .  c  om*/
            ProjectLinkGenerator.generateMilestonePreviewLink(project.getId(), milestone.getId()),
            AppContext.getMessage(BreadcrumbI18nEnum.FRA_PHASE_READ, milestone.getName()));
}

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

License:Open Source License

public void gotoMilestoneEdit(final Milestone milestone) {
    this.select(0);
    this.addLink(new Button(AppContext.getMessage(BreadcrumbI18nEnum.PHASES), new GotoMilestoneListListener()));
    this.setLinkEnabled(true, 1);
    this.addLink(generateBreadcrumbLink(milestone.getName(), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/* ww w  .jav  a2s .com*/
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new MilestoneEvent.GotoRead(this, milestone.getId()));
        }
    }));
    this.addLink(new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT)));
    AppContext.addFragment(
            "project/milestone/edit/" + UrlEncodeDecoder.encode(project.getId() + "/" + milestone.getId()),
            AppContext.getMessage(BreadcrumbI18nEnum.FRA_PHASE_EDIT, milestone.getName()));
}

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

License:Open Source License

public void gotoMilestoneAdd() {
    this.select(0);
    this.addLink(new Button(AppContext.getMessage(BreadcrumbI18nEnum.PHASES), new GotoMilestoneListListener()));
    this.setLinkEnabled(true, 1);
    this.addLink(new Button(AppContext.getMessage(MilestoneI18nEnum.VIEW_NEW_TITLE)));
    AppContext.addFragment("project/milestone/add/" + UrlEncodeDecoder.encode(project.getId()),
            AppContext.getMessage(BreadcrumbI18nEnum.FRA_PHASE_NEW));
}

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

License:Open Source License

private void buildPageBreadcrumbChain() {
    String basePath = CurrentProjectVariables.getBasePagePath();
    String currentPath = CurrentProjectVariables.getCurrentPagePath();

    this.addLink(
            new Button(AppContext.getMessage(BreadcrumbI18nEnum.PAGES), new GotoPageListListener(basePath)));
    this.setLinkEnabled(true, 1);

    String extraPath = currentPath.substring(basePath.length());
    if (extraPath.startsWith("/")) {
        extraPath = extraPath.substring(1);
    }//  w  w  w .j  ava2s . c  o m
    if (!extraPath.equals("")) {
        PageService wikiService = ApplicationContextUtil.getSpringBean(PageService.class);

        String[] subPath = extraPath.split("/");
        StringBuffer tempPath = new StringBuffer();
        for (String var : subPath) {
            tempPath.append("/").append(var);
            String folderPath = basePath + tempPath.toString();
            Folder folder = wikiService.getFolder(folderPath);
            if (folder != null) {
                this.addLink(new Button(folder.getName(), new GotoPageListListener(folderPath)));
            } else {
                return;
            }

        }
    }
}