Search in sources :

Example 21 with DGraphView

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

the class PerfTest method visualizeNetworks.

private void visualizeNetworks() {
    try {
        CyNetworkView[] views = getViews("A50-50.sif");
        JFrame frame = new JFrame();
        frame.setPreferredSize(new Dimension(800, 800));
        JPanel panel = new JPanel();
        panel.setPreferredSize(new Dimension(800, 800));
        panel.setBackground(Color.blue);
        InnerCanvas jc = ((DGraphView) (views[0])).getCanvas();
        jc.setVisible(true);
        jc.setPreferredSize(new Dimension(800, 800));
        panel.add(jc);
        frame.getContentPane().add(panel);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JPanel(javax.swing.JPanel) JFrame(javax.swing.JFrame) InnerCanvas(org.cytoscape.ding.impl.InnerCanvas) Dimension(java.awt.Dimension) CyNetworkView(org.cytoscape.view.model.CyNetworkView) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 22 with DGraphView

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

the class ShowGraphicsDetailsTask method run.

@Override
public void run(TaskMonitor taskMonitor) {
    if (view instanceof DGraphView) {
        final GraphLOD lod = ((DGraphView) view).getGraphLOD();
        if (lod instanceof DingGraphLODAll)
            ((DGraphView) view).setGraphLOD(dingGraphLOD);
        else
            ((DGraphView) view).setGraphLOD(dingGraphLODAll);
        view.updateView();
    }
}
Also used : GraphLOD(org.cytoscape.graph.render.stateful.GraphLOD) DingGraphLOD(org.cytoscape.ding.impl.DingGraphLOD) DingGraphLODAll(org.cytoscape.ding.impl.DingGraphLODAll) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 23 with DGraphView

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

the class GroupAnnotationFactory method createAnnotation.

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

Example 24 with DGraphView

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

the class AnnotationManagerImpl method addAnnotation.

/**
 ********************************************************************************
 *                   AnnotationManager implementation methods                     *
 *********************************************************************************
 */
@Override
public void addAnnotation(final Annotation annotation) {
    if (!(annotation instanceof DingAnnotation))
        return;
    DingAnnotation dAnnotation = (DingAnnotation) annotation;
    CyNetworkView view = annotation.getNetworkView();
    invokeOnEDTAndWait(() -> {
        ((DGraphView) view).getCyAnnotator().addAnnotation(annotation);
        if (dAnnotation.getCanvas() != null) {
            dAnnotation.getCanvas().add(dAnnotation.getComponent());
        } else {
            ((DGraphView) view).getCyAnnotator().getForeGroundCanvas().add(dAnnotation.getComponent());
        }
    });
}
Also used : DingAnnotation(org.cytoscape.ding.impl.cyannotator.annotations.DingAnnotation) CyNetworkView(org.cytoscape.view.model.CyNetworkView) DGraphView(org.cytoscape.ding.impl.DGraphView)

Example 25 with DGraphView

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

the class AnnotationManagerImpl method removeAnnotation.

@Override
public void removeAnnotation(final Annotation annotation) {
    CyNetworkView view = annotation.getNetworkView();
    if (!(view instanceof DGraphView))
        return;
    invokeOnEDTAndWait(() -> {
        annotation.removeAnnotation();
        ((DGraphView) view).getCyAnnotator().removeAnnotation(annotation);
    });
}
Also used : CyNetworkView(org.cytoscape.view.model.CyNetworkView) 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