Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Delivered-To: moderator for general@xml.apache.org Received: (qmail 32473 invoked from network); 7 Feb 2000 22:16:43 -0000 Received: from mail1.stofanet.dk (qmailr@212.10.10.6) by locus.apache.org with SMTP; 7 Feb 2000 22:16:43 -0000 Received: (qmail 16386 invoked from network); 7 Feb 2000 22:16:16 -0000 Received: from pc122021.stofanet.dk (HELO mail1.stofanet.dk) (max@212.10.48.21) by mail1.stofanet.dk with SMTP; 7 Feb 2000 22:16:16 -0000 Sender: max Message-ID: <389F43DD.CD67044E@mail1.stofanet.dk> Date: Mon, 07 Feb 2000 23:14:53 +0100 From: "Max R. Andersen" Reply-To: max@cs.auc.dk X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.12-20 i586) X-Accept-Language: en MIME-Version: 1.0 To: general@xml.apache.org Subject: Re: Deferred nodes and a little bit of swing :) References: <389F2069.8F0486E2@apache.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Andy Clark wrote: > > "Max R. Andersen" wrote: > > I have created a "slicker" implementation of the TreeModel used > > in the swing examples for Xerces. > > We'd be interested in seeing the code. :) Give me a day or two - then it will be "presentable" :) Should I just post it here as attachments ? > > What does this mean exactly ? > > What is the minimum "traversal" neede to expand a node, and what > > is the code for it ? > > The deferred expansion of the DOM document is transparent to a > program written using the W3C APIs. But in short, this is how > it works... > > 1) Both structure and data are lazy evaluated for expansion. > 2) When a child is queried at a node, all of its immediate > children are created and "patched" together. > 3) When the data is queried at a node, then the strings and > such are created. > > I would imagine that you don't have to do anything special > for your slicker TreeModel implementation. Until the user > "opens" each node level, the underlying DOM nodes are never > queried and therefore are never created. > That was also my understanding, but something is not working as I want it :) Small snippet of code from my short-lived memory: when I traverse the first level of children some of these are not "expanded" I test to see if they are deferred by doing the following: if (asinglenode instanceof DeferredNode) { } Now I would think it would be enough to just ask this node for something and it would be fetched - but nope it doesn't work. I have tried to call all the methods in the Node interface on asinglenode, but they all return null or similar "non-existing" values. regards Max