Search in sources :

Example 31 with DGraphView

use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.

the class TextAnnotationFactory method createAnnotation.

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

Example 32 with DGraphView

use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.

the class ChangeAnnotationCanvasTaskFactory 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 false;
    if (!annotation.getCanvasName().equals(canvas))
        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 33 with DGraphView

use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.

the class EditAnnotationTaskFactory 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 34 with DGraphView

use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.

the class LayerAnnotationTaskFactory 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 LayerAnnotationTask(networkView, annotation, newZorder));
}
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 35 with DGraphView

use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.

the class LayerAnnotationTaskFactory 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 false;
    JComponent canvas = annotation.getCanvas();
    int zorder = canvas.getComponentZOrder(annotation.getComponent());
    if ((offset < 0 && zorder > 0) || (offset > 0 && zorder < canvas.getComponentCount() - 1)) {
        this.newZorder = zorder + offset;
        if (this.newZorder < 0)
            this.newZorder = 0;
        else if (this.newZorder > canvas.getComponentCount() - 1)
            this.newZorder = canvas.getComponentCount() - 1;
        return true;
    }
    return false;
}
Also used : JComponent(javax.swing.JComponent) 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)35 DingAnnotation (org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation)22 CyAnnotator (org.cytoscape.ding.impl.cyannotator.CyAnnotator)20 TaskIterator (org.cytoscape.work.TaskIterator)9 GroupAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.GroupAnnotationImpl)4 CyNetworkView (org.cytoscape.view.model.CyNetworkView)4 JDialog (javax.swing.JDialog)3 GroupAnnotation (org.cytoscape.view.presentation.annotations.GroupAnnotation)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 JComponent (javax.swing.JComponent)2 ImageAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.ImageAnnotationImpl)2 ShapeAnnotationImpl (org.cytoscape.ding.impl.cyannotator.annotations.ShapeAnnotationImpl)2 AbstractDingAnnotationFactory (org.cytoscape.ding.impl.cyannotator.create.AbstractDingAnnotationFactory)2 Annotation (org.cytoscape.view.presentation.annotations.Annotation)2 Dimension (java.awt.Dimension)1 File (java.io.File)1 Collectors.toList (java.util.stream.Collectors.toList)1 JFrame (javax.swing.JFrame)1 JPanel (javax.swing.JPanel)1