Module xaos.ui
Class TreeDirectoryItems.TopLevelDirectoryItem<I,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>
-
- eu.ess.xaos.ui.control.tree.directory.TreeDirectoryItems.TopLevelDirectoryItem<I,T>
-
- Type Parameters:
I
- Type of the initiator of changes to the model.T
- Type of the object returned byTreeItem.getValue()
.
- All Implemented Interfaces:
EventTarget
- Enclosing class:
- TreeDirectoryItems
public static class TreeDirectoryItems.TopLevelDirectoryItem<I,T> extends TreeDirectoryItems.DirectoryItem<T>
ATreeItem
representing a top-level directory, i.e. the root directory for the tree model.
-
-
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
TopLevelDirectoryItem(T path, TreeDirectoryModel.GraphicFactory graphicFactory, Function<T,Path> projector, Function<Path,T> injector, DirectoryModel.Reporter<I> reporter, Consumer<? super TreeDirectoryItems.DirectoryItem<T>> onCollapse, Consumer<? super TreeDirectoryItems.DirectoryItem<T>> onExpand)
Creates a new instance ofTreeDirectoryItems.TopLevelDirectoryItem
for the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDirectory(Path relativePath, I initiator)
Adds a directory to the model rooted at this item.void
addFile(Path relativePath, FileTime lastModified, I initiator)
Adds a file to the model rooted at this item.boolean
contains(Path relativePath)
void
remove(Path relativePath, I initiator)
Removes the givenPath
from the model rooted at this item.void
sync(Path root, I initiator)
Adds to the model rooted at this item all the subdirectories and files rooted at the givenPath
element.void
updateModificationTime(Path relativePath, FileTime lastModified, I initiator)
Updates the modification time for the item associated to the givenPath
.-
Methods inherited from class eu.ess.xaos.ui.control.tree.directory.TreeDirectoryItems.DirectoryItem
addChildDirectory, addChildFile, getInjector, getOnCollapse, getOnExpand, inject, 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
-
TopLevelDirectoryItem
protected TopLevelDirectoryItem(T path, TreeDirectoryModel.GraphicFactory graphicFactory, Function<T,Path> projector, Function<Path,T> injector, DirectoryModel.Reporter<I> reporter, Consumer<? super TreeDirectoryItems.DirectoryItem<T>> onCollapse, Consumer<? super TreeDirectoryItems.DirectoryItem<T>> onExpand)
Creates a new instance ofTreeDirectoryItems.TopLevelDirectoryItem
for the given parameters.Note that the
TreeDirectoryItems.DirectoryItem.addChildDirectory(Path, TreeDirectoryModel.GraphicFactory)
method will pass the givenonCollapse
andonExpand
parameter to the newly createdTreeDirectoryItems.DirectoryItem
.- Parameters:
path
- The value of thisTreeItem
.graphicFactory
- The factory class used to get an "icon" representing the created item.projector
- AFunction
converting the object returned byTreeItem.getValue()
into the correspondingPath
.injector
- AFunction
converting aPath
into the object used as value in the correspondingTreeItem
.reporter
- The object reporting changes in the model.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
-
addDirectory
public void addDirectory(Path relativePath, I initiator)
Adds a directory to the model rooted at this item.- Parameters:
relativePath
- The directoryPath
.initiator
- The initiator of changes to the model.
-
addFile
public void addFile(Path relativePath, FileTime lastModified, I initiator)
Adds a file to the model rooted at this item.- Parameters:
relativePath
- The filePath
.lastModified
- The file's last modification time.initiator
- The initiator of changes to the model.
-
contains
public boolean contains(Path relativePath)
-
remove
public void remove(Path relativePath, I initiator)
Removes the givenPath
from the model rooted at this item.- Parameters:
relativePath
- ThePath
to be removed from the model rooted at this item.initiator
- The initiator of changes to the model.
-
sync
public void sync(Path root, I initiator)
Adds to the model rooted at this item all the subdirectories and files rooted at the givenPath
element.- Parameters:
root
- The path to be synchronized.initiator
- The initiator of changes to the model.
-
updateModificationTime
public void updateModificationTime(Path relativePath, FileTime lastModified, I initiator)
Updates the modification time for the item associated to the givenPath
.- Parameters:
relativePath
- The path whose associated item must be updated.lastModified
- The new modification time.initiator
- The initiator of changes to the model.
-
-