org.bklab.flow.layout.tab.FluentTab Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-vaadin-flow Show documentation
Show all versions of fluent-vaadin-flow Show documentation
Broderick Labs for fluent vaadin flow. Inherits common Vaadin components.
package org.bklab.flow.layout.tab;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.tabs.Tab;
import java.util.function.Supplier;
public class FluentTab extends Tab {
protected final String id;
protected Supplier componentSupplier;
protected Component component;
protected boolean cacheMode = true;
public FluentTab(String id) {
this.id = id;
}
public FluentTab(String id, Supplier componentSupplier) {
this(id, id, componentSupplier);
}
public FluentTab(String id, String caption, Supplier componentSupplier) {
super(caption);
this.id = id;
this.componentSupplier = componentSupplier;
}
public FluentTab(String id, String caption) {
super(caption);
this.id = id;
}
public FluentTab(String id, Component component, Supplier componentSupplier) {
super(component);
this.id = id;
this.componentSupplier = componentSupplier;
}
public FluentTab(String id, Supplier componentSupplier, Component... component) {
super(component);
this.id = id;
this.componentSupplier = componentSupplier;
}
public Component getComponent() {
if (component == null || !cacheMode) component = componentSupplier.get();
return component;
}
public Supplier getComponentSupplier() {
return componentSupplier;
}
public FluentTab enableCache() {
this.cacheMode = true;
return this;
}
public FluentTab disableCache() {
this.cacheMode = false;
return this;
}
public String getTabId() {
return id;
}
public boolean isCacheMode() {
return cacheMode;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy