Author: paperwing
Date: 2012-02-06 15:56:44 -0800 (Mon, 06 Feb 2012)
New Revision: 28202
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
Log:
refs #634 Crashing bug was fixed by listening to the event fired when the
GLJPanel is removed to stop the FPSAnimator thread. Work remains to update the
bird's eye view when switching between network windows. Currently, an event
such as adding a node seems to be needed to update the bird's eye view.
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
2012-02-06 23:19:44 UTC (rev 28201)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
2012-02-06 23:56:44 UTC (rev 28202)
@@ -4,6 +4,8 @@
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Image;
+import java.awt.event.ContainerEvent;
+import java.awt.event.ContainerListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.image.BufferedImage;
@@ -137,6 +139,8 @@
animator = new FPSAnimator(60);
animator.add(panel);
+ addStopAnimatorListener(component);
+
// Setup animator start/stop, can be based on
gaining/losing focus of the canvas
setUpAnimatorStarting(focus, animator);
@@ -145,6 +149,25 @@
}
}
+ // Adds a listener to the component containing the GLJPanel to stop the
animator
+ // if the GLJPanel is about to be removed
+ private void addStopAnimatorListener(JComponent container) {
+ container.addContainerListener(new ContainerListener(){
+
+ @Override
+ public void componentAdded(ContainerEvent event) {
+ }
+
+ @Override
+ public void componentRemoved(ContainerEvent event) {
+ if (event.getChild() == panel
+ && animator != null) {
+ animator.stop();
+ }
+ }
+ });
+ }
+
protected abstract void setUpAnimatorStarting(Container container,
FPSAnimator animator);
public void setUpNetworkViewDestroyedListener(CyServiceRegistrar
serviceRegistrar) {
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.