Search in sources :

Example 1 with GroupAnnotationImpl

use of org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl in project cytoscape-impl by cytoscape.

the class UngroupAnnotationsTaskFactory method isReady.

@Override
public boolean isReady(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
    CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
    DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
    if (annotation != null && annotation instanceof GroupAnnotationImpl)
        return true;
    return false;
}
Also used : GroupAnnotationImpl(org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 2 with GroupAnnotationImpl

use of org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl in project cytoscape-impl by cytoscape.

the class GroupAnnotationFactory method createAnnotation.

@Override
public GroupAnnotation createAnnotation(Class<? extends GroupAnnotation> type, CyNetworkView view, Map<String, String> argMap) {
    if (!(view instanceof DGraphView))
        return null;
    DGraphView dView = (DGraphView) view;
    if (type.equals(GroupAnnotation.class)) {
        final GroupAnnotationImpl a = new GroupAnnotationImpl(dView, argMap, getActiveWindow());
        a.update();
        return (GroupAnnotation) a;
    } else {
        return null;
    }
}
Also used : GroupAnnotation(org.cytoscape.view.presentation.annotations.GroupAnnotation) GroupAnnotationImpl(org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 3 with GroupAnnotationImpl

use of org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl in project cytoscape-impl by cytoscape.

the class ResizeAnnotationTaskFactory method isReady.

@Override
public boolean isReady(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
    CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
    DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
    if (annotation != null && (annotation instanceof ShapeAnnotationImpl || annotation instanceof ImageAnnotationImpl || annotation instanceof GroupAnnotationImpl)) {
        return true;
    }
    return false;
}
Also used : ShapeAnnotationImpl(org.cytoscape.ding.impl.cyannotator.annotations.ShapeAnnotationImpl) GroupAnnotationImpl(org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl) ImageAnnotationImpl(org.cytoscape.ding.impl.cyannotator.annotations.ImageAnnotationImpl) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 4 with GroupAnnotationImpl

use of org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl in project cytoscape-impl by cytoscape.

the class GroupAnnotationsTask method run.

@Override
public void run(TaskMonitor tm) throws Exception {
    if (view instanceof DGraphView) {
        DGraphView dView = (DGraphView) view;
        CyAnnotator cyAnnotator = dView.getCyAnnotator();
        GroupAnnotationImpl group = new GroupAnnotationImpl(dView, null);
        // Need to add this first so we can update
        group.addComponent(null);
        // things appropriately
        cyAnnotator.addAnnotation(group);
        // Now, add all of the children
        for (DingAnnotation child : new ArrayList<DingAnnotation>(cyAnnotator.getSelectedAnnotations())) {
            group.addMember(child);
            child.setSelected(false);
        }
        // Finally, set ourselves to be the selected component
        group.setSelected(true);
        group.update();
    }
}
Also used : GroupAnnotationImpl(org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl) ArrayList(java.util.ArrayList) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Aggregations

DGraphView (org.cytoscape.ding.impl.DGraphView)4 GroupAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl)4 CyAnnotator (org.cytoscape.ding.impl.cyannotator.CyAnnotator)3 DingAnnotation (org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation)3 ArrayList (java.util.ArrayList)1 ImageAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.ImageAnnotationImpl)1 ShapeAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.ShapeAnnotationImpl)1 GroupAnnotation (org.cytoscape.view.presentation.annotations.GroupAnnotation)1