use of org.cytoscape.view.vizmap.gui.internal.task.SetLockedValuesTask in project cytoscape-impl by cytoscape.
the class SetLockedValuesCommand method execute.
@Override
public void execute(final INotification notification) {
final LockedValuesVO vo = (LockedValuesVO) notification.getBody();
final Map<VisualProperty<?>, Object> values = vo.getValues();
if (values == 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 : values.keySet()) 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 SetLockedValuesTask(values, views, netView, servicesUtil));
final DialogTaskManager taskManager = servicesUtil.get(DialogTaskManager.class);
taskManager.execute(iterator);
}
}
Aggregations