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.mycollab.module.project.view.user.ProjectPagedList.java

License:Open Source License

@Override
protected MHorizontalLayout createPageControls() {
    MHorizontalLayout pageControls = super.createPageControls();
    if (pageControls != null) {
        Button browseProjectsBtn = new Button(UserUIContext.getMessage(ProjectI18nEnum.ACTION_BROWSE),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoList(this, null)));
        browseProjectsBtn.addStyleName(WebThemes.BUTTON_LINK);
        pageControls.addComponent(browseProjectsBtn, 0);
        pageControls.setComponentAlignment(browseProjectsBtn, Alignment.MIDDLE_LEFT);
    }/*  ww  w.  j a va2  s .co m*/
    return pageControls;
}

From source file:com.mycollab.module.user.accountsettings.team.view.NewUserAddedWindow.java

License:Open Source License

public NewUserAddedWindow(final SimpleUser user, String uncryptPassword) {
    super(UserUIContext.getMessage(UserI18nEnum.NEW));
    MVerticalLayout content = new MVerticalLayout();
    this.withModal(true).withResizable(false).withClosable(false).withCenter().withWidth("600px")
            .withContent(content);//  ww  w .  jav a 2 s  .  c o m

    ELabel infoLbl = ELabel.html(FontAwesome.CHECK_CIRCLE.getHtml()
            + UserUIContext.getMessage(UserI18nEnum.OPT_NEW_USER_CREATED, user.getDisplayName()));
    content.with(infoLbl);

    String signinInstruction = UserUIContext.getMessage(UserI18nEnum.OPT_SIGN_IN_MSG, MyCollabUI.getSiteUrl(),
            MyCollabUI.getSiteUrl());
    content.with(new MVerticalLayout(new Label(signinInstruction, ContentMode.HTML),
            new ELabel(UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL))
                    .withStyleName(UIConstants.META_INFO),
            new Label("    " + user.getUsername()),
            new ELabel(UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD))
                    .withStyleName(UIConstants.META_INFO),
            new Label("    " + (uncryptPassword != null ? uncryptPassword
                    : UserUIContext.getMessage(UserI18nEnum.OPT_USER_SET_OWN_PASSWORD)))));

    content.with(new ELabel(UserUIContext.getMessage(GenericI18Enum.HELP_SPAM_FILTER_PREVENT_MESSAGE))
            .withStyleName(UIConstants.META_INFO));

    Button createMoreUserBtn = new Button(UserUIContext.getMessage(UserI18nEnum.OPT_CREATE_ANOTHER_USER),
            clickEvent -> {
                EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null));
                close();
            });
    createMoreUserBtn.addStyleName(WebThemes.BUTTON_LINK);

    Button doneBtn = new Button(UserUIContext.getMessage(GenericI18Enum.ACTION_DONE), clickEvent -> {
        EventBusFactory.getInstance().post(new UserEvent.GotoList(this, null));
        close();
    });
    doneBtn.addStyleName(WebThemes.BUTTON_ACTION);
    MHorizontalLayout buttonControls = new MHorizontalLayout(createMoreUserBtn, doneBtn).withFullWidth()
            .withAlign(createMoreUserBtn, Alignment.MIDDLE_LEFT).withAlign(doneBtn, Alignment.MIDDLE_RIGHT);
    content.with(buttonControls);
}

From source file:com.mycollab.shell.view.components.NoSubDomainExistedWindow.java

License:Open Source License

public NoSubDomainExistedWindow(final String domain) {
    this.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    final Label titleIcon = ELabel.fontIcon(FontAwesome.EXCLAMATION_CIRCLE)
            .withStyleName("warning-icon", ValoTheme.LABEL_NO_MARGIN).withWidthUndefined();

    Label warningMsg = new ELabel(UserUIContext.getMessage(ShellI18nEnum.ERROR_NO_SUB_DOMAIN, domain))
            .withWidthUndefined();//from  w  ww  . ja  v a 2 s .  com

    Button backToHome = new Button(UserUIContext.getMessage(ShellI18nEnum.BUTTON_BACK_TO_HOME_PAGE),
            clickEvent -> getUI().getPage().setLocation("https://www.mycollab.com"));
    backToHome.addStyleName(WebThemes.BUTTON_ACTION);
    this.with(titleIcon, warningMsg, backToHome);
}

