Search in sources :

Example 1 with CyNetworkTableManager

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

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

the class Cy3SessionReaderImpl method mergeNetworkTables.

private final void mergeNetworkTables() throws UnsupportedEncodingException {
    final CyNetworkTableManager networkTableManager = serviceRegistrar.getService(CyNetworkTableManager.class);
    for (final Entry<Long, Set<CyTableMetadataBuilder>> entry : networkTableMap.entrySet()) {
        final Object oldId = entry.getKey();
        final Set<CyTableMetadataBuilder> builders = entry.getValue();
        final CyNetwork network = cache.getNetwork(oldId);
        if (network == null) {
            logger.error("Cannot merge network tables: Cannot find network " + oldId);
            continue;
        }
        for (final CyTableMetadataBuilder builder : builders) {
            if (cancelled)
                return;
            builder.setNetwork(network);
            mergeNetworkTable(network, builder, networkTableManager);
            CyTableMetadata metadata = builder.build();
            tableMetadata.add(metadata);
            // Update filename<->table maps
            final String filename = builderFilenameMap.get(builder);
            filenameTableMap.put(filename, metadata.getTable());
        }
    }
}
Also used : CyNetworkTableManager(org.cytoscape.model.CyNetworkTableManager) Set(java.util.Set) HashSet(java.util.HashSet) CyTableMetadataBuilder(org.cytoscape.io.internal.read.session.CyTableMetadataImpl.CyTableMetadataBuilder) CyNetwork(org.cytoscape.model.CyNetwork) CyTableMetadata(org.cytoscape.model.CyTableMetadata)

Example 3 with CyNetworkTableManager

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

the class NetworkViewMediator method onColumnChanged.

private void onColumnChanged(final CyTable tbl, final String columnName) {
    if (loadingSession || getNetworkViewMainPanel().isEmpty())
        return;
    final CyNetworkTableManager netTblMgr = serviceRegistrar.getService(CyNetworkTableManager.class);
    final CyNetwork net = netTblMgr.getNetworkForTable(tbl);
    final CyNetworkViewManager netViewMgr = serviceRegistrar.getService(CyNetworkViewManager.class);
    // And if there is no related view, nothing needs to be done
    if (net != null && netViewMgr.viewExists(net) && (tbl.equals(net.getDefaultNodeTable()) || tbl.equals(net.getDefaultEdgeTable()))) {
        // Reapply locked values that map to changed columns
        final Collection<CyNetworkView> networkViews = netViewMgr.getNetworkViews(net);
        final boolean lockedValuesApplyed = reapplyLockedValues(columnName, networkViews);
        // Find views that had their styles affected by the RowsSetEvent
        final Set<VisualStyle> styles = findStylesWithMappedColumn(columnName);
        final Set<CyNetworkView> viewsToUpdate = findNetworkViewsWithStyles(styles);
        if (lockedValuesApplyed)
            viewsToUpdate.addAll(networkViews);
        // Update views
        for (final CyNetworkView view : viewsToUpdate) updateView(view, null);
    }
}
Also used : CyNetworkTableManager(org.cytoscape.model.CyNetworkTableManager) CyNetworkViewManager(org.cytoscape.view.model.CyNetworkViewManager) CyNetwork(org.cytoscape.model.CyNetwork) VisualStyle(org.cytoscape.view.vizmap.VisualStyle) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Example 4 with CyNetworkTableManager

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

the class NetworkMediator method handleEvent.

@Override
public void handleEvent(final RowsSetEvent e) {
    if (loadingSession || networkMainPanel.getRootNetworkListPanel().isEmpty())
        return;
    // We only care about network name changes
    final Collection<RowSetRecord> nameRecords = e.getColumnRecords(CyNetwork.NAME);
    if (nameRecords == null || nameRecords.isEmpty())
        return;
    final CyTable tbl = e.getSource();
    final CyNetworkTableManager netTblMgr = serviceRegistrar.getService(CyNetworkTableManager.class);
    final CyNetwork net = netTblMgr.getNetworkForTable(tbl);
    // And if there is no related network, nothing needs to be done
    if (net != null && tbl.equals(net.getDefaultNetworkTable())) {
        invokeOnEDT(() -> {
            final AbstractNetworkPanel<?> item = networkMainPanel.getNetworkItem(net);
            if (item != null)
                item.update();
        });
    }
}
Also used : RowSetRecord(org.cytoscape.model.events.RowSetRecord) CyTable(org.cytoscape.model.CyTable) CyNetworkTableManager(org.cytoscape.model.CyNetworkTableManager) CyNetwork(org.cytoscape.model.CyNetwork)

Example 5 with CyNetworkTableManager

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

the class DefaultTableBrowser method getPublicTables.

private Set<CyTable> getPublicTables(CyNetwork currentNetwork) {
    final Set<CyTable> tables = new LinkedHashSet<>();
    if (currentNetwork == null)
        return tables;
    final CyNetworkTableManager netTableManager = serviceRegistrar.getService(CyNetworkTableManager.class);
    final Map<String, CyTable> map = netTableManager.getTables(currentNetwork, objType);
    if (showPrivateTables()) {
        tables.addAll(map.values());
    } else {
        for (final CyTable tbl : map.values()) {
            if (tbl.isPublic())
                tables.add(tbl);
        }
    }
    return tables;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) CyTable(org.cytoscape.model.CyTable) CyNetworkTableManager(org.cytoscape.model.CyNetworkTableManager)

Aggregations

CyNetworkTableManager (org.cytoscape.model.CyNetworkTableManager)19 CyNetwork (org.cytoscape.model.CyNetwork)15 CyTable (org.cytoscape.model.CyTable)13 CyApplicationManager (org.cytoscape.application.CyApplicationManager)8 HashSet (java.util.HashSet)7 VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)6 CyIdentifiable (org.cytoscape.model.CyIdentifiable)5 CyRootNetworkManager (org.cytoscape.model.subnetwork.CyRootNetworkManager)4 CyNetworkViewManager (org.cytoscape.view.model.CyNetworkViewManager)4 ContinuousMapping (org.cytoscape.view.vizmap.mappings.ContinuousMapping)4 RowSetRecord (org.cytoscape.model.events.RowSetRecord)3 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)3 CyNetworkView (org.cytoscape.view.model.CyNetworkView)3 HashMap (java.util.HashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 Set (java.util.Set)2 WeakHashMap (java.util.WeakHashMap)2 CyGroupFactory (org.cytoscape.group.CyGroupFactory)2 CyGroupManager (org.cytoscape.group.CyGroupManager)2 CyColumn (org.cytoscape.model.CyColumn)2