Revision: 681
Author: allain.lalonde
Date: Thu Oct  8 14:47:46 2009
Log: Formatting to conform with CheckStyle and some removal of inline  
conditionals.
http://code.google.com/p/piccolo2d/source/detail?r=681

Modified:
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/activities/PPathActivity.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/activities/PPositionPathActivity.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNavigationEventHandler.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PStyledTextEventHandler.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PCacheCamera.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/swing/PViewport.java
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/util/PFixedWidthStroke.java

=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/activities/PPathActivity.java
     
Thu Jul 30 12:36:17 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/activities/PPathActivity.java
     
Thu Oct  8 14:47:46 2009
@@ -29,7 +29,6 @@
  package edu.umd.cs.piccolox.activities;

  import edu.umd.cs.piccolo.activities.PInterpolatingActivity;
-import edu.umd.cs.piccolo.util.PUtil;

  /**
   * <b>PPathActivity</b> is the abstract base class for all path activity
@@ -69,11 +68,19 @@
      }

      public void setKnots(final float[] newKnots) {
-        this.knots = (newKnots == null) ? newKnots : (float[])  
newKnots.clone();
+        if (newKnots == null) {
+            this.knots = null;
+        }
+        else {
+            this.knots = (float[]) newKnots.clone();
+        }
      }

      public float[] getKnots() {
-        return (knots == null) ? knots : (float[]) knots.clone();
+        if (knots == null) {
+            return null;
+        }
+        return (float[]) knots.clone();
      }

      public void setKnot(final int index, final float knot) {
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/activities/PPositionPathActivity.java
     
Thu Jul 30 12:36:17 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/activities/PPositionPathActivity.java
     
Thu Oct  8 14:47:46 2009
@@ -62,8 +62,8 @@
      public PPositionPathActivity(final long duration, final long stepRate,  
final int loopCount, final int mode,
              final Target aTarget, final float[] knots, final Point2D[]  
positions) {
          super(duration, stepRate, loopCount, mode, knots);
-        target = aTarget;
-        this.positions = (Point2D[])positions.clone();
+        target = aTarget;
+        this.positions = (Point2D[]) positions.clone();
      }

      protected boolean isAnimation() {
@@ -71,7 +71,7 @@
      }

      public Point2D[] getPositions() {
-        return (Point2D[])positions.clone();
+        return (Point2D[]) positions.clone();
      }

      public Point2D getPosition(final int index) {
@@ -79,7 +79,7 @@
      }

      public void setPositions(final Point2D[] positions) {
-        this.positions = (Point2D[])positions.clone();
+        this.positions = (Point2D[]) positions.clone();
      }

      public void setPosition(final int index, final Point2D position) {
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNavigationEventHandler.java
        
Thu Jul 30 12:36:17 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNavigationEventHandler.java
        
Thu Oct  8 14:47:46 2009
@@ -326,7 +326,7 @@

          final double scaleFactor = d.getWidth() / aCamera.getViewScale();
          final Point2D scalePoint =  
focusNode.getGlobalFullBounds().getCenter2D();
-        if (Math.abs(1f-scaleFactor) < 0.0001) {
+        if (Math.abs(1f - scaleFactor) < 0.0001) {
              aCamera.scaleViewAboutPoint(scaleFactor, scalePoint.getX(),  
scalePoint.getY());
          }

=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
    
Tue Jul 28 13:41:36 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
    
Thu Oct  8 14:47:46 2009
@@ -262,13 +262,9 @@
                      listener.getMethod().invoke(listener.get(), new  
Object[] { aNotification });
                  }
                  catch (final IllegalAccessException e) {
-                    // it's impossible add listeners that are not public
-                }
-                catch (final InvocationTargetException e) {
-                    // Since this is how Swing handles Exceptions that get
-                    // thrown on listeners, it's probably ok to do it here.
-                    // mro: disagree. Now matter how Swing does it, either
-                    // handle or rethrow.
+                    throw new RuntimeException("Impossible Situation:  
invoking inaccessible method on listener", e);
+                }
+                catch (final InvocationTargetException e) {
                      throw new RuntimeException(e);
                  }
              }
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java
         
Tue Aug  4 13:42:37 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java
         
Thu Oct  8 14:47:46 2009
@@ -402,7 +402,7 @@
      // The overridden methods from PDragSequenceEventHandler
      // //////////////////////////////////////////////////////

-     protected void startDrag(final PInputEvent e) {
+    protected void startDrag(final PInputEvent e) {
          super.startDrag(e);

          initializeSelection(e);
@@ -463,7 +463,7 @@
      /**
       * Used to test whether the event is one that changes the selection.
       *
-     * @param pie The event under test
+     * @param pie The event under test
       * @return true if event changes the selection
       */
      public boolean isOptionSelection(final PInputEvent pie) {
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PStyledTextEventHandler.java
        
Wed Aug  5 09:19:11 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PStyledTextEventHandler.java
        
Thu Oct  8 14:47:46 2009
@@ -187,7 +187,7 @@
          }
          else if (pickedNode instanceof PCamera) {
              final PStyledText newText = createText();
-            final Insets pInsets = newText.getInsets();
+            final Insets pInsets = newText.getInsets();
              newText.translate(inputEvent.getPosition().getX() -  
pInsets.left, inputEvent.getPosition().getY()
                      - pInsets.top);
              startEditing(inputEvent, newText);
@@ -231,8 +231,8 @@
          else {
              editedText.syncWithDocument();
          }
-
-        if (editedText.getParent() == null) {
+
+        if (editedText.getParent() == null) {
              editedText.setScale(1.0 / event.getCamera().getViewScale());
              canvas.getLayer().addChild(editedText);
          }
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PCacheCamera.java
   
Thu Jul 30 12:23:57 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PCacheCamera.java
   
Thu Oct  8 14:47:46 2009
@@ -78,7 +78,7 @@
      private BufferedImage buildPaintBuffer(final PBounds fRef) {
          final int newBufferWidth = (int) Math.ceil(fRef.getWidth());
          final int newBufferHeight = (int) Math.ceil(fRef.getHeight());
-
+
          if (GraphicsEnvironment.isHeadless()) {
              return new BufferedImage(newBufferWidth, newBufferHeight,  
BufferedImage.TYPE_4BYTE_ABGR);
          }
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java
    
Tue Aug  4 18:13:28 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java
    
Thu Oct  8 14:47:46 2009
@@ -86,10 +86,10 @@

      /** Insets represent how far away from the bounding box text will be  
drawn. */
      protected Insets insets = new Insets(0, 0, 0, 0);
-
+
      /** Whether width will be forced to match containing text's height. */
      protected boolean constrainHeightToTextHeight = true;
-
+
      /** Whether width will be forced to match containing text's width. */
      protected boolean constrainWidthToTextWidth = true;

@@ -152,7 +152,8 @@
      }

      /**
-     * Ensures that the current display matches the styling of the  
underlying document as closely as possible.
+     * Ensures that the current display matches the styling of the  
underlying
+     * document as closely as possible.
       */
      public void syncWithDocument() {
          // First get the actual text and stick it in an Attributed String
@@ -252,12 +253,14 @@
      }

      /**
-     * Returns the first leaf encountered by drilling into the document  
for the given position.
+     * Returns the first leaf encountered by drilling into the document  
for the
+     * given position.
       *
       * @param pos position under which we're trying to find a leaf
       * @param rootElement top most element in the document tree
       *
-     * @return Leaf element that corresponds to the position provided in  
the document
+     * @return Leaf element that corresponds to the position provided in  
the
+     *         document
       */
      private Element drillDownFromRoot(final int pos, final Element  
rootElement) {
          Element curElement;
@@ -531,7 +534,7 @@
          // Small assumption here that there is one root element - can fix
          // for more general support later
          final Element rootElement = document.getDefaultRootElement();
-        final Element curElement = drillDownFromRoot(0, rootElement);
+        final Element curElement = drillDownFromRoot(0, rootElement);
          final StyleContext context = StyleContext.getDefaultStyleContext();
          final Font font = context.getFont(curElement.getAttributes());

@@ -670,7 +673,7 @@
       */
      protected static class RunInfo {
          public int startIndex;
-        public int endIndex;
+        public int endIndex;

          public RunInfo(final int runStart, final int runLimit) {
              startIndex = runStart;
@@ -694,7 +697,7 @@
          public int length() {
              return endIndex - startIndex;
          }
-    }
+    }

      /**
       * The info for rendering and computing the bounds of a line.
@@ -713,7 +716,7 @@
              segments = new ArrayList();
          }
      }
-
+
      protected static class SegmentInfo {
          public TextLayout layout;
          public Font font;
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/swing/PViewport.java
      
Thu Jul 30 15:07:25 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/swing/PViewport.java
      
Thu Oct  8 14:47:46 2009
@@ -65,7 +65,7 @@
      }

      /**
-     * Subclassers can override this to install a different layout manager  
(or
+     * Subclasses can override this to install a different layout manager  
(or
       * <code>null</code>) in the constructor. Returns a new
       * <code>ViewportLayout</code> object.
       *
@@ -76,7 +76,7 @@
      }

      /**
-     * Subclassers can override this to install a different scroll  
director in
+     * Subclasses can override this to install a different scroll director  
in
       * the constructor. Returns a new <code>PScrollDirector</code> object.
       *
       * @return a <code>PScrollDirector
@@ -86,7 +86,7 @@
      }

      /**
-     * Set the scroll director on this viewport
+     * Set the scroll director on this viewport.
       *
       * @param scrollDirector The new scroll director
       */
@@ -101,7 +101,7 @@
      }

      /**
-     * @return The scroll director on this viewport
+     * @return The scroll director on this viewport.
       */
      public PScrollDirector getScrollDirector() {
          return scrollDirector;
@@ -126,7 +126,7 @@

      /**
       * Notifies all <code>ChangeListeners</code> when the views size,  
position,
-     * or the viewports extent size has changed.
+     * or the viewports extent size has changed.
       *
       * PDefaultScrollDirector calls this so it needs to be public.
       */
=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/util/PFixedWidthStroke.java
       
Thu Jul 30 14:59:39 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/util/PFixedWidthStroke.java
       
Thu Oct  8 14:47:46 2009
@@ -59,7 +59,7 @@
   * @author Jesse Grosjean
   * @author Marcus Rohrmoser
   */
-public class PFixedWidthStroke extends PSemanticStroke implements  
Serializable {
+public class PFixedWidthStroke extends PSemanticStroke implements  
Serializable {

      private static final long serialVersionUID = 1L;


--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to