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

org.bklab.flow.IFluentFlowFactory Maven / Gradle / Ivy

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

import com.vaadin.flow.component.Component;
import org.bklab.flow.base.AttachNotifierFactory;
import org.bklab.flow.base.DetachNotifierFactory;
import org.bklab.flow.base.HasElementFactory;
import org.bklab.flow.base.HasReturnThis;

import java.util.function.Consumer;
import java.util.function.Predicate;

public interface IFluentFlowFactory> extends
        HasElementFactory, AttachNotifierFactory>,
        DetachNotifierFactory>, HasReturnThis, IFlowFactory {

    default E enabledStateChanged(boolean onEnabledStateChanged) {
        get().onEnabledStateChanged(onEnabledStateChanged);
        return thisObject();
    }

    default E id(String id) {
        get().setId(id);
        return thisObject();
    }

    default E visible(boolean visible) {
        get().setVisible(visible);
        return thisObject();
    }

    default E attributeTitle(String title) {
        get().getElement().setAttribute("title", title);
        return thisObject();
    }

    default E peek(Consumer consumer) {
        consumer.accept(get());
        return thisObject();
    }

    default E peek(boolean canPeek, Consumer consumer) {
        return canPeek ? thisObject() : peek(consumer);
    }

    default E peek(Predicate canPeek, Consumer consumer) {
        return canPeek.test(get()) ? thisObject() : peek(consumer);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy