- java.lang.Object
-
- eu.ess.xaos.ui.control.tree.directory.TreeDirectoryItems
-
public class TreeDirectoryItems extends Object
Containing the classes used byTreeDirectoryModel
.- Author:
- claudio.rosati@esss.se
- See Also:
- LiveDirsFX:org.fxmisc.livedirs.PathItem
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TreeDirectoryItems.DirectoryItem<T>
ATreeItem
representing a directory.static class
TreeDirectoryItems.FileItem<T>
ATreeItem
representing a file.static class
TreeDirectoryItems.PathItem<T>
static class
TreeDirectoryItems.TopLevelDirectoryItem<I,T>
ATreeItem
representing a top-level directory, i.e.
-
Field Summary
Fields Modifier and Type Field Description static Function<Path,Path>
DEFAULT_INJECTOR
static Function<Path,Path>
DEFAULT_PROJECTOR
The defaultFunction
converting the object returned byTreeItem.getValue()
into the correspondingPath
when theTreeItem
generic type is justPath
.
-
Method Summary
-
-
-
Method Detail
-
createDirectoryItem
public static <T> TreeDirectoryItems.DirectoryItem<T> createDirectoryItem(T path, TreeDirectoryModel.GraphicFactory graphicFactory, Function<T,Path> projector, Function<Path,T> injector)
Creates a new instance ofTreeDirectoryItems.DirectoryItem
for the given parameters.- Type Parameters:
T
- Type of the object returned byTreeItem.getValue()
.- 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
.- Returns:
- A new instance of
TreeDirectoryItems.DirectoryItem
.
-
createDirectoryItem
public static <T> TreeDirectoryItems.DirectoryItem<T> createDirectoryItem(T path, TreeDirectoryModel.GraphicFactory graphicFactory, 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
TreeDirectoryItems.DirectoryItem.addChildDirectory(Path, TreeDirectoryModel.GraphicFactory)
method will pass the givenonCollapse
andonExpand
parameters to the newly createdTreeDirectoryItems.DirectoryItem
.- Type Parameters:
T
- Type of the object returned byTreeItem.getValue()
.- 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
.onCollapse
- AConsumer
to be invoked when this item is collapsed. Can benull
.onExpand
- AConsumer
to be invoked when this item is expanded. Can benull
.- Returns:
- A new instance of
TreeDirectoryItems.DirectoryItem
.
-
createFileItem
public static <T> TreeDirectoryItems.FileItem<T> createFileItem(T path, FileTime lastModified, TreeDirectoryModel.GraphicFactory graphicFactory, Function<T,Path> projector)
Creates a new instance ofTreeDirectoryItems.FileItem
for the given parameters.- Type Parameters:
T
- Type of the object returned byTreeItem.getValue()
.- Parameters:
path
- The value of thisTreeItem
.lastModified
- The date of last modification for this item.graphicFactory
- The factory class used to get an "icon" representing the created item.projector
- AFunction
converting the object returned byTreeItem.getValue()
into the correspondingPath
.- Returns:
- A new instance of
TreeDirectoryItems.FileItem
.
-
createTopLevelDirectoryItem
public static <I,T> TreeDirectoryItems.TopLevelDirectoryItem<I,T> createTopLevelDirectoryItem(T path, TreeDirectoryModel.GraphicFactory graphicFactory, Function<T,Path> projector, Function<Path,T> injector, DirectoryModel.Reporter<I> reporter)
Creates a new instance ofTreeDirectoryItems.TopLevelDirectoryItem
for the given parameters.- Type Parameters:
I
- Type of the initiator of changes to the model.T
- Type of the object returned byTreeItem.getValue()
.- 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.- Returns:
- A new instance of
TreeDirectoryItems.TopLevelDirectoryItem
.
-
createTopLevelDirectoryItem
public static <I,T> TreeDirectoryItems.TopLevelDirectoryItem<I,T> createTopLevelDirectoryItem(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
parameters to the newly createdTreeDirectoryItems.DirectoryItem
.- Type Parameters:
I
- Type of the initiator of changes to the model.T
- Type of the object returned byTreeItem.getValue()
.- 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
.- Returns:
- A new instance of
TreeDirectoryItems.TopLevelDirectoryItem
.
-
-