All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bklab.flow.components.textfield.ComponentButtonField Maven / Gradle / Ivy

There is a newer version: 22.0.1
Show newest version
package org.bklab.flow.components.textfield;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.customfield.CustomField;
import org.bklab.flow.factory.CustomFieldFactory;

public class ComponentButtonField> extends CustomField {

    private final C component;
    private final Button button;

    private ComponentButtonField(C component, Button button) {
        this.component = component;
        this.button = button;
        add(component, button);
        getElement().getStyle().set("alignItems", "baseline").set("display", "flex");
    }

    public C getComponent() {
        return component;
    }

    public Button getButton() {
        return button;
    }

    @Override
    protected T generateModelValue() {
        return component.getValue();
    }

    @Override
    protected void setPresentationValue(T newPresentationValue) {
        component.setValue(newPresentationValue);
    }

    public CustomFieldFactory asFactory() {
        return new CustomFieldFactory<>(this);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy