Revision: 952
Author: allain.lalonde
Date: Sat Jan 23 19:11:53 2010
Log: bumping extras checkstyle up and fixing some checkstyle bugs
http://code.google.com/p/piccolo2d/source/detail?r=952
Modified:
/piccolo2d.java/branches/2.0-spike/extras/pom.xml
/piccolo2d.java/branches/2.0-spike/extras/src/build/conf/checkstyle.xml
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/swing/SwingLayoutNode.java
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/PFixedWidthStroke.java
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/POcclusionDetection.java
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/PSemanticStroke.java
=======================================
--- /piccolo2d.java/branches/2.0-spike/extras/pom.xml Tue Jan 19 12:39:24
2010
+++ /piccolo2d.java/branches/2.0-spike/extras/pom.xml Sat Jan 23 19:11:53
2010
@@ -57,7 +57,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/extras/src/build/conf/checkstyle.xml
Tue Oct 20 08:08:58 2009
+++ /piccolo2d.java/branches/2.0-spike/extras/src/build/conf/checkstyle.xml
Sat Jan 23 19:11:53 2010
@@ -34,7 +34,15 @@
<!-- Checks that a package.html file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
- <module name="PackageHtml"/>
+ <module name="JavadocPackage">
+ <property name="allowLegacy" value="true" />
+ </module>
+
+ <module name="FileLength">
+ <property name="max" value="4000" />
+ </module>
+
+ <module name="FileTabCharacter" />
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
@@ -98,7 +106,6 @@
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="FileLength"/>
<module name="LineLength">
<property name="max" value="120"/>
</module>
@@ -115,7 +122,6 @@
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
- <module name="TabCharacter"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
=======================================
---
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/swing/SwingLayoutNode.java
Wed Jan 20 10:51:17 2010
+++
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/swing/SwingLayoutNode.java
Sat Jan 23 19:11:53 2010
@@ -43,7 +43,6 @@
import org.piccolo2d.PNode;
-
/**
* Uses Swing layout managers to position PNodes.
*
@@ -382,8 +381,8 @@
* @return true property name relates to layout.
*/
private boolean isLayoutProperty(final String propertyName) {
- return propertyName.equals(PNode.PROPERTY_VISIBLE) ||
propertyName.equals(PNode.PROPERTY_FULL_BOUNDS) ||
- propertyName.equals(PNode.PROPERTY_BOUNDS) ||
propertyName.equals(PNode.PROPERTY_TRANSFORM);
+ return propertyName.equals(PNode.PROPERTY_VISIBLE) ||
propertyName.equals(PNode.PROPERTY_FULL_BOUNDS)
+ || propertyName.equals(PNode.PROPERTY_BOUNDS) ||
propertyName.equals(PNode.PROPERTY_TRANSFORM);
}
/**
=======================================
---
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/PFixedWidthStroke.java
Tue Jan 19 12:39:24 2010
+++
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/PFixedWidthStroke.java
Sat Jan 23 19:11:53 2010
@@ -181,9 +181,10 @@
}
/**
- * Returns the end cap style.
+ * Returns the end cap style.
*
- * @return the end cap style of this BasicStroke as one of the static
int values that define possible end cap styles.
+ * @return the end cap style of this BasicStroke as one of the static
int
+ * values that define possible end cap styles.
*/
public int getEndCap() {
return ((BasicStroke) stroke).getEndCap();
=======================================
---
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/POcclusionDetection.java
Sat Jan 23 17:38:49 2010
+++
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/POcclusionDetection.java
Sat Jan 23 19:11:53 2010
@@ -33,7 +33,6 @@
import org.piccolo2d.util.PPickPath;
import static org.piccolo2d.util.PUtil.reverse;
-
/**
* Experimental class for detecting occlusions.
*
@@ -70,7 +69,7 @@
pickPath.pushTransform(node.getTransformReference(false));
- for (PNode each: reverse(node.getChildrenReference())) {
+ for (PNode each : reverse(node.getChildrenReference())) {
if (node.getOccluded()) {
// if n has been occluded by a previous descendant then
// this child must also be occluded
=======================================
---
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/PSemanticStroke.java
Tue Jan 19 13:09:08 2010
+++
/piccolo2d.java/branches/2.0-spike/extras/src/main/java/org/piccolo2d/extras/util/PSemanticStroke.java
Sat Jan 23 19:11:53 2010
@@ -40,91 +40,91 @@
* @author Marcus Rohrmoser
*/
abstract class PSemanticStroke implements Stroke {
- protected static final double THRESHOLD = 1e-6;
-
- private transient float recentScale;
- private transient Stroke recentStroke;
- protected final Stroke stroke;
-
- protected PSemanticStroke(final Stroke stroke) {
- this.stroke = stroke;
- recentStroke = stroke;
- recentScale = 1.0F;
- }
-
- /**
- * Ask {...@link #getActiveScale()}, call {...@link #newStroke(float)}
if
- * necessary and delegate to {...@link
Stroke#createStrokedShape(Shape)}.
- *
- * @param s
- */
- public Shape createStrokedShape(final Shape s) {
- final float currentScale = getActiveScale();
- if (Math.abs(currentScale - recentScale) > THRESHOLD) {
- recentScale = currentScale;
- recentStroke = newStroke(recentScale);
- }
- return recentStroke.createStrokedShape(s);
- }
-
- /**
- * Returns true if this stroke is equivalent to the object provided.
- *
- * @param obj
- * Object being tested
- * @return true if object is equivalent
- */
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final PSemanticStroke other = (PSemanticStroke) obj;
- if (stroke == null) {
- if (other.stroke != null) {
- return false;
- }
- } else if (!stroke.equals(other.stroke)) {
- return false;
- }
- return true;
- }
-
- /**
- * Detect the current scale. Made protected to enable custom
- * re-implementations.
- */
- protected float getActiveScale() {
- if (PPickPath.CURRENT_PICK_PATH != null) {
- return (float) PPickPath.CURRENT_PICK_PATH.getScale();
- }
-
- return 1.0f;
- }
-
- public int hashCode() {
- final int prime = 31;
- int result = prime;
-
- if (stroke != null) {
- result += stroke.hashCode();
- }
-
- return result;
- }
-
- /**
- * Factory to create a new internal stroke delegate. Made protected to
- * enable custom re-implementations.
- */
- protected abstract Stroke newStroke(final float activeScale);
-
- public String toString() {
- return stroke.toString();
- }
-}
+ protected static final double THRESHOLD = 1e-6;
+
+ private transient float recentScale;
+ private transient Stroke recentStroke;
+ protected final Stroke stroke;
+
+ protected PSemanticStroke(final Stroke stroke) {
+ this.stroke = stroke;
+ recentStroke = stroke;
+ recentScale = 1.0F;
+ }
+
+ /**
+ * Ask {...@link #getActiveScale()}, call {...@link #newStroke(float)} if
+ * necessary and delegate to {...@link Stroke#createStrokedShape(Shape)}.
+ *
+ * @param s
+ */
+ public Shape createStrokedShape(final Shape s) {
+ final float currentScale = getActiveScale();
+ if (Math.abs(currentScale - recentScale) > THRESHOLD) {
+ recentScale = currentScale;
+ recentStroke = newStroke(recentScale);
+ }
+ return recentStroke.createStrokedShape(s);
+ }
+
+ /**
+ * Returns true if this stroke is equivalent to the object provided.
+ *
+ * @param obj Object being tested
+ * @return true if object is equivalent
+ */
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final PSemanticStroke other = (PSemanticStroke) obj;
+ if (stroke == null) {
+ if (other.stroke != null) {
+ return false;
+ }
+ }
+ else if (!stroke.equals(other.stroke)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Detect the current scale. Made protected to enable custom
+ * re-implementations.
+ */
+ protected float getActiveScale() {
+ if (PPickPath.CURRENT_PICK_PATH != null) {
+ return (float) PPickPath.CURRENT_PICK_PATH.getScale();
+ }
+
+ return 1.0f;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = prime;
+
+ if (stroke != null) {
+ result += stroke.hashCode();
+ }
+
+ return result;
+ }
+
+ /**
+ * Factory to create a new internal stroke delegate. Made protected to
+ * enable custom re-implementations.
+ */
+ protected abstract Stroke newStroke(final float activeScale);
+
+ public String toString() {
+ return stroke.toString();
+ }
+}
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en