Search in sources :

Example 1 with ArrowAnnotation

use of org.cytoscape.view.presentation.annotations.ArrowAnnotation in project cytoscape-impl by cytoscape.

the class AbstractAnnotation method setCanvas.

@Override
public void setCanvas(String cnvs) {
    canvasName = (cnvs.equals(BACKGROUND)) ? DGraphView.Canvas.BACKGROUND_CANVAS : DGraphView.Canvas.FOREGROUND_CANVAS;
    canvas = (ArbitraryGraphicsCanvas) (view.getCanvas(canvasName));
    for (ArrowAnnotation arrow : arrowList) if (arrow instanceof DingAnnotation)
        ((DingAnnotation) arrow).setCanvas(cnvs);
    // Update network attributes
    update();
}
Also used : ArrowAnnotation(org.cytoscape.view.presentation.annotations.ArrowAnnotation)

Example 2 with ArrowAnnotation

use of org.cytoscape.view.presentation.annotations.ArrowAnnotation in project cytoscape-impl by cytoscape.

the class AbstractAnnotation method changeCanvas.

@Override
public void changeCanvas(final String cnvs) {
    // Are we really changing anything?
    if ((cnvs.equals(BACKGROUND) && canvasName.equals(DGraphView.Canvas.BACKGROUND_CANVAS)) || (cnvs.equals(FOREGROUND) && canvasName.equals(DGraphView.Canvas.FOREGROUND_CANVAS)))
        return;
    ViewUtil.invokeOnEDTAndWait(() -> {
        if (!(this instanceof ArrowAnnotationImpl)) {
            for (ArrowAnnotation arrow : arrowList) {
                if (arrow instanceof DingAnnotation)
                    ((DingAnnotation) arrow).changeCanvas(cnvs);
            }
        }
        // Remove ourselves from the current canvas
        canvas.remove(this);
        // update the canvas
        canvas.repaint();
        // Set the new canvas
        setCanvas(cnvs);
        // Add ourselves
        canvas.add(this);
        // update the canvas
        canvas.repaint();
    });
}
Also used : ArrowAnnotation(org.cytoscape.view.presentation.annotations.ArrowAnnotation)

Example 3 with ArrowAnnotation

use of org.cytoscape.view.presentation.annotations.ArrowAnnotation in project cytoscape-impl by cytoscape.

the class AbstractAnnotation method removeAnnotation.

public void removeAnnotation() {
    ViewUtil.invokeOnEDTAndWait(() -> {
        canvas.remove(this);
        cyAnnotator.removeAnnotation(this);
        for (ArrowAnnotation arrow : arrowList) {
            if (arrow instanceof DingAnnotation)
                ((DingAnnotation) arrow).removeAnnotation();
        }
        if (parent != null)
            parent.removeMember(this);
        canvas.repaint();
    });
}
Also used : ArrowAnnotation(org.cytoscape.view.presentation.annotations.ArrowAnnotation)

Aggregations

ArrowAnnotation (org.cytoscape.view.presentation.annotations.ArrowAnnotation)3