Module xaos.ui
Class TreeDirectoryItems.DirectoryItem<T>
- java.lang.Object
-
- javafx.scene.control.TreeItem<T>
-
- eu.ess.xaos.ui.control.tree.directory.TreeDirectoryItems.PathItem<T>
-
- eu.ess.xaos.ui.control.tree.directory.TreeDirectoryItems.DirectoryItem<T>
-
- Type Parameters:
T
- Type of the object returned byTreeItem.getValue()
.
- All Implemented Interfaces:
EventTarget
- Direct Known Subclasses:
TreeDirectoryItems.TopLevelDirectoryItem
- Enclosing class:
- TreeDirectoryItems
public static class TreeDirectoryItems.DirectoryItem<T> extends TreeDirectoryItems.PathItem<T>
ATreeItem
representing a directory.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javafx.scene.control.TreeItem
TreeItem.TreeModificationEvent<T extends Object>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DirectoryItem(T path, Node collapsedGraphic, Node expandedGraphic, Function<T,Path> projector, Function<Path,T> injector, Consumer<? super TreeDirectoryItems.DirectoryItem<T>> onCollapse, Consumer<? super TreeDirectoryItems.DirectoryItem<T>> onExpand)
Creates a new instance ofTreeDirectoryItems.DirectoryItem
for the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TreeDirectoryItems.DirectoryItem<T>
addChildDirectory(Path dir, TreeDirectoryModel.GraphicFactory graphicFactory)
Adds a new child representing a directory to this item.TreeDirectoryItems.FileItem<T>
addChildFile(Path file, FileTime lastModified, TreeDirectoryModel.GraphicFactory graphicFactory)
Adds a new child representing a directory to this item.Function<Path,T>
getInjector()
Consumer<? super TreeDirectoryItems.DirectoryItem<T>>
getOnCollapse()
Consumer<? super TreeDirectoryItems.DirectoryItem<T>>
getOnExpand()
T
inject(Path path)
AppliesgetInjector()
to the givenPath
.boolean
isDirectory()
-
Methods inherited from class eu.ess.xaos.ui.control.tree.directory.TreeDirectoryItems.PathItem
asDirectoryItem, asFileItem, getPath, getProjector, getRelativeChild, isLeaf, resolve
-
Methods inherited from class javafx.scene.control.TreeItem
addEventHandler, branchCollapsedEvent, branchExpandedEvent, buildEventDispatchChain, childrenModificationEvent, expandedItemCountChangeEvent, expandedProperty, getChildren, getGraphic, getParent, getValue, graphicChangedEvent, graphicProperty, isExpanded, leafProperty, nextSibling, nextSibling, parentProperty, previousSibling, previousSibling, removeEventHandler, setExpanded, setGraphic, setValue, toString, treeNotificationEvent, valueChangedEvent, valueProperty
-
-
-
-
Constructor Detail
-
DirectoryItem
protected DirectoryItem(T path, Node collapsedGraphic, Node expandedGraphic, Function<T,Path> projector, Function<Path,T> injector, Consumer<? super TreeDirectoryItems.DirectoryItem<T>> onCollapse, Consumer<? super TreeDirectoryItems.DirectoryItem<T>> onExpand)
Creates a new instance ofTreeDirectoryItems.DirectoryItem
for the given parameters.Note that the
addChildDirectory(Path, TreeDirectoryModel.GraphicFactory)
method will pass the givenonCollapse
andonExpand
parameter to the newly createdTreeDirectoryItems.DirectoryItem
.- Parameters:
path
- The value of thisTreeItem
.collapsedGraphic
- The graphicNode
to be used when this item is collapsed.expandedGraphic
- The graphicNode
to be used when this item is expanded.projector
- AFunction
converting the object returned byTreeItem.getValue()
into the correspondingPath
.injector
- AFunction
converting aPath
into the object used as value in the correspondingTreeItem
.onCollapse
- AConsumer
to be invoked when this item is collapsed. Can benull
.onExpand
- AConsumer
to be invoked when this item is expanded. Can benull
.
-
-
Method Detail
-
addChildDirectory
public TreeDirectoryItems.DirectoryItem<T> addChildDirectory(Path dir, TreeDirectoryModel.GraphicFactory graphicFactory)
Adds a new child representing a directory to this item.- Parameters:
dir
- The directoryPath
.graphicFactory
- The factory returning a suitable icon.- Returns:
- The child
TreeDirectoryItems.DirectoryItem
.
-
addChildFile
public TreeDirectoryItems.FileItem<T> addChildFile(Path file, FileTime lastModified, TreeDirectoryModel.GraphicFactory graphicFactory)
Adds a new child representing a directory to this item.- Parameters:
file
- The filePath
.lastModified
- The file's last modification time.graphicFactory
- The factory returning a suitable icon.- Returns:
- The child
TreeDirectoryItems.FileItem
.
-
getOnCollapse
public Consumer<? super TreeDirectoryItems.DirectoryItem<T>> getOnCollapse()
- Returns:
- The
Consumer
invoked when this item is collapsed. Can benull
.
-
getOnExpand
public Consumer<? super TreeDirectoryItems.DirectoryItem<T>> getOnExpand()
- Returns:
- The
Consumer
invoked when this item is expanded. Can benull
.
-
inject
public final T inject(Path path)
AppliesgetInjector()
to the givenPath
.- Parameters:
path
- ThePath
to be converted.- Returns:
- The value obtained applying
getInjector()
to the givenPath
.
-
isDirectory
public final boolean isDirectory()
- Specified by:
isDirectory
in classTreeDirectoryItems.PathItem<T>
- Returns:
true
if this item represents a directory.
-
-