From source file:com.mycollab.vaadin.web.ui.SplitButton.java

License:Open Source License

public SplitButton(Button parentButton) {
    this.setImmediate(true);
    HorizontalLayout contentLayout = new HorizontalLayout();
    contentLayout.setStyleName("splitbutton");
    this.parentButton = parentButton;
    parentButton.addStyleName("parent-button");
    parentButton.setImmediate(true);//from w w  w  . ja v  a 2 s . c om
    parentButton.addClickListener(clickEvent -> fireEvent(new SplitButtonClickEvent(SplitButton.this)));

    popupButton = new PopupButton();
    popupButton.addClickListener(clickEvent -> {
        isPopupVisible = !isPopupVisible;
        fireEvent(new SplitButtonPopupVisibilityEvent(SplitButton.this, isPopupVisible));
    });

    contentLayout.addComponent(parentButton);
    contentLayout.addComponent(popupButton);

    this.setCompositionRoot(contentLayout);
}

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);/*  w ww . j  a va 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);//ww w .  ja v  a2s.  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/*from  w  ww.j a v  a  2  s .com*/
        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();// ww  w  . j a v  a 2s .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;//w  w w. j a  v a2  s. c  om
        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.neatresults.mgnltweaks.app.status.ConfigStatusViewImpl.java

License:Open Source License

@Override
public void build() {
    Component totalExtends = buildAndBind(ConfigStatusView.EXTENDS_COUNT,
            translator.translate("neatconfiguration.app.status.extendscount"));
    Component absoluteExtends = buildAndBind(ConfigStatusView.ABS_EXTENDS_COUNT,
            translator.translate("neatconfiguration.app.status.absoluteextendscount"));
    Component relativeExtends = buildAndBind(ConfigStatusView.REL_EXTENDS_COUNT,
            translator.translate("neatconfiguration.app.status.relativeextendscount"));
    Component overrideExtends = buildAndBind(ConfigStatusView.OVR_EXTENDS_COUNT,
            translator.translate("neatconfiguration.app.status.overrideextendscount"));
    Component unresolvedExtends = buildAndBind(ConfigStatusView.EXTENDS_FAIL_COUNT,
            translator.translate("neatconfiguration.app.status.extendsfailcount"));
    Component unresolvedExtendsList = buildAndBindList(ConfigStatusView.EXTENDS_FAIL_LIST,
            translator.translate("neatconfiguration.app.status.extendsfaillist"));
    unresolvedExtendsList.addStyleName("neat-extends-list");

    // top title/*from  w  w w .  j  a va  2  s  .  com*/
    FormLayout layout = new FormLayout();
    Label sectionTitle = new Label(translator.translate("neatconfiguration.app.status.top.title"));
    sectionTitle.addStyleName("section-title");
    layout.addComponent(sectionTitle);
    root.addSection(layout);

    // extends
    layout = new FormLayout();
    layout.addComponent(
            createFieldsetTitle(translator.translate("neatconfiguration.app.status.extends.title")));
    layout.addComponent(totalExtends);
    layout.addComponent(absoluteExtends);
    layout.addComponent(relativeExtends);
    layout.addComponent(overrideExtends);
    layout.addComponent(unresolvedExtends);
    layout.addComponent(unresolvedExtendsList);
    root.addSection(layout);

    // refresh
    layout = new FormLayout();
    Button refreshButton = new Button(translator.translate("neatconfiguration.app.status.refresh.caption"));
    refreshButton.addStyleName("v-button-smallapp");
    refreshButton.addStyleName("commit");
    refreshButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            getListener().refreshData();
            refresh();
        }
    });
    layout.addComponent(refreshButton);
    root.addSection(layout);
}