Search in sources :

Example 1 with RemoveLockedValuesTask

use of org.cytoscape.view.vizmap.gui.internal.task.RemoveLockedValuesTask in project cytoscape-impl by cytoscape.

the class RemoveLockedValuesCommand method execute.

@Override
public void execute(final INotification notification) {
    final LockedValuesVO vo = (LockedValuesVO) notification.getBody();
    final Set<VisualProperty<?>> visualProperties = vo.getVisualProperties();
    if (visualProperties == null)
        return;
    CyNetworkView netView = vo.getNetworkView();
    Set<View<? extends CyIdentifiable>> views = vo.getViews();
    final VizMapperProxy vmProxy = (VizMapperProxy) getFacade().retrieveProxy(VizMapperProxy.NAME);
    if (netView == null)
        netView = vmProxy.getCurrentNetworkView();
    if (netView != null && views == null) {
        // Get the selected views
        final Set<Class<? extends CyIdentifiable>> targetDataTypes = new HashSet<Class<? extends CyIdentifiable>>();
        for (final VisualProperty<?> vp : visualProperties) targetDataTypes.add(vp.getTargetDataType());
        views = new HashSet<View<? extends CyIdentifiable>>();
        if (targetDataTypes.contains(CyNode.class))
            views.addAll(vmProxy.getSelectedNodeViews(netView));
        if (targetDataTypes.contains(CyEdge.class))
            views.addAll(vmProxy.getSelectedEdgeViews(netView));
        if (targetDataTypes.contains(CyNetwork.class))
            views.add(netView);
    }
    if (views != null) {
        final TaskIterator iterator = new TaskIterator(new RemoveLockedValuesTask(visualProperties, views, netView, servicesUtil));
        final DialogTaskManager taskManager = servicesUtil.get(DialogTaskManager.class);
        taskManager.execute(iterator);
    }
}
Also used : DialogTaskManager(org.cytoscape.work.swing.DialogTaskManager) View(org.cytoscape.view.model.View) CyNetworkView(org.cytoscape.view.model.CyNetworkView) VizMapperProxy(org.cytoscape.view.vizmap.gui.internal.model.VizMapperProxy) RemoveLockedValuesTask(org.cytoscape.view.vizmap.gui.internal.task.RemoveLockedValuesTask) TaskIterator(org.cytoscape.work.TaskIterator) LockedValuesVO(org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO) VisualProperty(org.cytoscape.view.model.VisualProperty) CyNetworkView(org.cytoscape.view.model.CyNetworkView) CyIdentifiable(org.cytoscape.model.CyIdentifiable) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 CyIdentifiable (org.cytoscape.model.CyIdentifiable)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1 View (org.cytoscape.view.model.View)1 VisualProperty (org.cytoscape.view.model.VisualProperty)1 LockedValuesVO (org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO)1 VizMapperProxy (org.cytoscape.view.vizmap.gui.internal.model.VizMapperProxy)1 RemoveLockedValuesTask (org.cytoscape.view.vizmap.gui.internal.task.RemoveLockedValuesTask)1 TaskIterator (org.cytoscape.work.TaskIterator)1 DialogTaskManager (org.cytoscape.work.swing.DialogTaskManager)1