Search in sources :

Example 1 with CyGroupSettingsImpl

use of org.cytoscape.group.internal.data.CyGroupSettingsImpl in project cytoscape-impl by cytoscape.

the class CyActivator method start.

@Override
public void start(BundleContext bc) {
    final CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
    LockedVisualPropertiesManager lockedVisualPropertiesManager = new LockedVisualPropertiesManager(serviceRegistrar);
    CyGroupManagerImpl cyGroupManager = new CyGroupManagerImpl(serviceRegistrar);
    CyGroupFactoryImpl cyGroupFactory = new CyGroupFactoryImpl(cyGroupManager, lockedVisualPropertiesManager);
    registerService(bc, cyGroupManager, CyGroupManager.class);
    registerService(bc, cyGroupManager, AddedEdgesListener.class);
    registerService(bc, cyGroupManager, AboutToRemoveEdgesListener.class);
    registerService(bc, cyGroupFactory, CyGroupFactory.class);
    // Create the aggregation manager
    CyGroupAggregationManagerImpl cyAggMgr = new CyGroupAggregationManagerImpl(cyGroupManager);
    registerService(bc, cyAggMgr, CyGroupAggregationManager.class, new Properties());
    // Get our Settings object
    CyGroupSettingsImpl cyGroupSettings = new CyGroupSettingsImpl(cyGroupManager, cyAggMgr, serviceRegistrar);
    GroupIO groupIO = new GroupIO(cyGroupManager, lockedVisualPropertiesManager, cyGroupSettings);
    registerAllServices(bc, groupIO);
    // Register our settings menu
    CyGroupSettingsTaskFactory settingsFactory = new CyGroupSettingsTaskFactory(cyGroupManager, cyAggMgr, cyGroupSettings);
    Properties settingsProps = new Properties();
    settingsProps.setProperty(ID, "settingsFactory");
    settingsProps.setProperty(PREFERRED_MENU, "Edit.Preferences");
    settingsProps.setProperty(TITLE, "Group Preferences...");
    settingsProps.setProperty(MENU_GRAVITY, "4.0");
    settingsProps.setProperty(TOOL_BAR_GRAVITY, "4");
    settingsProps.setProperty(IN_TOOL_BAR, "false");
    registerService(bc, settingsFactory, TaskFactory.class, settingsProps);
    // Now register our node-specific settings menu
    CyGroupNodeSettingsTaskFactory nodeSettingsFactory = new CyGroupNodeSettingsTaskFactory(cyGroupManager, cyAggMgr, cyGroupSettings);
    settingsProps = new Properties();
    settingsProps.setProperty(ID, "groupNodeSettingsFactory");
    settingsProps.setProperty(PREFERRED_MENU, NODE_PREFERENCES_MENU);
    settingsProps.setProperty(MENU_GRAVITY, "-1");
    settingsProps.setProperty(TITLE, "Group Preferences...");
    settingsProps.setProperty(PREFERRED_ACTION, "NEW");
    settingsProps.setProperty(COMMAND, "group-node-settings");
    settingsProps.setProperty(COMMAND_NAMESPACE, "network-view");
    registerService(bc, nodeSettingsFactory, NodeViewTaskFactory.class, settingsProps);
    // Make the settings available to consumers
    registerService(bc, cyGroupSettings, GroupAddedListener.class, new Properties());
    registerService(bc, cyGroupSettings, NetworkAddedListener.class, new Properties());
    registerService(bc, cyGroupSettings, CyGroupSettingsManager.class, new Properties());
    registerService(bc, cyGroupSettings, PropertyUpdatedListener.class, new Properties());
    // Set up listener for node movement
    NodeChangeListener nodeChangeListener = new NodeChangeListener(cyGroupManager, cyGroupSettings);
    registerService(bc, nodeChangeListener, ViewChangedListener.class, new Properties());
    settingsProps = new Properties();
    settingsProps.setProperty(ID, "groupViewCollapseFactory");
    settingsProps.setProperty(TITLE, "Collapse Group View");
    settingsProps.setProperty(COMMAND, "groupViewCollapseFactory");
    settingsProps.setProperty(COMMAND_NAMESPACE, "network-view");
    settingsProps.setProperty(COMMAND_SUPPORTS_JSON, "true");
    GroupViewCollapseHandler gvcHandler = new GroupViewCollapseHandler(cyGroupManager, cyGroupSettings, nodeChangeListener);
    registerService(bc, gvcHandler, GroupAboutToCollapseListener.class, settingsProps);
    registerService(bc, gvcHandler, GroupAboutToBeDestroyedListener.class, settingsProps);
    registerService(bc, gvcHandler, GroupCollapsedListener.class, settingsProps);
    registerService(bc, gvcHandler, SessionLoadedListener.class, settingsProps);
    registerService(bc, gvcHandler, GroupAddedListener.class, settingsProps);
    registerService(bc, gvcHandler, GroupViewTypeChangedListener.class, settingsProps);
    GroupDataCollapseHandler gdcHandler = new GroupDataCollapseHandler(cyGroupManager, cyGroupSettings);
    registerService(bc, gdcHandler, GroupAboutToCollapseListener.class, new Properties());
    // Listen for double-click
    GroupViewDoubleClickListener gvsListener = new GroupViewDoubleClickListener(cyGroupManager, cyGroupSettings);
    Properties doubleClickProperties = new Properties();
    doubleClickProperties.setProperty(PREFERRED_ACTION, "OPEN");
    doubleClickProperties.setProperty(TITLE, "Expand/Collapse Group");
    registerService(bc, gvsListener, NodeViewTaskFactory.class, doubleClickProperties);
}
Also used : NodeChangeListener(org.cytoscape.group.internal.view.NodeChangeListener) CyGroupAggregationManagerImpl(org.cytoscape.group.internal.data.CyGroupAggregationManagerImpl) Properties(java.util.Properties) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) CyGroupSettingsTaskFactory(org.cytoscape.group.internal.data.CyGroupSettingsTaskFactory) GroupViewDoubleClickListener(org.cytoscape.group.internal.view.GroupViewDoubleClickListener) GroupViewCollapseHandler(org.cytoscape.group.internal.view.GroupViewCollapseHandler) CyGroupNodeSettingsTaskFactory(org.cytoscape.group.internal.data.CyGroupNodeSettingsTaskFactory) GroupDataCollapseHandler(org.cytoscape.group.internal.data.GroupDataCollapseHandler) CyGroupSettingsImpl(org.cytoscape.group.internal.data.CyGroupSettingsImpl)

Aggregations

Properties (java.util.Properties)1 CyGroupAggregationManagerImpl (org.cytoscape.group.internal.data.CyGroupAggregationManagerImpl)1 CyGroupNodeSettingsTaskFactory (org.cytoscape.group.internal.data.CyGroupNodeSettingsTaskFactory)1 CyGroupSettingsImpl (org.cytoscape.group.internal.data.CyGroupSettingsImpl)1 CyGroupSettingsTaskFactory (org.cytoscape.group.internal.data.CyGroupSettingsTaskFactory)1 GroupDataCollapseHandler (org.cytoscape.group.internal.data.GroupDataCollapseHandler)1 GroupViewCollapseHandler (org.cytoscape.group.internal.view.GroupViewCollapseHandler)1 GroupViewDoubleClickListener (org.cytoscape.group.internal.view.GroupViewDoubleClickListener)1 NodeChangeListener (org.cytoscape.group.internal.view.NodeChangeListener)1 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)1