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);
}
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());
}
}
}
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);
}
}
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();
});
}
}
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;
}
Aggregations