diff --git a/core/src/main/java/edu/umd/cs/piccolo/PCamera.java b/core/src/main/java/edu/umd/cs/piccolo/PCamera.java index 1cb9465..b8ac0df 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PCamera.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PCamera.java @@ -109,9 +109,7 @@ */ public static final int PROPERTY_CODE_VIEW_TRANSFORM = 1 << 12; - /** - * Denotes that the view has no constraints. - */ + /** Denotes that the view has no constraints. */ public static final int VIEW_CONSTRAINT_NONE = 0; public static final int VIEW_CONSTRAINT_ALL = 1; public static final int VIEW_CONSTRAINT_CENTER = 2; @@ -121,9 +119,7 @@ * wishes to be repainted. */ private transient PComponent component; - /** - * Layers which the camera is viewing. - */ + /** Layers which the camera is viewing. */ private transient List layers; /** * Transform that is applied to layers before they are rendered. @@ -133,14 +129,10 @@ */ private final PAffineTransform viewTransform; - /** - * The constraints to apply to the viewing area. - */ + /** The constraints to apply to the viewing area. */ private int viewConstraint; - /** - * Construct a new camera with no layers and a default white color. - */ + /** Construct a new camera with no layers and a default white color. */ public PCamera() { super(); viewTransform = new PAffineTransform(); diff --git a/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java b/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java index 84d7545..50d169c 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java @@ -103,9 +103,7 @@ */ public static PCanvas CURRENT_ZCANVAS = null; - /** - * The camera though which this Canvas is viewing. - */ + /** The camera though which this Canvas is viewing. */ private PCamera camera; /** @@ -124,39 +122,31 @@ * animated. */ private int normalRenderQuality; - /** - * The quality to use while the scene is being animated. - */ + + /** The quality to use while the scene is being animated. */ private int animatingRenderQuality; - /** - * The quality to use while the scene is being interacted with. - */ + + /** The quality to use while the scene is being interacted with. */ private int interactingRenderQuality; - /** - * The one and only pan handler. - */ + + /** The one and only pan handler. */ private PPanEventHandler panEventHandler; - /** - * The one and only ZoomEventHandler. - */ + + /** The one and only ZoomEventHandler. */ private PZoomEventHandler zoomEventHandler; private boolean paintingImmediately; - /** - * Used to track whether the last paint operation was during an animation. - */ + + /** Used to track whether the last paint operation was during an animation. */ private boolean animatingOnLastPaint; - /** - * The mouse listener that is registered for large scale mouse events. - */ + + /** The mouse listener that is registered for large scale mouse events. */ private transient MouseListener mouseListener; - /** - * Remembers the key processor. - */ + + /** Remembers the key processor. */ private transient KeyEventPostProcessor keyEventPostProcessor; - /** - * The mouse wheel listeners that's registered to receive wheel events. - */ + + /** The mouse wheel listeners that's registered to receive wheel events. */ private transient MouseWheelListener mouseWheelListener; /** * The mouse listener that is registered to receive small scale mouse events diff --git a/core/src/main/java/edu/umd/cs/piccolo/PInputManager.java b/core/src/main/java/edu/umd/cs/piccolo/PInputManager.java index 095d6a5..0741777 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PInputManager.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PInputManager.java @@ -52,63 +52,42 @@ */ public class PInputManager extends PBasicInputEventHandler implements PRoot.InputSource { - /** - * Records the last known mouse position on the canvas. - */ + /** Records the last known mouse position on the canvas. */ private final Point2D lastCanvasPosition; - /** - * Records the current known mouse position on the canvas. - */ + /** Records the current known mouse position on the canvas. */ private final Point2D currentCanvasPosition; - /** - * The next InputEvent that needs to be processed. - */ + /** The next InputEvent that needs to be processed. */ private InputEvent nextInput; - /** - * The type of the next InputEvent that needs to be processed. - */ + /** The type of the next InputEvent that needs to be processed. */ private int nextType; - /** - * The Input Source the next event to process came from. - */ + /** The Input Source the next event to process came from. */ private PCamera nextInputSource; - /** - * The current mouse focus. - */ + /** The current mouse focus. */ private PPickPath mouseFocus; - /** - * The previous mouse focus. - */ + /** The previous mouse focus. */ private PPickPath previousMouseFocus; - /** - * Tracks where the mouse is right now on the canvas. - */ + /** Tracks where the mouse is right now on the canvas. */ private PPickPath mouseOver; - /** - * Tracks the previous location of the mouse on the canvas. - */ + /** Tracks the previous location of the mouse on the canvas. */ private PPickPath previousMouseOver; - /** - * Tracks the input event listener that should receive keyboard events. - */ + /** Tracks the input event listener that should receive keyboard events. */ private PInputEventListener keyboardFocus; - /** - * Tracks the number mouse buttons currently pressed. - */ + /** Tracks the number mouse buttons currently pressed. */ private int buttonsPressed; /** - * Creates a PInputManager and sets last positions to the origin (0,0). + * Creates a PInputManager and sets positions (last, current) to the origin + * (0,0). */ public PInputManager() { super(); @@ -116,10 +95,6 @@ currentCanvasPosition = new Point2D.Double(); } - // **************************************************************** - // Basic - // **************************************************************** - /** * Return the node that currently has the keyboard focus. This node receives * the key events. diff --git a/core/src/main/java/edu/umd/cs/piccolo/PNode.java b/core/src/main/java/edu/umd/cs/piccolo/PNode.java index 61f7ad5..dd9ab9f 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PNode.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PNode.java @@ -271,37 +271,25 @@ */ public static final int PROPERTY_CODE_PARENT = 1 << 10; - /** - * Is an optimization for use during repaints - */ + /** Is an optimization for use during repaints. */ private static final PBounds TEMP_REPAINT_BOUNDS = new PBounds(); - /** - * The single scene graph delegate that recives low level node events. - */ + /** The single scene graph delegate that receives low level node events. */ public static PSceneGraphDelegate SCENE_GRAPH_DELEGATE = null; - /** - * Tracks the parent of this node, may be null. - */ + /** Tracks the parent of this node, may be null. */ private transient PNode parent; - /** - * Tracks all immediate child nodes. - */ + + /** Tracks all immediate child nodes. */ private List children; - /** - * Bounds of the PNode. - */ + + /** Bounds of the PNode. */ private final PBounds bounds; - /** - * Transform that applies to this node in relation to its parent. - */ + /** Transform that applies to this node in relation to its parent. */ private PAffineTransform transform; - /** - * The paint to use for the background of this node. - */ + /** The paint to use for the background of this node. */ private Paint paint; /** @@ -310,9 +298,7 @@ */ private float transparency; - /** - * A modifiable set of client properties. - */ + /** A modifiable set of client properties. */ private MutableAttributeSet clientProperties; /** @@ -327,19 +313,13 @@ */ private int propertyChangeParentMask = 0; - /** - * Used to handle property change listeners. - */ + /** Used to handle property change listeners. */ private transient SwingPropertyChangeSupport changeSupport; - /** - * List of event listeners. - */ + /** List of event listeners. */ private transient EventListenerList listenerList; - /** - * Whether this node is pickable or not. - */ + /** Whether this node is pickable or not. */ private boolean pickable; /** @@ -348,43 +328,29 @@ */ private boolean childrenPickable; - /** - * Whether this node will be rendered. - */ + /** Whether this node will be rendered. */ private boolean visible; private boolean childBoundsVolatile; - /** - * Whether this node needs to be repainted. - */ + /** Whether this node needs to be repainted. */ private boolean paintInvalid; - /** - * Whether children need to be repainted. - */ + /** Whether children need to be repainted. */ private boolean childPaintInvalid; - /** - * Whether this node's bounds have changed, and so needs to be relaid out. - */ + /** Whether this node's bounds have changed, and so needs to be relaid out. */ private boolean boundsChanged; - /** - * Whether this node's full bounds need to be recomputed. - */ + /** Whether this node's full bounds need to be recomputed. */ private boolean fullBoundsInvalid; - /** - * Whether this node's child bounds need to be recomputed. - */ + /** Whether this node's child bounds need to be recomputed. */ private boolean childBoundsInvalid; private boolean occluded; - /** - * Stores the name associated to this node. - */ + /** Stores the name associated to this node. */ private String name; /** @@ -1135,24 +1101,25 @@ * @return The concatenation of transforms from the top node down to this * node. */ - public PAffineTransform getLocalToGlobalTransform(PAffineTransform dest) { + public PAffineTransform getLocalToGlobalTransform(final PAffineTransform dest) { + PAffineTransform result = dest; if (parent != null) { - dest = parent.getLocalToGlobalTransform(dest); + result = parent.getLocalToGlobalTransform(result); if (transform != null) { - dest.concatenate(transform); + result.concatenate(transform); } } else if (dest == null) { - dest = getTransform(); + result = getTransform(); } else if (transform != null) { - dest.setTransform(transform); + result.setTransform(transform); } else { - dest.setToIdentity(); + result.setToIdentity(); } - return dest; + return result; } /** @@ -1164,15 +1131,15 @@ * @return The inverse of the concatenation of transforms from the root down * to this node. */ - public PAffineTransform getGlobalToLocalTransform(PAffineTransform dest) { - dest = getLocalToGlobalTransform(dest); + public PAffineTransform getGlobalToLocalTransform(final PAffineTransform dest) { + PAffineTransform result = getLocalToGlobalTransform(dest); try { - dest.setTransform(dest.createInverse()); + result.setTransform(result.createInverse()); } catch (final NoninvertibleTransformException e) { - throw new PAffineTransformException(e, dest); + throw new PAffineTransformException(e, result); } - return dest; + return result; } // ****************************************************************