All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.alantea.swing.mindmap.MindMapNode Maven / Gradle / Ivy

The newest version!
package net.alantea.swing.mindmap;

import java.util.ArrayList;
import java.util.List;

public class MindMapNode
{
   private T data;
   private MindMapNode parent;
   private List> children = new ArrayList<>();

   public MindMapNode(MindMapNode parent, T data)
   {
      this.parent = parent;
      this.data = data;
      if (parent != null)
      {
         parent.addNode(this);
      }
   }

   private void addNode(MindMapNode mindMapNode)
   {
      children.add(mindMapNode);
   }

   public T getData()
   {
      return data;
   }

   public void setData(T data)
   {
      this.data = data;
   }

   public MindMapNode getParent()
   {
      return parent;
   }

   public void setParent(MindMapNode parent)
   {
      this.parent = parent;
   }

   public List> getChildren()
   {
      return children;
   }

   public void setChildren(List> children)
   {
      this.children = children;
   }
   
   @Override
   public String toString()
   {
      if (data == null)
      {
         return "null";
      }
      return data.toString();
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy