I call the addNotify () method in the class that I posted here. The problem is that when calling addNotify (), as in the code, setKeys (objs) does nothing. Nothing is displayed in my application explorer.
But when I call addNotify () without a loop (for int ....) and add only one element to the ArrayList, it shows that one element is correct.
Does anyone know where there might be a problem? See 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() {
for (int i=0;i==10;i++){
objs.add(new MainProject("project1000"));
}
setKeys (objs);
}
}
source
share