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.selzlein.lojavirtual.vaadin.core.NavigationMenu.java

License:Open Source License

private void buildTopMenu() {
    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    final Label title = new Label("<h3>LSPS <strong>ProcessApplication</strong></h3>", ContentMode.HTML);
    title.setSizeUndefined();//from   ww  w .ja  va 2  s . c om
    top.addComponent(title);
    top.setExpandRatio(title, 1);
    this.addComponent(top);

    final NavigationMenu menuWrapp = this;
    final Button showMenu = new Button("Menu", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuWrapp.getStyleName().contains("valo-menu-visible")) {
                menuWrapp.removeStyleName("valo-menu-visible");
            } else {
                menuWrapp.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    this.addComponent(showMenu);
}

From source file:com.selzlein.lojavirtual.vaadin.core.NavigationMenu.java

License:Open Source License

/**
 * Sets active menu item based on current viewId
 * //from   w ww .  ja  v  a2s .c  om
 * @param viewId
 */
public void setActiveMenuItem(String viewId) {
    Button button = menuItems.get(viewId);
    if (button == null) {
        return;
    }
    if (activeItem != null) {
        activeItem.removeStyleName("selected");
    }
    button.addStyleName("selected");
    activeItem = button;
}

From source file:com.terralcode.frontend.vista.widgets.listados.ListadoAlumnosView.java

private Component buildTable() {
    containerAlumnos = new BeanItemContainer<>(Alumno.class);

    table = new Table();
    table.setContainerDataSource(containerAlumnos);
    table.addGeneratedColumn("details", new Table.ColumnGenerator() {

        @Override//  w w  w .j a  va 2  s  . c om
        public Object generateCell(Table source, Object itemId, Object columnId) {
            Button detailsButton = new Button(FontAwesome.EYE);
            detailsButton.addStyleName(ValoTheme.BUTTON_SMALL);
            //detailsButton.setCaption(((CustomerCRM) itemId).getCode());
            detailsButton.addClickListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    alumnoVista.open((Alumno) itemId);
                }
            });
            return detailsButton;
        }
    });
    table.setColumnHeader("nombre", "");
    table.setColumnWidth("nombre", 60);
    table.setColumnHeader("apellido1", "apellido");
    table.setColumnExpandRatio("nombre", 1);
    table.setColumnHeader("apellido2", "Apellido");
    //table.setColumnHeader("companyTaxCode", "CIF");
    table.setVisibleColumns(new Object[] { "nombre", "apellido1", "apellido2" });
    //table.setVisibleColumns(new Object[]{"details", "name", "mainContactInfo", "companyTaxCode"});
    table.setSizeFull();

    //addButtonAtTable(allCustomer);
    return table;
}

From source file:com.terralcode.gestion.frontend.view.panel.species.SpeciesPanel.java

private void refreshBind() {
    layout.removeAllComponents();//from w  w  w.  ja  v  a2  s.  c o  m
    //        this.customer.getSpecies().forEach(sp -> addElement(sp));

    for (Species species : this.customer.getSpecies()) {
        Button newElement = new Button(species.getName());
        newElement.addStyleName(ValoTheme.BUTTON_BORDERLESS);
        layout.addComponent(newElement);
    }

    addElementToolbar();
}

From source file:com.terralcode.gestion.frontend.view.panel.species.SpeciesPanel.java

private void addElementToolbar() {
    Button newElement = new Button("", FontAwesome.ELLIPSIS_H);
    newElement.addStyleName(ValoTheme.BUTTON_LINK);
    newElement.addClickListener(new Button.ClickListener() {

        @Override/*from  www .jav a  2 s  .com*/
        public void buttonClick(Button.ClickEvent event) {
            openElementSelector();
            refreshBind();
        }
    });
    layout.addComponent(newElement);
}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentComplaintsPanel.java

private void addComplaintToolbar() {
    Button newComplaint = new Button("", FontAwesome.PLUS);
    newComplaint.addStyleName(ValoTheme.BUTTON_LINK);
    newComplaint.addClickListener(new Button.ClickListener() {

        @Override//from   w ww .j  ava 2s .c  om
        public void buttonClick(Button.ClickEvent event) {
            Complaint newComplaint = new Complaint();
            newComplaint.setAppointment(appointment);
            appointment.getComplaints().add(newComplaint);
            openComplaintWindow(newComplaint);
        }
    });
    layout.addComponent(newComplaint);
}

From source file:com.toptal.ui.view.LoginView.java

License:Open Source License

/**
 * Generates content.//from   ww  w .  jav a2 s  .  c  om
 * @return Content.
 */
private Component content() {
    final HorizontalLayout content = new HorizontalLayout();
    content.setSpacing(true);
    this.username = new TextField("Username");
    this.username.setIcon(FontAwesome.USER);
    this.username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    this.password = new PasswordField("Password");
    this.password.setIcon(FontAwesome.LOCK);
    this.password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    final Button login = new Button("Log In");
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    login.setClickShortcut(KeyCode.ENTER);
    login.focus();
    login.addClickListener(e -> this.login(this.username.getValue(), this.password.getValue()));
    final Button signup = new Button("Sign Up");
    signup.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signup.addClickListener(e -> this.signup(this.username.getValue(), this.password.getValue()));
    content.addComponents(this.username, this.password, login, signup);
    content.setComponentAlignment(login, Alignment.BOTTOM_LEFT);
    content.setComponentAlignment(signup, Alignment.BOTTOM_LEFT);
    return content;
}

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.DummyRegWithReCaptcha.java

License:Apache License

private void buildContent() {
    content.setMargin(true);// w  w  w  . ja va2s.c o m
    content.addComponent(createForm());
    content.addComponent(reCaptcha);
    Button reconfigBtn = createCancelBtn();
    Button submitBtn = new Button("Register", this);
    submitBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    submitBtn.addStyleName(Reindeer.BUTTON_DEFAULT);
    HorizontalLayout actionsLayout = new HorizontalLayout(submitBtn, reconfigBtn);
    actionsLayout.setSpacing(true);
    actionsLayout.setWidth(100, Unit.PERCENTAGE);
    actionsLayout.setComponentAlignment(reconfigBtn, Alignment.MIDDLE_RIGHT);
    content.addComponent(actionsLayout);
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java

private Component buildToggleButton() {
    Button valoMenuToggleButton = new Button("Menu", new ClickListener() {
        @Override/*from  ww  w  .j a  va2s .c o m*/
        public void buttonClick(final ClickEvent event) {
            if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
                getCompositionRoot().removeStyleName(STYLE_VISIBLE);
            } else {
                getCompositionRoot().addStyleName(STYLE_VISIBLE);
            }
        }
    });
    valoMenuToggleButton.setIcon(FontAwesome.LIST);
    valoMenuToggleButton.addStyleName("valo-menu-toggle");
    valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_SMALL);
    return valoMenuToggleButton;
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);// w w w. j a va 2 s.  c  o  m
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {

            System.out.println("TRIGGER LOGIN");
            DashboardEventBus.post(new UserLoginRequestedEvent(username.getValue(), password.getValue()));
        }
    });
    return fields;
}