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.mycompany.exodious.login.java

public login() {
    this.setId("loginPanel");
    this.setSpacing(true);
    Image logo = new Image();
    logo.setId("logo");
    logo.setSource(slikaLogo);//from ww w  .j  av a  2 s.  co m
    logo.setHeight("18em");
    logo.setWidth("30em");
    Label welcome = new Label("Welcome, please login");
    welcome.setId("welcome");
    TextField username = new TextField("Your ID");
    PasswordField password = new PasswordField("Password");
    Button submit = new Button("Login");
    submit.setIcon(FontAwesome.SIGN_IN);
    submit.addStyleName(ValoTheme.BUTTON_PRIMARY);

    submit.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {

        }
    });

    addComponents(logo, welcome, username, password, submit);
    setComponentAlignment(logo, Alignment.MIDDLE_CENTER);
    setComponentAlignment(welcome, Alignment.MIDDLE_CENTER);
    setComponentAlignment(username, Alignment.MIDDLE_CENTER);
    setComponentAlignment(password, Alignment.MIDDLE_CENTER);
    setComponentAlignment(submit, Alignment.MIDDLE_CENTER);
}

From source file:com.mycompany.perfectphone.start.java

public start() {

    Label title = new Label("Find Your Perfect Smartphone");
    title.setId("title");
    Label welcome = new Label("Welcome to DaX's Perfect Smartphone Finder");
    welcome.setId("welcome");
    Button start = new Button("Start");

    start.setIcon(FontAwesome.SIGN_IN);//from  ww  w. j  a  va2 s.  c  o  m

    start.addStyleName(ValoTheme.BUTTON_PRIMARY);

    Label question1 = new Label("Do you like big screen?");
    OptionGroup answer1 = new OptionGroup();
    Button next = new Button("Continue");

    addComponents(title, question1, answer1, next);

    setComponentAlignment(question1, Alignment.TOP_CENTER);

    setComponentAlignment(answer1, Alignment.TOP_CENTER);

    setComponentAlignment(next, Alignment.TOP_CENTER);
}

From source file:com.naoset.framework.frontend.component.profile.CustomerEditWindowView.java

private Component builtButton() {

    HorizontalLayout hLayout = new HorizontalLayout();

    Button bSave = new Button("Guardar");
    Button bCancel = new Button("Cancelar");

    bSave.addStyleName(ValoTheme.BUTTON_PRIMARY);
    bSave.addClickListener(new Button.ClickListener() {

        @Override/*  w  w  w .ja  v a2 s  . c  o m*/
        public void buttonClick(Button.ClickEvent event) {

        }
    });

    hLayout.addComponent(bSave);
    hLayout.addComponent(bCancel);

    return hLayout;
}

From source file:com.naoset.framework.frontend.view.window.DialogWindow.java

public void setFooterButtons(DialogButton... buttons) {
    footer.removeAllComponents();//from   w  w w .j av a2s. c  om

    HorizontalLayout innerLayout = new HorizontalLayout();
    innerLayout.setSpacing(true);
    footer.addComponent(innerLayout);
    footer.setComponentAlignment(innerLayout, Alignment.TOP_RIGHT);

    for (DialogButton button : buttons) {
        Button btn = new Button();
        if (button.equals(DialogButton.OK)) {
            btn.setCaption("OK");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonOKClicked();
                }
            });
            okButton = btn;
        }
        if (button.equals(DialogButton.CANCEL)) {
            btn.setCaption("CANCEL");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonCancelClicked();
                }
            });
            cancelButton = btn;
        }
        if (button.equals(DialogButton.YES)) {
            btn.setCaption("YES");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonYesClicked();
                }
            });
            yesButton = btn;
        }
        if (button.equals(DialogButton.NO)) {
            btn.setCaption("NO");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonNoClicked();
                }
            });
            noButton = btn;
        }
        if (button.equals(DialogButton.CLOSE)) {
            btn.setCaption("CLOSE");
            btn.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    onButtonCloseClicked();
                }
            });
            closeButton = btn;
        }
        innerLayout.addComponent(btn);
    }

}

