Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx.treeview

public Class TreeNodeView<T>

extends Control
Class Inheritance
Imports
com.dlsc.gemsfx.treeview.link.LinkStrategy, .StraightLineLink, javafx.beans.property.DoubleProperty, .ObjectProperty, .SimpleObjectProperty, javafx.css.CssMetaData, .PseudoClass, .Styleable, .StyleableDoubleProperty, .StyleableObjectProperty, .StyleableProperty, javafx.css.converter.EnumConverter, .SizeConverter, javafx.geometry.HPos, .VPos, javafx.scene.Node, javafx.scene.control.Control, .Label, .Skin, javafx.util.Callback, java.util.ArrayList, .Collections, .List, .Objects

A visual control for displaying trees.

Built on the TreeNode class, this control visualizes hierarchical structures, allowing nodes to have children.

Customizable in layout, alignment, and style, it's ideal for representing data like file systems or organizational charts.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static enum
private static class

Field Summary

Modifier and TypeField and Description
private static final PseudoClass
private final ObjectProperty<Callback<T, TreeNodeCell<T>>>
private final DoubleProperty
private final DoubleProperty
private final StyleableObjectProperty<HPos>
columnAlignment

Alignment on the same level; When the layout direction is ltr or rtl, this attribute indicates the alignment of nodes at the same level;

private static final int
private static final int
private static final HPos
private static final double
private static final TreeNodeView.LayoutDirection
private static final TreeNodeView.LayoutType
private static final double
private static final VPos
private static final String
private static final double
private final DoubleProperty
private final ObjectProperty<TreeNodeView.LayoutDirection>
private final ObjectProperty<TreeNodeView.LayoutType>
private final ObjectProperty<LinkStrategy<T>>
private static final PseudoClass
private final DoubleProperty
private final ObjectProperty<Node>
private final ObjectProperty<TreeNode<T>>
private final StyleableObjectProperty<VPos>
rowAlignment

Alignment on the same level; When the layout direction is btt or ttb, this attribute indicates the alignment of nodes at the same level;

private static final PseudoClass
private static final PseudoClass
private final DoubleProperty

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
private void
public final ObjectProperty<Callback<T, TreeNodeCell<T>>>
public DoubleProperty
public DoubleProperty
public ObjectProperty<HPos>
private Node
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final Callback<T, TreeNodeCell<T>>
public double
public double
public static List<CssMetaData<? extends Styleable, ?>>
getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public HPos
protected List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public double
public TreeNodeView.LayoutDirection
public TreeNodeView.LayoutType
public LinkStrategy<T>
public double
public Node
public TreeNode<T>
public VPos
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public double
public DoubleProperty
public ObjectProperty<TreeNodeView.LayoutDirection>
public ObjectProperty<TreeNodeView.LayoutType>
public ObjectProperty<LinkStrategy<T>>
public DoubleProperty
public ObjectProperty<Node>
public void
public ObjectProperty<TreeNode<T>>
public ObjectProperty<VPos>
public final void
public void
setCellHeight(double cellHeight)

public void
setCellWidth(double cellWidth)

public void
setColumnAlignment(HPos columnAlignment)

public void
setHgap(double hgap)

public void
public void
public void
setLinkStrategy(LinkStrategy<T> linkStrategy)

public void
setNodeLineGap(double nodeLineGap)

public void
setPlaceholder(Node placeholder)

public void
setRoot(TreeNode<T> root)

public void
setRowAlignment(VPos rowAlignment)

public void
setVgap(double vgap)

public DoubleProperty
Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetContextMenugetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

BTT_PSEUDOCLASS_STATEback to summary
private static final PseudoClass BTT_PSEUDOCLASS_STATE
cellFactoryback to summary
private final ObjectProperty<Callback<T, TreeNodeCell<T>>> cellFactory
cellHeightback to summary
private final DoubleProperty cellHeight
cellWidthback to summary
private final DoubleProperty cellWidth
columnAlignmentback to summary
private final StyleableObjectProperty<HPos> columnAlignment

Alignment on the same level; When the layout direction is ltr or rtl, this attribute indicates the alignment of nodes at the same level;

