Search in sources :

Example 1 with CyTableManager

use of org.cytoscape.model.CyTableManager 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 CyTableManager

use of org.cytoscape.model.CyTableManager in project cytoscape-impl by cytoscape.

the class BrowserTable method handleEvent.

@Override
public void handleEvent(final RowsSetEvent e) {
    if (isEditing()) {
        getCellEditor().stopCellEditing();
    }
    if (ignoreRowSetEvents)
        return;
    final BrowserTableModel model = (BrowserTableModel) getModel();
    final CyTable dataTable = model.getDataTable();
    if (e.getSource() != dataTable)
        return;
    if (model.getViewMode() == BrowserTableModel.ViewMode.SELECTED || model.getViewMode() == BrowserTableModel.ViewMode.AUTO) {
        model.clearSelectedRows();
        boolean foundANonSelectedColumnName = false;
        for (String column : e.getColumns()) {
            if (!CyNetwork.SELECTED.equals(column)) {
                foundANonSelectedColumnName = true;
                break;
            }
        }
        if (!foundANonSelectedColumnName) {
            model.fireTableDataChanged();
            return;
        }
    }
    final Collection<RowSetRecord> rows = e.getPayloadCollection();
    synchronized (this) {
        if (model.getViewMode() == BrowserTableModel.ViewMode.SELECTED || model.getViewMode() == BrowserTableModel.ViewMode.AUTO) {
            model.fireTableDataChanged();
        } else {
            final CyTableManager tableManager = serviceRegistrar.getService(CyTableManager.class);
            if (!tableManager.getGlobalTables().contains(dataTable))
                bulkUpdate(rows);
        }
    }
}
Also used : CyTable(org.cytoscape.model.CyTable) RowSetRecord(org.cytoscape.model.events.RowSetRecord) CyTableManager(org.cytoscape.model.CyTableManager) ValidatedObjectAndEditString(org.cytoscape.browser.internal.util.ValidatedObjectAndEditString)

Example 3 with CyTableManager

use of org.cytoscape.model.CyTableManager in project cytoscape-impl by cytoscape.

the class GlobalTableBrowser method handleEvent.

/**
 * Switch to new table when it is registered to the table manager.
 *
 * Note: This combo box only displays Global Table.
 */
@Override
public void handleEvent(TableAddedEvent e) {
    final CyTable newTable = e.getTable();
    if (newTable.isPublic() || showPrivateTables()) {
        final CyTableManager tableManager = serviceRegistrar.getService(CyTableManager.class);
        if (tableManager.getGlobalTables().contains(newTable)) {
            final GlobalTableComboBoxModel comboBoxModel = (GlobalTableComboBoxModel) tableChooser.getModel();
            comboBoxModel.addAndSetSelectedItem(newTable);
            getToolBar().updateEnableState(tableChooser);
        }
        if (tableChooser.getItemCount() == 1) {
            invokeOnEDT(() -> {
                serviceRegistrar.registerService(GlobalTableBrowser.this, CytoPanelComponent.class, new Properties());
            });
        }
    }
}
Also used : CyTable(org.cytoscape.model.CyTable) CyTableManager(org.cytoscape.model.CyTableManager) Properties(java.util.Properties)

Example 4 with CyTableManager

use of org.cytoscape.model.CyTableManager in project cytoscape-impl by cytoscape.

the class CySessionManagerImpl method disposeCurrentSession.

