Search in sources :

Example 1 with GraphModel

use of cbit.gui.graph.GraphModel in project vcell by virtualcell.

the class VCGroupManager method collapseExistingGroups.

public void collapseExistingGroups() {
    GraphModel graphModel = graphView.getGraphModel();
    List<Shape> selectedShapes = graphModel.getSelectedShapes();
    for (Shape selectedShape : selectedShapes) {
        Shape parentShape = selectedShape.getParent();
        if (parentShape != null) {
            ShapeGroupUtil.collapseGroup(parentShape);
        }
    }
    graphView.repaint();
}
Also used : Shape(cbit.gui.graph.Shape) GraphModel(cbit.gui.graph.GraphModel)

Example 2 with GraphModel

use of cbit.gui.graph.GraphModel 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();
}
Also used : Shape(cbit.gui.graph.Shape) GraphModel(cbit.gui.graph.GraphModel) HashSet(java.util.HashSet)

Example 3 with GraphModel

use of cbit.gui.graph.GraphModel 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();
}
Also used : Shape(cbit.gui.graph.Shape) GraphModel(cbit.gui.graph.GraphModel)

Example 4 with GraphModel

use of cbit.gui.graph.GraphModel 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();
    }
}
Also used : Shape(cbit.gui.graph.Shape) GraphModel(cbit.gui.graph.GraphModel)

Aggregations

GraphModel (cbit.gui.graph.GraphModel)4 Shape (cbit.gui.graph.Shape)4 HashSet (java.util.HashSet)1