return children.isEmpty();
}
+ /**
+ * {@inheritDoc}
+ */
+ public Enumeration<?> children() {
+ return Collections.enumeration(children);
+ }
+
//
// ACTIONS
//
*/
public void insert(MutableTreeNode child, int index) {
children.add(index, child);
+ child.setParent(this);
}
/**
* {@inheritDoc}
*/
public void remove(int index) {
- children.remove(index);
+ children.remove(index).setParent(null);
}
/**
*/
public void remove(MutableTreeNode node) {
children.remove(node);
+ node.setParent(null);
}
/**
}
/**
+ * Removes all children of this node.
+ */
+ public void removeAll() {
+ for (MutableTreeNode childNode: children) {
+ childNode.setParent(null);
+ }
+ children.clear();
+ }
+
+ /**
* {@inheritDoc}
*/
public void setParent(MutableTreeNode newParent) {
/**
* {@inheritDoc}
*/
- public Enumeration<?> children() {
- return Collections.enumeration(children);
- }
-
- /**
- * {@inheritDoc}
- */
@Override
public String toString() {
return (userObject != null) ? userObject.toString() : null;