use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class BoundedTextAnnotationFactory method createAnnotation.
@Override
public BoundedTextAnnotation createAnnotation(Class<? extends BoundedTextAnnotation> type, CyNetworkView view, Map<String, String> argMap) {
if (!(view instanceof DGraphView))
return null;
DGraphView dView = (DGraphView) view;
if (type.equals(BoundedTextAnnotation.class)) {
final BoundedTextAnnotationImpl a = new BoundedTextAnnotationImpl(dView, argMap, getActiveWindow());
a.update();
return (BoundedTextAnnotation) a;
} else {
return null;
}
}
use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class ImageAnnotationFactory method createAnnotation.
@Override
public ImageAnnotation createAnnotation(Class<? extends ImageAnnotation> clazz, CyNetworkView view, Map<String, String> argMap) {
if (!(view instanceof DGraphView))
return null;
DGraphView dView = (DGraphView) view;
if (ImageAnnotation.class.equals(clazz)) {
final CustomGraphicsManager customGraphicsManager = serviceRegistrar.getService(CustomGraphicsManager.class);
final ImageAnnotationImpl a = new ImageAnnotationImpl(dView, argMap, customGraphicsManager, getActiveWindow());
a.update();
return (ImageAnnotation) a;
} else {
return null;
}
}
use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class AnnotationManagerImpl method removeAnnotations.
@Override
public void removeAnnotations(Collection<? extends Annotation> annotations) {
Map<DGraphView, List<DingAnnotation>> annotationsByView = groupByView(annotations);
if (annotationsByView.isEmpty())
return;
invokeOnEDTAndWait(() -> {
annotationsByView.forEach((view, viewAnnotations) -> {
Map<ArbitraryGraphicsCanvas, List<DingAnnotation>> annotationsByCanvas = groupByCanvas(view, viewAnnotations);
annotationsByCanvas.forEach((canvas, dingAnnotations) -> {
// The following code is a batch version of Annotation.removeAnnotation()
for (DingAnnotation a : dingAnnotations) {
GroupAnnotation parent = a.getGroupParent();
if (parent != null) {
parent.removeMember(a);
}
}
canvas.removeAnnotations(getArrows(dingAnnotations));
canvas.removeAnnotations(dingAnnotations);
canvas.repaint();
});
});
});
}
use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class ShapeAnnotationFactory method createAnnotation.
@Override
public ShapeAnnotation createAnnotation(Class<? extends ShapeAnnotation> type, CyNetworkView view, Map<String, String> argMap) {
if (!(view instanceof DGraphView))
return null;
DGraphView dView = (DGraphView) view;
if (type.equals(ShapeAnnotation.class)) {
final ShapeAnnotationImpl a = new ShapeAnnotationImpl(dView, argMap, getActiveWindow());
a.update();
return (ShapeAnnotation) a;
}
return null;
}
use of org.cytoscape.ding.impl.DGraphView 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();
}
Aggregations