@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; }
@Override public TaskIterator createTaskIterator( CyNetworkView networkView, Point2D javaPt, Point2D xformPt) { CyAnnotator cyAnnotator = ((DGraphView) networkView).getCyAnnotator(); DingAnnotation annotation = cyAnnotator.getAnnotationAt(javaPt); return new TaskIterator(new MoveAnnotationTask(networkView, annotation, javaPt)); }
@Override public void run(TaskMonitor tm) throws Exception { if (view instanceof DGraphView) { DGraphView dView = (DGraphView) view; CyAnnotator cyAnnotator = dView.getCyAnnotator(); GroupAnnotationImpl group = new GroupAnnotationImpl(cyAnnotator, dView); group.addComponent(null); // Need to add this first so we can update things appropriately cyAnnotator.addAnnotation(group); // Now, add all of the children for (DingAnnotation child : new ArrayList<DingAnnotation>(cyAnnotator.getSelectedAnnotations())) { group.addMember(child); child.setSelected(false); } // Finally, set ourselves to be the selected component group.setSelected(true); group.update(); } }