use of org.cytoscape.event.CyEventHelper 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.event.CyEventHelper in project cytoscape-impl by cytoscape.
the class UnHideTask method run.
@Override
public void run(TaskMonitor e) {
e.setProgress(0.0);
final CyNetwork network = view.getModel();
final List<CyIdentifiable> elements = new ArrayList<>();
nodes = null;
edges = null;
e.setProgress(0.1);
if (unhideNodes) {
nodes = network.getNodeList();
elements.addAll(nodes);
}
if (unhideEdges) {
edges = network.getEdgeList();
elements.addAll(edges);
}
e.setProgress(0.2);
final UndoSupport undoSupport = serviceRegistrar.getService(UndoSupport.class);
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
final VisualMappingManager vmMgr = serviceRegistrar.getService(VisualMappingManager.class);
undoSupport.postEdit(new HideEdit(description, view, elements, true, eventHelper, vmMgr));
e.setProgress(0.3);
if (nodes != null)
HideUtils.setVisibleNodes(nodes, true, view);
e.setProgress(0.5);
if (edges != null)
HideUtils.setVisibleEdges(edges, true, view);
e.setProgress(0.7);
vmMgr.getVisualStyle(view).apply(view);
view.updateView();
e.setProgress(1.0);
}
use of org.cytoscape.event.CyEventHelper in project cytoscape-impl by cytoscape.
the class SIFInterpreterTask method run.
@Override
public void run(TaskMonitor tm) {
if (sifString == null)
throw new NullPointerException("SIF input string is null");
String[] terms = sifString.split("\\s");
if (terms != null) {
if (terms.length > 0) {
String name1 = terms[0].trim();
if (!name1.equals(null)) {
CyNode node1 = findNode(terms[0]);
if (node1 == null) {
node1 = network.addNode();
network.getRow(node1).set("name", terms[0]);
// nv1 = view.getNodeView(node1);
// double[] nextLocn = new double[2];
// nextLocn[0] = p.getX();
// nextLocn[1] = p.getY();
// view.xformComponentToNodeCoords(nextLocn);
// nv1.setOffset(nextLocn[0], nextLocn[1]);
} else {
// nv1 = view.getNodeView(node1);
}
if (terms.length == 3) {
// simple case of 'A interaction B'
CyNode node2 = findNode(terms[2]);
if (node2 == null) {
node2 = network.addNode();
network.getRow(node2).set("name", terms[2]);
// nv2 = view.getNodeView(node2);
// nv2.setOffset(nv1.getXPosition() + spacing, nv1.getYPosition());
}
CyEdge edge = network.addEdge(node1, node2, true);
network.getRow(edge).set("name", terms[1]);
} else if (terms.length > 3) {
// process multiple targets and one source
List<View<CyNode>> nodeViews = new ArrayList<View<CyNode>>();
String interactionType = terms[1];
for (int i = 2; i < terms.length; i++) {
CyNode node2 = findNode(terms[i]);
if (node2 == null) {
node2 = network.addNode();
network.getRow(node2).set("name", terms[i]);
// nv2 = view.getNodeView(node2);
// nv2.setOffset(nv1.getXPosition() + spacing, nv1
// .getYPosition());
}
CyEdge edge = network.addEdge(node1, node2, true);
network.getRow(edge).set("name", terms[1]);
// doCircleLayout(nodeViews, nv1);
}
}
}
// Apply visual style
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
// To make sure the edge view is created before applying the style
eventHelper.flushPayloadEvents();
final VisualMappingManager vmMgr = serviceRegistrar.getService(VisualMappingManager.class);
VisualStyle vs = vmMgr.getVisualStyle(view);
vs.apply(view);
view.updateView();
}
}
}
use of org.cytoscape.event.CyEventHelper in project cytoscape-impl by cytoscape.
the class EquationParserImpl method unregisterFunctionService.
public void unregisterFunctionService(final Function function, final Map<?, ?> props) {
if (function != null) {
registeredFunctions.remove(function);
nameToFunctionMap.remove(function.getName().toUpperCase(), function);
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
eventHelper.addEventPayload(this, function, EquationFunctionRemovedEvent.class);
}
}
use of org.cytoscape.event.CyEventHelper in project cytoscape-impl by cytoscape.
the class EquationParserImpl method registerFunction.
@Deprecated
@Override
public void registerFunction(Function func) throws IllegalArgumentException {
registerFunctionInternal(func);
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
eventHelper.addEventPayload(this, func, EquationFunctionAddedEvent.class);
}
Aggregations