Example usage for com.vaadin.ui FormLayout setWidthUndefined

List of usage examples for com.vaadin.ui FormLayout setWidthUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui FormLayout setWidthUndefined.

Prototype

@Override
    public void setWidthUndefined() 

Source Link

Usage

From source file:management.limbr.ui.entity.EntityEditorViewImpl.java

License:Open Source License

@PostConstruct
public void init() {
    FormLayout content = new FormLayout();
    content.setWidthUndefined();

    for (java.lang.reflect.Field field : entityClass.getDeclaredFields()) {
        if ("id".equals(field.getName())) {
            continue;
        }// w  ww .  java 2s .c  o  m
        Field uiField = getUIField(field);
        fieldMap.put(field.getName(), uiField);
        content.addComponent(uiField);
    }

    save = new Button(messages.get("saveButtonLabel"), FontAwesome.SAVE);
    Button cancel = new Button(messages.get("cancelButtonLabel"));
    delete = new Button(messages.get("deleteButtonLabel"), FontAwesome.TRASH_O);

    CssLayout actions = new CssLayout(save, cancel, delete);
    content.addComponent(actions);

    content.setMargin(true);
    setContent(content);
    setClosable(true);
    setResizable(false);
    setModal(true);

    save.addClickListener(event -> listeners.forEach(EntityEditorView.Listener::save));
    delete.addClickListener(event -> listeners.forEach(EntityEditorView.Listener::deleteClicked));
    cancel.addClickListener(event -> listeners.forEach(EntityEditorView.Listener::cancel));
}