/** * Updates the selected set of this world for the specified node. * This method must be called when (1) the specified node is added/removed * to/from this world or (2) the specified node is selected or deselected. * @param node the node for which to update the selected set of this world. */ void updateSelectedSet(Node node) { // Update our selected set for the specified node. If the node is now // (1) selected and (2) part of this world, then add it to our selected // set. (Ok if already there.) Otherwise, remove it from our selected // set. (Ok if not there.) if (node instanceof Selectable) { if (node.isSelected() && this==node.getWorld()) { _selectedSet.add(node); } else { _selectedSet.remove(node); } } // If the specified node is a group, then update our selected set // for each of its children. if (node instanceof Group) { Group group = (Group)node; Iterator<Node> children = group.getChildren(); while (children.hasNext()) { Node child = children.next(); updateSelectedSet(child); } } }