Search in sources :

Example 41 with CyApplicationManager

use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.

the class BirdsEyeViewPanel method update.

public final void update() {
    final Dimension currentPanelSize = getSize();
    getPresentationPanel().setSize(currentPanelSize);
    getPresentationPanel().setPreferredSize(currentPanelSize);
    if (engine == null) {
        final CyApplicationManager applicationManager = serviceRegistrar.getService(CyApplicationManager.class);
        final NetworkViewRenderer renderer = applicationManager.getNetworkViewRenderer(networkView.getRendererId());
        final RenderingEngineFactory<CyNetwork> bevFactory = renderer.getRenderingEngineFactory(NetworkViewRenderer.BIRDS_EYE_CONTEXT);
        engine = bevFactory.createRenderingEngine(getPresentationPanel(), networkView);
    }
    repaint();
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) CyNetwork(org.cytoscape.model.CyNetwork) Dimension(java.awt.Dimension) NetworkViewRenderer(org.cytoscape.application.NetworkViewRenderer)

Example 42 with CyApplicationManager

use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.

the class GradientEditorPanel method updateView.

void updateView() {
    final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
    style.apply(appMgr.getCurrentNetworkView());
    appMgr.getCurrentNetworkView().updateView();
    getSlider().repaint();
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager)

Example 43 with CyApplicationManager

use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.

the class GradientEditorPanel method deleteButtonActionPerformed.

@Override
protected void deleteButtonActionPerformed(final ActionEvent evt) {
    final int selectedIndex = getSlider().getSelectedIndex();
    if (0 <= selectedIndex) {
        getSlider().getModel().removeThumb(selectedIndex);
        mapping.removePoint(selectedIndex);
        updateMap();
        final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
        appMgr.getCurrentNetworkView().updateView();
        repaint();
    }
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) ContinuousMappingPoint(org.cytoscape.view.vizmap.mappings.ContinuousMappingPoint) Paint(java.awt.Paint)

Example 44 with CyApplicationManager

use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.

the class C2DEditor method setValue.

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setValue(final Object value) {
    if (value instanceof ContinuousMapping == false)
        throw new IllegalArgumentException("Value should be ContinuousMapping: this is " + value);
    final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
    final CyNetwork currentNetwork = appMgr.getCurrentNetwork();
    if (currentNetwork == null)
        return;
    ContinuousMapping<?, ?> mTest = (ContinuousMapping<?, ?>) value;
    // TODO: error chekcing
    mapping = (ContinuousMapping<Number, V>) value;
    Class<? extends CyIdentifiable> type = (Class<? extends CyIdentifiable>) mapping.getVisualProperty().getTargetDataType();
    final CyNetworkTableManager netTblMgr = servicesUtil.get(CyNetworkTableManager.class);
    final CyTable attr = netTblMgr.getTable(appMgr.getCurrentNetwork(), type, CyNetwork.DEFAULT_ATTRS);
    final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
    editorPanel = new C2DMappingEditorPanel(vmMgr.getCurrentVisualStyle(), mapping, attr, editorManager, servicesUtil);
}
Also used : ContinuousMapping(org.cytoscape.view.vizmap.mappings.ContinuousMapping) CyNetworkTableManager(org.cytoscape.model.CyNetworkTableManager) CyNetwork(org.cytoscape.model.CyNetwork) CyApplicationManager(org.cytoscape.application.CyApplicationManager) CyTable(org.cytoscape.model.CyTable) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 45 with CyApplicationManager

use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.

the class LegendDialog method createMappingLegends.

@SuppressWarnings("rawtypes")
private void createMappingLegends(final Collection<VisualMappingFunction<?, ?>> mappings, final JPanel legend) {
    for (VisualMappingFunction<?, ?> map : mappings) {
        final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
        final JPanel mappingLegend;
        if (map instanceof ContinuousMapping) {
            mappingLegend = new ContinuousLegendPanel(visualStyle, (ContinuousMapping) map, appMgr.getCurrentNetwork().getDefaultNodeTable(), servicesUtil);
        } else if (map instanceof DiscreteMapping) {
            mappingLegend = new DiscreteLegendPanel((DiscreteMapping<?, ?>) map, servicesUtil);
        } else if (map instanceof DiscreteMapping) {
            mappingLegend = new PassthroughLegendPanel((PassthroughMapping<?, ?>) map, servicesUtil);
        } else {
            continue;
        }
        // display anything besides the title.
        if (map instanceof PassthroughMapping)
            legend.add(mappingLegend, 0);
        else
            legend.add(mappingLegend);
        // Set padding
        mappingLegend.setBorder(new EmptyBorder(15, 30, 15, 30));
    }
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) JPanel(javax.swing.JPanel) ContinuousMapping(org.cytoscape.view.vizmap.mappings.ContinuousMapping) DiscreteMapping(org.cytoscape.view.vizmap.mappings.DiscreteMapping) PassthroughMapping(org.cytoscape.view.vizmap.mappings.PassthroughMapping) EmptyBorder(javax.swing.border.EmptyBorder)

Aggregations

CyApplicationManager (org.cytoscape.application.CyApplicationManager)80 CyNetwork (org.cytoscape.model.CyNetwork)40 CyNetworkView (org.cytoscape.view.model.CyNetworkView)30 CyNetworkViewManager (org.cytoscape.view.model.CyNetworkViewManager)18 VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)16 CyNetworkManager (org.cytoscape.model.CyNetworkManager)14 CyEventHelper (org.cytoscape.event.CyEventHelper)12 CyTable (org.cytoscape.model.CyTable)12 ArrayList (java.util.ArrayList)11 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)10 CyNode (org.cytoscape.model.CyNode)9 VisualStyle (org.cytoscape.view.vizmap.VisualStyle)9 Test (org.junit.Test)9 HashSet (java.util.HashSet)8 CyNetworkTableManager (org.cytoscape.model.CyNetworkTableManager)8 CyRootNetworkManager (org.cytoscape.model.subnetwork.CyRootNetworkManager)8 TaskIterator (org.cytoscape.work.TaskIterator)8 HashMap (java.util.HashMap)7 CyGroupManager (org.cytoscape.group.CyGroupManager)7 CyTableManager (org.cytoscape.model.CyTableManager)7