34 import java.util.ArrayList;
35 import java.util.Comparator;
36 import java.util.Enumeration;
37 import java.util.Iterator;
38 import java.util.concurrent.atomic.AtomicBoolean;
39 import javax.swing.event.TreeModelEvent;
40 import javax.swing.tree.TreeNode;
41
42 /**
43 *
44 * Representation of a node in the GUI tree representing the visible test structure.
45 */
46 public class TT_BasicNode extends TT_TreeNode {
47
48 TT_BasicNode(TT_BasicNode parent, TRT_TreeNode tn, Comparator<String> comp) {
49 this.comp = comp;
50 this.parent = parent;
51 this.tn = tn;
52 }
53 // ------- interface methods --------
54 public Enumeration children() {
55 updateNode();
56
57 ArrayList<TT_TreeNode> copy = null;
58 synchronized (children) {
59 // shallow copy child list?
60 copy = new ArrayList<>(children);
61 }
62
63 final Iterator it = copy.iterator();
64 return new Enumeration() {
65
66 public boolean hasMoreElements() {
67 return it.hasNext();
68 }
69
70 public Object nextElement() {
71 return it.next();
72 }
73 };
74 }
75
76 public boolean getAllowsChildren() {
77 return true;
78 }
79
80 public TreeNode getChildAt(int arg0) {
81 if (children == null) {
82 return null;
83 }
84 updateNode();
85 synchronized (children) {
86 return children.get(arg0);
87 }
88 }
89
90 public int getChildCount() {
|
34 import java.util.ArrayList;
35 import java.util.Comparator;
36 import java.util.Enumeration;
37 import java.util.Iterator;
38 import java.util.concurrent.atomic.AtomicBoolean;
39 import javax.swing.event.TreeModelEvent;
40 import javax.swing.tree.TreeNode;
41
42 /**
43 *
44 * Representation of a node in the GUI tree representing the visible test structure.
45 */
46 public class TT_BasicNode extends TT_TreeNode {
47
48 TT_BasicNode(TT_BasicNode parent, TRT_TreeNode tn, Comparator<String> comp) {
49 this.comp = comp;
50 this.parent = parent;
51 this.tn = tn;
52 }
53 // ------- interface methods --------
54 public Enumeration<TT_TreeNode> children() {
55 updateNode();
56
57 ArrayList<TT_TreeNode> copy = null;
58 synchronized (children) {
59 // shallow copy child list?
60 copy = new ArrayList<>(children);
61 }
62
63 final Iterator<TT_TreeNode> it = copy.iterator();
64 return new Enumeration<TT_TreeNode>() {
65
66 public boolean hasMoreElements() {
67 return it.hasNext();
68 }
69
70 public TT_TreeNode nextElement() {
71 return it.next();
72 }
73 };
74 }
75
76 public boolean getAllowsChildren() {
77 return true;
78 }
79
80 public TreeNode getChildAt(int arg0) {
81 if (children == null) {
82 return null;
83 }
84 updateNode();
85 synchronized (children) {
86 return children.get(arg0);
87 }
88 }
89
90 public int getChildCount() {
|