Example usage for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY.

Prototype

String BUTTON_PRIMARY

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_PRIMARY.

Click Source Link

Document

Primary action button (e.g.

Usage

From source file:com.github.fbhd.view.MainView.java

private void createButtons() {
    buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);//from  w  ww .jav a  2  s . co  m

    Button btnLogin = new Button("Login");
    btnLogin.setStyleName(ValoTheme.BUTTON_PRIMARY);

    btnLogin.addClickListener((Button.ClickEvent event) -> {
        doLogin();
    });

    Button btnCancel = new Button("Cancel");

    btnCancel.addClickListener((Button.ClickEvent event) -> {

    });

    buttonLayout.addComponents(btnLogin, btnCancel);
    mainLayout.addComponent(buttonLayout);
}

From source file:com.github.fbhd.view.TicketView.java

private void createButtons() {
    buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);//from  ww  w. j  a va 2  s  .c o m

    Button btnSubmit = new Button("Submit");
    btnSubmit.setStyleName(ValoTheme.BUTTON_PRIMARY);

    btnSubmit.addClickListener((Button.ClickEvent event) -> {
        persistAndContinue(ConfirmationView.VIEW_NAME);
    });

    Button btnCancel = new Button("Cancel");

    btnCancel.addClickListener((Button.ClickEvent event) -> {

    });

    buttonLayout.addComponents(btnSubmit, btnCancel);
    mainLayout.addComponent(buttonLayout);
}

