diff --git a/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java b/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java index 92af3d2..34f5706 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java @@ -879,13 +879,13 @@ final PBounds clippingRect = new PBounds(g.getClipBounds()); clippingRect.expandNearestIntegerDimensions(); - + final PBounds originalCameraBounds = getCamera().getBounds(); final PBounds layerBounds = getCamera().getUnionOfLayerFullBounds(); getCamera().setBounds(layerBounds); final double clipRatio = clippingRect.getWidth() / clippingRect.getHeight(); - final double nodeRatio = getWidth() / getHeight(); + final double nodeRatio = ((double)getWidth()) / ((double)getHeight()); final double scale; if (nodeRatio <= clipRatio) { scale = clippingRect.getHeight() / getCamera().getHeight(); diff --git a/core/src/main/java/edu/umd/cs/piccolo/PNode.java b/core/src/main/java/edu/umd/cs/piccolo/PNode.java index ec6b9a4..2b1c9b6 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PNode.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PNode.java @@ -875,7 +875,7 @@ final byte[] ser = PObjectOutputStream.toByteArray(this); return new ObjectInputStream(new ByteArrayInputStream(ser)).readObject(); } - catch (final IOException e) { + catch (final IOException e) { return null; } catch (final ClassNotFoundException e) { diff --git a/core/src/main/java/edu/umd/cs/piccolo/PRoot.java b/core/src/main/java/edu/umd/cs/piccolo/PRoot.java index 40ce8cb..e9b6009 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PRoot.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PRoot.java @@ -98,7 +98,7 @@ /** * The singleton instance of the default input manager. */ - private PInputManager defaultInputManager; + private transient PInputManager defaultInputManager; /** The Input Sources that are registered to this node. */ private final transient List inputSources; diff --git a/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java b/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java index 7ad3e1d..2c85679 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java +++ b/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java @@ -30,6 +30,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -52,11 +53,11 @@ * @version 1.0 * @author Jesse Grosjean */ -public class PActivityScheduler { - +public class PActivityScheduler implements Serializable { + private static final long serialVersionUID = 1L; private final PRoot root; private final List activities; - private Timer activityTimer; + private transient Timer activityTimer; private boolean activitiesChanged; private boolean animating; private final ArrayList processingActivities; diff --git a/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java b/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java index 9a56666..215355e 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java +++ b/core/src/main/java/edu/umd/cs/piccolo/nodes/PHtmlView.java @@ -117,7 +117,7 @@ private final JLabel label; /** Object that encapsulates the HTML rendering logic. */ - private View htmlView; + private transient View htmlView; /** * Create an empty HTML text node with the default font and text color. diff --git a/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java b/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java index 2fcbcb3..1661e42 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java +++ b/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java @@ -354,9 +354,10 @@ * @param text text for this text node */ public void setText(final String text) { - if (text == this.text) { + if ((text == null && this.text == null) || (text != null && text.equals(this.text))) { return; } + final String oldText = this.text; this.text = text == null ? DEFAULT_TEXT : text; lines = null; diff --git a/core/src/test/java/edu/umd/cs/piccolo/PerformanceTests.java b/core/src/test/java/edu/umd/cs/piccolo/PerformanceTests.java index c8b8311..fcf16ae 100644 --- a/core/src/test/java/edu/umd/cs/piccolo/PerformanceTests.java +++ b/core/src/test/java/edu/umd/cs/piccolo/PerformanceTests.java @@ -222,7 +222,7 @@ } log.endTest("Do fullIntersects test for " + NUMBER_NODES + " nodes"); } - + public void memorySizeOfNodes() { final PNode[] nodes = new PNode[NUMBER_NODES]; Runtime.getRuntime().gc();