DEFAULT_CELL_HEIGHTback to summary
private static final int DEFAULT_CELL_HEIGHT
DEFAULT_CELL_WIDTHback to summary
private static final int DEFAULT_CELL_WIDTH
DEFAULT_COLUMN_ALIGNMENTback to summary
private static final HPos DEFAULT_COLUMN_ALIGNMENT
DEFAULT_HGAPback to summary
private static final double DEFAULT_HGAP
DEFAULT_LAYOUT_DIRECTIONback to summary
private static final TreeNodeView.LayoutDirection DEFAULT_LAYOUT_DIRECTION
DEFAULT_LAYOUT_TYPEback to summary
private static final TreeNodeView.LayoutType DEFAULT_LAYOUT_TYPE
DEFAULT_NODE_LINE_GAPback to summary
private static final double DEFAULT_NODE_LINE_GAP
DEFAULT_ROW_ALIGNMENTback to summary
private static final VPos DEFAULT_ROW_ALIGNMENT
DEFAULT_STYLE_CLASSback to summary
private static final String DEFAULT_STYLE_CLASS
DEFAULT_VGAPback to summary
private static final double DEFAULT_VGAP
hgapback to summary
private final DoubleProperty hgap
layoutDirectionback to summary
private final ObjectProperty<TreeNodeView.LayoutDirection> layoutDirection
layoutTypeback to summary
private final ObjectProperty<TreeNodeView.LayoutType> layoutType
linkStrategyback to summary
private final ObjectProperty<LinkStrategy<T>> linkStrategy
LTR_PSEUDOCLASS_STATEback to summary
private static final PseudoClass LTR_PSEUDOCLASS_STATE
nodeLineGapback to summary
private final DoubleProperty nodeLineGap
placeholderback to summary
private final ObjectProperty<Node> placeholder
rootback to summary
private final ObjectProperty<TreeNode<T>> root
rowAlignmentback to summary
private final StyleableObjectProperty<VPos> rowAlignment

Alignment on the same level; When the layout direction is btt or ttb, this attribute indicates the alignment of nodes at the same level;

RTL_PSEUDOCLASS_STATEback to summary
private static final PseudoClass RTL_PSEUDOCLASS_STATE
TTB_PSEUDOCLASS_STATEback to summary
private static final PseudoClass TTB_PSEUDOCLASS_STATE
vgapback to summary
private final DoubleProperty vgap

Constructor Detail

TreeNodeViewback to summary
public TreeNodeView()
TreeNodeViewback to summary
public TreeNodeView(TreeNode<T> root)

Method Detail

activateDirectionPseudoClassback to summary
private void activateDirectionPseudoClass()
cellFactoryPropertyback to summary
public final ObjectProperty<Callback<T, TreeNodeCell<T>>> cellFactoryProperty()
cellHeightPropertyback to summary
public DoubleProperty cellHeightProperty()
cellWidthPropertyback to summary
public DoubleProperty cellWidthProperty()
columnAlignmentPropertyback to summary
public ObjectProperty<HPos> columnAlignmentProperty()
createDefaultPlaceholderback to summary
private Node createDefaultPlaceholder()
createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
getCellFactoryback to summary
public final Callback<T, TreeNodeCell<T>> getCellFactory()
getCellHeightback to summary
public double getCellHeight()
getCellWidthback to summary
public double getCellWidth()
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Doc from javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

getColumnAlignmentback to summary
public HPos getColumnAlignment()
getControlCssMetaDataback to summary
protected List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

Annotations
@Override
getHgapback to summary
public double getHgap()
getLayoutDirectionback to summary
public TreeNodeView.LayoutDirection getLayoutDirection()
getLayoutTypeback to summary
public TreeNodeView.LayoutType getLayoutType()
getLinkStrategyback to summary
public LinkStrategy<T> getLinkStrategy()
getNodeLineGapback to summary
public double getNodeLineGap()
getPlaceholderback to summary
public Node getPlaceholder()
getRootback to summary
public TreeNode<T> getRoot()
getRowAlignmentback to summary
public VPos getRowAlignment()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
getVgapback to summary
public double getVgap()
hgapPropertyback to summary
public DoubleProperty hgapProperty()
layoutDirectionPropertyback to summary
public ObjectProperty<TreeNodeView.LayoutDirection> layoutDirectionProperty()
layoutTypePropertyback to summary
public ObjectProperty<TreeNodeView.LayoutType> layoutTypeProperty()
linkStrategyPropertyback to summary
public ObjectProperty<LinkStrategy<T>> linkStrategyProperty()
nodeLineGapPropertyback to summary
public DoubleProperty nodeLineGapProperty()
placeholderPropertyback to summary
public ObjectProperty<Node> placeholderProperty()
refreshback to summary
public void refresh()
rootPropertyback to summary
public ObjectProperty<TreeNode<T>> rootProperty()
rowAlignmentPropertyback to summary
public ObjectProperty<VPos> rowAlignmentProperty()
setCellFactoryback to summary
public final void setCellFactory(Callback<T, TreeNodeCell<T>> value)
setCellHeightback to summary
public void setCellHeight(double cellHeight)
setCellWidthback to summary
public void setCellWidth(double cellWidth)
setColumnAlignmentback to summary
public void setColumnAlignment(HPos columnAlignment)
setHgapback to summary
public void setHgap(double hgap)
setLayoutDirectionback to summary
public void setLayoutDirection(TreeNodeView.LayoutDirection layoutDirection)
setLayoutTypeback to summary
public void setLayoutType(TreeNodeView.LayoutType layoutType)
setLinkStrategyback to summary
public void setLinkStrategy(LinkStrategy<T> linkStrategy)
setNodeLineGapback to summary
public void setNodeLineGap(double nodeLineGap)
setPlaceholderback to summary
public void setPlaceholder(Node placeholder)
setRootback to summary
public void setRoot(TreeNode<T> root)
setRowAlignmentback to summary
public void setRowAlignment(VPos rowAlignment)
setVgapback to summary
public void setVgap(double vgap)
vgapPropertyback to summary
public DoubleProperty vgapProperty()
com.dlsc.gemsfx.treeview back to summary

