use of org.cytoscape.service.util.CyServiceRegistrar in project cytoscape-impl by cytoscape.
the class CyActivator method start.
@Override
public void start(BundleContext bc) {
final CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
// Mapping Factories:
final DiscreteMappingFactory dmFactory = new DiscreteMappingFactory(serviceRegistrar);
{
final Properties props = new Properties();
props.setProperty("service.type", "factory");
props.setProperty("mapping.type", "discrete");
registerService(bc, dmFactory, VisualMappingFunctionFactory.class, props);
}
final ContinuousMappingFactory cmFactory = new ContinuousMappingFactory(serviceRegistrar);
{
final Properties props = new Properties();
props.setProperty("service.type", "factory");
props.setProperty("mapping.type", "continuous");
registerService(bc, cmFactory, VisualMappingFunctionFactory.class, props);
}
final PassthroughMappingFactory pmFactory = new PassthroughMappingFactory(serviceRegistrar);
{
final Properties props = new Properties();
props.setProperty("service.type", "factory");
props.setProperty("mapping.type", "passthrough");
registerService(bc, pmFactory, VisualMappingFunctionFactory.class, props);
registerServiceListener(bc, pmFactory::addValueTranslator, pmFactory::removeValueTranslator, ValueTranslator.class);
}
final VisualStyleFactoryImpl visualStyleFactory = new VisualStyleFactoryImpl(serviceRegistrar, pmFactory);
registerService(bc, visualStyleFactory, VisualStyleFactory.class);
final VisualMappingManagerImpl visualMappingManager = new VisualMappingManagerImpl(visualStyleFactory, serviceRegistrar);
registerAllServices(bc, visualMappingManager);
}
use of org.cytoscape.service.util.CyServiceRegistrar in project cytoscape-impl by cytoscape.
the class CyActivator method start.
@Override
public void start(BundleContext bc) {
CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
// UI for Network Import Clients
WebServiceImportDialog<NetworkImportWebServiceClient> unifiedNetworkImportDialog = new WebServiceImportDialog<NetworkImportWebServiceClient>(NetworkImportWebServiceClient.class, "Import Network from Public Databases", serviceRegistrar);
// UI for Table Import Clients
WebServiceImportDialog<TableImportWebServiceClient> unifiedTableImportDialog = new WebServiceImportDialog<TableImportWebServiceClient>(TableImportWebServiceClient.class, "Import Table from Public Databases", serviceRegistrar);
WebServiceGUIImpl webServiceGui = new WebServiceGUIImpl();
webServiceGui.addClient(NetworkImportWebServiceClient.class, unifiedNetworkImportDialog);
webServiceGui.addClient(TableImportWebServiceClient.class, unifiedTableImportDialog);
// ALT (for Mac, it's Option)
final KeyStroke networkImportShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.ALT_DOWN_MASK);
final KeyStroke tableImportShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.ALT_DOWN_MASK);
ShowImportDialogAction showImportNetworkFromWebServiceDialogAction = new ShowImportDialogAction(unifiedNetworkImportDialog, "File.Import.Network", 3.0f, "Public Databases...", networkImportShortcut, "Import Network from Database...", serviceRegistrar);
ShowImportDialogAction showImportTableFromWebServiceDialogAction = new ShowImportDialogAction(unifiedTableImportDialog, "File.Import.Table", 3.0f, "Public Databases...", tableImportShortcut, serviceRegistrar);
{
Properties props = new Properties();
props.setProperty("id", "showImportNetworkFromWebServiceDialogAction");
registerService(bc, showImportNetworkFromWebServiceDialogAction, CyAction.class, props);
}
registerService(bc, showImportTableFromWebServiceDialogAction, CyAction.class, new Properties());
registerService(bc, webServiceGui, WebServiceGUI.class, new Properties());
registerServiceListener(bc, unifiedNetworkImportDialog::addClient, unifiedNetworkImportDialog::removeClient, WebServiceClient.class);
registerServiceListener(bc, unifiedTableImportDialog::addClient, unifiedTableImportDialog::removeClient, WebServiceClient.class);
}
use of org.cytoscape.service.util.CyServiceRegistrar in project cytoscape-impl by cytoscape.
the class CyActivator method start.
@Override
public void start(BundleContext bc) {
final CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
{
// NetworkView (empty space) context menus
SIFInterpreterTaskFactory factory = new SIFInterpreterTaskFactory(serviceRegistrar);
Properties props = new Properties();
props.setProperty(ENABLE_FOR, "networkAndView");
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NETWORK_ADD_MENU);
props.setProperty(MENU_GRAVITY, "1.0");
props.setProperty(IN_MENU_BAR, "false");
props.setProperty(TITLE, "Edge (and possibly Nodes) using SIF...");
registerService(bc, factory, NetworkViewTaskFactory.class, props);
}
{
NetworkViewLocationTaskFactory factory = new AddNodeTaskFactory(serviceRegistrar);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NETWORK_ADD_MENU);
props.setProperty(MENU_GRAVITY, "1.1");
props.setProperty(TITLE, "Node");
registerService(bc, factory, NetworkViewLocationTaskFactory.class, props);
}
// We need a place to hold the objects themselves
ClipboardManagerImpl clipboardManager = new ClipboardManagerImpl(serviceRegistrar);
{
// Copy node
NetworkViewTaskFactory factory = new CopyTaskFactory(clipboardManager);
Properties props = new Properties();
props.setProperty(ENABLE_FOR, "networkAndView");
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU);
props.setProperty(ACCELERATOR, "cmd c");
props.setProperty(TITLE, "Copy");
props.setProperty(MENU_GRAVITY, "0.0f");
registerService(bc, factory, NetworkViewTaskFactory.class, props);
}
{
// Cut node
NetworkViewTaskFactory factory = new CutTaskFactory(clipboardManager, serviceRegistrar);
Properties props = new Properties();
props.setProperty(ENABLE_FOR, "networkAndView");
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU);
props.setProperty(ACCELERATOR, "cmd x");
props.setProperty(MENU_GRAVITY, "0.1f");
props.setProperty(TITLE, "Cut");
registerService(bc, factory, NetworkViewTaskFactory.class, props);
}
{
// Paste node
NetworkViewLocationTaskFactory pasteTaskFactory = new PasteTaskFactory(clipboardManager, serviceRegistrar);
Properties props = new Properties();
props.setProperty(ENABLE_FOR, "networkAndView");
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU);
props.setProperty(TITLE, "Paste");
props.setProperty(MENU_GRAVITY, "0.2f");
props.setProperty(ACCELERATOR, "cmd v");
props.setProperty(IN_MENU_BAR, "true");
registerService(bc, pasteTaskFactory, NetworkViewLocationTaskFactory.class, props);
}
// At some point, add Paste Special. Paste special would allow paste node only, paste copy, etc.
// NodeView context menus
{
// Copy node
NodeViewTaskFactory factory = new CopyNodeTaskFactory(clipboardManager);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NODE_EDIT_MENU);
props.setProperty(ACCELERATOR, "cmd c");
props.setProperty(MENU_GRAVITY, "0.0f");
props.setProperty(TITLE, "Copy");
registerService(bc, factory, NodeViewTaskFactory.class, props);
}
{
// Cut node
NodeViewTaskFactory factory = new CutNodeTaskFactory(clipboardManager, serviceRegistrar);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NODE_EDIT_MENU);
props.setProperty(ACCELERATOR, "cmd x");
props.setProperty(MENU_GRAVITY, "0.1f");
props.setProperty(TITLE, "Cut");
registerService(bc, factory, NodeViewTaskFactory.class, props);
}
{
// Rename node
NodeViewTaskFactory factory = new RenameNodeTaskFactory(serviceRegistrar);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NODE_EDIT_MENU);
props.setProperty(INSERT_SEPARATOR_AFTER, "true");
props.setProperty(MENU_GRAVITY, "0.2f");
props.setProperty(TITLE, "Rename Node");
registerService(bc, factory, NodeViewTaskFactory.class, props);
}
{
NodeViewTaskFactory factory = new AddNestedNetworkTaskFactory(serviceRegistrar);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NODE_NESTED_NETWORKS_MENU);
props.setProperty(MENU_GRAVITY, "0.1f");
props.setProperty(TITLE, "Add Nested Network");
registerService(bc, factory, NodeViewTaskFactory.class, props);
}
{
NodeViewTaskFactory factory = new DeleteNestedNetworkTaskFactory(serviceRegistrar);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NODE_NESTED_NETWORKS_MENU);
props.setProperty(MENU_GRAVITY, "0.2f");
props.setProperty(TITLE, "Remove Nested Network");
registerService(bc, factory, NodeViewTaskFactory.class, props);
}
{
NodeViewTaskFactory factory = new GoToNestedNetworkTaskFactory(serviceRegistrar);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, NODE_NESTED_NETWORKS_MENU);
props.setProperty(MENU_GRAVITY, "0.3f");
props.setProperty(TITLE, "Go to Nested Network");
registerService(bc, factory, NodeViewTaskFactory.class, props);
}
// EdgeView context menus
{
// Copy node
EdgeViewTaskFactory factory = new CopyEdgeTaskFactory(clipboardManager);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, EDGE_EDIT_MENU);
props.setProperty(ACCELERATOR, "cmd c");
props.setProperty(MENU_GRAVITY, "0.0f");
props.setProperty(TITLE, "Copy");
registerService(bc, factory, EdgeViewTaskFactory.class, props);
}
{
// Cut edge
EdgeViewTaskFactory factory = new CutEdgeTaskFactory(clipboardManager, serviceRegistrar);
Properties props = new Properties();
props.setProperty(PREFERRED_ACTION, "NEW");
props.setProperty(PREFERRED_MENU, EDGE_EDIT_MENU);
props.setProperty(ACCELERATOR, "cmd x");
props.setProperty(MENU_GRAVITY, "0.1f");
props.setProperty(TITLE, "Cut");
registerService(bc, factory, EdgeViewTaskFactory.class, props);
}
}
use of org.cytoscape.service.util.CyServiceRegistrar in project cytoscape-impl by cytoscape.
the class Cy3SessionReaderImplTest method setUp.
@Before
public void setUp() {
InputStream is = mock(InputStream.class);
GroupUtil groupUtil = mock(GroupUtil.class);
SUIDUpdater suidUpdater = mock(SUIDUpdater.class);
CyNetworkReaderManager netReaderMgr = mock(CyNetworkReaderManager.class);
CyPropertyReaderManager propReaderMgr = mock(CyPropertyReaderManager.class);
VizmapReaderManager vizmapReaderMgr = mock(VizmapReaderManager.class);
CSVCyReaderFactory csvCyReaderFactory = mock(CSVCyReaderFactory.class);
CyNetworkTableManager netTblMgr = mock(CyNetworkTableManager.class);
CyRootNetworkManager rootNetMgr = mock(CyRootNetworkManager.class);
EquationCompiler compiler = mock(EquationCompiler.class);
CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
when(serviceRegistrar.getService(CyNetworkTableManager.class)).thenReturn(netTblMgr);
when(serviceRegistrar.getService(CyRootNetworkManager.class)).thenReturn(rootNetMgr);
when(serviceRegistrar.getService(EquationCompiler.class)).thenReturn(compiler);
ReadCache cache = new ReadCache(serviceRegistrar);
reader = new Cy3SessionReaderImpl(is, cache, groupUtil, suidUpdater, netReaderMgr, propReaderMgr, vizmapReaderMgr, csvCyReaderFactory, serviceRegistrar);
tblTestSupport = new TableTestSupport();
}
use of org.cytoscape.service.util.CyServiceRegistrar in project cytoscape-impl by cytoscape.
the class GenericXGMMLFileFilterTest method setUp.
@Before
public void setUp() {
Set<String> extensions = new HashSet<String>();
Set<String> contentTypes = new HashSet<String>();
String description = "XGMML";
Properties props = new Properties();
CyProperty<Properties> cyProperties = new SimpleCyProperty<Properties>("test", props, Properties.class, SavePolicy.DO_NOT_SAVE);
CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
when(serviceRegistrar.getService(CyProperty.class, "(cyPropertyName=cytoscape3.props)")).thenReturn(cyProperties);
filter = new GenericXGMMLFileFilter(extensions, contentTypes, description, DataCategory.NETWORK, new StreamUtilImpl(serviceRegistrar));
}
Aggregations