[platform-dev] Re: Re: Performance issue with OutlineView

  • From: Geertjan Wielenga < >
  • To:
  • Subject: [platform-dev] Re: Re: Performance issue with OutlineView
  • Date: Wed, 21 Nov 2012 18:08:46 +0100




What you've sent so far quite clearly doesn't perform at all since the OutlineView hasn't been added to the TopComponent.

I had to add this to your TopComponent:

setLayout(new BorderLayout());
add(new JScrollPane(outline), BorderLayout.CENTER);


Kind of curious to know how you could display anything at all without adding your OutlineView to your TopComponent.

Next, read these:

http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/Children.Keys.html
http://bits.netbeans.org/dev/javadoc/org-openide-nodes/apichanges.html#Children.Keys.lazy
https://blogs.oracle.com/geertjan/entry/create_lazy_children_with_netbeans

Change the TradeNode constructor to the following:

public TradeNode() {
    super(new TradeChildFactory(new Business()));
// super(Children.create(new TradeChildFactory(new Business()), false));
    setDisplayName("Trades");
}

Then, change your TradeChildFactory (which should be renamed to TradeChildren, but I haven't done that because this way it's clearer what you need to replace in your module):

package test.outlineviewexample;

import java.util.ArrayList;
import java.util.List;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Children;
import org.openide.nodes.Node;

public class TradeChildFactory extends Children.Keys<Trade> {

    private final Business business;

    public TradeChildFactory(Business business) {
        super(true);
        this.business = business;
    }

    @Override
    protected void addNotify() {
        setKeys(generateDummyTrades(business));
    }

    @Override
    protected Node[] createNodes(Trade key) {
        return new Node[]{new TradeNode(key)};
    }

//    @Override
//    protected boolean createKeys(List<Trade> toPopulate) {
//        List<Trade> trades = generateDummyTrades(business);
//        toPopulate.addAll(trades);
//        return true;
//    }
//
//    @Override
//    protected Node createNodeForKey(Trade key) {
//        return new TradeNode(key);
//    }


    // testing only
    private List<Trade> generateDummyTrades(Business business) {
        List<Trade> trades = new ArrayList<Trade>(700);
        for(int i=0; i< 700;i++){
            trades.add(new Trade(business));
        }
        return trades;
    }


}

Interested to hear if this improves performance for you.

Gj



On 11/21/2012 05:55 PM, imavroukakis wrote:
Argh! You're right it doesn't and the reason behind that is that I can have 
multiple of those, and I create them via an action. re-attached, third time 
lucky.
Interestingly enough, when I run the module it performed a little better, 
which makes it all the more confusing..




Attachments:
http://forums.netbeans.org//files/outlineviewexample_167.zip




[platform-dev] Re: Performance issue with OutlineView

ruben.hinojo 11/19/2012

[platform-dev] Re: Performance issue with OutlineView

Ioannis Mavroukakis 11/19/2012

<Possible follow-up(s)>

[platform-dev] Re: Performance issue with OutlineView

imavroukakis 11/21/2012

[platform-dev] Re: Re: Performance issue with OutlineView

Geertjan Wielenga 11/21/2012

[platform-dev] Re: Performance issue with OutlineView

imavroukakis 11/21/2012

[platform-dev] Re: Re: Performance issue with OutlineView

Geertjan Wielenga 11/21/2012

[platform-dev] Re: Performance issue with OutlineView

imavroukakis 11/21/2012

[platform-dev] Re: Re: Performance issue with OutlineView

Geertjan Wielenga 11/21/2012

[platform-dev] Re: Performance issue with OutlineView

imavroukakis 11/21/2012

[platform-dev] Re: Re: Performance issue with OutlineView

Geertjan Wielenga 11/21/2012

[platform-dev] Re: Performance issue with OutlineView

imavroukakis 11/21/2012

[platform-dev] Re: Re: Performance issue with OutlineView

Geertjan Wielenga 11/21/2012

[platform-dev] Re: Performance issue with OutlineView

Ioannis Mavroukakis 11/21/2012

[platform-dev] Re: Performance issue with OutlineView

imavroukakis 11/22/2012

[platform-dev] Re: Re: Performance issue with OutlineView

Geertjan Wielenga 11/22/2012

[platform-dev] Re: Re: Performance issue with OutlineView

Geertjan Wielenga 11/22/2012

[platform-dev] Re: Performance issue with OutlineView

imavroukakis 11/22/2012

[platform-dev] Re: Performance issue with OutlineView

Frédéric Deniger 11/22/2012

Project Features

Project Links

About this Project

Platform was started in November 2009, is owned by Antonin Nebuzelsky, and has 138 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close