/** * This method removes the given cluster from the cluster list of this compound model, and * moreover it removes this compound model from the set of clustered nodes of the given cluster. * This is done by calling super method. Since this is a compound model, this operation is done * recursively. */ public void removeCluster(Cluster cluster) { // call super method super.removeCluster(cluster); // get all children node models List childrenNodes = this.children; Iterator itr = childrenNodes.iterator(); // iterate over each child node model while (itr.hasNext()) { NodeModel childModel = (NodeModel) itr.next(); // recursively remove children node models from the cluster childModel.removeCluster(cluster); } }
public void resetClusters() { List<Cluster> clusters = new ArrayList<Cluster>(); clusters.addAll(this.clusters); super.resetClusters(); List childrenNodes = this.children; Iterator itr = childrenNodes.iterator(); while (itr.hasNext()) { NodeModel childModel = (NodeModel) itr.next(); for (Cluster cluster : clusters) { childModel.removeCluster(cluster); } } }