[nbdev] Re: Stupid (?) question on ChildFactories

  • From: Peter Blemel < >
  • To: NetBeans Mailing list < >
  • Subject: [nbdev] Re: Stupid (?) question on ChildFactories
  • Date: Wed, 13 Mar 2013 09:05:03 -0600
  • Importance: Normal

Hermann,

createKeys is a deceptive name.  You don't have to create anything at all if you don't want to.  You can even return the same list over and over again if that's what you want to do.   So, it does whatever you program it to do. 

The key word in the FAQ is 'update'.  If you set up your node/factory to cache the list of children nodes along with a "change list", you could then create new nodes for things in the "change list" and merge them into the node cache on subsequent calls to createKeys(), and return the aggregate list.

You would need to give your "OK" action implementation for your dialog a mechanism by which to get the new data to the ChildFactory, and then invoke refresh().   By the way, refresh() is protected.  Whatever method in your CF that implements updating the change list should invoke it.

Peter

> Date: Wed, 13 Mar 2013 11:16:40 +0100
> From:
> To:
> Subject: [nbdev] Stupid (?) question on ChildFactories
>
> Hi everybody,
> I want to dynamically add a node to an OutlineView which is populated
> using the netbeans standard mechanism via ChildFactory. The FAQ states
> "When the child list needs updating, call refresh() on your
> ChildFactory. Its createKeys method will be called again and you can
> update the set of key objects as needed".
> But I don't want createKeys() to be called, it would again fetch all
> nodes from the database. I only want to add one object I already got
> from my create dialog. How can I obtain that?
>
> Hermann


[nbdev] Stupid (?) question on ChildFactories

Hermann Matthes 03/13/2013

[nbdev] Re: Stupid (?) question on ChildFactories

Peter Blemel 03/13/2013

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 25 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150226.965aeb8). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close