/** more info in class javadoc. * @since 7.9 */ static Node factory(Map<String,?> map) { return new LazyNode(map); }
public void run() { changeOriginal(n[0], true); } });
@Override public int getNodesCount(boolean optimalResult) { node.switchToOriginal(); return super.getNodesCount(optimalResult); }
final Node switchToOriginal() { final Node[] n = new Node[]{null}; synchronized (this) { if (map == null) { return getOriginal(); } n[0] = (Node)map.get("original"); // NOI18N if (n[0] == null) { throw new IllegalArgumentException("Original Node from map " + map + " is null"); } map = null; } Children.MUTEX.postWriteRequest(new Runnable() { public void run() { changeOriginal(n[0], true); } }); return n[0]; }
private LazyNode(AbstractNode an, Map<String,?> map) { super(an, new SwitchChildren(an)); ((SwitchChildren)getChildren()).node = this; this.map = map; an.setName((String) map.get("name")); // NOI18N an.setDisplayName((String) map.get("displayName")); // NOI18N an.setShortDescription((String) map.get("shortDescription")); // NOI18N String iconBase = (String) map.get("iconResource"); // NOI18N if (iconBase != null) { an.setIconBaseWithExtension(iconBase); } }
@Override protected void addNotify() { node.switchToOriginal(); super.addNotify(); }
@Override public Node[] getNodes(boolean optimalResult) { node.switchToOriginal(); return super.getNodes(optimalResult); }
@Override public Node findChild(String name) { node.switchToOriginal(); return super.findChild(name); }
@Override public Action[] getActions(boolean context) { return switchToOriginal().getActions(context); }