@Override
public void disposeCurrentSession() {
    logger.debug("Disposing current session...");
    // Destroy network views
    final CyNetworkViewManager nvMgr = serviceRegistrar.getService(CyNetworkViewManager.class);
    final Set<CyNetworkView> netViews = nvMgr.getNetworkViewSet();
    for (final CyNetworkView nv : netViews) nvMgr.destroyNetworkView(nv);
    nvMgr.reset();
    // Destroy networks
    final CyNetworkManager netMgr = serviceRegistrar.getService(CyNetworkManager.class);
    final Set<CyNetwork> networks = netMgr.getNetworkSet();
    for (final CyNetwork n : networks) netMgr.destroyNetwork(n);
    netMgr.reset();
    // Destroy styles
    logger.debug("Removing current visual styles...");
    final VisualMappingManager vmMgr = serviceRegistrar.getService(VisualMappingManager.class);
    final VisualStyle defaultStyle = vmMgr.getDefaultVisualStyle();
    final List<VisualStyle> allStyles = new ArrayList<>(vmMgr.getAllVisualStyles());
    for (final VisualStyle vs : allStyles) {
        if (!vs.equals(defaultStyle))
            vmMgr.removeVisualStyle(vs);
    }
    // Destroy tables
    final CyTableManager tblMgr = serviceRegistrar.getService(CyTableManager.class);
    tblMgr.reset();
    // Reset groups
    serviceRegistrar.getService(CyGroupManager.class).reset();
    // Unregister session properties
    final Set<CyProperty<?>> cyPropsClone = getAllProperties();
    for (CyProperty<?> cyProps : cyPropsClone) {
        if (cyProps.getSavePolicy().equals(CyProperty.SavePolicy.SESSION_FILE)) {
            serviceRegistrar.unregisterAllServices(cyProps);
            sessionProperties.remove(cyProps.getName());
        }
    }
    // Clear undo stack
    serviceRegistrar.getService(UndoSupport.class).reset();
    // Reset current table and rendering engine
    final CyApplicationManager appMgr = serviceRegistrar.getService(CyApplicationManager.class);
    appMgr.reset();
    currentFileName = null;
    disposed = true;
}
Also used : CyNetworkViewManager(org.cytoscape.view.model.CyNetworkViewManager) ArrayList(java.util.ArrayList) CyNetwork(org.cytoscape.model.CyNetwork) UndoSupport(org.cytoscape.work.undo.UndoSupport) CyApplicationManager(org.cytoscape.application.CyApplicationManager) SimpleCyProperty(org.cytoscape.property.SimpleCyProperty) CyProperty(org.cytoscape.property.CyProperty) CyNetworkManager(org.cytoscape.model.CyNetworkManager) CyTableManager(org.cytoscape.model.CyTableManager) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager) VisualStyle(org.cytoscape.view.vizmap.VisualStyle) CyNetworkView(org.cytoscape.view.model.CyNetworkView) CyGroupManager(org.cytoscape.group.CyGroupManager)

Example 5 with CyTableManager

use of org.cytoscape.model.CyTableManager in project cytoscape-impl by cytoscape.

the class StringToModelImpl method getTable.

@Override
public CyTable getTable(String strTable) {
    if (strTable == null || strTable.length() == 0 || strTable.equalsIgnoreCase(CURRENT))
        return serviceRegistrar.getService(CyApplicationManager.class).getCurrentTable();
    // Look for any special prefix
    CyNetwork network;
    String[] splitString = strTable.split(":");
    if (splitString.length > 1) {
        if (splitString[0].equalsIgnoreCase("node")) {
            network = getNetwork(splitString[1]);
            if (network != null)
                return network.getDefaultNodeTable();
        }
        if (splitString[0].equalsIgnoreCase("edge")) {
            network = getNetwork(splitString[1]);
            if (network != null)
                return network.getDefaultEdgeTable();
        }
        if (splitString[0].equalsIgnoreCase("network")) {
            network = getNetwork(splitString[1]);
            if (network != null)
                return network.getDefaultNetworkTable();
        }
    } else {
        final CyTableManager tableMgr = serviceRegistrar.getService(CyTableManager.class);
        for (CyTable tab : tableMgr.getGlobalTables()) {
            if (tab.getTitle().contains(strTable))
                return tab;
        }
    }
    return null;
}
Also used : CyTable(org.cytoscape.model.CyTable) CyTableManager(org.cytoscape.model.CyTableManager) CyNetwork(org.cytoscape.model.CyNetwork)

Aggregations

CyTableManager (org.cytoscape.model.CyTableManager)19 CyTable (org.cytoscape.model.CyTable)10 CyApplicationManager (org.cytoscape.application.CyApplicationManager)7 CyNetworkManager (org.cytoscape.model.CyNetworkManager)6 Properties (java.util.Properties)4 CyTableFactory (org.cytoscape.model.CyTableFactory)4 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)4 CyGroupManager (org.cytoscape.group.CyGroupManager)3 HashSet (java.util.HashSet)2 CyEventHelper (org.cytoscape.event.CyEventHelper)2 CyGroupFactory (org.cytoscape.group.CyGroupFactory)2 CyNetwork (org.cytoscape.model.CyNetwork)2 CyRootNetworkManager (org.cytoscape.model.subnetwork.CyRootNetworkManager)2 CyNetworkViewManager (org.cytoscape.view.model.CyNetworkViewManager)2 VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)2 UndoSupport (org.cytoscape.work.undo.UndoSupport)2 AttributeClusterTaskFactory (edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.AttributeClusterTaskFactory)1 ChengChurchTaskFactory (edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.ChengChurch.ChengChurchTaskFactory)1 DBSCANTaskFactory (edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.DBSCAN.DBSCANTaskFactory)1 AutoSOMETaskFactory (edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.autosome.AutoSOMETaskFactory)1