]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc/src/main/java/org/argeo/slc/core/structure/tree/TreeSElement.java
Simplify structure framework
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / core / structure / tree / TreeSElement.java
index 6e3ff04a86625b5ab3769d14b1b6c634f2cc306e..aa296c5a927a42add9598168a906f86f99af10f1 100644 (file)
@@ -1,10 +1,6 @@
 package org.argeo.slc.core.structure.tree;\r
 \r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
 import org.argeo.slc.core.structure.StructureElement;\r
-import org.argeo.slc.core.structure.StructurePath;\r
 \r
 /**\r
  * Implementation of <code>StructureElement</code> for tree based registries,\r
@@ -14,10 +10,15 @@ import org.argeo.slc.core.structure.StructurePath;
  */\r
 public class TreeSElement implements StructureElement {\r
        private String description;\r
-       private TreeSPath path;\r
-\r
-       private List<TreeSElement> children = new Vector<TreeSElement>();\r
 \r
+       public TreeSElement(String description){\r
+               this.description = description;\r
+       }\r
+       \r
+       public TreeSElement(String description, String defaultDescription){\r
+               this(description!=null?description:defaultDescription);\r
+       }\r
+       \r
        public String getDescription() {\r
                return description;\r
        }\r
@@ -26,37 +27,4 @@ public class TreeSElement implements StructureElement {
                this.description = description;\r
        }\r
 \r
-       public StructurePath getPath() {\r
-               return path;\r
-       }\r
-\r
-       public List<TreeSElement> getChildren() {\r
-               return children;\r
-       }\r
-\r
-       public TreeSElement createChild(String name, String description) {\r
-               TreeSElement element = new TreeSElement();\r
-               element.path = TreeSPath.createChild((TreeSPath) this.getPath(), name);\r
-               element.description = description;\r
-               children.add(element);\r
-               return element;\r
-       }\r
-\r
-       public static TreeSElement createRootElelment(String name,\r
-                       String description) {\r
-               TreeSElement element = new TreeSElement();\r
-               element.path = TreeSPath.createChild(null, name);\r
-               element.description = description;\r
-               return element;\r
-       }\r
-\r
-       @Override\r
-       public boolean equals(Object obj) {\r
-               if (obj instanceof StructureElement) {\r
-                       StructureElement element = (StructureElement) obj;\r
-                       return getPath().equals(element.getPath());\r
-               }\r
-               return false;\r
-       }\r
-\r
 }\r