![JAR search and dependency download from the Maven repository](/logo.png)
com.netopyr.reduxfx.vscenegraph.builders.TreeViewBuilder Maven / Gradle / Ivy
package com.netopyr.reduxfx.vscenegraph.builders;
import com.netopyr.reduxfx.vscenegraph.VNode;
import com.netopyr.reduxfx.vscenegraph.event.VEventHandler;
import com.netopyr.reduxfx.vscenegraph.event.VEventType;
import com.netopyr.reduxfx.vscenegraph.impl.patcher.property.Accessors;
import com.netopyr.reduxfx.vscenegraph.impl.patcher.property.TreeViewCellFactoryAccessor;
import com.netopyr.reduxfx.vscenegraph.property.VProperty;
import io.vavr.collection.Array;
import io.vavr.collection.Map;
import io.vavr.control.Option;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.function.Function;
public class TreeViewBuilder, E>
extends ControlBuilder {
private static final String CELL_FACTORY = "cellFactory";
private static final String ROOT = "root";
private static final String SHOW_ROOT = "showRoot";
private final Class elementClass;
public TreeViewBuilder(Class> nodeClass,
Class elementClass,
Map> childrenMap,
Map> singleChildMap,
Map properties,
Map eventHandlers) {
super(nodeClass, childrenMap, singleChildMap, properties, eventHandlers);
this.elementClass = elementClass;
}
@SuppressWarnings("unchecked")
@Override
protected B create(
Map> childrenMap,
Map> singleChildMap,
Map properties,
Map eventHandlers) {
return (B) new TreeViewBuilder<>(getNodeClass(), elementClass, childrenMap, singleChildMap, properties,
eventHandlers);
}
public B root(TreeItemBuilder root) {
return child(ROOT, root);
}
public B showRoot(boolean value) {
return property(SHOW_ROOT, value);
}
public B cellFactory(Function super E, VNode> value) {
Accessors.registerAccessor(getNodeClass(), "cellFactory", TreeViewCellFactoryAccessor::new);
return property(CELL_FACTORY, value);
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
.appendSuper(super.toString())
.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy