use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class CustomGraphicsManagerImpl method handleEvent.
@Override
public void handleEvent(SessionLoadedEvent e) {
// Add new images
final CySession sess = e.getLoadedSession();
if (sess != null) {
final Map<String, List<File>> filesMap = sess.getAppFileListMap();
if (filesMap != null) {
final List<File> files = filesMap.get(APP_NAME);
if (files != null && files.size() != 0) {
// get parent directory
final File parent = files.get(0).getParentFile();
final RestoreImageTaskFactory taskFactory = new RestoreImageTaskFactory(new HashSet<>(), parent, this, serviceRegistrar);
final TaskIterator loadImagesIterator = taskFactory.createTaskIterator();
for (CyNetworkView networkView : sess.getNetworkViews()) {
loadImagesIterator.append(((DGraphView) networkView).getCyAnnotator().getReloadImagesTask());
}
loadImagesIterator.append(new ReloadMissingImagesTask(sess.getNetworkViews()));
serviceRegistrar.getService(DialogTaskManager.class).execute(loadImagesIterator);
}
}
}
}
use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class AddArrowTask method run.
@Override
public void run(TaskMonitor tm) throws Exception {
if (view instanceof DGraphView && annotationFactory instanceof AbstractDingAnnotationFactory) {
SwingUtilities.invokeLater(() -> {
final JDialog dialog = ((AbstractDingAnnotationFactory<?>) annotationFactory).createAnnotationDialog((DGraphView) view, location);
dialog.setLocation((int) location.getX(), (int) location.getY());
dialog.setVisible(true);
});
}
}
use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class EditAnnotationTask method run.
@Override
public void run(TaskMonitor tm) throws Exception {
if (view instanceof DGraphView) {
SwingUtilities.invokeLater(() -> {
final JDialog dialog = annotation.getModifyDialog();
if (dialog != null) {
dialog.setLocation((int) location.getX(), (int) location.getY());
dialog.setVisible(true);
}
});
}
}
use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class AddArrowTaskFactory method isReady.
@Override
public boolean isReady(CyNetworkView networkView, Point2D javaPt, Point2D xformPt) {
// We need to be over an annotation
CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator();
DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt);
if (annotation == null || annotation instanceof ArrowAnnotationImpl)
return false;
return true;
}
use of org.cytoscape.ding.impl.DGraphView in project cytoscape-impl by cytoscape.
the class ChangeAnnotationCanvasTaskFactory 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 ChangeAnnotationCanvasTask(networkView, annotation, canvas));
}
Aggregations