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