Search in sources :

Example 1 with ImportDefaultVizmapTask

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

the class ImportDefaultVisualStylesCommand method execute.

@Override
public void execute(final INotification notification) {
    final TaskIterator iterator = new TaskIterator(new ImportDefaultVizmapTask(servicesUtil));
    final DialogTaskManager taskManager = servicesUtil.get(DialogTaskManager.class);
    final VizMapperProxy proxy = (VizMapperProxy) getFacade().retrieveProxy(VizMapperProxy.NAME);
    proxy.setIgnoreStyleEvents(true);
    taskManager.execute(iterator, new TaskObserver() {

        @Override
        public void taskFinished(ObservableTask task) {
        }

        @Override
        public void allFinished(FinishStatus finishStatus) {
            proxy.setIgnoreStyleEvents(false);
            proxy.loadVisualStyles();
            proxy.setCurrentVisualStyle(servicesUtil.get(VisualMappingManager.class).getDefaultVisualStyle());
        }
    });
}
Also used : TaskObserver(org.cytoscape.work.TaskObserver) ObservableTask(org.cytoscape.work.ObservableTask) VizMapperProxy(org.cytoscape.view.vizmap.gui.internal.model.VizMapperProxy) TaskIterator(org.cytoscape.work.TaskIterator) FinishStatus(org.cytoscape.work.FinishStatus) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager) DialogTaskManager(org.cytoscape.work.swing.DialogTaskManager) ImportDefaultVizmapTask(org.cytoscape.view.vizmap.gui.internal.task.ImportDefaultVizmapTask)

Aggregations

VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)1 VizMapperProxy (org.cytoscape.view.vizmap.gui.internal.model.VizMapperProxy)1 ImportDefaultVizmapTask (org.cytoscape.view.vizmap.gui.internal.task.ImportDefaultVizmapTask)1 FinishStatus (org.cytoscape.work.FinishStatus)1 ObservableTask (org.cytoscape.work.ObservableTask)1 TaskIterator (org.cytoscape.work.TaskIterator)1 TaskObserver (org.cytoscape.work.TaskObserver)1 DialogTaskManager (org.cytoscape.work.swing.DialogTaskManager)1