Example usage for com.vaadin.server FontAwesome RECYCLE

List of usage examples for com.vaadin.server FontAwesome RECYCLE

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome RECYCLE.

Prototype

FontAwesome RECYCLE

To view the source code for com.vaadin.server FontAwesome RECYCLE.

Click Source Link

Usage

From source file:com.etest.view.systemadministration.HousekeepingMainUI.java

Table populateDataTable() {
    table.removeAllItems();//from   w w w .  java 2s  .c o m
    int i = 0;
    for (CellItem ci : hs.getAllItemsFromArchive()) {
        VerticalLayout v = new VerticalLayout();
        v.setWidth("100%");

        Button recycle = new Button("recycle");
        recycle.setWidthUndefined();
        recycle.setData(ci.getCellItemId());
        recycle.setIcon(FontAwesome.RECYCLE);
        recycle.addStyleName(ValoTheme.BUTTON_LINK);
        recycle.addStyleName(ValoTheme.BUTTON_TINY);
        recycle.addStyleName(ValoTheme.BUTTON_QUIET);
        recycle.addStyleName("button-container");
        v.addComponent(recycle);
        v.setComponentAlignment(recycle, Alignment.MIDDLE_LEFT);

        Button view = new Button("view");
        view.setWidthUndefined();
        view.setData(ci.getCellItemId());
        view.setIcon(FontAwesome.COFFEE);
        view.addStyleName(ValoTheme.BUTTON_LINK);
        view.addStyleName(ValoTheme.BUTTON_TINY);
        view.addStyleName(ValoTheme.BUTTON_QUIET);
        view.addStyleName("button-container");
        view.addClickListener(buttonClickListener);
        v.addComponent(view);
        v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);

        table.addItem(new Object[] { ci.getCellItemId(), ci.getItem(), v }, i);
        i++;
    }
    table.setPageLength(table.size());

    return table;
}

From source file:local.ikram.assesment.web.SimpleFormComponent.java

private void initForm() {

    employeeId = new TextField("Employee Id: ");
    employeeId.setIcon(FontAwesome.FILE_PICTURE_O);
    employeeId.setRequired(true);//from ww w .j  ava 2 s.  c o m
    employeeId.addValidator(new StringLengthValidator("Must be btw 7 and 9 characters", 7, 9, false));

    firstName = new TextField("First Name: ");
    firstName.setIcon(FontAwesome.USER);
    firstName.setRequired(true);
    firstName.addValidator(new NullValidator("Cannot be empty", false));

    lastName = new TextField("Last Name: ");
    lastName.setIcon(FontAwesome.USER);
    lastName.setRequired(true);
    lastName.addValidator(new NullValidator("Cannot be empty", false));

    phoneNumber = new TextField("Phone Number: ");
    phoneNumber.setIcon(FontAwesome.PHONE_SQUARE);
    phoneNumber.setRequired(true);
    phoneNumber.addValidator(new NullValidator("Cannot be empty", false));

    department = new TextField("Department: ");
    department.setIcon(FontAwesome.DESKTOP);
    department.setRequired(true);
    department.addValidator(new NullValidator("Cannot be empty", false));

    saveBtn = new Button("Save", FontAwesome.SAVE);
    saveBtn.addStyleName("save-btn");
    saveBtn.addClickListener((Button.ClickEvent e) -> {
        try {
            employeeId.validate();
            firstName.validate();
            lastName.validate();
            phoneNumber.validate();
            department.validate();
            update(getEmployee());
        } catch (Validator.InvalidValueException ex) {
            Logger.getLogger(SimpleFormComponent.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(),
                    ex);
        }
    });
    deleteBtn = new Button("Delete", FontAwesome.RECYCLE);
    deleteBtn.addStyleName("delete-btn");
    deleteBtn.addClickListener((Button.ClickEvent e) -> {
        delete(getEmployee());
    });
    addBtn = new Button("Add Employee", FontAwesome.PLUS_SQUARE);
    addBtn.addStyleName("add-btn");
    addBtn.addClickListener((Button.ClickEvent e) -> {
        clear();
    });

    final HorizontalLayout buttonLayout = new HorizontalLayout(saveBtn, deleteBtn);
    buttonLayout.setSpacing(true);

    final FormLayout formLayout = new FormLayout();
    formLayout.setSizeUndefined();
    formLayout.setMargin(true);
    formLayout.setData(this);
    formLayout.addComponents(employeeId, firstName, lastName, phoneNumber, department, buttonLayout);
    setCompositionRoot(formLayout);

    setEmployee(new Employee());
    BeanFieldGroup.bindFieldsUnbuffered(employee, this);
}