@Override public void childrenAdded (NodeMemberEvent ev) { loadNodes(); }
public void loadNodes() { final List<Object> keys = new ArrayList<Object>(); final Node[] nn = delegateChildren.getNodes(); if ((nn.length == 1) && isWaitingNode(nn[0])) { keys.add(nn[0]); } else if (nn.length > 0) { for (final Object o : composite.findChildren().results()) { try { keys.add(findRepresentantOf(o)); } catch (NotFoundException e) { keys.add(o); } } } setKeys(keys); }
@Override @Nonnull protected Node[] createNodes (final @Nonnull Object key) { if (key instanceof Node) { final Node node = (Node)key; if (isWaitingNode(node)) { return new Node[] { new GenericFilterNode(node) }; } return new Node[] { nodeFactory.createNode(getNode().getClass(), node) }; } else { return new Node[] { nodeFactory.createNode(getNode().getClass(), new NodePresentationModel(key)) }; } }
@Nonnull private static org.openide.nodes.Children createChildren (final @Nonnull Node delegateNode, final @Nonnull Lookup lookup, final @Nonnull Object[] extraArgs) { // // If we have a different Composite than the delegate, we have to compute children on our own. // Otherwise, we use a DecoratorChildren as usual for FilterNodes that do not manipulate children. // final Composite<?, Finder<?>> newComposite = lookup.lookup(Composite.class); final Composite<?, Finder<?>> oldComposite = delegateNode.getLookup().lookup(Composite.class); if (newComposite == oldComposite) { return new DecoratorChildren(delegateNode, extraArgs); } else { // Can't occur, since newComposite != oldComposite, and removing a Composite is not supported assert newComposite != null : "newComposite is null"; // TODO: should reuse the existing nodes. Should use the DecoratorChildren as usual, but // rearranging nodes according to the order provided by the Composite, eventually ignoring things // not created by the composite. New items created in the Composite should be mapped to GenericNode. return new RearrangingChildren(delegateNode, newComposite, extraArgs); } } }
@Override public void childrenRemoved (NodeMemberEvent ev) { loadNodes(); }
@Override public void propertyChange (final @Nonnull PropertyChangeEvent event) { // Forces the reloading of children in sortableNode //@bluebook-ignore-begin final RearrangingChildren children = (RearrangingChildren)sortableNode.getChildren(); children.loadNodes(); //@bluebook-ignore-end } });
loadNodes(); // FIXME: in addNotify()