Search in sources :

Example 1 with CyAnnotator

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

the class LayerAnnotationTask method run.

@Override
public void run(TaskMonitor tm) throws Exception {
    JComponent canvas = annotation.getCanvas();
    if (annotation instanceof GroupAnnotation) {
        int z = zorder;
        for (Annotation ann : ((GroupAnnotation) annotation).getMembers()) {
            DingAnnotation dAnn = (DingAnnotation) ann;
            z += 1;
            dAnn.getCanvas().setComponentZOrder(dAnn.getComponent(), z);
        }
    }
    canvas.setComponentZOrder(annotation.getComponent(), zorder);
    canvas.repaint();
    if (view instanceof DGraphView) {
        DGraphView dView = (DGraphView) view;
        CyAnnotator cyAnnotator = dView.getCyAnnotator();
        // Force an update of all of the argMaps
        for (Annotation ann : cyAnnotator.getAnnotations()) cyAnnotator.addAnnotation(ann);
    }
    // We need to do this to update the Bird's Eye View
    annotation.contentChanged();
}
Also used : GroupAnnotation(org.cytoscape.view.presentation.annotations.GroupAnnotation) JComponent(javax.swing.JComponent) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) GroupAnnotation(org.cytoscape.view.presentation.annotations.GroupAnnotation) Annotation(org.cytoscape.view.presentation.annotations.Annotation) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 2 with CyAnnotator

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

the class RemoveAnnotationTaskFactory 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)
        return true;
    return false;
}
Also used : CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 3 with CyAnnotator

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

the class SelectAnnotationTaskFactory method createTaskIterator.

@Override
public TaskIterator createTaskIterator(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
    CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
    DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
    return new TaskIterator(new SelectAnnotationTask(networkView, annotation));
}
Also used : TaskIterator(org.cytoscape.work.TaskIterator) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 4 with CyAnnotator

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

the class UngroupAnnotationsTaskFactory method createTaskIterator.

@Override
public TaskIterator createTaskIterator(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
    CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
    DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
    return new TaskIterator(new UngroupAnnotationsTask(networkView, annotation));
}
Also used : TaskIterator(org.cytoscape.work.TaskIterator) CyAnnotator(org.cytoscape.ding.impl.cyannotator.CyAnnotator) DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 5 with CyAnnotator

use of org.cytoscape.ding.impl.cyannotator.CyAnnotator 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)

Aggregations

DGraphView (org.cytoscape.ding.impl.DGraphView)20 CyAnnotator (org.cytoscape.ding.impl.cyannotator.CyAnnotator)20 DingAnnotation (org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation)20 TaskIterator (org.cytoscape.work.TaskIterator)8 GroupAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl)3 JComponent (javax.swing.JComponent)2 Annotation (org.cytoscape.view.presentation.annotations.Annotation)2 ArrayList (java.util.ArrayList)1 ArrowAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.ArrowAnnotationImpl)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