Revision: 951
Author: allain.lalonde
Date: Sat Jan 23 18:48:30 2010
Log: Bumping checkstyle maven plugin to next version so that it correctly
identifies generics. Also, cleaned up some checkstyle warnings.
http://code.google.com/p/piccolo2d/source/detail?r=951
Modified:
/piccolo2d.java/branches/2.0-spike/core/pom.xml
/piccolo2d.java/branches/2.0-spike/core/src/build/conf/checkstyle.xml
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PCamera.java
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PLayer.java
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PRoot.java
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/nodes/PText.java
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/util/PStack.java
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/util/PUtil.java
=======================================
--- /piccolo2d.java/branches/2.0-spike/core/pom.xml Sat Jan 23 17:41:13 2010
+++ /piccolo2d.java/branches/2.0-spike/core/pom.xml Sat Jan 23 18:48:30 2010
@@ -50,7 +50,7 @@
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.3</version>
+ <version>2.4</version>
<configuration>
<configLocation>${basedir}/src/build/conf/checkstyle.xml</configLocation>
<enableRulesSummary>false</enableRulesSummary>
=======================================
--- /piccolo2d.java/branches/2.0-spike/core/src/build/conf/checkstyle.xml
Mon Oct 19 19:39:23 2009
+++ /piccolo2d.java/branches/2.0-spike/core/src/build/conf/checkstyle.xml
Sat Jan 23 18:48:30 2010
@@ -3,183 +3,180 @@
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-<!--
-
- Checkstyle configuration that checks the sun coding conventions from:
-
- - the Java Language Specification at
- http://java.sun.com/docs/books/jls/second_edition/html/index.html
-
- - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
-
- - the Javadoc guidelines at
- http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
-
- - the JDK Api documentation
http://java.sun.com/j2se/docs/api/index.html
-
- - some best practices
-
- Checkstyle is very configurable. Be sure to read the documentation at
- http://checkstyle.sf.net (or in your downloaded distribution).
-
- Most Checks are configurable, be sure to consult the documentation.
-
- To completely disable a check, just comment it out or delete it from the
file.
-
- Finally, it is worth reading the documentation.
-
--->
+ <!--
+
+ Checkstyle configuration that checks the sun coding conventions
from:
+
+ - the Java Language Specification at
+
http://java.sun.com/docs/books/jls/second_edition/html/index.html -
+ the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the
+ Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
- the
+ JDK Api documentation
http://java.sun.com/j2se/docs/api/index.html -
+ some best practices Checkstyle is very configurable. Be sure to
read
+ the documentation at http://checkstyle.sf.net (or in your
downloaded
+ distribution). Most Checks are configurable, be sure to consult
the
+ documentation. To completely disable a check, just comment it
out or
+ delete it from the file. Finally, it is worth reading the
+ documentation.
+ -->
<module name="Checker">
- <!-- Checks that a package.html file exists for each package. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
- <module name="PackageHtml"/>
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
- <module name="Translation"/>
+ <!-- Checks that a package.html file exists for each package. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
+ <module name="JavadocPackage">
+ <property name="allowLegacy" value="true" />
+ </module>
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="FileLength">
+ <property name="max" value="4000" />
+ </module>
+
+ <module name="FileTabCharacter" />
- <module name="TreeWalker">
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod">
- <property name="scope" value="protected"/>
- <property name="allowUndeclaredRTE" value="true"/>
- </module>
- <module name="JavadocType">
- <property name="scope" value="public"/>
- </module>
- <module name="JavadocVariable">
- <property name="scope" value="protected" />
- </module>
- <module name="JavadocStyle"/>
-
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="ConstantName"/>
- <module name="LocalFinalVariableName"/>
- <module name="LocalVariableName"/>
- <module name="MemberName"/>
- <module name="MethodName"/>
- <module name="PackageName"/>
- <module name="ParameterName"/>
- <module name="StaticVariableName"/>
- <module name="TypeName"/>
-
-
- <!-- Checks for Headers -->
- <!-- See http://checkstyle.sf.net/config_header.html -->
- <!-- <module name="Header"> -->
- <!-- The follow property value demonstrates the ability -->
- <!-- to have access to ANT properties. In this case it uses -->
- <!-- the ${basedir} property to allow Checkstyle to be run -->
- <!-- from any directory within a project. See property -->
- <!-- expansion, -->
- <!-- http://checkstyle.sf.net/config.html#properties -->
- <!-- <property -->
- <!-- name="headerFile" -->
- <!-- value="${basedir}/java.header"/> -->
- <!-- </module> -->
-
- <!-- Following interprets the header file as regular expressions.
-->
- <!-- <module name="RegexpHeader"/>
-->
-
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
- <module name="AvoidStarImport"/>
- <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation" />
+
+
+ <module name="TreeWalker">
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <module name="JavadocMethod">
+ <property name="scope" value="protected" />
+ <property name="allowUndeclaredRTE" value="true" />
+ <property name="allowMissingPropertyJavadoc" value="true"
/>
+ </module>
+ <module name="JavadocType">
+ <property name="scope" value="public" />
+ </module>
+ <module name="JavadocVariable">
+ <property name="scope" value="protected" />
+ </module>
+ <module name="JavadocStyle" />
+
+ <module name="LineLength">
+ <property name="max" value="120" />
+ </module>
+ <module name="MethodLength" />
+ <module name="ParameterNumber" />
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName" />
+ <module name="LocalFinalVariableName" />
+ <module name="LocalVariableName" />
+ <module name="MemberName" />
+ <module name="MethodName" />
+ <module name="PackageName" />
+ <module name="ParameterName" />
+ <module name="StaticVariableName" />
+ <module name="TypeName" />
+
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!-- <module name="Header"> -->
+ <!-- The follow property value demonstrates the ability -->
+ <!-- to have access to ANT properties. In this case it uses -->
+ <!-- the ${basedir} property to allow Checkstyle to be run -->
+ <!-- from any directory within a project. See property -->
+ <!-- expansion, -->
+ <!-- http://checkstyle.sf.net/config.html#properties -->
+ <!-- <property -->
+ <!-- name="headerFile" -->
+ <!-- value="${basedir}/java.header"/> -->
+ <!-- </module> -->
+
+ <!-- Following interprets the header file as regular expressions.
-->
+ <!-- <module name="RegexpHeader"/>
-->
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="FileLength">
- <property name="max" value="4000"/>
- </module>
- <module name="LineLength">
- <property name="max" value="120"/>
- </module>
- <module name="MethodLength"/>
- <module name="ParameterNumber"/>
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport" />
+ <module name="IllegalImport" /> <!-- defaults to sun.* packages
-->
+ <module name="RedundantImport" />
+ <module name="UnusedImports" />
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="EmptyForIteratorPad"/>
- <module name="MethodParamPad"/>
- <module name="NoWhitespaceAfter"/>
- <module name="NoWhitespaceBefore"/>
- <module name="OperatorWrap"/>
- <module name="ParenPad"/>
- <module name="TypecastParenPad"/>
- <module name="TabCharacter"/>
- <module name="WhitespaceAfter"/>
- <module name="WhitespaceAround"/>
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad" />
+ <module name="MethodParamPad" />
+ <module name="NoWhitespaceAfter" />
+ <module name="NoWhitespaceBefore" />
+ <module name="OperatorWrap" />
+ <module name="ParenPad" />
+ <module name="TypecastParenPad" />
+ <module name="WhitespaceAfter" />
+ <module name="WhitespaceAround" />
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <module name="ModifierOrder"/>
- <module name="RedundantModifier"/>
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <module name="ModifierOrder" />
+ <module name="RedundantModifier" />
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="AvoidNestedBlocks"/>
- <module name="EmptyBlock"/>
- <module name="LeftCurly"/>
- <module name="NeedBraces"/>
- <module name="RightCurly">
- <property name="option" value="alone"/>
- </module>
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks" />
+ <module name="EmptyBlock" />
+ <module name="LeftCurly" />
+ <module name="NeedBraces" />
+ <module name="RightCurly">
+ <property name="option" value="alone" />
+ </module>
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <module name="AvoidInlineConditionals"/>
- <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
- <module name="EmptyStatement"/>
- <module name="EqualsHashCode"/>
- <module name="HiddenField">
- <property name="ignoreSetter" value="true" />
- <property name="ignoreConstructorParameter" value="true" />
- </module>
- <module name="IllegalInstantiation"/>
- <module name="InnerAssignment"/>
- <!-- 2.0: Lots of enums are defined using constants, so until 2.0
this needs to stay disabled. -->
- <!--
- <module name="MagicNumber">
- <property name="ignoreNumbers" value="0, 0.5, 2, 1, -1, 1000, 2, 3,
4, 5, 6, 7, 8" />
- </module>
- -->
-
- <module name="MissingSwitchDefault"/>
- <module name="RedundantThrows"/>
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <!-- For P2d 2.0: <module name="DesignForExtension"/> -->
- <module name="FinalClass"/>
- <module name="HideUtilityClassConstructor"/>
- <module name="InterfaceIsType"/>
- <!-- For P2d 2.0: <module name="VisibilityModifier"/> -->
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <module name="AvoidInlineConditionals" />
+ <module name="DoubleCheckedLocking" /> <!-- MY FAVOURITE -->
+ <module name="EmptyStatement" />
+ <module name="EqualsHashCode" />
+ <module name="HiddenField">
+ <property name="ignoreSetter" value="true" />
+ <property name="ignoreConstructorParameter" value="true"
/>
+ </module>
+ <module name="IllegalInstantiation" />
+ <module name="InnerAssignment" />
+ <!--
+ 2.0: Lots of enums are defined using constants, so
until 2.0 this
+ needs to stay disabled.
+ -->
+ <!--
+ <module name="MagicNumber"> <property name="ignoreNumbers"
value="0,
+ 0.5, 2, 1, -1, 1000, 2, 3, 4, 5, 6, 7, 8" /> </module>
+ -->
+
+ <module name="MissingSwitchDefault" />
+ <module name="RedundantThrows" />
+ <module name="SimplifyBooleanExpression" />
+ <module name="SimplifyBooleanReturn" />
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!-- For P2d 2.0: <module name="DesignForExtension"/> -->
+ <module name="FinalClass" />
+ <module name="HideUtilityClassConstructor" />
+ <module name="InterfaceIsType" />
+ <!-- For P2d 2.0: <module name="VisibilityModifier"/> -->
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <module name="ArrayTypeStyle"/>
- <module name="FinalParameters"/>
- <module name="TodoComment"/>
- <module name="UpperEll"/>
-
- </module>
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="ArrayTypeStyle" />
+ <module name="FinalParameters" />
+ <module name="TodoComment" />
+ <module name="UpperEll" />
+
+ </module>
</module>
=======================================
---
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PCamera.java
Wed Jan 20 10:01:15 2010
+++
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PCamera.java
Sat Jan 23 18:48:30 2010
@@ -53,7 +53,6 @@
import org.piccolo2d.util.PPickPath;
import org.piccolo2d.util.PUtil;
-
/**
* <b>PCamera</b> represents a viewport onto a list of layer nodes. Each
camera
* maintains a view transform through which it views these layers.
Translating
@@ -137,7 +136,6 @@
/** Temporary bounds used as an optimization during repaint. */
private static final PBounds TEMP_REPAINT_RECT = new PBounds();
-
/**
* Create a new camera with an empy list of layers.
*/
@@ -147,7 +145,6 @@
layers = new ArrayList<PLayer>();
viewConstraint = VIEW_CONSTRAINT_NONE;
}
-
/**
* Return the component for this camera, or <code>null</code> if no
@@ -155,7 +152,7 @@
* internal cameras.
*
* @return the component for this camera, or <code>null</code> if no
such
- * component exists
+ * component exists
*/
public PComponent getComponent() {
return component;
@@ -173,12 +170,12 @@
}
/**
- * Repaint this camera and forward the repaint request to the component
- * for this camera, if it is non-null.
+ * Repaint this camera and forward the repaint request to the
component for
+ * this camera, if it is non-null.
*
* @param localBounds bounds that require repainting, in local
coordinates
- * @param sourceNode node from which the repaint message originates,
may
- * be the camera itself
+ * @param sourceNode node from which the repaint message originates,
may be
+ * the camera itself
*/
public void repaintFrom(final PBounds localBounds, final PNode
sourceNode) {
if (getParent() != null) {
@@ -209,7 +206,7 @@
Rectangle2D.intersect(TEMP_REPAINT_RECT, getBoundsReference(),
TEMP_REPAINT_RECT);
repaintFrom(TEMP_REPAINT_RECT, repaintedLayer);
}
- }
+ }
/**
* Return a reference to the list of layers viewed by this camera.
@@ -230,12 +227,14 @@
}
/**
- * Return the layer at the specified position in the list of layers
viewed by this camera.
+ * Return the layer at the specified position in the list of layers
viewed
+ * by this camera.
*
* @param index index of the layer to return
- * @return the layer at the specified position in the list of layers
viewed by this camera
+ * @return the layer at the specified position in the list of layers
viewed
+ * by this camera
* @throws IndexOutOfBoundsException if the specified index is out of
range
- * (<code>index < 0 || index >= getLayerCount()</code>)
+ * (<code>index < 0 || index >=
getLayerCount()</code>)
*/
public PLayer getLayer(final int index) {
return (PLayer) layers.get(index);
@@ -243,21 +242,22 @@
/**
* Return the index of the first occurrence of the specified layer in
the
- * list of layers viewed by this camera, or <code>-1</code> if the
list of layers
- * viewed by this camera does not contain the specified layer.
+ * list of layers viewed by this camera, or <code>-1</code> if the
list of
+ * layers viewed by this camera does not contain the specified layer.
*
* @param layer layer to search for
* @return the index of the first occurrence of the specified layer in
the
- * list of layers viewed by this camera, or <code>-1</code> if the
list of
- * layers viewed by this camera does not contain the specified layer
+ * list of layers viewed by this camera, or <code>-1</code> if
the
+ * list of layers viewed by this camera does not contain the
+ * specified layer
*/
public int indexOfLayer(final PLayer layer) {
return layers.indexOf(layer);
}
/**
- * Inserts the specified layer at the end of the list of layers viewed
by this camera.
- * Layers may be viewed by multiple cameras at once.
+ * Inserts the specified layer at the end of the list of layers viewed
by
+ * this camera. Layers may be viewed by multiple cameras at once.
*
* @param layer layer to add
*/
@@ -266,13 +266,14 @@
}
/**
- * Inserts the specified layer at the specified position in the list
of layers viewed by this camera.
- * Layers may be viewed by multiple cameras at once.
+ * Inserts the specified layer at the specified position in the list of
+ * layers viewed by this camera. Layers may be viewed by multiple
cameras at
+ * once.
*
* @param index index at which the specified layer is to be inserted
* @param layer layer to add
* @throws IndexOutOfBoundsException if the specified index is out of
range
- * (<code>index < 0 || index >= getLayerCount()</code>)
+ * (<code>index < 0 || index >=
getLayerCount()</code>)
*/
public void addLayer(final int index, final PLayer layer) {
layers.add(index, layer);
@@ -304,7 +305,7 @@
* @param index index of the layer to remove
* @return the layer previously at the specified position
* @throws IndexOutOfBoundsException if the specified index is out of
range
- * (<code>index < 0 || index >= getLayerCount()</code>)
+ * (<code>index < 0 || index >=
getLayerCount()</code>)
*/
public PLayer removeLayer(final int index) {
final PLayer layer = (PLayer) layers.remove(index);
@@ -320,8 +321,8 @@
* this camera is empty.
*
* @return the union of the full bounds of each layer in the list of
layers
- * viewed by this camera, or empty bounds if the list of layers
viewed
- * by this camera is empty
+ * viewed by this camera, or empty bounds if the list of layers
+ * viewed by this camera is empty
*/
public PBounds getUnionOfLayerFullBounds() {
final PBounds result = new PBounds();
@@ -353,9 +354,9 @@
}
/**
- * Paint all the layers in the list of layers viewed by this camera.
This method
- * is called after the view transform and clip have been applied to the
- * specified paint context.
+ * Paint all the layers in the list of layers viewed by this camera.
This
+ * method is called after the view transform and clip have been
applied to
+ * the specified paint context.
*
* @param paintContext context in which painting occurs
*/
@@ -379,7 +380,7 @@
paintContext.setRenderQuality(PPaintContext.LOW_QUALITY_RENDERING);
g2.setStroke(new BasicStroke(0));
final ArrayList<PNode> nodes = new ArrayList<PNode>();
-
+
final PBounds nodeBounds = new PBounds();
final Color boundsColor = Color.red;
@@ -390,7 +391,7 @@
((PLayer) layers.get(i)).getAllNodes(null, nodes);
}
- for (PNode each : getAllNodes(null, nodes)) {
+ for (PNode each : getAllNodes(null, nodes)) {
if (PDebug.debugBounds) {
g2.setPaint(boundsColor);
nodeBounds.setRect(each.getBoundsReference());
@@ -428,8 +429,8 @@
* {...@inheritdoc}
*
* <p>
- * Pushes this camera onto the specified paint context so that it
- * can be accessed later by {...@link PPaintContext#getCamera}.
+ * Pushes this camera onto the specified paint context so that it can
be
+ * accessed later by {...@link PPaintContext#getCamera}.
* </p>
*/
public void fullPaint(final PPaintContext paintContext) {
@@ -475,7 +476,7 @@
* </p>
*
* @return true if any of the layers in the list of layers viewed by
this
- * camera were picked
+ * camera were picked
*/
protected boolean pickAfterChildren(final PPickPath pickPath) {
if (intersects(pickPath.getPickBounds())) {
@@ -498,7 +499,7 @@
*
* @param pickPath pick path
* @return true if any of the layers in the list of layers viewed by
this
- * camera were picked
+ * camera were picked
*/
protected boolean pickCameraView(final PPickPath pickPath) {
for (PLayer each : reverse(layers)) {
@@ -543,7 +544,7 @@
* viewed by this camera.
*
* @return the scale applied by the view transform to the list of
layers
- * viewed by this camera
+ * viewed by this camera
*/
public double getViewScale() {
return viewTransform.getScale();
@@ -576,8 +577,8 @@
}
/**
- * Set the scale applied by the view transform to the list of layers
- * viewed by this camera to <code>scale</code>.
+ * Set the scale applied by the view transform to the list of layers
viewed
+ * by this camera to <code>scale</code>.
*
* @param scale view transform scale
*/
@@ -600,18 +601,20 @@
}
/**
- * Offset the view transform applied to the list of layers viewed by
this camera by <code>[dx, dy]</code>. This is
- * NOT effected by the view transform's current scale or rotation.
This is implemented by directly adding dx to the
- * m02 position and dy to the m12 position in the affine transform.
+ * Offset the view transform applied to the list of layers viewed by
this
+ * camera by <code>[dx, dy]</code>. This is NOT effected by the view
+ * transform's current scale or rotation. This is implemented by
directly
+ * adding dx to the m02 position and dy to the m12 position in the
affine
+ * transform.
*
* @param dx offset delta x
* @param dy offset delta y
*/
/*
- public void offsetView(final double dx, final double dy) {
- setViewOffset(viewTransform.getTranslateX() + dx,
viewTransform.getTranslateY() + dy);
- }
- */
+ * public void offsetView(final double dx, final double dy) {
+ * setViewOffset(viewTransform.getTranslateX() + dx,
+ * viewTransform.getTranslateY() + dy); }
+ */
/**
* Set the offset for the view transform applied to the list of layers
@@ -628,11 +631,11 @@
}
/**
- * Return a copy of the view transform applied to the list of layers
- * viewed by this camera.
+ * Return a copy of the view transform applied to the list of layers
viewed
+ * by this camera.
*
- * @return a copy of the view transform applied to the list of layers
- * viewed by this camera
+ * @return a copy of the view transform applied to the list of layers
viewed
+ * by this camera
*/
public PAffineTransform getViewTransform() {
return (PAffineTransform) viewTransform.clone();
@@ -642,19 +645,19 @@
* Return a reference to the view transform applied to the list of
layers
* viewed by this camera.
*
- * @return the view transform applied to the list of layers
- * viewed by this camera
+ * @return the view transform applied to the list of layers viewed by
this
+ * camera
*/
public PAffineTransform getViewTransformReference() {
return viewTransform;
}
/**
- * Set the view transform applied to the list of layers
- * viewed by this camera to <code>viewTransform</code>.
+ * Set the view transform applied to the list of layers viewed by this
+ * camera to <code>viewTransform</code>.
*
- * @param viewTransform view transform applied to the list of layers
- * viewed by this camera
+ * @param viewTransform view transform applied to the list of layers
viewed
+ * by this camera
*/
public void setViewTransform(final AffineTransform viewTransform) {
this.viewTransform.setTransform(viewTransform);
@@ -666,8 +669,8 @@
/**
* Animate the camera's view from its current transform when the
activity
* starts to a new transform that centers the given bounds in the
camera
- * layer's coordinate system into the cameras view bounds. If the
duration is
- * 0 then the view will be transformed immediately, and null will be
+ * layer's coordinate system into the cameras view bounds. If the
duration
+ * is 0 then the view will be transformed immediately, and null will be
* returned. Else a new PTransformActivity will get returned that is
set to
* animate the camera's view transform to the new bounds. If
shouldScale is
* true, then the camera will also scale its view so that the given
bounds
@@ -730,7 +733,7 @@
}
return null;
- }
+ }
/**
* Animate the cameras view transform from its current value when the
@@ -777,8 +780,10 @@
// ****************************************************************
/**
- * Return the constraint applied to the view. The view constraint will
be one of {...@link #VIEW_CONSTRAINT_NONE},
- * {...@link #VIEW_CONSTRAINT_CENTER}, or {...@link
#VIEW_CONSTRAINT_CENTER}. Defaults to {...@link #VIEW_CONSTRAINT_NONE}.
+ * Return the constraint applied to the view. The view constraint will
be
+ * one of {...@link #VIEW_CONSTRAINT_NONE}, {...@link
#VIEW_CONSTRAINT_CENTER}, or
+ * {...@link #VIEW_CONSTRAINT_CENTER}. Defaults to
+ * {...@link #VIEW_CONSTRAINT_NONE}.
*
* @return the view constraint being applied to the view
*/
@@ -787,12 +792,16 @@
}
/**
- * Set the view constraint to apply to the view to
<code>viewConstraint</code>. The view constraint must be one of
- * {...@link #VIEW_CONSTRAINT_NONE}, {...@link #VIEW_CONSTRAINT_CENTER}, or
{...@link #VIEW_CONSTRAINT_CENTER}.
+ * Set the view constraint to apply to the view to
+ * <code>viewConstraint</code>. The view constraint must be one of
+ * {...@link #VIEW_CONSTRAINT_NONE}, {...@link #VIEW_CONSTRAINT_CENTER}, or
+ * {...@link #VIEW_CONSTRAINT_CENTER}.
*
* @param viewConstraint constraint to apply to the view
- * @throws IllegalArgumentException if <code>viewConstraint</code> is
not one of {...@link #VIEW_CONSTRAINT_NONE},
- * {...@link #VIEW_CONSTRAINT_CENTER}, or {...@link
#VIEW_CONSTRAINT_CENTER}
+ * @throws IllegalArgumentException if <code>viewConstraint</code> is
not
+ * one of {...@link #VIEW_CONSTRAINT_NONE},
+ * {...@link #VIEW_CONSTRAINT_CENTER}, or
+ * {...@link #VIEW_CONSTRAINT_CENTER}
*/
public void setViewConstraint(final int viewConstraint) {
if (viewConstraint != VIEW_CONSTRAINT_NONE && viewConstraint !=
VIEW_CONSTRAINT_CENTER
@@ -815,7 +824,7 @@
final PBounds layerBounds = (PBounds)
globalToLocal(getUnionOfLayerFullBounds());
if (VIEW_CONSTRAINT_CENTER == viewConstraint) {
- layerBounds.setRect(layerBounds.getCenterX(),
layerBounds.getCenterY(), 0, 0);
+ layerBounds.setRect(layerBounds.getCenterX(),
layerBounds.getCenterY(), 0, 0);
}
PDimension constraintDelta =
viewBounds.deltaRequiredToContain(layerBounds);
viewTransform.translate(-constraintDelta.width,
-constraintDelta.height);
@@ -952,13 +961,13 @@
layers = new ArrayList<PLayer>();
while (true) {
- final Object each = in.readObject();
+ final Object each = in.readObject();
if (each != null) {
if (each.equals(Boolean.FALSE)) {
break;
}
else {
- layers.add((PLayer)each);
+ layers.add((PLayer) each);
}
}
}
=======================================
---
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PLayer.java
Wed Jan 20 10:01:15 2010
+++
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PLayer.java
Sat Jan 23 18:48:30 2010
@@ -38,7 +38,6 @@
import org.piccolo2d.util.PBounds;
import org.piccolo2d.util.PObjectOutputStream;
-
/**
* <b>PLayer</b> is a node that can be viewed directly by multiple camera
nodes.
* Generally child nodes are added to a layer to give the viewing cameras
@@ -84,13 +83,13 @@
* Cameras which are registered as viewers of this PLayer.
*/
private transient List<PCamera> cameras;
-
- private static final List<PCamera> EMPTY_CAMERAS =
Collections.<PCamera>emptyList();
+
+ private static final List<PCamera> EMPTY_CAMERAS =
Collections.<PCamera> emptyList();
/**
* Creates a PLayer without any cameras attached to it.
*/
- public PLayer() {
+ public PLayer() {
cameras = EMPTY_CAMERAS;
}
@@ -113,7 +112,7 @@
*
* @return the number of cameras attached to this layer
*/
- public int getCameraCount() {
+ public int getCameraCount() {
return cameras.size();
}
@@ -268,7 +267,7 @@
break;
}
else {
- cameras.add((PCamera)each);
+ cameras.add((PCamera) each);
}
}
}
=======================================
---
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PRoot.java
Sat Jan 23 17:26:07 2010
+++
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/PRoot.java
Sat Jan 23 18:48:30 2010
@@ -238,13 +238,13 @@
if (!isInteracting && !getInteracting()) {
// force all the child cameras to repaint
- for (PNode child : getChildrenReference()) {
+ for (PNode child : getChildrenReference()) {
if (child instanceof PCamera) {
child.repaint();
}
}
}
-
+
if (wasInteracting != isInteracting) {
firePropertyChange(PROPERTY_CODE_INTERACTING_CHANGED,
PROPERTY_INTERACTING_CHANGED, Boolean
.valueOf(wasInteracting),
Boolean.valueOf(isInteracting));
=======================================
---
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/nodes/PText.java
Wed Jan 20 10:01:15 2010
+++
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/nodes/PText.java
Sat Jan 23 18:48:30 2010
@@ -112,13 +112,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/branches/2.0-spike/core/src/main/java/org/piccolo2d/util/PStack.java
Wed Jan 20 10:01:15 2010
+++
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/util/PStack.java
Sat Jan 23 18:48:30 2010
@@ -37,6 +37,8 @@
*
* @version 1.0
* @author Jesse Grosjean
+ *
+ * @param <T> Type of element this tack holds
*/
public class PStack<T> extends ArrayList<T> {
/**
=======================================
---
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/util/PUtil.java
Wed Jan 20 10:01:15 2010
+++
/piccolo2d.java/branches/2.0-spike/core/src/main/java/org/piccolo2d/util/PUtil.java
Sat Jan 23 18:48:30 2010
@@ -44,7 +44,6 @@
import org.piccolo2d.PLayer;
import org.piccolo2d.PRoot;
-
/**
* <b>PUtil</b> util methods for the Piccolo framework.
* <P>
@@ -61,12 +60,12 @@
/** Rate in milliseconds at which the activity timer will get invoked.
*/
public static final int ACTIVITY_SCHEDULER_FRAME_DELAY = 10;
-
+
/**
* Used when persisting paths to an object stream. Used to mark the
end of
* the path.
*/
- private static final int PATH_TERMINATOR = -1;
+ private static final int PATH_TERMINATOR = -1;
/**
* Creates the simplest possible scene graph. 1 Camera, 1 Layer, 1 Root
@@ -280,17 +279,25 @@
out.writeInt(PATH_TERMINATOR);
}
-
+
+ /**
+ * Returns an iterable instance that can be used to iterate over the
+ * provided list in reverse order.
+ *
+ * @param <T> Type of object the list contains
+ * @param wrapped list for which we desire a reverse iterable
+ * @return an iterable that iterates the provided list in reverse order
+ */
public static <T> Iterable<T> reverse(List<T> wrapped) {
return new ListReverser<T>(wrapped);
}
-
+
private static class ListReverser<T> implements Iterable<T> {
- private ListIterator<T> listIterator;
-
+ private ListIterator<T> listIterator;
+
public ListReverser(List<T> wrappedList) {
- this.listIterator =
wrappedList.listIterator(wrappedList.size());
- }
+ this.listIterator =
wrappedList.listIterator(wrappedList.size());
+ }
public Iterator<T> iterator() {
return new Iterator<T>() {
@@ -306,9 +313,9 @@
public void remove() {
listIterator.remove();
}
-
+
};
}
-
+
}
}
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en