Harsha Sanjeewa has translated the vaadin example of the tree in clojure. 
The source is here <https://github.com/hsenid-mobile/clj-vaadin>. It is very 
useful to begin working with clojure and vaadin. 

This tree example has 2 levels and I would like to have 4 levels. With the 
following code it shows still the 2 levels, although the levels 3 and 4 are 
parented. Why is there no level 3 and 4?

(defn level1 [tree [n1 n2 n3 n4]]
  (.addItem tree n1)
  (if (empty? n2)
    (.setChildrenAllowed tree n1 false)
    (do
      (reduce
        (fn [tree n2]
          (doto tree
            (.addItem n2)
            (.setParent n2 n1)))
        tree n2)
      (.expandItemsRecursively tree n1)
      (if (empty? n3)
        (.setChildrenAllowed tree n2 false)
        (do
          (reduce
            (fn [tree n3]
              (doto tree
                (.addItem n3)
                (.setParent n3 n2)))
            tree n3)
          (.expandItemsRecursively tree n2)
          (if (empty? n4)
            (.setChildrenAllowed tree n3 false)
            (do (doto tree
                  (.addItem n4)
                  (.setParent n4 n3)
                  (.expandItemsRecursively n3)
                  (.setChildrenAllowed n4 false)
                  )))))))
  tree) 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to