Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1631

Re: automatic refreshing

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!transit3.readnews.com!textspool1.readnews.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this>
Subject Re: automatic refreshing
Message-ID <464a8a7a$0$8975$4c368faf@roadrunner.com> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <464a8503$0$9099$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
References <464a8503$0$9099$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 44
Date Wed, 27 Apr 2011 15:34:27 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918467 96.60.20.240 (Wed, 27 Apr 2011 10:34:27 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:34:27 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1631

Show key headers only | View raw


  To: comp.lang.java.gui
Qu0ll wrote:
> "Brandon McCombs" <none@none.com> wrote in message 
> news:464a7cdf$0$502$4c368faf@roadrunner.com...
>> Hello,
>>
>> I'm having a hell of a time trying to get a JTree to automatically 
>> refresh to show that a node has been moved from one parent node to 
>> another.
>>
>> I'm using the following statement to move the node to the new parent:
>>     model.getTreeModel().insertNodeInto(movedNode,
>> newParent,newParent.getChildCount());
>>
>> I'm trying to implement cut/copy/paste functionality and I'm working 
>> to get cut/paste functionality working first so in my paste method I 
>> test for the original operation. If it was a "cut" then I do the 
>> following:
>>     model.getTreeModel().removeNodeFromParent(movedNode);
>>
>> However both of the statements above do not make the tree refresh 
>> automatically to show the changes. I thought using the above were 
>> supposed to do that?  I tried the reload() method of the tree model 
>> and of course when I do that the entire tree collapses and that isn't 
>> what I want (I have a feeling hardly anyone finds that "feature" of 
>> the reload() method useful).
>>
>> Is reloading the tree the only way to make the change in the node's 
>> location visible in the tree? If so, what the hell is the point of 
>> those particular methods when I could just do, for an insertion, 
>> newParent.add(movedNode) instead?
> 
> 
> Are you notifying the tree that a new node has been inserted or removed?
> 

I forgot to mention that my tree model is in fact the DefaultTreeModel 
so that's why I thought the notifications should happen automatically as 
long as I used the methods above.

---
 * 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

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

automatic refreshing of J "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  Re: automatic refreshing "Qu0ll" <qu0ll@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
    Re: automatic refreshing "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
    Re: automatic refreshing "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
      Re: automatic refreshing "Qu0ll" <qu0ll@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
        Re: automatic refreshing "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  Re: automatic refreshing "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000

csiph-web