From source file:com.naoset.framework.frontend.view.window.Window.java

private HorizontalLayout buildFooter() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    layout.setWidth(100.0f, Unit.PERCENTAGE);

    //Si el objeto a mostrar hereda de Widget, mostraremos su cabecera con el men en la ventana.
    if (Widget.class.isInstance(body)) {
        //if (details.getClass().isInstance(Widget.class)) {
        Widget aux = (Widget) body;/*ww  w . java 2 s .c  o m*/
        HorizontalLayout header = aux.getHeader();
        header.setWidth(100.0f, Unit.PERCENTAGE);
        layout.addComponent(header);
        //layout.setComponentAlignment(header, Alignment.TOP_LEFT);
        layout.setExpandRatio(header, 1);
    }

    Button ok = new Button("Cerrar");
    ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
    ok.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            Boolean canClose = true;
            if (Widget.class.isInstance(body)) {
                Widget aux = (Widget) body;
                canClose = !aux.isModified();
            }
            if (canClose) {
                close();
            } else {

                buildConfirmCloseDialog();

            }

        }
    });
    ok.focus();
    layout.addComponent(ok);
    layout.setComponentAlignment(ok, Alignment.TOP_RIGHT);
    return layout;
}

From source file:com.piccritic.website.user.UserForm.java

public void configureComponents() {
    save.setStyleName(ValoTheme.BUTTON_PRIMARY);
}

From source file:com.save.client.promodeals.PDDataGridProperties.java

Window delete(Object itemId, int promoId) {
    Window sub = new Window("REMOVE PROMO DEAL");
    sub.setWidth("250px");
    sub.setModal(true);//w ww  . j a va 2s  . com
    sub.center();

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

    Button delBtn = new Button("CONFIRM DELETE?", (Button.ClickEvent event) -> {
        boolean result = pds.delete(promoId, "removed");
        getContainerDataSource().removeItem(itemId);
        sub.close();
    });
    delBtn.setWidth("100%");
    delBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    delBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    v.addComponent(delBtn);

    sub.setContent(v);
    return sub;
}

From source file:com.save.employee.maintenance.MRDataGridProperties.java

Window deletConfirmationWindow(int mrId, Object itemId) {
    Window sub = new Window();
    sub.setCaption("CONFIRM DELETE");
    sub.setWidth("250px");
    sub.setModal(true);/*from w w w. j a v a2  s. co m*/

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

    Button deleteBtn = new Button("DELETE?");
    deleteBtn.setWidth("100%");
    deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    deleteBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = mrs.removeMaintenanceReimbursement(mrId);
        if (result) {
            getContainerDataSource().removeItem(itemId);
            sub.close();
        }
    });
    v.addComponent(deleteBtn);

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

From source file:com.save.employee.maintenance.MRFormWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);/* w ww. ja  v a2  s.  co  m*/

    formType = CommonComboBox.getFormType("Select Form Type..");
    formType.setValue(1);
    formType.setWidth("60%");
    form.addComponent(formType);

    area = CommonComboBox.areas();
    area.setWidth("60%");
    form.addComponent(area);

    plateNo = new TextField("Plate No: ");
    plateNo.setWidth("60%");
    form.addComponent(plateNo);

    dateCovered = new DateField("Date Covered: ");
    dateCovered.setWidth("60%");
    form.addComponent(dateCovered);

    amount = new TextField("Amount: ");
    amount.setWidth("60%");
    amount.addStyleName("align-right");
    form.addComponent(amount);

    description = new TextArea("Description: ");
    description.setWidth("100%");
    description.setRows(3);
    form.addComponent(description);

    actionButton = new Button();
    actionButton.setCaption("SAVE");
    actionButton.setWidth("100%");
    actionButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    actionButton.addClickListener(buttonClickListener);
    form.addComponent(actionButton);

    formType.addValueChangeListener((Property.ValueChangeEvent e) -> {
        if (e.getProperty().getValue().toString().equals("1")) {
            if (getMrId() != 0) {
                actionButton.setCaption("UPDATE");
            } else {
                actionButton.setCaption("SAVE");
            }
            panel.setCaption("MAINTENANCE FORM");
        } else {
            if (getMrId() != 0) {
                actionButton.setCaption("UPDATE");
            } else {
                actionButton.setCaption("SAVE");
            }
            panel.setCaption("REIMBURSEMENT FORM");
        }
    });

    editForm();
    viewForm(form);

    return form;
}