public final Enum TreeNodeView.LayoutDirection

extends Enum<TreeNodeView.LayoutDirection>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final TreeNodeView.LayoutDirection
BOTTOM_TO_TOP

The tree node view will be layout from bottom to top.

public static final TreeNodeView.LayoutDirection
LEFT_TO_RIGHT

The tree node view will be layout from left to right.

public static final TreeNodeView.LayoutDirection
RIGHT_TO_LEFT

The tree node view will be layout from right to left.

public static final TreeNodeView.LayoutDirection
TOP_TO_BOTTOM

The tree node view will be layout from top to bottom.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TreeNodeView.LayoutDirection
public static TreeNodeView.LayoutDirection[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BOTTOM_TO_TOPback to summary
public static final TreeNodeView.LayoutDirection BOTTOM_TO_TOP

The tree node view will be layout from bottom to top.

LEFT_TO_RIGHTback to summary
public static final TreeNodeView.LayoutDirection LEFT_TO_RIGHT

The tree node view will be layout from left to right.

RIGHT_TO_LEFTback to summary
public static final TreeNodeView.LayoutDirection RIGHT_TO_LEFT

The tree node view will be layout from right to left.

TOP_TO_BOTTOMback to summary
public static final TreeNodeView.LayoutDirection TOP_TO_BOTTOM

The tree node view will be layout from top to bottom.

Constructor Detail

LayoutDirectionback to summary
private LayoutDirection()

Method Detail

valueOfback to summary
public static TreeNodeView.LayoutDirection valueOf(String name)
valuesback to summary
public static TreeNodeView.LayoutDirection[] values()
com.dlsc.gemsfx.treeview back to summary

public final Enum TreeNodeView.LayoutType

extends Enum<TreeNodeView.LayoutType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final TreeNodeView.LayoutType
COMPACT

The tree node view will be layout in a compact way.

public static final TreeNodeView.LayoutType
REGULAR

The tree node view will be layout in a regular way.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TreeNodeView.LayoutType
public static TreeNodeView.LayoutType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COMPACTback to summary
public static final TreeNodeView.LayoutType COMPACT

The tree node view will be layout in a compact way. may be narrower.

REGULARback to summary
public static final TreeNodeView.LayoutType REGULAR

The tree node view will be layout in a regular way. may be wider

Constructor Detail

LayoutTypeback to summary
private LayoutType()

Method Detail

valueOfback to summary
public static TreeNodeView.LayoutType valueOf(String name)
valuesback to summary
public static TreeNodeView.LayoutType[] values()
com.dlsc.gemsfx.treeview back to summary

private Class TreeNodeView.StyleableProperties

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final CssMetaData<TreeNodeView<?>, Number>
public static final CssMetaData<TreeNodeView<?>, Number>
public static final CssMetaData<TreeNodeView<?>, HPos>
public static final CssMetaData<TreeNodeView<?>, Number>
public static final CssMetaData<TreeNodeView<?>, TreeNodeView.LayoutDirection>
public static final CssMetaData<TreeNodeView<?>, TreeNodeView.LayoutType>
public static final CssMetaData<TreeNodeView<?>, Number>
private static final CssMetaData<TreeNodeView<?>, VPos>
private static final List<CssMetaData<? extends Styleable, ?>>
public static final CssMetaData<TreeNodeView<?>, Number>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CELL_HEIGHTback to summary
public static final CssMetaData<TreeNodeView<?>, Number> CELL_HEIGHT
CELL_WIDTHback to summary
public static final CssMetaData<TreeNodeView<?>, Number> CELL_WIDTH
COLUMN_ALIGNMENTback to summary
public static final CssMetaData<TreeNodeView<?>, HPos> COLUMN_ALIGNMENT
H_GAPback to summary
public static final CssMetaData<TreeNodeView<?>, Number> H_GAP
LAYOUT_DIRECTIONback to summary
public static final CssMetaData<TreeNodeView<?>, TreeNodeView.LayoutDirection> LAYOUT_DIRECTION
LAYOUT_TYPEback to summary
public static final CssMetaData<TreeNodeView<?>, TreeNodeView.LayoutType> LAYOUT_TYPE
NODE_LINE_GAPback to summary
public static final CssMetaData<TreeNodeView<?>, Number> NODE_LINE_GAP
ROW_ALIGNMENTback to summary
private static final CssMetaData<TreeNodeView<?>, VPos> ROW_ALIGNMENT
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES
V_GAPback to summary
public static final CssMetaData<TreeNodeView<?>, Number> V_GAP

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()