Search in sources :

Example 1 with TunableSetter

use of org.cytoscape.work.TunableSetter in project cytoscape-impl by cytoscape.

the class CyActivator method start.

@Override
public void start(BundleContext bc) {
    CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
    CyEventHelper cyEventHelperRef = getService(bc, CyEventHelper.class);
    CyNetworkNaming cyNetworkNamingServiceRef = getService(bc, CyNetworkNaming.class);
    UndoSupport undoSupportServiceRef = getService(bc, UndoSupport.class);
    CyNetworkViewFactory cyNetworkViewFactoryServiceRef = getService(bc, CyNetworkViewFactory.class);
    CyNetworkFactory cyNetworkFactoryServiceRef = getService(bc, CyNetworkFactory.class);
    CyRootNetworkManager cyRootNetworkFactoryServiceRef = getService(bc, CyRootNetworkManager.class);
    VisualMappingManager visualMappingManagerServiceRef = getService(bc, VisualMappingManager.class);
    CyNetworkViewWriterManager networkViewWriterManagerServiceRef = getService(bc, CyNetworkViewWriterManager.class);
    CyNetworkManager cyNetworkManagerServiceRef = getService(bc, CyNetworkManager.class);
    CyNetworkViewManager cyNetworkViewManagerServiceRef = getService(bc, CyNetworkViewManager.class);
    CyApplicationManager cyApplicationManagerServiceRef = getService(bc, CyApplicationManager.class);
    CySessionManager cySessionManagerServiceRef = getService(bc, CySessionManager.class);
    CyTableFactory cyTableFactoryServiceRef = getService(bc, CyTableFactory.class);
    CyTableManager cyTableManagerServiceRef = getService(bc, CyTableManager.class);
    CyLayoutAlgorithmManager cyLayoutsServiceRef = getService(bc, CyLayoutAlgorithmManager.class);
    CyTableWriterManager cyTableWriterManagerRef = getService(bc, CyTableWriterManager.class);
    SynchronousTaskManager<?> synchronousTaskManagerServiceRef = getService(bc, SynchronousTaskManager.class);
    TunableSetter tunableSetterServiceRef = getService(bc, TunableSetter.class);
    CyRootNetworkManager rootNetworkManagerServiceRef = getService(bc, CyRootNetworkManager.class);
    CyNetworkTableManager cyNetworkTableManagerServiceRef = getService(bc, CyNetworkTableManager.class);
    RenderingEngineManager renderingEngineManagerServiceRef = getService(bc, RenderingEngineManager.class);
    CyNetworkViewFactory nullNetworkViewFactory = getService(bc, CyNetworkViewFactory.class, "(id=NullCyNetworkViewFactory)");
    CyGroupManager cyGroupManager = getService(bc, CyGroupManager.class);
    CyGroupFactory cyGroupFactory = getService(bc, CyGroupFactory.class);
    {
        DynamicTaskFactoryProvisionerImpl factory = new DynamicTaskFactoryProvisionerImpl(serviceRegistrar);
        registerAllServices(bc, factory);
    }
    createPreferencesTaskFactories(bc, serviceRegistrar);
    createFilterTaskFactories(bc, serviceRegistrar);
    createTableTaskFactories(bc, serviceRegistrar, undoSupportServiceRef, cyNetworkManagerServiceRef, cyApplicationManagerServiceRef, cyTableFactoryServiceRef, cyTableManagerServiceRef, cyTableWriterManagerRef, tunableSetterServiceRef, rootNetworkManagerServiceRef, cyNetworkTableManagerServiceRef);
    createNetworkTaskFactories(bc, serviceRegistrar, cyEventHelperRef, cyNetworkNamingServiceRef, undoSupportServiceRef, cyNetworkViewFactoryServiceRef, cyNetworkFactoryServiceRef, cyRootNetworkFactoryServiceRef, visualMappingManagerServiceRef, cyNetworkManagerServiceRef, cyNetworkViewManagerServiceRef, cyApplicationManagerServiceRef, synchronousTaskManagerServiceRef, rootNetworkManagerServiceRef, cyNetworkTableManagerServiceRef, renderingEngineManagerServiceRef, nullNetworkViewFactory, cyGroupManager, cyGroupFactory, networkViewWriterManagerServiceRef, tunableSetterServiceRef);
    createViewTaskFactories(bc, cyEventHelperRef, undoSupportServiceRef, visualMappingManagerServiceRef, networkViewWriterManagerServiceRef, cyNetworkViewManagerServiceRef, cyApplicationManagerServiceRef, cyLayoutsServiceRef, tunableSetterServiceRef, renderingEngineManagerServiceRef, cyNetworkManagerServiceRef, cySessionManagerServiceRef, serviceRegistrar);
    createVizmapTaskFactories(bc, serviceRegistrar);
    createSessionTaskFactories(bc, serviceRegistrar);
    createGroupTaskFactories(bc, undoSupportServiceRef, cyApplicationManagerServiceRef, cyGroupManager, cyGroupFactory, serviceRegistrar);
    createNodeEdgeTaskFactories(bc, serviceRegistrar, cyEventHelperRef, undoSupportServiceRef, cyNetworkViewManagerServiceRef, tunableSetterServiceRef, cyApplicationManagerServiceRef, cyTableManagerServiceRef, renderingEngineManagerServiceRef, visualMappingManagerServiceRef);
    createLayoutTaskFactories(bc, serviceRegistrar);
    createHelpTaskFactories(bc, serviceRegistrar);
}
Also used : CyEventHelper(org.cytoscape.event.CyEventHelper) CyNetworkTableManager(org.cytoscape.model.CyNetworkTableManager) CyRootNetworkManager(org.cytoscape.model.subnetwork.CyRootNetworkManager) CyNetworkViewManager(org.cytoscape.view.model.CyNetworkViewManager) RenderingEngineManager(org.cytoscape.view.presentation.RenderingEngineManager) CyTableWriterManager(org.cytoscape.io.write.CyTableWriterManager) UndoSupport(org.cytoscape.work.undo.UndoSupport) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) CyApplicationManager(org.cytoscape.application.CyApplicationManager) CyTableFactory(org.cytoscape.model.CyTableFactory) TunableSetter(org.cytoscape.work.TunableSetter) CyNetworkManager(org.cytoscape.model.CyNetworkManager) CyNetworkViewFactory(org.cytoscape.view.model.CyNetworkViewFactory) CyTableManager(org.cytoscape.model.CyTableManager) CyLayoutAlgorithmManager(org.cytoscape.view.layout.CyLayoutAlgorithmManager) CyNetworkNaming(org.cytoscape.session.CyNetworkNaming) CyNetworkViewWriterManager(org.cytoscape.io.write.CyNetworkViewWriterManager) CySessionManager(org.cytoscape.session.CySessionManager) CyNetworkFactory(org.cytoscape.model.CyNetworkFactory) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager) CyGroupFactory(org.cytoscape.group.CyGroupFactory) CyGroupManager(org.cytoscape.group.CyGroupManager)

