Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1FF489FC for ; Fri, 6 May 2011 12:16:41 +0000 (UTC) Received: (qmail 87499 invoked by uid 500); 6 May 2011 12:16:41 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 87478 invoked by uid 500); 6 May 2011 12:16:41 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 87470 invoked by uid 99); 6 May 2011 12:16:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 12:16:40 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gk_brown@verizon.net designates 206.46.173.3 as permitted sender) Received: from [206.46.173.3] (HELO vms173003pub.verizon.net) (206.46.173.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 12:16:33 +0000 Received: from [192.168.1.15] ([unknown] [98.110.173.176]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LKR00AAFWQU08T8@vms173003.mailsrvcs.net> for user@pivot.apache.org; Fri, 06 May 2011 07:16:12 -0500 (CDT) Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Apple Message framework v1084) Subject: Re: How to use java.util.List backed tree structure with TreeView From: Greg Brown In-reply-to: <4DC3E435.7080806@sysedata.no> Date: Fri, 06 May 2011 08:16:06 -0400 Content-transfer-encoding: quoted-printable Message-id: <685B2EF3-A3D2-4E3A-9E47-B0932A388FFE@verizon.net> References: <4DC3DC14.8060000@sysedata.no> <4DC3E435.7080806@sysedata.no> To: user@pivot.apache.org X-Mailer: Apple Mail (2.1084) If a node implements org.apache.pivot.collections.List, it is considered = a branch. Otherwise, it is a leaf. On May 6, 2011, at 8:06 AM, Edvin Syse wrote: > ListAdapter was nice, thanks :) >=20 > But how do I express what is supposed to be Leaf nodes and what to be = Branch nodes? >=20 > -- Edvin >=20 > Den 06.05.2011 13:49, skrev Greg Brown: >> Have you looked at org.apache.pivot.collections.adapter.ListAdapter? = You might be able to use this in conjunction with TreeViewBranchListener = to construct your tree nodes from your backing data structure on demand. >>=20 >> G >>=20 >>=20 >> On May 6, 2011, at 7:31 AM, Edvin Syse wrote: >>=20 >>> I have a tree-structure represented by a list of domain objects. = Some of the domain objects have a "children" property with a = java.util.List of children. The TreeView#setTreeData method takes a = org.apache.pivot.collections.List, and I figured I could do: >>>=20 >>> setTreeData(new ArrayList(myJavaUtilListList.toArray())); >>>=20 >>> This works so that I can see the first level of nodes, but I don't = know how to express branch nodes. Also, I would like to lazy load some = of the nodes. I think I need to use the TreeViewBranchListener somehow, = but I can't find any documentation or examples. >>>=20 >>> Do I need to wrap all my domain objects in TreeNodes or is there = another way to do this? >>>=20 >>> -- Edvin >>=20