- ISSUE:
With Cytoscape 3.3.0-SNAPSHOT, Java 1.8.0_45
From an empty network running the AddTwoNodes task creates two nodes but does not show their names Clicking and dragging on the top node gives this exception:
- Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: width of node has degenerated to zero after rounding
at org.cytoscape.ding.impl.DNodeView.setOffset(DNodeView.java:470) at org.cytoscape.ding.impl.InnerCanvas$MouseDraggedDelegator.singleLeftClick(InnerCanvas.java:1476) at org.cytoscape.ding.impl.InnerCanvas$MouseDraggedDelegator.delegateMouseEvent(InnerCanvas.java:1417) at org.cytoscape.ding.impl.InnerCanvas.mouseDragged(InnerCanvas.java:304) at org.cytoscape.ding.impl.cyannotator.listeners.CanvasMouseMotionListener.mouseDragged(CanvasMouseMotionListener.java:58) at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:319) at java.awt.Component.processMouseMotionEvent(Component.java:6573) at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3342) at java.awt.Component.processEvent(Component.java:6294) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4881) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4550) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2750) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Created
November 10, 2015 15:43
-
-
Save momeara/4833e93631f5908ec31d to your computer and use it in GitHub Desktop.
AddTwoNodes test case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.AddTwoNodes.internal.tasks; | |
import org.cytoscape.model.CyNetwork; | |
import org.cytoscape.model.CyNode; | |
import org.cytoscape.view.vizmap.VisualMappingManager; | |
import org.cytoscape.work.AbstractTask; | |
import org.cytoscape.work.TaskMonitor; | |
import org.cytoscape.view.model.CyNetworkView; | |
import org.cytoscape.view.vizmap.VisualStyle; | |
public class AddTwoNodesTask extends AbstractTask { | |
private CyNetworkView netView; | |
private final VisualMappingManager vmmServiceRef; | |
public AddTwoNodesTask(final CyNetworkView netView, final VisualMappingManager vmmServiceRef){ | |
this.netView = netView; | |
this.vmmServiceRef =vmmServiceRef; | |
} | |
public void run(TaskMonitor monitor) { | |
CyNetwork network = netView.getModel(); | |
CyNode node1 = network.addNode(); | |
network.getDefaultNodeTable().getRow(node1.getSUID()).set("name", "Node1"); | |
CyNode node2 = network.addNode(); | |
network.getDefaultNodeTable().getRow(node2.getSUID()).set("name", "Node2"); | |
// Apply the change to the view | |
VisualStyle style = vmmServiceRef.getCurrentVisualStyle(); | |
style.apply(netView); | |
netView.updateView(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.AddTwoNodes.internal.tasks; | |
import org.cytoscape.application.CyApplicationManager; | |
import org.cytoscape.view.vizmap.VisualMappingManager; | |
import org.cytoscape.work.AbstractTaskFactory; | |
import org.cytoscape.work.TaskIterator; | |
public class AddTwoNodesTaskFactory extends AbstractTaskFactory { | |
private final CyApplicationManager cyApplicationManagerServiceRef; | |
private final VisualMappingManager vmmServiceRef; | |
public AddTwoNodesTaskFactory(final CyApplicationManager cyApplicationManagerServiceRef, VisualMappingManager vmmServiceRef){ | |
this.cyApplicationManagerServiceRef = cyApplicationManagerServiceRef; | |
this.vmmServiceRef = vmmServiceRef; | |
} | |
public TaskIterator createTaskIterator(){ | |
return new TaskIterator(new AddTwoNodesTask(cyApplicationManagerServiceRef.getCurrentNetworkView(), vmmServiceRef)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.AddTwoNodes.internal | |
import org.osgi.framework.BundleContext; | |
import static org.cytoscape.work.ServiceProperties.COMMAND; | |
import static org.cytoscape.work.ServiceProperties.COMMAND_NAMESPACE; | |
import static org.cytoscape.work.ServiceProperties.IN_MENU_BAR; | |
import static org.cytoscape.work.ServiceProperties.MENU_GRAVITY; | |
import static org.cytoscape.work.ServiceProperties.PREFERRED_MENU; | |
import static org.cytoscape.work.ServiceProperties.TITLE; | |
import org.AddTwoNodes.internal.tasks.AddTwoNodesTaskFactory; | |
import org.cytoscape.application.CyApplicationManager; | |
import org.cytoscape.model.CyTableFactory; | |
import org.cytoscape.model.CyTableManager; | |
import org.cytoscape.service.util.AbstractCyActivator; | |
import org.cytoscape.task.NetworkTaskFactory; | |
import org.cytoscape.task.NetworkViewTaskFactory; | |
import org.cytoscape.view.vizmap.VisualMappingManager; | |
import org.cytoscape.work.TaskFactory; | |
import java.util.Properties; | |
public class CyActivator extends AbstractCyActivator { | |
public CyActivator() { | |
super(); | |
} | |
public void start(BundleContext bc) { | |
AddTwoNodesTaskFactory addTwoNodesTaskFactory = new AddTwoNodesTaskFactory(cyApplicationManagerServiceRef, vmmServiceRef); | |
Properties addTwoNodesTaskFactoryProps = new Properties(); | |
addTwoNodesTaskFactoryProps.setProperty("preferredMenu","Apps.Samples"); | |
addTwoNodesTaskFactoryProps.setProperty("title","Add two nodes"); | |
registerService(bc,addTwoNodesTaskFactory,TaskFactory.class, addTwoNodesTaskFactoryProps); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment