summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/gui/ClassInheritanceTreeNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuchaz/enigma/gui/ClassInheritanceTreeNode.java')
-rw-r--r--src/cuchaz/enigma/gui/ClassInheritanceTreeNode.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/gui/ClassInheritanceTreeNode.java b/src/cuchaz/enigma/gui/ClassInheritanceTreeNode.java
new file mode 100644
index 0000000..921a1e9
--- /dev/null
+++ b/src/cuchaz/enigma/gui/ClassInheritanceTreeNode.java
@@ -0,0 +1,56 @@
1package cuchaz.enigma.gui;
2
3import java.util.List;
4
5import javax.swing.tree.DefaultMutableTreeNode;
6
7import com.beust.jcommander.internal.Lists;
8
9import cuchaz.enigma.mapping.Ancestries;
10
11public class ClassInheritanceTreeNode extends DefaultMutableTreeNode
12{
13 private static final long serialVersionUID = 4432367405826178490L;
14
15 String m_className;
16
17 public ClassInheritanceTreeNode( String className )
18 {
19 m_className = className;
20 }
21
22 public String getClassName( )
23 {
24 return m_className;
25 }
26
27 @Override
28 public String toString( )
29 {
30 return m_className;
31 }
32
33 public void load( Ancestries ancestries, boolean recurse )
34 {
35 // get all the child nodes
36 List<ClassInheritanceTreeNode> nodes = Lists.newArrayList();
37 for( String subclassName : ancestries.getSubclasses( m_className ) )
38 {
39 nodes.add( new ClassInheritanceTreeNode( subclassName ) );
40 }
41
42 // add then to this node
43 for( ClassInheritanceTreeNode node : nodes )
44 {
45 this.add( node );
46 }
47
48 if( recurse )
49 {
50 for( ClassInheritanceTreeNode node : nodes )
51 {
52 node.load( ancestries, true );
53 }
54 }
55 }
56}