From source file:com.save.employee.request.RequestFormWindow.java

Component buildRequestForm() {
    GridLayout glayout = new GridLayout(4, 7);
    glayout.setSizeFull();/*  w ww  . ja v  a  2  s.  co  m*/
    glayout.setSpacing(true);
    glayout.setMargin(true);

    controlNo = new TextField("Control No.");
    controlNo.setWidth("100%");
    controlNo.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    glayout.addComponent(controlNo, 0, 0);

    dateOfActivity = new DateField("Date of Activity: ");
    dateOfActivity.setWidth("100%");
    dateOfActivity.addStyleName(ValoTheme.DATEFIELD_SMALL);
    glayout.addComponent(dateOfActivity, 1, 0);

    area = CommonComboBox.areas();
    area.setWidth("100%");
    glayout.addComponent(area, 2, 0);

    activity = new TextField("Activity: ");
    activity.setWidth("100%");
    activity.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    glayout.addComponent(activity, 0, 1, 1, 1);

    venue = new TextField("Venue: ");
    venue.setWidth("100%");
    venue.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    glayout.addComponent(venue, 0, 2, 1, 2);

    requirements = new TextArea("Requirements: ");
    requirements.setWidth("100%");
    requirements.addStyleName(ValoTheme.TEXTAREA_SMALL);
    glayout.addComponent(requirements, 2, 1, 3, 2);

    Label lodging = new Label("Lodging: ");
    lodging.setWidthUndefined();
    glayout.addComponent(lodging, 0, 3);
    glayout.setComponentAlignment(lodging, Alignment.MIDDLE_CENTER);

    lodgingPax = new TextField("Pax: ");
    lodgingPax.setWidth("100%");
    lodgingPax.setValue("0");
    lodgingPax.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    lodgingPax.addStyleName("align-right");
    glayout.addComponent(lodgingPax, 1, 3);

    lodgingAmount = new TextField("Amount: ");
    lodgingAmount.setWidth("100%");
    lodgingAmount.setValue("0.00");
    lodgingAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    lodgingAmount.addStyleName("align-right");
    lodgingAmount.setEnabled(false);
    lodgingAmount.setImmediate(true);
    glayout.addComponent(lodgingAmount, 3, 3);

    lodgingBudget = new TextField("Budget: ");
    lodgingBudget.setWidth("100%");
    lodgingBudget.setValue("0.00");
    lodgingBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    lodgingBudget.addStyleName("align-right");
    lodgingBudget.addValueChangeListener((ValueChangeEvent event) -> {
        if (!CommonUtilities.checkInputIfInteger(lodgingPax.getValue().trim())) {
            Notification.show("Enter a numeric value for Pax", Notification.Type.ERROR_MESSAGE);
            return;
        }

        if (!CommonUtilities.checkInputIfDouble(lodgingBudget.getValue().trim())) {
            Notification.show("Enter a numeric value for Budget", Notification.Type.ERROR_MESSAGE);
            return;
        }

        lodgingAmount.setValue(String.valueOf(CommonUtilities.convertStringToInt(lodgingPax.getValue().trim())
                * CommonUtilities.convertStringToDouble(lodgingBudget.getValue().trim())));
    });
    lodgingBudget.setImmediate(true);
    glayout.addComponent(lodgingBudget, 2, 3);

    Label meals = new Label("Meals: ");
    meals.setWidthUndefined();
    glayout.addComponent(meals, 0, 4);
    glayout.setComponentAlignment(meals, Alignment.MIDDLE_CENTER);

    mealsPax = new TextField("Pax: ");
    mealsPax.setWidth("100%");
    mealsPax.setValue("0");
    mealsPax.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    mealsPax.addStyleName("align-right");
    glayout.addComponent(mealsPax, 1, 4);

    mealsAmount = new TextField("Amount: ");
    mealsAmount.setWidth("100%");
    mealsAmount.setValue("0.00");
    mealsAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    mealsAmount.addStyleName("align-right");
    mealsAmount.setEnabled(false);
    mealsAmount.setImmediate(liquidated);
    glayout.addComponent(mealsAmount, 3, 4);

    mealsBudget = new TextField("Budget: ");
    mealsBudget.setWidth("100%");
    mealsBudget.setValue("0.00");
    mealsBudget.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    mealsBudget.addStyleName("align-right");
    mealsBudget.addValueChangeListener((ValueChangeEvent event) -> {
        if (!CommonUtilities.checkInputIfInteger(mealsPax.getValue().trim())) {
            Notification.show("Enter a numeric value for Pax", Notification.Type.ERROR_MESSAGE);
            return;
        }

        if (!CommonUtilities.checkInputIfDouble(mealsBudget.getValue().trim())) {
            Notification.show("Enter a numeric value for Budget", Notification.Type.ERROR_MESSAGE);
            return;
        }

        mealsAmount.setValue(String.valueOf(CommonUtilities.convertStringToInt(mealsPax.getValue().trim())
                * CommonUtilities.convertStringToDouble(mealsBudget.getValue().trim())));
    });
    mealsAmount.setImmediate(true);
    glayout.addComponent(mealsBudget, 2, 4);

    others = new TextArea("Others: ");
    others.setWidth("100%");
    others.setRows(3);
    others.addStyleName(ValoTheme.TEXTAREA_SMALL);
    glayout.addComponent(others, 0, 5, 2, 6);

    othersAmount = new TextField("Amount: ");
    othersAmount.setWidth("100%");
    othersAmount.setValue("0.00");
    othersAmount.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    othersAmount.addStyleName("align-right");
    glayout.addComponent(othersAmount, 3, 5);
    glayout.setComponentAlignment(othersAmount, Alignment.TOP_CENTER);

    Button rlButton = new Button();
    rlButton.setCaption("SAVE");
    rlButton.setWidth("100%");
    rlButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    rlButton.addStyleName(ValoTheme.BUTTON_SMALL);
    rlButton.addClickListener(buttonClickListener);
    glayout.addComponent(rlButton, 3, 6);
    glayout.setComponentAlignment(rlButton, Alignment.TOP_CENTER);

    if (getRequestId() != 0) {
        LiquidationForm lf = rls.getRLById(getRequestId());
        controlNo.setValue(String.valueOf(lf.getControlNo()));
        dateOfActivity.setValue(lf.getDateOfActivity());
        area.setValue(lf.getAreaId());
        activity.setValue(lf.getActivity());
        requirements.setValue(lf.getRequirements());
        venue.setValue(lf.getVenue());
        others.setValue(lf.getOthersRemarks());
        othersAmount.setValue(String.valueOf(lf.getOthersAmount()));
        lodgingAmount.setValue(String.valueOf(lf.getLodgingAmount()));
        mealsAmount.setValue(String.valueOf(lf.getMealsAmount()));
        if (getLiquidated() == true) {
            setCaption("LIQUIDATE FROM");
            rlButton.setCaption("LIQUIDATE");
            controlNo.setReadOnly(liquidated);
            dateOfActivity.setReadOnly(liquidated);
            area.setReadOnly(liquidated);
            activity.setReadOnly(liquidated);
            requirements.setReadOnly(liquidated);
            venue.setReadOnly(liquidated);
        } else {
            rlButton.setCaption("EDIT");
            lodgingPax.setValue(String.valueOf(lf.getLodgingPax()));
            lodgingBudget.setValue(String.valueOf(lf.getLodgingBudget()));
            mealsPax.setValue(String.valueOf(lf.getMealsPax()));
            mealsBudget.setValue(String.valueOf(lf.getMealsBudget()));
            rlButton.setEnabled(rls.getRLById(getRequestId()).getLiquidated() == 0);
        }
        //            delete.setVisible(true);
    }

    return glayout;
}