summaryrefslogtreecommitdiff
path: root/new-structs.go
diff options
context:
space:
mode:
Diffstat (limited to 'new-structs.go')
-rw-r--r--new-structs.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/new-structs.go b/new-structs.go
index 03b6b94..a9cd2a6 100644
--- a/new-structs.go
+++ b/new-structs.go
@@ -80,10 +80,31 @@ func (n *Node) Append(child *Node) {
// }
n.children = append(n.children, child)
}
+
func (n *Node) List() {
findByIdDFS(n, "test")
}
+func (n *Node) ListChildren() {
+ log.Println("gui.Node.ListChildren() node =", n.Name, n)
+
+ if len(n.children) == 0 {
+ log.Println("\t\tNo children START")
+ return
+ }
+// if len(n.children) > 0 {
+ for _, child := range n.children {
+ log.Println("gui.Node.ListChildren() child =", child.Name, child)
+ if (child.children == nil) {
+ log.Println("\t\tNo children END")
+ break
+ }
+ log.Println("\t\tHas children:", child.children)
+ child.ListChildren()
+ }
+ return
+}
+
func findByIdDFS(node *Node, id string) *Node {
log.Println("findByIdDFS()", id, node)
node.Dump()