use of cbit.gui.graph.Shape in project vcell by virtualcell.
the class ShapeGroupUtil method disbandGroup.
public static void disbandGroup(GraphModel graphModel, Shape groupShape) {
List<Shape> memberShapes = new ArrayList<Shape>(groupShape.getChildren());
Shape parentShape = groupShape.getParent();
if (parentShape != null) {
for (Shape memberShape : memberShapes) {
parentShape.addChildShape(memberShape);
}
parentShape.removeChild(groupShape);
}
groupShape.removeAllChildren();
graphModel.removeShape(groupShape);
for (Shape edge : ShapeUtil.getEdges(graphModel, groupShape)) {
graphModel.removeShape(edge);
}
}
use of cbit.gui.graph.Shape in project vcell by virtualcell.
the class ShapeGroupUtil method moveMembersToGroup.
public static void moveMembersToGroup(Shape groupShape, Collection<Shape> memberShapes) {
for (Shape memberShape : memberShapes) {
if (!willBeSkippedWhenGrouping(memberShape)) {
Point absLocation = memberShape.getSpaceManager().getAbsLoc();
groupShape.addChildShape(memberShape);
memberShape.getSpaceManager().setAbsLoc(absLocation);
}
}
}
use of cbit.gui.graph.Shape in project vcell by virtualcell.
the class VCGroupManager method disbandSelectedGroups.
public void disbandSelectedGroups() {
GraphModel graphModel = graphView.getGraphModel();
List<Shape> selectedShapes = graphModel.getSelectedShapes();
Set<Shape> groups = new HashSet<Shape>();
for (Shape selectedShape : selectedShapes) {
if (ShapeGroupUtil.isGroup(selectedShape)) {
groups.add(selectedShape);
}
// else {
// Shape parent = selectedShape.getParent();
// if(parent != null && ShapeGroupUtil.isGroup(parent)) {
// groups.add(parent);
// }
// }
}
for (Shape group : groups) {
ShapeGroupUtil.disbandGroup(graphModel, group);
}
graphView.repaint();
}
use of cbit.gui.graph.Shape in project vcell by virtualcell.
the class VCGroupManager method expandSelectedGroups.
public void expandSelectedGroups() {
GraphModel graphModel = graphView.getGraphModel();
List<Shape> selectedShapes = graphModel.getSelectedShapes();
for (Shape selectedShape : selectedShapes) {
ShapeGroupUtil.expandGroup(selectedShape);
}
graphView.repaint();
}
use of cbit.gui.graph.Shape in project vcell by virtualcell.
the class VCGroupManager method collapseAsNewGroup.
public void collapseAsNewGroup() {
GraphModel graphModel = graphView.getGraphModel();
List<Shape> selectedShapes = graphModel.getSelectedShapes();
try {
GroupShape groupShape = ShapeGroupUtil.createGroup(graphModel, groupNamer.createName(), selectedShapes);
ShapeGroupUtil.collapseGroup(groupShape);
graphView.repaint();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations