Example usage for com.vaadin.server FontAwesome PAW

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

Introduction

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

Prototype

FontAwesome PAW

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

Click Source Link

Usage

From source file:com.hack23.cia.web.impl.ui.application.views.common.formfactory.impl.FormFactoryImpl.java

License:Apache License

@Override
public <T extends Serializable> void addRequestInputFormFields(final FormLayout panelContent,
        final BeanItem<T> item, final Class<T> beanType, final List<String> displayProperties,
        final String buttonLabel, final ClickListener buttonListener) {
    final BeanFieldGroup<T> fieldGroup = new BeanFieldGroup<>(beanType);
    fieldGroup.setItemDataSource(item);/*from w w w  . java  2  s.co m*/
    fieldGroup.setReadOnly(true);

    for (final String property : displayProperties) {

        final Field<?> buildAndBind;
        if (property.contains(HIDDEN_FIELD_NAME)) {
            buildAndBind = fieldGroup.buildAndBind(property, property, PasswordField.class);
        } else {
            buildAndBind = fieldGroup.buildAndBind(property);
        }

        buildAndBind.setId(MessageFormat.format("{0}.{1}", buttonLabel, property));
        buildAndBind.setReadOnly(false);
        buildAndBind.setWidth(ContentSize.HALF_SIZE);

        panelContent.addComponent(buildAndBind);
    }
    final Collection<Object> unboundPropertyIds = fieldGroup.getUnboundPropertyIds();
    for (final Object property : unboundPropertyIds) {
        LOGGER.debug(LOG_MSG_PROPERTY, property);
    }

    final VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth("50%");

    final Button button = new Button(buttonLabel,
            new CommitFormWrapperClickListener(fieldGroup, buttonListener));
    button.setId(buttonLabel);
    button.setWidth("25%");
    button.setIcon(FontAwesome.PAW);

    verticalLayout.addComponent(button);
    verticalLayout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);

    panelContent.addComponent(verticalLayout);
}