Author: rwhitcomb Date: Fri Mar 12 20:58:56 2021 New Revision: 1887552 URL: http://svn.apache.org/viewvc?rev=1887552&view=rev Log: PIVOT-1032: Changes to reduce "checkstyle" violations.
Modified: pivot/trunk/core/src/org/apache/pivot/util/BooleanResult.java pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java pivot/trunk/wtk/src/org/apache/pivot/wtk/Panorama.java pivot/trunk/wtk/src/org/apache/pivot/wtk/Tooltip.java pivot/trunk/wtk/src/org/apache/pivot/wtk/Viewport.java pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java Modified: pivot/trunk/core/src/org/apache/pivot/util/BooleanResult.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/BooleanResult.java?rev=1887552&r1=1887551&r2=1887552&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/util/BooleanResult.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/BooleanResult.java Fri Mar 12 20:58:56 2021 @@ -22,7 +22,9 @@ package org.apache.pivot.util; * final or effectively final. */ public class BooleanResult { - /** The current boolean value. */ + /** + * The current boolean value. + */ private boolean result; /** @@ -30,7 +32,7 @@ public class BooleanResult { * * @param initialValue The initial boolean value. */ - public BooleanResult(boolean initialValue) { + public BooleanResult(final boolean initialValue) { result = initialValue; } @@ -48,7 +50,7 @@ public class BooleanResult { * * @param value The new value to OR into the saved one. */ - public void or(boolean value) { + public void or(final boolean value) { result |= value; } @@ -58,7 +60,7 @@ public class BooleanResult { * * @param value The new value to AND into the saved one. */ - public void and(boolean value) { + public void and(final boolean value) { result &= value; } @@ -68,7 +70,7 @@ public class BooleanResult { * * @param value The new value to XOR into the saved one. */ - public void xor(boolean value) { + public void xor(final boolean value) { result ^= value; } @@ -92,7 +94,7 @@ public class BooleanResult { * * @param value The new value to set. */ - public void set(boolean value) { + public void set(final boolean value) { result = value; } Modified: pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java?rev=1887552&r1=1887551&r2=1887552&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java Fri Mar 12 20:58:56 2021 @@ -78,7 +78,7 @@ public final class ExceptionUtils { * @param ex The exception in question. * @return A "nicer" or more readable name to use in reporting. */ - private static String exceptionName(Throwable ex) { + private static String exceptionName(final Throwable ex) { String simpleName = ex.getClass().getSimpleName(); String nicerName = simpleName; Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java?rev=1887552&r1=1887551&r2=1887552&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java Fri Mar 12 20:58:56 2021 @@ -60,23 +60,36 @@ public final class GraphicsUtilities { RADIAL_GRADIENT } + /** Dictionary key for the paint type value. */ public static final String PAINT_TYPE_KEY = "paintType"; + /** Dictionary key for the color value. */ public static final String COLOR_KEY = "color"; + /** Dictionary key for the starting X-position value. */ public static final String START_X_KEY = "startX"; + /** Dictionary key for the starting Y-position value. */ public static final String START_Y_KEY = "startY"; + /** Dictionary key for the ending X-position value. */ public static final String END_X_KEY = "endX"; + /** Dictionary key for the ending Y-position value. */ public static final String END_Y_KEY = "endY"; + /** Dictionary key for the starting color value for a gradient. */ public static final String START_COLOR_KEY = "startColor"; + /** Dictionary key for the ending color value for a gradient. */ public static final String END_COLOR_KEY = "endColor"; + /** Dictionary key for the center X-position value for a radial gradient. */ public static final String CENTER_X_KEY = "centerX"; + /** Dictionary key for the center Y-position value for a radial gradient. */ public static final String CENTER_Y_KEY = "centerY"; + /** Dictionary key for the radius value for a radial gradient. */ public static final String RADIUS_KEY = "radius"; + /** Dictionary key for the dictionary of gradient stop values. */ public static final String STOPS_KEY = "stops"; + /** Dictionary key for the gradient offset values. */ public static final String OFFSET_KEY = "offset"; /** A bit mask for 8 bits (max size of a color value). */ Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Panorama.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Panorama.java?rev=1887552&r1=1887551&r2=1887552&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Panorama.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Panorama.java Fri Mar 12 20:58:56 2021 @@ -20,11 +20,19 @@ package org.apache.pivot.wtk; * Container that provides a scrollable view of a component. */ public class Panorama extends Viewport { + /** + * Default constructor without a view component (yet). + */ public Panorama() { this(null); } - public Panorama(Component view) { + /** + * Constructor supplying the view component. + * + * @param view The component we will be viewing. + */ + public Panorama(final Component view) { installSkin(Panorama.class); setView(view); } Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Tooltip.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Tooltip.java?rev=1887552&r1=1887551&r2=1887552&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Tooltip.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Tooltip.java Fri Mar 12 20:58:56 2021 @@ -22,11 +22,19 @@ package org.apache.pivot.wtk; * amount of time has passed and closes when the user moves the mouse. */ public class Tooltip extends Window { + /** + * Default constructor without a content component (yet). + */ public Tooltip() { this(null); } - public Tooltip(Component content) { + /** + * Construct a tooltip with the given content. + * + * @param content The content to be shown in this tooltip window. + */ + public Tooltip(final Component content) { super(content); installSkin(Tooltip.class); Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Viewport.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Viewport.java?rev=1887552&r1=1887551&r2=1887552&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Viewport.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Viewport.java Fri Mar 12 20:58:56 2021 @@ -39,47 +39,69 @@ public abstract class Viewport extends C * @return The bounds of the Viewport within the container, for example, in * ScrollPaneSkin, this excludes the scrollbars. */ - public Bounds getViewportBounds(); + Bounds getViewportBounds(); } + /** Current top scroll offset. */ private int scrollTop = 0; + /** Current left scroll offset. */ private int scrollLeft = 0; + /** The current component (typically a {@link Container}) that we are viewing. */ private Component view; + /** Whether we are consuming or propagating repaints. */ private boolean consumeRepaint = false; + /** Whether repainting is optimized, or whether a full repaint is required. */ private boolean repaintAllViewport = false; + /** Current set of listeners for events. */ private ViewportListener.Listeners viewportListeners = new ViewportListener.Listeners(); @Override - protected void setSkin(org.apache.pivot.wtk.Skin skin) { + protected void setSkin(final org.apache.pivot.wtk.Skin skin) { checkSkin(skin, Viewport.Skin.class); super.setSkin(skin); } + /** + * @return The current top scroll offset. + */ public int getScrollTop() { return scrollTop; } - public void setScrollTop(int scrollTop) { - int previousScrollTop = this.scrollTop; + /** + * Set the new top scroll offset. + * + * @param newScrollTop The new top offset. + */ + public void setScrollTop(final int newScrollTop) { + int previousScrollTop = scrollTop; - if (scrollTop != previousScrollTop) { - this.scrollTop = scrollTop; + if (newScrollTop != previousScrollTop) { + scrollTop = newScrollTop; viewportListeners.scrollTopChanged(this, previousScrollTop); } } + /** + * @return The current left scroll offset. + */ public int getScrollLeft() { return scrollLeft; } - public void setScrollLeft(int scrollLeft) { - int previousScrollLeft = this.scrollLeft; + /** + * Set the new left scroll offset. + * + * @param newScrollLeft The new left offset. + */ + public void setScrollLeft(final int newScrollLeft) { + int previousScrollLeft = scrollLeft; - if (scrollLeft != previousScrollLeft) { - this.scrollLeft = scrollLeft; + if (newScrollLeft != previousScrollLeft) { + scrollLeft = newScrollLeft; viewportListeners.scrollLeftChanged(this, previousScrollLeft); } } @@ -96,25 +118,25 @@ public abstract class Viewport extends C * Set the single component (typically a {@link Container}) that we will * provide a windowed (or scrollable) view of. * - * @param view The new component (container) we are viewing. + * @param newView The new component (container) we are viewing. */ - public void setView(Component view) { - Component previousView = this.view; + public void setView(final Component newView) { + Component previousView = view; - if (view != previousView) { + if (newView != previousView) { // Remove any previous view component - this.view = null; + view = null; if (previousView != null) { remove(previousView); } // Set the new view component - if (view != null) { - insert(view, 0); + if (newView != null) { + insert(newView, 0); } - this.view = view; + view = newView; viewportListeners.viewChanged(this, previousView); } @@ -139,11 +161,11 @@ public abstract class Viewport extends C * enables skins to optimize viewport scrolling by blitting the display to * reduce the required repaint area. * - * @param consumeRepaint {@code true} to consume repaints that bubble up + * @param newConsumeRepaint {@code true} to consume repaints that bubble up * through this viewport; {@code false} to propagate them up like normal. */ - public void setConsumeRepaint(boolean consumeRepaint) { - this.consumeRepaint = consumeRepaint; + public void setConsumeRepaint(final boolean newConsumeRepaint) { + consumeRepaint = newConsumeRepaint; } /** @@ -156,7 +178,7 @@ public abstract class Viewport extends C } @Override - public void repaint(int x, int y, int width, int height, boolean immediate) { + public void repaint(final int x, final int y, final int width, final int height, final boolean immediate) { if (!consumeRepaint) { super.repaint(x, y, width, height, immediate); } @@ -169,7 +191,7 @@ public abstract class Viewport extends C * method will result in an exception. */ @Override - public Sequence<Component> remove(int index, int count) { + public Sequence<Component> remove(final int index, final int count) { for (int i = index, n = index + count; i < n; i++) { Component component = get(i); if (component == view) { @@ -181,6 +203,9 @@ public abstract class Viewport extends C return super.remove(index, count); } + /** + * @return The current list of listeners for events on this viewport. + */ public ListenerList<ViewportListener> getViewportListeners() { return viewportListeners; } @@ -206,11 +231,11 @@ public abstract class Viewport extends C * problems with the scrolled-in area not being painted properly by default, * consider setting this property {@code true} (default is {@code false}). * - * @param repaintAllViewport {@code false} means optimized (repaint only + * @param newRepaintAllViewport {@code false} means optimized (repaint only * needed area, default), while {@code true} means repaint all */ - public void setRepaintAllViewport(boolean repaintAllViewport) { - this.repaintAllViewport = repaintAllViewport; + public void setRepaintAllViewport(final boolean newRepaintAllViewport) { + repaintAllViewport = newRepaintAllViewport; } } Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java?rev=1887552&r1=1887551&r2=1887552&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java Fri Mar 12 20:58:56 2021 @@ -24,12 +24,15 @@ import org.apache.pivot.wtk.Style; * Default list button data renderer. */ public class ListButtonDataRenderer extends ButtonDataRenderer { + /** + * Default constructor - set necessary styles. + */ public ListButtonDataRenderer() { getStyles().put(Style.horizontalAlignment, HorizontalAlignment.LEFT); } @Override - public void render(final Object data, final Button button, boolean highlight) { + public void render(final Object data, final Button button, final boolean highlight) { Object localData = data; if (localData == null) { localData = "";