public void ungroupCluster(Cluster cluster) {
   GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel();
   if (gm != null) {
     HierarchicalGraph graph = gm.getHierarchicalGraphVisible();
     graph.ungroupNodes(cluster.getMetaNode());
     cluster.setMetaNode(null);
   }
 }
  public void groupCluster(Cluster cluster) {
    GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel();
    if (gm != null) {
      HierarchicalGraph graph = gm.getHierarchicalGraphVisible();
      Node[] newGroup = cluster.getNodes();
      float centroidX = 0;
      float centroidY = 0;
      int len = 0;
      Node group = graph.groupNodes(newGroup);
      cluster.setMetaNode(group);

      group.getNodeData().setLabel("Group");
      group.getNodeData().setSize(10f);
      for (Node child : newGroup) {
        centroidX += child.getNodeData().x();
        centroidY += child.getNodeData().y();
        len++;
      }
      centroidX /= len;
      centroidY /= len;
      group.getNodeData().setX(centroidX);
      group.getNodeData().setY(centroidY);
    }
  }
 public boolean canUngroup(Cluster cluster) {
   return cluster.getMetaNode() != null;
 }
 public void selectCluster(Cluster cluster) {
   SelectionManager selectionManager = VizController.getInstance().getSelectionManager();
   selectionManager.resetSelection();
   selectionManager.selectNodes(cluster.getNodes());
 }