Module swing.tree.component.main
Class BaseTreeNodeFactory
java.lang.Object
io.github.astrapi69.swing.tree.factory.BaseTreeNodeFactory
Factory class for generate
DefaultMutableTreeNode
from BaseTreeNode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
K> io.github.astrapi69.gen.tree.BaseTreeNode<T, K> initializeBaseTreeNodeWithTreeElement
(T treeElement, io.github.astrapi69.gen.tree.BaseTreeNode<T, K> parentTreeNode, @NonNull io.github.astrapi69.data.identifiable.IdGenerator<K> idGenerator) Factory method that creates a newBaseTreeNode
object from the givenTreeElement
objectstatic <T,
K> io.github.astrapi69.gen.tree.BaseTreeNode<io.github.astrapi69.swing.renderer.tree.GenericTreeElement<T>, K> initializeTreeNodeWithTreeElement
(io.github.astrapi69.swing.renderer.tree.GenericTreeElement<T> treeElement, io.github.astrapi69.gen.tree.BaseTreeNode<io.github.astrapi69.swing.renderer.tree.GenericTreeElement<T>, K> parentTreeNode, @NonNull io.github.astrapi69.data.identifiable.IdGenerator<K> idGenerator) Factory method that creates a newBaseTreeNode
object from the givenTreeElement
objectstatic <K> io.github.astrapi69.gen.tree.BaseTreeNode<io.github.astrapi69.swing.renderer.tree.JTreeElement,
K> initializeTreeNodeWithTreeElement
(io.github.astrapi69.swing.renderer.tree.JTreeElement treeElement, io.github.astrapi69.gen.tree.BaseTreeNode<io.github.astrapi69.swing.renderer.tree.JTreeElement, K> parentTreeNode, @NonNull io.github.astrapi69.data.identifiable.IdGenerator<K> idGenerator) Factory method that creates a newBaseTreeNode
object from the givenTreeElement
objectstatic <K> io.github.astrapi69.gen.tree.BaseTreeNode<TreeElement,
K> initializeTreeNodeWithTreeElement
(TreeElement treeElement, io.github.astrapi69.gen.tree.BaseTreeNode<TreeElement, K> parentTreeNode, @NonNull io.github.astrapi69.data.identifiable.IdGenerator<K> idGenerator) Factory method that creates a newBaseTreeNode
object from the givenTreeElement
objectstatic <T,
K> DefaultMutableTreeNode newDefaultMutableTreeNode
(@NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T, K> treeNode) Creates a newDefaultMutableTreeNode
object from the givenBaseTreeNode
objectstatic <T,
K> DefaultMutableTreeNode newDefaultMutableTreeNode
(@NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T, K> treeNode, DefaultMutableTreeNode parent, boolean onlyRoot) Creates a newDefaultMutableTreeNode
object from the givenBaseTreeNode
objectstatic <T,
K> DefaultMutableTreeNode traverseAndAdd
(DefaultMutableTreeNode rootDefaultMutableTreeNode, @NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T, K> treeNode) Traverses through the givenBaseTreeNode
object and return the rootDefaultMutableTreeNode
objectstatic <T,
K> DefaultMutableTreeNode traverseAndAdd
(DefaultMutableTreeNode rootDefaultMutableTreeNode, @NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T, K> treeNode, boolean root) Traverses through the givenBaseTreeNode
object and return the rootDefaultMutableTreeNode
object
-
Constructor Details
-
BaseTreeNodeFactory
public BaseTreeNodeFactory()
-
-
Method Details
-
newDefaultMutableTreeNode
public static <T,K> DefaultMutableTreeNode newDefaultMutableTreeNode(@NonNull @NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T, K> treeNode) Creates a newDefaultMutableTreeNode
object from the givenBaseTreeNode
object- Type Parameters:
T
- the generic type of the givenBaseTreeNode
objectK
- the generic type of the id of the givenBaseTreeNode
object- Parameters:
treeNode
- theBaseTreeNode
object- Returns:
- the new
DefaultMutableTreeNode
object generated from the givenBaseTreeNode
object
-
traverseAndAdd
public static <T,K> DefaultMutableTreeNode traverseAndAdd(DefaultMutableTreeNode rootDefaultMutableTreeNode, @NonNull @NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T, K> treeNode) Traverses through the givenBaseTreeNode
object and return the rootDefaultMutableTreeNode
object- Type Parameters:
T
- the generic type of the givenBaseTreeNode
objectK
- the generic type of the id of the givenBaseTreeNode
object- Parameters:
rootDefaultMutableTreeNode
- theDefaultMutableTreeNode
objecttreeNode
- theBaseTreeNode
object- Returns:
- the root
DefaultMutableTreeNode
object
-
newDefaultMutableTreeNode
public static <T,K> DefaultMutableTreeNode newDefaultMutableTreeNode(@NonNull @NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T, K> treeNode, DefaultMutableTreeNode parent, boolean onlyRoot) Creates a newDefaultMutableTreeNode
object from the givenBaseTreeNode
object- Type Parameters:
T
- the generic type of the givenBaseTreeNode
objectK
- the generic type of the id of the givenBaseTreeNode
object- Parameters:
treeNode
- theBaseTreeNode
objectparent
- the parentDefaultMutableTreeNode
objectonlyRoot
- the flag if only root tree node will be chosen, otherwise the given tree node will be traversed and added- Returns:
- the new
DefaultMutableTreeNode
object generated from the givenBaseTreeNode
object
-
traverseAndAdd
public static <T,K> DefaultMutableTreeNode traverseAndAdd(DefaultMutableTreeNode rootDefaultMutableTreeNode, @NonNull @NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T, K> treeNode, boolean root) Traverses through the givenBaseTreeNode
object and return the rootDefaultMutableTreeNode
object- Type Parameters:
T
- the generic type of the givenBaseTreeNode
objectK
- the generic type of the id of the givenBaseTreeNode
object- Parameters:
rootDefaultMutableTreeNode
- theDefaultMutableTreeNode
objecttreeNode
- theBaseTreeNode
objectroot
- the flag if the given root tree node will be used for creation of the parent object- Returns:
- the root
DefaultMutableTreeNode
object
-
initializeTreeNodeWithTreeElement
public static <K> io.github.astrapi69.gen.tree.BaseTreeNode<TreeElement,K> initializeTreeNodeWithTreeElement(TreeElement treeElement, io.github.astrapi69.gen.tree.BaseTreeNode<TreeElement, K> parentTreeNode, @NonNull @NonNull io.github.astrapi69.data.identifiable.IdGenerator<K> idGenerator) Factory method that creates a newBaseTreeNode
object from the givenTreeElement
object- Type Parameters:
K
- the generic type of the id of the givenBaseTreeNode
object- Parameters:
treeElement
- theTreeElement
objectparentTreeNode
- the parent objectidGenerator
- the id generator- Returns:
- the new
BaseTreeNode
object
-
initializeBaseTreeNodeWithTreeElement
public static <T,K> io.github.astrapi69.gen.tree.BaseTreeNode<T,K> initializeBaseTreeNodeWithTreeElement(T treeElement, io.github.astrapi69.gen.tree.BaseTreeNode<T, K> parentTreeNode, @NonNull @NonNull io.github.astrapi69.data.identifiable.IdGenerator<K> idGenerator) Factory method that creates a newBaseTreeNode
object from the givenTreeElement
object- Type Parameters:
T
- the generic type of the givenBaseTreeNode
objectK
- the generic type of the id of the givenBaseTreeNode
object- Parameters:
treeElement
- theTreeElement
objectparentTreeNode
- the parent objectidGenerator
- the id generator- Returns:
- the new
BaseTreeNode
object
-
initializeTreeNodeWithTreeElement
public static <K> io.github.astrapi69.gen.tree.BaseTreeNode<io.github.astrapi69.swing.renderer.tree.JTreeElement,K> initializeTreeNodeWithTreeElement(io.github.astrapi69.swing.renderer.tree.JTreeElement treeElement, io.github.astrapi69.gen.tree.BaseTreeNode<io.github.astrapi69.swing.renderer.tree.JTreeElement, K> parentTreeNode, @NonNull @NonNull io.github.astrapi69.data.identifiable.IdGenerator<K> idGenerator) Factory method that creates a newBaseTreeNode
object from the givenTreeElement
object- Type Parameters:
K
- the generic type of the id of the givenBaseTreeNode
object- Parameters:
treeElement
- theTreeElement
objectparentTreeNode
- the parent objectidGenerator
- the id generator- Returns:
- the new
BaseTreeNode
object
-
initializeTreeNodeWithTreeElement
public static <T,K> io.github.astrapi69.gen.tree.BaseTreeNode<io.github.astrapi69.swing.renderer.tree.GenericTreeElement<T>,K> initializeTreeNodeWithTreeElement(io.github.astrapi69.swing.renderer.tree.GenericTreeElement<T> treeElement, io.github.astrapi69.gen.tree.BaseTreeNode<io.github.astrapi69.swing.renderer.tree.GenericTreeElement<T>, K> parentTreeNode, @NonNull @NonNull io.github.astrapi69.data.identifiable.IdGenerator<K> idGenerator) Factory method that creates a newBaseTreeNode
object from the givenTreeElement
object- Type Parameters:
T
- the generic type of the givenBaseTreeNode
objectK
- the generic type of the id of the givenBaseTreeNode
object- Parameters:
treeElement
- theTreeElement
objectparentTreeNode
- the parent objectidGenerator
- the id generator- Returns:
- the new
BaseTreeNode
object
-