diff --git a/extras/src/main/java/edu/umd/cs/piccolox/activities/PPathActivity.java b/extras/src/main/java/edu/umd/cs/piccolox/activities/PPathActivity.java index 0dd3cfc..65129ac 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/activities/PPathActivity.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/activities/PPathActivity.java @@ -29,7 +29,6 @@ package edu.umd.cs.piccolox.activities; import edu.umd.cs.piccolo.activities.PInterpolatingActivity; -import edu.umd.cs.piccolo.util.PUtil; /** * PPathActivity 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) { diff --git a/extras/src/main/java/edu/umd/cs/piccolox/activities/PPositionPathActivity.java b/extras/src/main/java/edu/umd/cs/piccolox/activities/PPositionPathActivity.java index d0b4b64..6e923d6 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/activities/PPositionPathActivity.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/activities/PPositionPathActivity.java @@ -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) { diff --git a/extras/src/main/java/edu/umd/cs/piccolox/event/PNavigationEventHandler.java b/extras/src/main/java/edu/umd/cs/piccolox/event/PNavigationEventHandler.java index 338cdb5..5408e29 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/event/PNavigationEventHandler.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/event/PNavigationEventHandler.java @@ -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()); } diff --git a/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java b/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java index c4c62dc..d639681 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java @@ -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 + throw new RuntimeException("Impossible Situation: invoking inaccessible method on listener", e); } - 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. + catch (final InvocationTargetException e) { throw new RuntimeException(e); } } diff --git a/extras/src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java b/extras/src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java index be90724..faeaa1e 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java @@ -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) { diff --git a/extras/src/main/java/edu/umd/cs/piccolox/event/PStyledTextEventHandler.java b/extras/src/main/java/edu/umd/cs/piccolox/event/PStyledTextEventHandler.java index 044f21e..f28f86b 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/event/PStyledTextEventHandler.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/event/PStyledTextEventHandler.java @@ -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); } diff --git a/extras/src/main/java/edu/umd/cs/piccolox/nodes/PCacheCamera.java b/extras/src/main/java/edu/umd/cs/piccolox/nodes/PCacheCamera.java index d753762..3c91f9a 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/nodes/PCacheCamera.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/nodes/PCacheCamera.java @@ -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); } diff --git a/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java b/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java index 8c2e9ea..ea7e420 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/nodes/PStyledText.java @@ -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; diff --git a/extras/src/main/java/edu/umd/cs/piccolox/swing/PViewport.java b/extras/src/main/java/edu/umd/cs/piccolox/swing/PViewport.java index 2a19ada..9bd8962 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/swing/PViewport.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/swing/PViewport.java @@ -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 * null) in the constructor. Returns a new * ViewportLayout 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 PScrollDirector object. * * @return a 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 ChangeListeners 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. */ diff --git a/extras/src/main/java/edu/umd/cs/piccolox/util/PFixedWidthStroke.java b/extras/src/main/java/edu/umd/cs/piccolox/util/PFixedWidthStroke.java index f04f33d..608da39 100644 --- a/extras/src/main/java/edu/umd/cs/piccolox/util/PFixedWidthStroke.java +++ b/extras/src/main/java/edu/umd/cs/piccolox/util/PFixedWidthStroke.java @@ -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;