🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11790

Re: Tree model question

#11790
From: Leo Cohen
Date: Wed, 24 Mar 1999 00:00
58 lines
2665 bytes
Vasu: Thinking about your response, I decided to see if the tree models
I'm using are indeed different. Here's the code fragment that creates a
new tree model:

 		treeModel = new ViewTreeModel(dataManager);                

In the constructor for ViewTreeModel I generate an integer ID number
that is then assigned to the member variable treeModelID. Then I put a
breakpoint in TreeModel.getChild() and check treeModelID. When I'm
placing view A, I get model #1, when I'm placing view B I get model #2.
This tells me that they are indeed different tree model instances.

Further experiments tell me the following: I put view A on the screen
with each of its rows expanded. When I write view B, view A is rewritten
automatically and without reference to the tree model, but its rows are
collapsed. 

When I go to expand an individual row in view A, JTree goes to its tree
model, which goes to the common data manager and gets all of the
available data, which is now more than originally contained in view A
because view B expanded the cache when it was created. 

Finally, the cache  is rather large, and I may have many views of the
data on the screen at one time. Therefore, it is impractical to copy the
cache for each view.

*******************

Vasudevan Srinivasan wrote:
> 
> Hi,
> Why dont you use another instance of the same model for tree B?
> 
> Vasu
> 
> Leo Cohen wrote:
> 
> > I have two JTrees, A and B. They both use the same data model. When A
> > comes up it displays a limited number of levels, x. When B comes up it
> > displays more levels than A. However, the first x levels of B are the
> > same as A.
> >
> > The problem is, when I put B on the screen JTree regenerates A with the
> > same number of levels as B.
> >
> > The question is, how do I put B on the screen without regenerating A?

-- 
Leo Cohen

116-1 Howard Drive
Charlottesville, VA  22903

804-243-8922 (UVA)
804-244-4648 (home)
804-244-7922 (home fax)
815-550-9313 (office fax)
lcohen@cs.virginia.edu
Technical Details
Message-ID: <36F91DD6.B2F013F1@cs.virginia.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36F5756B.2A0CE1D6@cs.virginia.edu> <36F65300.300CECC8@netrisk.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,5fd079ebe2f90602
X-Google-Attributes: gid111d45,public
From: Leo Cohen <lcohen@cs.virginia.edu>
Subject: Re: Tree model question
Date: 1999/03/24
Message-ID: <36F91DD6.B2F013F1@cs.virginia.edu>
X-Deja-AN: 458468433
Content-Transfer-Encoding: 7bit
References: <36F5756B.2A0CE1D6@cs.virginia.edu> <36F65300.300CECC8@netrisk.com>
To: Vasudevan Srinivasan <vasudevan@netrisk.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing