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;
}
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;
}
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;
}
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));
}
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;
}
Aggregations