Example 2 with TunableSetter

use of org.cytoscape.work.TunableSetter in project cytoscape-impl by cytoscape.

the class OpenSessionTask method loadSession.

private void loadSession(AbstractTask currentTask) {
    if (sessionFile == null) {
        // Should use Tunables to show a file chooser and let the user select the file
        getTaskIterator().insertTasksAfter(currentTask, new OpenSessionWithoutWarningTask());
    } else {
        // Should not show the Tunables dialog
        final Map<String, Object> m = new HashMap<>();
        m.put("file", sessionFile);
        final TunableSetter tunableSetter = serviceRegistrar.getService(TunableSetter.class);
        getTaskIterator().insertTasksAfter(currentTask, tunableSetter.createTaskIterator(new TaskIterator(new OpenSessionWithoutWarningTask()), m));
    }
}
Also used : TunableSetter(org.cytoscape.work.TunableSetter) TaskIterator(org.cytoscape.work.TaskIterator) HashMap(java.util.HashMap)

Example 3 with TunableSetter

use of org.cytoscape.work.TunableSetter in project cytoscape-impl by cytoscape.

the class ExportVizmapTaskFactoryImpl method createTaskIterator.

@Override
public TaskIterator createTaskIterator(File file) {
    final Map<String, Object> m = new HashMap<>();
    m.put("OutputFile", file);
    final VizmapWriterManager writerManager = serviceRegistrar.getService(VizmapWriterManager.class);
    final CyApplicationManager cyApplicationManager = serviceRegistrar.getService(CyApplicationManager.class);
    final VizmapWriter writer = new VizmapWriter(writerManager, cyApplicationManager, serviceRegistrar);
    writer.setDefaultFileFormatUsingFileExt(file);
    final TunableSetter tunableSetter = serviceRegistrar.getService(TunableSetter.class);
    return tunableSetter.createTaskIterator(new TaskIterator(2, writer), m);
}
Also used : CyApplicationManager(org.cytoscape.application.CyApplicationManager) TunableSetter(org.cytoscape.work.TunableSetter) TaskIterator(org.cytoscape.work.TaskIterator) HashMap(java.util.HashMap) VizmapWriterManager(org.cytoscape.io.write.VizmapWriterManager)

Example 4 with TunableSetter

use of org.cytoscape.work.TunableSetter in project cytoscape-impl by cytoscape.

the class LoadVizmapFileTaskFactoryImpl method createTaskIterator.

@Override
public TaskIterator createTaskIterator(File file, TaskObserver observer) {
    final Map<String, Object> m = new HashMap<>();
    m.put("file", file);
    TunableSetter tunableSetter = serviceRegistrar.getService(TunableSetter.class);
    return tunableSetter.createTaskIterator(this.createTaskIterator(), m, observer);
}
Also used : TunableSetter(org.cytoscape.work.TunableSetter) HashMap(java.util.HashMap)

