Revision: 1003
Author: [email protected]
Date: Thu Apr 15 18:47:47 2010
Log: Changing constants to final as per Issue #135
http://code.google.com/p/piccolo2d/source/detail?r=1003
Modified:
/piccolo2d.java/trunk
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventFilter.java
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PUtil.java
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/event/PInputEventFilterTest.java
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/util/PUtilTest.java
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/handles/PHandle.java
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PLens.java
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java
/piccolo2d.java/trunk/parent/.settings/org.eclipse.jdt.core.prefs
/piccolo2d.java/trunk/parent/.settings/org.maven.ide.eclipse.prefs
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTHandle.java
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventFilter.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEventFilter.java
Thu Apr 15 18:47:47 2010
@@ -53,7 +53,7 @@
*/
public class PInputEventFilter {
/** Mask representing all possible modifiers. */
- public static int ALL_MODIFIERS_MASK = InputEvent.BUTTON1_MASK |
InputEvent.BUTTON2_MASK | InputEvent.BUTTON3_MASK
+ public static final int ALL_MODIFIERS_MASK = InputEvent.BUTTON1_MASK |
InputEvent.BUTTON2_MASK | InputEvent.BUTTON3_MASK
| InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK |
InputEvent.ALT_MASK | InputEvent.ALT_GRAPH_MASK
| InputEvent.META_MASK;
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java
Thu Apr 15 18:47:47 2010
@@ -110,13 +110,13 @@
*/
// public static final Font DEFAULT_FONT = new Font(Font.SANS_SERIF,
// Font.PLAIN, 12); jdk 1.6+
- public static Font DEFAULT_FONT = new Font("SansSerif", Font.PLAIN,
12);
+ public static final Font DEFAULT_FONT = new Font("SansSerif",
Font.PLAIN, 12);
/**
* Default greek threshold, <code>5.5d</code>. Will be made final in
version
* 2.0.
*/
- public static double DEFAULT_GREEK_THRESHOLD = 5.5d;
+ public static final double DEFAULT_GREEK_THRESHOLD = 5.5d;
/**
* Default horizontal alignment, <code>Component.LEFT_ALIGNMENT</code>.
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java
Thu Apr 15 18:47:47 2010
@@ -56,10 +56,10 @@
public static final int HIGH_QUALITY_RENDERING = 1;
/** Font context to use while in low quality rendering. */
- public static FontRenderContext RENDER_QUALITY_LOW_FRC = new
FontRenderContext(null, false, true);
+ public static final FontRenderContext RENDER_QUALITY_LOW_FRC = new
FontRenderContext(null, false, true);
/** Font context to use while in high quality rendering. */
- public static FontRenderContext RENDER_QUALITY_HIGH_FRC = new
FontRenderContext(null, true, true);
+ public static final FontRenderContext RENDER_QUALITY_HIGH_FRC = new
FontRenderContext(null, true, true);
/**
* @deprecated will disappear as soon as possible Global for accessing
the
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PUtil.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PUtil.java
Thu Apr 15 18:47:47 2010
@@ -57,13 +57,13 @@
* PActivities are broken into steps, this is how many milliseconds
should
* pass between steps.
*/
- public static long DEFAULT_ACTIVITY_STEP_RATE = 20;
+ public static final long DEFAULT_ACTIVITY_STEP_RATE = 20;
/** Rate in milliseconds at which the activity timer will get invoked.
*/
- public static int ACTIVITY_SCHEDULER_FRAME_DELAY = 10;
+ public static final int ACTIVITY_SCHEDULER_FRAME_DELAY = 10;
/** An iterator that iterates over an empty collection. */
- public static Iterator NULL_ITERATOR =
Collections.EMPTY_LIST.iterator();
+ public static final Iterator NULL_ITERATOR =
Collections.EMPTY_LIST.iterator();
/**
* Used when persisting paths to an object stream. Used to mark the
end of
@@ -72,7 +72,7 @@
private static final int PATH_TERMINATOR = -1;
/** A utility enumeration with no elements. */
- public static Enumeration NULL_ENUMERATION = new Enumeration() {
+ public static final Enumeration NULL_ENUMERATION = new Enumeration() {
public boolean hasMoreElements() {
return false;
}
@@ -86,7 +86,7 @@
* @deprecated This has been moved into a private static class of
* PObjectOutputStream
*/
- public static OutputStream NULL_OUTPUT_STREAM = new OutputStream() {
+ public static final OutputStream NULL_OUTPUT_STREAM = new
OutputStream() {
public void close() {
}
=======================================
---
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/event/PInputEventFilterTest.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/event/PInputEventFilterTest.java
Thu Apr 15 18:47:47 2010
@@ -45,17 +45,6 @@
public void setUp() {
filter = new PInputEventFilter();
}
-
- // http://code.google.com/p/piccolo2d/issues/detail?id=116
- public void testPreventCodeCleanFinal() {
- final int pre = PInputEventFilter.ALL_MODIFIERS_MASK;
- try {
- PInputEventFilter.ALL_MODIFIERS_MASK = 0;
- }
- finally {
- PInputEventFilter.ALL_MODIFIERS_MASK = pre;
- }
- }
public void testAcceptsAlreadyHandledEventsFalseByDefault() {
assertFalse(filter.getAcceptsAlreadyHandledEvents());
=======================================
---
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/util/PUtilTest.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/util/PUtilTest.java
Thu Apr 15 18:47:47 2010
@@ -27,42 +27,11 @@
*/
package edu.umd.cs.piccolo.util;
-import java.io.OutputStream;
-import java.util.Enumeration;
-import java.util.Iterator;
-
import junit.framework.TestCase;
/**
* Unit test for PUtil.
*/
public class PUtilTest extends TestCase {
-
- // see http://code.google.com/p/piccolo2d/issues/detail?id=116
- public void testPreventCodeCleanFinal() {
- final Enumeration ne = PUtil.NULL_ENUMERATION;
- try {
- PUtil.NULL_ENUMERATION = null;
- }
- finally {
- PUtil.NULL_ENUMERATION = ne;
- }
-
- final Iterator ni = PUtil.NULL_ITERATOR;
- try {
- PUtil.NULL_ITERATOR = null;
- }
- finally {
- PUtil.NULL_ITERATOR = ni;
- }
-
- final OutputStream no = PUtil.NULL_OUTPUT_STREAM;
- try {
- PUtil.NULL_OUTPUT_STREAM = null;
- }
- finally {
- PUtil.NULL_OUTPUT_STREAM = no;
- }
- }
}
=======================================
---
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/handles/PHandle.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/handles/PHandle.java
Thu Apr 15 18:47:47 2010
@@ -82,12 +82,12 @@
private static final long serialVersionUID = 1L;
/** The default size for a handle. */
- public static float DEFAULT_HANDLE_SIZE = 8;
+ public static final float DEFAULT_HANDLE_SIZE = 8;
/** Default shape to use when drawing handles. */
- public static Shape DEFAULT_HANDLE_SHAPE = new Ellipse2D.Float(0f, 0f,
DEFAULT_HANDLE_SIZE, DEFAULT_HANDLE_SIZE);
+ public static final Shape DEFAULT_HANDLE_SHAPE = new
Ellipse2D.Float(0f, 0f, DEFAULT_HANDLE_SIZE, DEFAULT_HANDLE_SIZE);
/** Default color to paint handles. */
- public static Color DEFAULT_COLOR = Color.white;
+ public static final Color DEFAULT_COLOR = Color.white;
private PLocator locator;
private transient PDragSequenceEventHandler handleDragger;
=======================================
---
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PLens.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PLens.java
Thu Apr 15 18:47:47 2010
@@ -69,13 +69,13 @@
private final transient PDragEventHandler lensDragger;
/** The height of the drag bar. */
- public static double LENS_DRAGBAR_HEIGHT = 20;
+ public static final double LENS_DRAGBAR_HEIGHT = 20;
/** Default paint to use for the drag bar. */
- public static Paint DEFAULT_DRAGBAR_PAINT = Color.DARK_GRAY;
+ public static final Paint DEFAULT_DRAGBAR_PAINT = Color.DARK_GRAY;
/** Default paint to use when drawing the background of the lens. */
- public static Paint DEFAULT_LENS_PAINT = Color.LIGHT_GRAY;
+ public static final Paint DEFAULT_LENS_PAINT = Color.LIGHT_GRAY;
/**
* Constructs the default PLens.
=======================================
---
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java
Thu Apr 15 18:47:47 2010
@@ -65,10 +65,10 @@
private static final long serialVersionUID = 1L;
/** Font rendering context used for all PStyledText instances. */
- protected static FontRenderContext SWING_FRC = new
FontRenderContext(null, true, false);
+ protected static final FontRenderContext SWING_FRC = new
FontRenderContext(null, true, false);
/** Used while painting underlines. */
- protected static Line2D paintLine = new Line2D.Double();
+ protected static final Line2D paintLine = new Line2D.Double();
/**
* Underlying document used to handle the complexities involved with
=======================================
--- /piccolo2d.java/trunk/parent/.settings/org.eclipse.jdt.core.prefs Wed
Oct 28 07:58:59 2009
+++ /piccolo2d.java/trunk/parent/.settings/org.eclipse.jdt.core.prefs Thu
Apr 15 18:47:47 2010
@@ -1,4 +1,4 @@
-#Wed Oct 28 10:17:01 EDT 2009
+#Fri Jul 31 20:29:04 EDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
org.eclipse.jdt.core.compiler.compliance=1.4
=======================================
--- /piccolo2d.java/trunk/parent/.settings/org.maven.ide.eclipse.prefs Wed
Oct 28 07:58:59 2009
+++ /piccolo2d.java/trunk/parent/.settings/org.maven.ide.eclipse.prefs Thu
Apr 15 18:47:47 2010
@@ -1,4 +1,4 @@
-#Wed Oct 28 10:16:59 EDT 2009
+#Fri Jul 31 20:28:54 EDT 2009
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
=======================================
---
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTHandle.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTHandle.java
Thu Apr 15 18:47:47 2010
@@ -61,11 +61,11 @@
public class PSWTHandle extends PSWTPath {
private static final long serialVersionUID = 1L;
/** The Default Size of a handle not including its border. */
- public static float DEFAULT_HANDLE_SIZE = 8;
+ public static final float DEFAULT_HANDLE_SIZE = 8;
/** The default shape to use when drawing handles. Default is an
ellipse. */
- public static Shape DEFAULT_HANDLE_SHAPE = new Ellipse2D.Float(0f, 0f,
DEFAULT_HANDLE_SIZE, DEFAULT_HANDLE_SIZE);
+ public static final Shape DEFAULT_HANDLE_SHAPE = new
Ellipse2D.Float(0f, 0f, DEFAULT_HANDLE_SIZE, DEFAULT_HANDLE_SIZE);
/** The default color to use when drawing a handle. (white) */
- public static Color DEFAULT_COLOR = Color.white;
+ public static final Color DEFAULT_COLOR = Color.white;
private PLocator locator;
private PDragSequenceEventHandler handleDragger;
=======================================
---
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
Thu Apr 15 18:47:47 2010
@@ -93,18 +93,18 @@
*/
protected static int CACHE_COUNT = 0;
/** Map from font names to Fonts. */
- protected static HashMap FONT_CACHE = new HashMap();
+ protected static final HashMap FONT_CACHE = new HashMap();
/** Map from awt colors to swt colors. */
- protected static HashMap COLOR_CACHE = new HashMap();
+ protected static final HashMap COLOR_CACHE = new HashMap();
/** Map from awt shapess to swt Paths. */
- protected static HashMap SHAPE_CACHE = new HashMap();
+ protected static final HashMap SHAPE_CACHE = new HashMap();
/** Buffer used to extract the graphics device. */
- protected static BufferedImage BUFFER = new BufferedImage(1, 1,
BufferedImage.TYPE_INT_ARGB);
-
- private static Point TEMP_POINT = new Point();
- private static Rectangle2D TEMP_RECT = new Rectangle2D.Double();
- private static Rectangle2D TEMP_LINE_RECT = new Rectangle2D.Double();
- private static org.eclipse.swt.graphics.Rectangle SWT_RECT = new
org.eclipse.swt.graphics.Rectangle(0, 0, 0, 0);
+ protected static final BufferedImage BUFFER = new BufferedImage(1, 1,
BufferedImage.TYPE_INT_ARGB);
+
+ private static final Point TEMP_POINT = new Point();
+ private static final Rectangle2D TEMP_RECT = new Rectangle2D.Double();
+ private static final Rectangle2D TEMP_LINE_RECT = new
Rectangle2D.Double();
+ private static final org.eclipse.swt.graphics.Rectangle SWT_RECT = new
org.eclipse.swt.graphics.Rectangle(0, 0, 0, 0);
/** The Underlying GraphicsContext provided by swt. */
protected GC gc;
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en