addNotify not works allright

Posted by joseph on Stack Overflow See other posts from Stack Overflow or by joseph
Published on 2010-03-22T16:06:50Z Indexed on 2010/03/22 16:11 UTC
Read the original article Hit count: 384

Filed under:
|

Hello. I call addNotify() method in class that I posted here. The problem is, that when I call addNotify() as it is in the code, setKeys(objs) do nothing. Nothing appears in my explorer of running app.

But when I call addNotify()without loop(for int....), and add only one item to ArrayList, it shows that one item correctly.

Does anybody knows where can be problem? See the cede

class ProjectsNode extends Children.Keys{
private ArrayList objs = new ArrayList();

public ProjectsNode() {


}

    @Override
protected Node[] createNodes(Object o) {
    MainProject obj = (MainProject) o;
    AbstractNode result = new AbstractNode (new DiagramsNode(), Lookups.singleton(obj));
    result.setDisplayName (obj.getName());
    return new Node[] { result };
}

@Override
protected void addNotify() {
    //this loop causes nothing appears in my explorer.
    //but when I replace this loop by single line "objs.add(new MainProject("project1000"));", it shows that one item in explorer
    for (int i=0;i==10;i++){
        objs.add(new MainProject("project1000"));
    }
    setKeys (objs);
}

}

© Stack Overflow or respective owner

Related posts about netbeans

Related posts about java