Example 5 with TunableSetter

use of org.cytoscape.work.TunableSetter in project cytoscape-impl by cytoscape.

the class ImportTableDataTaskFactoryImpl method createTaskIterator.

@Override
public TaskIterator createTaskIterator(final CyTable globalTable, final boolean selectedNetworksOnly, final boolean loadToUnassignedTable, final List<CyNetwork> networkList, final CyRootNetwork rootNetwork, final CyColumn targetJoinColumn, final Class<? extends CyIdentifiable> type) {
    ListSingleSelection<String> chooser = new ListSingleSelection<String>(ImportTableDataTask.NETWORK_COLLECTION, ImportTableDataTask.NETWORK_SELECTION, ImportTableDataTask.UNASSIGNED_TABLE);
    final Map<String, Object> m = new HashMap<>();
    if (!loadToUnassignedTable) {
        TableType tableType = getTableType(type);
        if (tableType == null)
            throw new IllegalArgumentException("The specified type " + type + " is not acceptable.");
        ListSingleSelection<TableType> tableTypes = new ListSingleSelection<>(tableType);
        tableTypes.setSelectedValue(tableType);
        List<String> networkNames = new ArrayList<String>();
        for (CyNetwork net : networkList) {
            networkNames.add(net.getRow(net).get(CyNetwork.NAME, String.class));
        }
        ListMultipleSelection<String> networksListTunable = new ListMultipleSelection<>(networkNames);
        networksListTunable.setSelectedValues(networkNames);
        List<String> rootNetworkNames = new ArrayList<>();
        ListSingleSelection<String> rootNetworkList = new ListSingleSelection<>();
        if (rootNetwork != null) {
            rootNetworkNames.add(rootNetwork.getRow(rootNetwork).get(CyNetwork.NAME, String.class));
            rootNetworkList = new ListSingleSelection<String>(rootNetworkNames);
            rootNetworkList.setSelectedValue(rootNetworkNames.get(0));
        }
        List<String> columnNames = new ArrayList<String>();
        ListSingleSelection<String> columnNamesList = new ListSingleSelection<>();
        if (targetJoinColumn != null) {
            columnNames.add(targetJoinColumn.getName());
            columnNamesList = new ListSingleSelection<>(columnNames);
            columnNamesList.setSelectedValue(columnNames.get(0));
        }
        if (selectedNetworksOnly) {
            m.put("DataTypeTargetForNetworkList", tableTypes);
            chooser.setSelectedValue(ImportTableDataTask.NETWORK_SELECTION);
        } else {
            m.put("DataTypeTargetForNetworkCollection", tableTypes);
            chooser.setSelectedValue(ImportTableDataTask.NETWORK_COLLECTION);
        }
        m.put("TargetNetworkList", networksListTunable);
        m.put("KeyColumnForMapping", columnNamesList);
        m.put("TargetNetworkCollection", rootNetworkList);
    } else {
        chooser.setSelectedValue(ImportTableDataTask.UNASSIGNED_TABLE);
    }
    m.put("WhereImportTable", chooser);
    final TunableSetter tunableSetter = serviceRegistrar.getService(TunableSetter.class);
    return tunableSetter.createTaskIterator(createTaskIterator(globalTable), m);
}
Also used : TableType(org.cytoscape.task.internal.table.ImportTableDataTask.TableType) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ListMultipleSelection(org.cytoscape.work.util.ListMultipleSelection) CyNetwork(org.cytoscape.model.CyNetwork) TunableSetter(org.cytoscape.work.TunableSetter) ListSingleSelection(org.cytoscape.work.util.ListSingleSelection)

Aggregations

TunableSetter (org.cytoscape.work.TunableSetter)7 HashMap (java.util.HashMap)5 CyApplicationManager (org.cytoscape.application.CyApplicationManager)3 VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)3 TaskIterator (org.cytoscape.work.TaskIterator)3 ArrayList (java.util.ArrayList)2 CyEventHelper (org.cytoscape.event.CyEventHelper)2 CyNetworkManager (org.cytoscape.model.CyNetworkManager)2 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)2 CyLayoutAlgorithmManager (org.cytoscape.view.layout.CyLayoutAlgorithmManager)2 CyNetworkViewFactory (org.cytoscape.view.model.CyNetworkViewFactory)2 CyNetworkViewManager (org.cytoscape.view.model.CyNetworkViewManager)2 File (java.io.File)1 URI (java.net.URI)1 Index (mikera.indexz.Index)1 AMatrix (mikera.matrixx.AMatrix)1 SparseRowMatrix (mikera.matrixx.impl.SparseRowMatrix)1 AVector (mikera.vectorz.AVector)1 CyGroupFactory (org.cytoscape.group.CyGroupFactory)1 CyGroupManager (org.cytoscape.group.CyGroupManager)1