Search in sources :

Example 71 with VisualStyle

use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.

the class VizMapperProxy method handleEvent.

@Override
public void handleEvent(final VisualStyleAboutToBeRemovedEvent e) {
    synchronized (lock) {
        if (!cytoscapeStarted || ignoreStyleEvents)
            return;
    }
    final VisualStyle vs = e.getVisualStyleToBeRemoved();
    boolean changed = false;
    synchronized (lock) {
        changed = visualStyles.remove(vs);
    }
    if (changed && !loadingSession)
        sendNotification(VISUAL_STYLE_REMOVED, vs);
}
Also used : VisualStyle(org.cytoscape.view.vizmap.VisualStyle)

Example 72 with VisualStyle

use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.

the class VizMapperProxy method getNetworkViewsWithStyle.

public Set<CyNetworkView> getNetworkViewsWithStyle(final VisualStyle style) {
    final Set<CyNetworkView> views = new HashSet<>();
    if (style != null) {
        final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
        final Set<CyNetworkView> allNetViews = servicesUtil.get(CyNetworkViewManager.class).getNetworkViewSet();
        for (final CyNetworkView nv : allNetViews) {
            final VisualStyle vs = vmMgr.getVisualStyle(nv);
            if (style.equals(vs))
                views.add(nv);
        }
    }
    return views;
}
Also used : CyNetworkViewManager(org.cytoscape.view.model.CyNetworkViewManager) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager) VisualStyle(org.cytoscape.view.vizmap.VisualStyle) CyNetworkView(org.cytoscape.view.model.CyNetworkView) HashSet(java.util.HashSet)

Example 73 with VisualStyle

use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.

the class VizMapperProxy method setCurrentVisualStyle.

public void setCurrentVisualStyle(final VisualStyle vs) {
    final VisualStyle curVs = getCurrentVisualStyle();
    final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
    if (vs != null && !vs.equals(curVs))
        vmMgr.setCurrentVisualStyle(vs);
}
Also used : VisualStyle(org.cytoscape.view.vizmap.VisualStyle) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager)

Example 74 with VisualStyle

use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.

the class MakeVisualStylesDefaultTask method run.

@Override
public void run(final TaskMonitor monitor) throws Exception {
    if (!confirm)
        return;
    final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
    final Set<VisualStyle> currentStyles = vmMgr.getAllVisualStyles();
    if (!currentStyles.isEmpty()) {
        final VizmapWriterFactory vizmapWriterFactory = servicesUtil.get(VizmapWriterFactory.class);
        final CyApplicationConfiguration config = servicesUtil.get(CyApplicationConfiguration.class);
        final FileOutputStream os = new FileOutputStream(new File(config.getConfigurationDirectoryLocation(), VizMapperProxy.PRESET_VIZMAP_FILE));
        final CyWriter vizmapWriter = vizmapWriterFactory.createWriter(os, currentStyles);
        if (!cancelled)
            vizmapWriter.run(monitor);
    }
}
Also used : FileOutputStream(java.io.FileOutputStream) CyWriter(org.cytoscape.io.write.CyWriter) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager) VisualStyle(org.cytoscape.view.vizmap.VisualStyle) VizmapWriterFactory(org.cytoscape.io.write.VizmapWriterFactory) CyApplicationConfiguration(org.cytoscape.application.CyApplicationConfiguration) File(java.io.File)

Example 75 with VisualStyle

use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.

the class RemoveLockedValuesTask method updateView.

private void updateView() {
    final VisualStyle style = servicesUtil.get(VisualMappingManager.class).getVisualStyle(netView);
    style.apply(netView);
    netView.updateView();
}
Also used : VisualStyle(org.cytoscape.view.vizmap.VisualStyle) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager)

Aggregations

VisualStyle (org.cytoscape.view.vizmap.VisualStyle)100 CyNetworkView (org.cytoscape.view.model.CyNetworkView)42 VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)37 CyNetwork (org.cytoscape.model.CyNetwork)35 CyNode (org.cytoscape.model.CyNode)30 CyEdge (org.cytoscape.model.CyEdge)24 CyEventHelper (org.cytoscape.event.CyEventHelper)14 HashSet (java.util.HashSet)13 VisualProperty (org.cytoscape.view.model.VisualProperty)12 DiscreteMapping (org.cytoscape.view.vizmap.mappings.DiscreteMapping)12 Paint (java.awt.Paint)11 HashMap (java.util.HashMap)11 CyApplicationManager (org.cytoscape.application.CyApplicationManager)11 CyNetworkViewManager (org.cytoscape.view.model.CyNetworkViewManager)11 Color (java.awt.Color)10 ArrayList (java.util.ArrayList)10 RenderingEngineManager (org.cytoscape.view.presentation.RenderingEngineManager)9 BasicVisualLexicon (org.cytoscape.view.presentation.property.BasicVisualLexicon)9 ContinuousMapping (org.cytoscape.view.vizmap.mappings.ContinuousMapping)9 View (org.cytoscape.view.model.View)8