This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
<apidef name="nodes">Nodes API</apidef>
</apidefs>
<changes>
<change id="Node.updateChildren">
<api name="nodes"/>
<summary>A mechanism to lazily update node's children.</summary>
<version major="7" minor="18"/>
<date day="9" month="9" year="2010"/>
<author login="mentlicher"/>
<compatibility addition="yes" binary="compatible" source="compatible" semantic="compatible"/>
<description>
<p>
<a href="@TOP@/org/openide/nodes/Node.html">Node</a> has a new updateChildren()
protected method, that can be overriden to provide Children implementation
when node's children are needed.
</p>
</description>
<class package="org.openide.nodes" name="Node"/>
<issue number="190115"/>
</change>
<change id="IndexedNode.LookupConstr">
<summary>New constructor of IndexedNode</summary>
OpenIDE-Module: org.openide.nodes
OpenIDE-Module-Localizing-Bundle: org/openide/nodes/Bundle.properties
AutoUpdate-Essential-Module: true
OpenIDE-Module-Specification-Version: 7.17
OpenIDE-Module-Specification-Version: 7.18
* setChildren will fire the appropriate events
*/
@Override
final void updateChildren() {
protected final org.openide.nodes.Children updateChildren(org.openide.nodes.Children origChildren) {
if (isDefault()) {
org.openide.nodes.Children newChildren = null;
}
if (newChildren != null) {
final org.openide.nodes.Children set = newChildren;
return newChildren;
Children.MUTEX.postWriteRequest(
new Runnable() {
public void run() {
setChildren(set);
);
return origChildren;
/** An exception to be thrown from hashCode() to debug issue 46993.
return hierarchy;
/** Can be overridden in subclasses (probably in FilterNode) to check
/** Can be called in subclasses (probably in FilterNode) to check
* whether children are of the right subclass
void updateChildren() {
Children origChildren = hierarchy;
final Children newChildren = updateChildren(origChildren);
if (newChildren != origChildren && newChildren != null) {
setChildren(newChildren);
/**
* Can be overridden in subclasses to update the children of this node
* when someone asks for them.
* @param origChildren Original Children passed to the constructor.
* @return Children instance to be used instead of the original.
* @since 7.18
protected Children updateChildren(Children origChildren) {
/** Allows to change Children of the node. Call to this method aquires
GoldenEvent.assertEvents ( nl.getEvents(), goldenEvents, PropertyChangeEvent.class );
/** Test whether updateChildren() is called and children are updated
public void testUpdateChildren() {
TestNodeUCh n = new TestNodeUCh(Children.LEAF);
assertSame("Children not updated", n.newChildren, n.getChildren());
n = new TestNodeUCh(Children.LEAF);
assertFalse("Children not updated, the node should not be leaf", n.isLeaf());
/** Tests property changes on old and new nodes
private static class TestNodeUCh extends AbstractNode {
private Children origChildren;
Children newChildren = new Children.Array();
public TestNodeUCh( Children ch ) {
super( ch );
origChildren = ch;
if (origChildren == this.origChildren) {
/** Useful class for testing events.