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

org.bklab.flow.base.HasValueFactory Maven / Gradle / Ivy

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

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.grid.Grid;
import org.bklab.crud.FluentCrudView;
import org.bklab.flow.IFlowFactory;

import java.util.function.Function;

@SuppressWarnings("unchecked")
public interface HasValueFactory, C extends Component & HasValue, E extends HasValueFactory> extends IFlowFactory {
    default E clear() {
        get().clear();
        return (E) this;
    }

    default E readOnly(boolean readOnly) {
        get().setReadOnly(readOnly);
        return (E) this;
    }

    default E value(T value) {
        get().setValue(value);
        return (E) this;
    }

    default E valueChangeListener(HasValue.ValueChangeListener valueChangeListener) {
        get().addValueChangeListener(valueChangeListener);
        return (E) this;
    }

    default E requiredIndicatorVisible(boolean requiredIndicatorVisible) {
        get().setRequiredIndicatorVisible(requiredIndicatorVisible);
        return (E) this;
    }

    default >> E addFluentCrudViewParameter(G view, String name) {
        view.addParameter(name, get());
        return (E) this;
    }

    default >> E addFluentCrudViewParameter(G view, String name, Function mapValue) {
        view.addParameter(name, get(), mapValue);
        return (E) this;
    }

    default >> E watch(G view) {
        view.watch(get());
        return (E) this;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy