Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "dhanya" Subject: Re: dynamic JTree from XM Message-ID: <1164964156.348406.53030@j72g2000cwa.googlegroups.com> X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: References: Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 61 Date: Wed, 27 Apr 2011 15:26:38 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303917998 96.60.20.240 (Wed, 27 Apr 2011 10:26:38 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:26:38 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:282 To: comp.lang.java.gui Oliver Wong wrote: > "dhanya" wrote in message > news:1164772962.662698.218240@j72g2000cwa.googlegroups.com... > > > > This is my structure > > > > Root > > | > > | > > ,.... RED > > | | > > | _Cherry > > | _Wine > > | > > | > > _VIOLET > > _Flower > > _Name > > | > > _Leaf > > > > > > I have two XML files parent and chile. The parent has only detail abt > > parent nodes. When i construct tree i read the parent XML check whether > > it has child nodes, if it has i add a dummy node to parent and display. > > When the user clicks on the parent node i have to parse child XML, read > > child's data and display the corresponding child nodes for the clicked > > parent. > > I have done the first level i.e displaying dummy nodes. I have > > TreeExpansionListener and i can get the parent's name using getpath. > > But Wat i get is if i click on RED i get RED as the resukt of getpath, > > what i want is i want to know it is a parent node. > > I'm still a bit confused. You have exactly two XML files, one parent > file and one child file? Or you have two types of XML files, with probably > one file of the "parent" type, and many files of the "child" type? > > If you just need to know whether a node came from one file or the other, > why don't you store this information with the nodes, or perhaps in a > Map? Or if you always know that parents are at 1 depth below the > root, why don't you just try going up 1 level, checking if what's there is > the root, and if so, then you have a so-called "parent" node, otherwise you > have a so-called "child" node? > > - Oliver Hi Oliver, Thanks for ur reply. I have achieved what i wanted to do. Thanks for ur patience. Regards, Dhanya --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24