Class BaseTreeNodeFactory

java.lang.Object
io.github.astrapi69.swing.tree.factory.BaseTreeNodeFactory

public class BaseTreeNodeFactory extends Object
Factory class for generate DefaultMutableTreeNode from BaseTreeNode
  • 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 new DefaultMutableTreeNode object from the given BaseTreeNode object
      Type Parameters:
      T - the generic type of the given BaseTreeNode object
      K - the generic type of the id of the given BaseTreeNode object
      Parameters:
      treeNode - the BaseTreeNode object
      Returns:
      the new DefaultMutableTreeNode object generated from the given BaseTreeNode object
    • traverseAndAdd

      public static <T, K> DefaultMutableTreeNode traverseAndAdd(DefaultMutableTreeNode rootDefaultMutableTreeNode, @NonNull @NonNull io.github.astrapi69.gen.tree.BaseTreeNode<T,K> treeNode)
      Traverses through the given BaseTreeNode object and return the root DefaultMutableTreeNode object
      Type Parameters:
      T - the generic type of the given BaseTreeNode object
      K - the generic type of the id of the given BaseTreeNode object
      Parameters:
      rootDefaultMutableTreeNode - the DefaultMutableTreeNode object
      treeNode - the BaseTreeNode 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 new DefaultMutableTreeNode object from the given BaseTreeNode object
      Type Parameters:
      T - the generic type of the given BaseTreeNode object
      K - the generic type of the id of the given BaseTreeNode object
      Parameters:
      treeNode - the BaseTreeNode object
      parent - the parent DefaultMutableTreeNode object
      onlyRoot - 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 given BaseTreeNode 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 given BaseTreeNode object and return the root DefaultMutableTreeNode object
      Type Parameters:
      T - the generic type of the given BaseTreeNode object
      K - the generic type of the id of the given BaseTreeNode object
      Parameters:
      rootDefaultMutableTreeNode - the DefaultMutableTreeNode object
      treeNode - the BaseTreeNode object
      root - 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 new BaseTreeNode object from the given TreeElement object
      Type Parameters:
      K - the generic type of the id of the given BaseTreeNode object
      Parameters:
      treeElement - the TreeElement object
      parentTreeNode - the parent object
      idGenerator - 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 new BaseTreeNode object from the given TreeElement object
      Type Parameters:
      T - the generic type of the given BaseTreeNode object
      K - the generic type of the id of the given BaseTreeNode object
      Parameters:
      treeElement - the TreeElement object
      parentTreeNode - the parent object
      idGenerator - 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 new BaseTreeNode object from the given TreeElement object
      Type Parameters:
      K - the generic type of the id of the given BaseTreeNode object
      Parameters:
      treeElement - the TreeElement object
      parentTreeNode - the parent object
      idGenerator - 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 new BaseTreeNode object from the given TreeElement object
      Type Parameters:
      T - the generic type of the given BaseTreeNode object
      K - the generic type of the id of the given BaseTreeNode object
      Parameters:
      treeElement - the TreeElement object
      parentTreeNode - the parent object
      idGenerator - the id generator
      Returns:
      the new BaseTreeNode object