From source file:com.gmail.volodymyrdotsenko.cms.fe.vaadin.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    langRepo.findAll().forEach(e -> {
        langSet.add(e.getCode());//w  w  w.j  a  v  a2s.c  o m
    });

    lang = new ComboBox("Language", langSet);

    getPage().setTitle("CMS");

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();

    loginForm.addComponent(userName = new TextField("Username"));
    userName.setRequired(true);
    loginForm.addComponent(passwordField = new PasswordField("Password"));
    passwordField.setRequired(true);
    loginForm.addComponent(rememberMe = new CheckBox("Remember me"));
    loginForm.addComponent(lang);
    lang.setRequired(true);
    lang.setNullSelectionAllowed(false);
    loginForm.addComponent(login = new Button("Login"));
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(e -> {
        login();
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    if (request.getParameter("logout") != null) {
        loggedOutLabel = new Label("You have been logged out!");
        loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
        loggedOutLabel.setSizeUndefined();
        loginLayout.addComponent(loggedOutLabel);
        loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    }

    loginLayout.addComponent(loginFailedLabel = new Label());
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();

    String currentLang = getLocale().getLanguage();
    if (langSet.contains(currentLang))
        lang.select(currentLang);
    else
        lang.select("en");
}

From source file:com.hris.payroll.alphalist.AlphaListMainUI.java

private Button alphaListButton() {
    alphaListBtn.setWidth("200px");
    alphaListBtn.setIcon(FontAwesome.SPINNER);
    alphaListBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    alphaListBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    alphaListBtn.setDisableOnClick(true);
    alphaListBtn.addClickListener((Button.ClickEvent event) -> {
        status.setValue(" Loading... ");
        current = 1.0;/*from  w ww  .j  a  va 2s. c  o  m*/
        dataSize = es.findEmployeeByBranchForAlphaList(getBranchId(), employmentStatus.getValue().toString(),
                CommonUtil.convertStringToInteger(year.getValue().toString())).size();

        List<EmployeePersonalInformation> employeeLists = es.findEmployeeByBranchForAlphaList(getBranchId(),
                employmentStatus.getValue().toString(),
                CommonUtil.convertStringToInteger(year.getValue().toString()));
        if (employeeLists.isEmpty()) {
            Notification.show("NO DATA FOUND!!!", Notification.Type.WARNING_MESSAGE);
            alphaListBtn.setEnabled(true);
            return;
        }

        populateDataGrid();
    });

    return alphaListBtn;
}

From source file:com.hris.payroll.alphalist.AlphaListMainUI.java

private Button exportToExcelButton() {
    ExportDataGridToExcel exportGrid = new ExportDataGridToExcel(grid);

    exportToExcelButton.setEnabled(false);
    exportToExcelButton.setWidth("200px");
    exportToExcelButton.setIcon(FontAwesome.EXCLAMATION_CIRCLE);
    exportToExcelButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    exportToExcelButton.addStyleName(ValoTheme.BUTTON_SMALL);
    exportToExcelButton.addClickListener((Button.ClickEvent e) -> {
        exportGrid.workSheet();/*from w  w w  .  ja  va2  s . c om*/

        StreamResource.StreamSource source = () -> {
            try {
                File f = new File(exportGrid.getFilePath());
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e1) {
                e1.getMessage();
                return null;
            }
        };

        Date date = new Date();
        String branchName = cs.getBranchById(getBranchId());
        int tradeId = cs.getTradeIdByBranchId(getBranchId());
        String tradeName = cs.getTradeById(tradeId);
        int corporateId = cs.getCorporateIdByTradeId(tradeId);
        String corporateName = cs.getCorporateById(corporateId);

        StreamResource resource = new StreamResource(source, "AlphaList-" + corporateName + "-" + tradeName
                + "-" + branchName + "-" + date.getTime() + ".xls");
        resource.setMIMEType("application/vnd.ms-office");

        Page.getCurrent().open(resource, null, false);
    });

    return exportToExcelButton;
}

From source file:com.hris.payroll.reports.ReportUI.java

private Button viewReportBtn() {
    viewReport.setWidth("200px");
    viewReport.setIcon(FontAwesome.EXCLAMATION_CIRCLE);
    viewReport.addStyleName(ValoTheme.BUTTON_PRIMARY);
    viewReport.addStyleName(ValoTheme.BUTTON_SMALL);
    viewReport.addClickListener((Button.ClickEvent e) -> {
        if (getBranchId() == 0) {
            Notification.show("Select a Branch!!!", Notification.Type.WARNING_MESSAGE);
            return;
        }/*from   w  w  w  .ja  va2  s .  c  o  m*/

        if (getPayrollDate() == null) {
            Notification.show("Select a Payroll Date!!!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        Window sub = new ReportViewer(reportType.getValue().toString(), getBranchId(), payrollDate.getValue());
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
        //            switch(reportType.getValue().toString()){                
        //                case "Payslip" : {                    
        //                    if(sub.getParent() == null){
        //                        UI.getCurrent().addWindow(sub);
        //                    }
        //                    break;        
        //                }
        //                        
        //                case "Advances Summary" : {
        //                    
        //                }
        //                
        //                default: {
        //                    if(sub.getParent() == null){
        //                        UI.getCurrent().addWindow(sub);
        //                        grid.setContainerDataSource(
        //                                new PayrollAdvancesContainer(
        //                                        getBranchId(), 
        //                                        payrollDate.getValue(), 
        //                                        reportType.getValue().toString()));
        //                        removeComponent(grid);
        //                        addComponent(grid);
        //                        setExpandRatio(grid, 2);
        //                    }
        //                }                
        //            }
    });

    return viewReport;
}

From source file:com.hris.payroll.thirteenthmonth.ThirteenthMonth.java

private Button generate13thMonth() {
    Button button = new Button("13th MONTH");
    button.setWidth("200px");
    button.setIcon(FontAwesome.SPINNER);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        status.setValue(" Loading...");
        current = 1.0;/*  ww w . j av a  2  s  .co m*/
        dataSize = es.findEmployeeByBranch(getBranchId(), employmentStatus.getValue().toString(),
                CommonUtil.convertStringToInteger(year.getValue().toString())).size();

        populateDataGrid();
    });

    return button;
}

From source file:com.hris.payroll.thirteenthmonth.ThirteenthMonth.java

private Button exportToExcelButton() {
    exportToExcelButton.setWidth("200px");
    exportToExcelButton.setIcon(FontAwesome.EXCLAMATION_CIRCLE);
    exportToExcelButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    exportToExcelButton.addStyleName(ValoTheme.BUTTON_SMALL);
    exportToExcelButton.addClickListener((Button.ClickEvent e) -> {
        ExportDataGridToExcel exportGrid = new ExportDataGridToExcel(grid);
        exportGrid.workSheet();/*from w w w.ja va2s .  c om*/

        StreamResource.StreamSource source = () -> {
            try {
                File f = new File(exportGrid.getFilePath());
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e1) {
                e1.getMessage();
                return null;
            }
        };

        Date date = new Date();
        String branchName = cs.getBranchById(getBranchId());
        int tradeId = cs.getTradeIdByBranchId(getBranchId());
        String tradeName = cs.getTradeById(tradeId);
        int corporateId = cs.getCorporateIdByTradeId(tradeId);
        String corporateName = cs.getCorporateById(corporateId);

        StreamResource resource = new StreamResource(source, "ThirteenthMonth-" + corporateName + "-"
                + tradeName + "-" + branchName + "-" + date.getTime() + ".xls");
        resource.setMIMEType("application/vnd.ms-office");

        Page.getCurrent().open(resource, null, false);
    });

    return exportToExcelButton;
}

From source file:com.hybridbpm.ui.component.bpm.CaseLayout.java

License:Apache License

public CaseLayout(String caseId) {
    this.caseId = caseId;

    Responsive.makeResponsive(this);
    btnDelete.setIcon(FontAwesome.TIMES);
    btnTerminate.setIcon(FontAwesome.STOP);
    btnTerminate.setStyleName(ValoTheme.BUTTON_PRIMARY);

    buttonBar.setWidth(100, Unit.PERCENTAGE);
    buttonBar.setSpacing(true);/*from  w w w . j av a 2 s  . co m*/
    buttonBar.addStyleName("toolbar");
    buttonBar.setExpandRatio(btnDelete, 1f);
    buttonBar.setComponentAlignment(btnDelete, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnTerminate, Alignment.MIDDLE_RIGHT);

    tabSheet.setStyleName(ValoTheme.TABSHEET_FRAMED);
    tabSheet.setSizeFull();

    setSizeFull();
    setSpacing(true);
    addComponent(caseFormHeader);
    addComponent(tabSheet);
    addComponent(buttonBar);
    setExpandRatio(tabSheet, 1f);

    loadForm();
}

From source file:com.hybridbpm.ui.component.bpm.TaskLayout.java

License:Apache License

public TaskLayout(String taskId, String processName, String taskName, boolean showHeader) {
    this.taskId = taskId;
    this.processName = processName;
    this.taskName = taskName;
    this.showHeader = showHeader;

    Responsive.makeResponsive(this);
    btnAccept.setIcon(FontAwesome.CHECK);
    btnEscalate.setIcon(FontAwesome.ARROW_UP);
    btnDelegate.setIcon(FontAwesome.ARROW_DOWN);
    btnSchedule.setIcon(FontAwesome.CALENDAR);
    btnSave.setIcon(FontAwesome.SAVE);//from  ww w  .  ja  v  a2 s  .c om
    btnSend.setIcon(FontAwesome.SEND);
    //        btnClose.setIcon(FontAwesome.TIMES);

    btnSend.setStyleName(ValoTheme.BUTTON_PRIMARY);

    btnAccept.addStyleName(ValoTheme.BUTTON_SMALL);
    btnEscalate.addStyleName(ValoTheme.BUTTON_SMALL);
    btnDelegate.addStyleName(ValoTheme.BUTTON_SMALL);
    btnSchedule.addStyleName(ValoTheme.BUTTON_SMALL);
    btnSave.addStyleName(ValoTheme.BUTTON_SMALL);
    btnSend.addStyleName(ValoTheme.BUTTON_SMALL);
    btnClose.addStyleName(ValoTheme.BUTTON_SMALL);

    priorityMenubar.setStyleName(ValoTheme.MENUBAR_SMALL);

    //        buttonBar.setWidth(100, Unit.PERCENTAGE);
    buttonBar.setSpacing(true);
    buttonBar.addStyleName("toolbar");
    //        buttonBar.setExpandRatio(btnAccept, 1f);
    //        buttonBar.setComponentAlignment(priorityMenubar, Alignment.MIDDLE_LEFT);
    buttonBar.setComponentAlignment(btnAccept, Alignment.MIDDLE_RIGHT);
    //        buttonBar.setComponentAlignment(btnEscalate, Alignment.MIDDLE_RIGHT);
    //        buttonBar.setComponentAlignment(btnDelegate, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnSchedule, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnSave, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnSend, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);

    tabSheet.setStyleName(ValoTheme.TABSHEET_COMPACT_TABBAR);
    tabSheet.setStyleName(ValoTheme.TABSHEET_FRAMED);
    tabSheet.setSizeFull();

    setSizeFull();
    setSpacing(true);
    if (showHeader) {
        addComponent(taskFormHeader);
    }
    addComponent(buttonBar);
    setComponentAlignment(buttonBar, Alignment.MIDDLE_RIGHT);
    addComponent(tabSheet);
    setExpandRatio(tabSheet, 1f);
    loadForm();
}