Author: rwhitcomb Date: Thu Mar 1 21:40:11 2018 New Revision: 1825686 URL: http://svn.apache.org/viewvc?rev=1825686&view=rev Log: PIVOT-1032: First checkin from "check-style" task: * Add a "pivot_checks.xml" which is the canonical "sun_checks.xml" but with a line length max set to 110, which eliminates a ton of errors in our source. * Fix some things in some of the new tests I've introduced. * Change constructors in CSSColor to eliminate a ton of warnings there about no space before comma.
Added: pivot/trunk/pivot_checks.xml Modified: pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java pivot/trunk/wtk/src/org/apache/pivot/wtk/util/ColorUtilities.java pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BoundsTest.java pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ColorUtilitiesTest.java pivot/trunk/wtk/test/org/apache/pivot/wtk/test/GaugeTest.java pivot/trunk/wtk/test/org/apache/pivot/wtk/test/InsetsTest.java pivot/trunk/wtk/test/org/apache/pivot/wtk/test/MeterTest.java Added: pivot/trunk/pivot_checks.xml URL: http://svn.apache.org/viewvc/pivot/trunk/pivot_checks.xml?rev=1825686&view=auto ============================================================================== --- pivot/trunk/pivot_checks.xml (added) +++ pivot/trunk/pivot_checks.xml Thu Mar 1 21:40:11 2018 @@ -0,0 +1,175 @@ +<?xml version="1.0"?> +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd"> + +<!-- + + Checkstyle configuration that checks the sun coding conventions from: + + - the Java Language Specification at + http://java.sun.com/docs/books/jls/second_edition/html/index.html + + - the Sun Code Conventions at http://java.sun.com/docs/codeconv/ + + - the Javadoc guidelines at + http://java.sun.com/j2se/javadoc/writingdoccomments/index.html + + - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html + + - some best practices + + Checkstyle is very configurable. Be sure to read the documentation at + http://checkstyle.sf.net (or in your downloaded distribution). + + Most Checks are configurable, be sure to consult the documentation. + + To completely disable a check, just comment it out or delete it from the file. + + Finally, it is worth reading the documentation. + +--> + +<module name="Checker"> + <!-- + If you set the basedir property below, then all reported file + names will be relative to the specified directory. See + http://checkstyle.sourceforge.net/5.x/config.html#Checker + + <property name="basedir" value="${basedir}"/> + --> + + <property name="fileExtensions" value="java, properties, xml"/> + + <!-- Checks that a package-info.java file exists for each package. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage --> + <module name="JavadocPackage"/> + + <!-- Checks whether files end with a new line. --> + <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> + <module name="NewlineAtEndOfFile"/> + + <!-- Checks that property files contain the same keys. --> + <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> + <module name="Translation"/> + + <!-- Checks for Size Violations. --> + <!-- See http://checkstyle.sf.net/config_sizes.html --> + <module name="FileLength"/> + + <!-- Checks for whitespace --> + <!-- See http://checkstyle.sf.net/config_whitespace.html --> + <module name="FileTabCharacter"/> + + <!-- Miscellaneous other checks. --> + <!-- See http://checkstyle.sf.net/config_misc.html --> + <module name="RegexpSingleline"> + <property name="format" value="\s+$"/> + <property name="minimum" value="0"/> + <property name="maximum" value="0"/> + <property name="message" value="Line has trailing spaces."/> + </module> + + <!-- Checks for Headers --> + <!-- See http://checkstyle.sf.net/config_header.html --> + <!-- <module name="Header"> --> + <!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> + <!-- <property name="fileExtensions" value="java"/> --> + <!-- </module> --> + + <module name="TreeWalker"> + + <!-- Checks for Javadoc comments. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html --> + <module name="JavadocMethod"/> + <module name="JavadocType"/> + <module name="JavadocVariable"/> + <module name="JavadocStyle"/> + + <!-- Checks for Naming Conventions. --> + <!-- See http://checkstyle.sf.net/config_naming.html --> + <module name="ConstantName"/> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"/> + <module name="MethodName"/> + <module name="PackageName"/> + <module name="ParameterName"/> + <module name="StaticVariableName"/> + <module name="TypeName"/> + + <!-- Checks for imports --> + <!-- See http://checkstyle.sf.net/config_import.html --> + <module name="AvoidStarImport"/> + <module name="IllegalImport"/> <!-- defaults to sun.* packages --> + <module name="RedundantImport"/> + <module name="UnusedImports"> + <property name="processJavadoc" value="false"/> + </module> + + <!-- Checks for Size Violations. --> + <!-- See http://checkstyle.sf.net/config_sizes.html --> + <module name="LineLength"> + <property name="max" value="110"/> + </module> + <module name="MethodLength"/> + <module name="ParameterNumber"/> + + <!-- Checks for whitespace --> + <!-- See http://checkstyle.sf.net/config_whitespace.html --> + <module name="EmptyForIteratorPad"/> + <module name="GenericWhitespace"/> + <module name="MethodParamPad"/> + <module name="NoWhitespaceAfter"/> + <module name="NoWhitespaceBefore"/> + <module name="OperatorWrap"/> + <module name="ParenPad"/> + <module name="TypecastParenPad"/> + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"/> + + <!-- Modifier Checks --> + <!-- See http://checkstyle.sf.net/config_modifiers.html --> + <module name="ModifierOrder"/> + <module name="RedundantModifier"/> + + <!-- Checks for blocks. You know, those {}'s --> + <!-- See http://checkstyle.sf.net/config_blocks.html --> + <module name="AvoidNestedBlocks"/> + <module name="EmptyBlock"/> + <module name="LeftCurly"/> + <module name="NeedBraces"/> + <module name="RightCurly"/> + + <!-- Checks for common coding problems --> + <!-- See http://checkstyle.sf.net/config_coding.html --> + <module name="AvoidInlineConditionals"/> + <module name="EmptyStatement"/> + <module name="EqualsHashCode"/> + <module name="HiddenField"/> + <module name="IllegalInstantiation"/> + <module name="InnerAssignment"/> + <module name="MagicNumber"/> + <module name="MissingSwitchDefault"/> + <module name="SimplifyBooleanExpression"/> + <module name="SimplifyBooleanReturn"/> + + <!-- Checks for class design --> + <!-- See http://checkstyle.sf.net/config_design.html --> + <module name="DesignForExtension"/> + <module name="FinalClass"/> + <module name="HideUtilityClassConstructor"/> + <module name="InterfaceIsType"/> + <module name="VisibilityModifier"/> + + <!-- Miscellaneous other checks. --> + <!-- See http://checkstyle.sf.net/config_misc.html --> + <module name="ArrayTypeStyle"/> + <module name="FinalParameters"/> + <module name="TodoComment"/> + <module name="UpperEll"/> + + </module> + +</module> + Modified: pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java?rev=1825686&r1=1825685&r2=1825686&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java Thu Mar 1 21:40:11 2018 @@ -24,7 +24,6 @@ import org.apache.pivot.wtk.Application; import org.apache.pivot.wtk.ApplicationContext; import org.apache.pivot.wtk.Button; import org.apache.pivot.wtk.Checkbox; -import org.apache.pivot.wtk.Component; import org.apache.pivot.wtk.DesktopApplicationContext; import org.apache.pivot.wtk.Display; import org.apache.pivot.wtk.Gauge; @@ -32,7 +31,7 @@ import org.apache.pivot.wtk.PushButton; import org.apache.pivot.wtk.Theme; import org.apache.pivot.wtk.Window; -public class GaugeTest implements Application { +public final class GaugeTest implements Application { private Window window; private PushButton gasPedal; private PushButton brakePedal; @@ -43,18 +42,18 @@ public class GaugeTest implements Applic private Color warningColor; private Color criticalColor; - private int randomInt(int bound) { + private int randomInt(final int bound) { double variant = Math.random(); int value; if (variant >= 0.5) { - value = (int)Math.floor((variant - 0.5) * (double)bound); + value = (int) Math.floor((variant - 0.5) * (double) bound); } else { - value = (int)Math.ceil((variant * -1.0) * (double)bound); + value = (int) Math.ceil((variant * -1.0) * (double) bound); } return value; } - private void setSpeed(int value) { + private void setSpeed(final int value) { speed = Math.min(value, speedGauge.getMaxValue()); speed = Math.max(speed, speedGauge.getMinValue()); speedGauge.setValue(speed); @@ -85,19 +84,19 @@ public class GaugeTest implements Applic } } - private void toggleMax(Button.State state) { + private void toggleMax(final Button.State state) { speedGauge.getStyles().put("onlyMaxColor", state == Button.State.SELECTED); } @Override @SuppressWarnings("unchecked") - public void startup(Display display, Map<String, String> properties) throws Exception { + public void startup(final Display display, final Map<String, String> properties) throws Exception { BXMLSerializer bxmlSerializer = new BXMLSerializer(); window = (Window) bxmlSerializer.readObject(getClass().getResource("gauge_test.bxml")); - gasPedal = (PushButton)bxmlSerializer.getNamespace().get("gasPedal"); - brakePedal = (PushButton)bxmlSerializer.getNamespace().get("brakePedal"); - speedGauge = (Gauge<Integer>)bxmlSerializer.getNamespace().get("speedGauge"); - maxCheck = (Checkbox)bxmlSerializer.getNamespace().get("maxCheck"); + gasPedal = (PushButton) bxmlSerializer.getNamespace().get("gasPedal"); + brakePedal = (PushButton) bxmlSerializer.getNamespace().get("brakePedal"); + speedGauge = (Gauge<Integer>) bxmlSerializer.getNamespace().get("speedGauge"); + maxCheck = (Checkbox) bxmlSerializer.getNamespace().get("maxCheck"); warningColor = speedGauge.getStyles().getColor("warningColor"); criticalColor = speedGauge.getStyles().getColor("criticalColor"); textColor = Theme.getTheme().getColor(6); @@ -109,7 +108,7 @@ public class GaugeTest implements Applic window.open(display); } - public static void main(String[] args) { + public static void main(final String[] args) { DesktopApplicationContext.main(GaugeTest.class, args); } } Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java?rev=1825686&r1=1825685&r2=1825686&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java Thu Mar 1 21:40:11 2018 @@ -23,164 +23,167 @@ import java.util.Map; /** * The complete enumeration of the CSS3/X11 color names and values, - * taken from here: <a href="http://www.w3.org/TR/css3-color/">http://www.w3.org/TR/css3-color/</a>, - * and including the Java {@link Color} names (with all British/American spelling variants). - * <p> Note: these are available through the {@link GraphicsUtilities#decodeColor GraphicsUtilities.decodeColor()} + * taken from here: + * <a href="http://www.w3.org/TR/css3-color/">http://www.w3.org/TR/css3-color/</a>, + * and including the Java {@link Color} names (with all British/American + * spelling variants). + * <p> Note: these are available through the + * {@link GraphicsUtilities#decodeColor GraphicsUtilities.decodeColor()} * and {@link org.apache.pivot.wtk.content.ColorItem#allCSSColors} methods. */ public enum CSSColor { - AliceBlue (new Color(240,248,255)), - AntiqueWhite (new Color(250,235,215)), - Aqua (new Color( 0,255,255)), - Aquamarine (new Color(127,255,212)), - Azure (new Color(240,255,255)), - Beige (new Color(245,245,220)), - Bisque (new Color(255,228,196)), + AliceBlue (new Color(240, 248, 255)), + AntiqueWhite (new Color(250, 235, 215)), + Aqua (new Color( 0, 255, 255)), + Aquamarine (new Color(127, 255, 212)), + Azure (new Color(240, 255, 255)), + Beige (new Color(245, 245, 220)), + Bisque (new Color(255, 228, 196)), Black (Color.BLACK), - BlanchedAlmond (new Color(255,235,205)), + BlanchedAlmond (new Color(255, 235, 205)), Blue (Color.BLUE), - BlueViolet (new Color(138, 43,226)), - Brown (new Color(165, 42, 42)), - Burlywood (new Color(222,184,135)), - CadetBlue (new Color( 95,158,160)), - Chartreuse (new Color(127,255, 0)), - Chocolate (new Color(210,105, 30)), - Coral (new Color(255,127, 80)), - CornflowerBlue (new Color(100,149,237)), - Cornsilk (new Color(255,248,220)), - Crimson (new Color(220, 20, 60)), + BlueViolet (new Color(138, 43, 226)), + Brown (new Color(165, 42, 42)), + Burlywood (new Color(222, 184, 135)), + CadetBlue (new Color( 95, 158, 160)), + Chartreuse (new Color(127, 255, 0)), + Chocolate (new Color(210, 105, 30)), + Coral (new Color(255, 127, 80)), + CornflowerBlue (new Color(100, 149, 237)), + Cornsilk (new Color(255, 248, 220)), + Crimson (new Color(220, 20, 60)), Cyan (Color.CYAN), - DarkBlue (new Color( 0, 0,139)), - DarkCyan (new Color( 0,139,139)), - DarkGoldenrod (new Color(184,134, 11)), + DarkBlue (new Color( 0, 0, 139)), + DarkCyan (new Color( 0, 139, 139)), + DarkGoldenrod (new Color(184, 134, 11)), DarkGray (Color.DARK_GRAY), - DarkGreen (new Color( 0,100, 0)), + DarkGreen (new Color( 0, 100, 0)), DarkGrey (Color.DARK_GRAY), - DarkKhaki (new Color(189,183,107)), - DarkMagenta (new Color(139, 0,139)), - DarkOliveGreen (new Color( 85,107, 47)), - DarkOrange (new Color(255,140, 0)), - DarkOrchid (new Color(153, 50,204)), - DarkRed (new Color(139, 0, 0)), - DarkSalmon (new Color(233,150,122)), - DarkSeaGreen (new Color(143,188,143)), - DarkSlateBlue (new Color( 72, 61,139)), - DarkSlateGray (new Color( 47, 79, 79)), - DarkSlateGrey (new Color( 47, 79, 79)), - DarkTurquoise (new Color( 0,206,209)), - DarkViolet (new Color(148, 0,211)), - DeepPink (new Color(255, 20,147)), - DeepSkyBlue (new Color( 0,191,255)), - DimGray (new Color(105,105,105)), - DimGrey (new Color(105,105,105)), - DodgerBlue (new Color( 30,144,255)), - FireBrick (new Color(178, 34, 34)), - FloralWhite (new Color(255,250,240)), - ForestGreen (new Color( 34,139, 34)), - Fuchsia (new Color(255, 0,255)), - Gainsboro (new Color(220,220,220)), - GhostWhite (new Color(248,248,255)), - Gold (new Color(255,215, 0)), - Goldenrod (new Color(218,165, 32)), + DarkKhaki (new Color(189, 183, 107)), + DarkMagenta (new Color(139, 0, 139)), + DarkOliveGreen (new Color( 85, 107, 47)), + DarkOrange (new Color(255, 140, 0)), + DarkOrchid (new Color(153, 50, 204)), + DarkRed (new Color(139, 0, 0)), + DarkSalmon (new Color(233, 150, 122)), + DarkSeaGreen (new Color(143, 188, 143)), + DarkSlateBlue (new Color( 72, 61, 139)), + DarkSlateGray (new Color( 47, 79, 79)), + DarkSlateGrey (new Color( 47, 79, 79)), + DarkTurquoise (new Color( 0, 206, 209)), + DarkViolet (new Color(148, 0, 211)), + DeepPink (new Color(255, 20, 147)), + DeepSkyBlue (new Color( 0, 191, 255)), + DimGray (new Color(105, 105, 105)), + DimGrey (new Color(105, 105, 105)), + DodgerBlue (new Color( 30, 144, 255)), + FireBrick (new Color(178, 34, 34)), + FloralWhite (new Color(255, 250, 240)), + ForestGreen (new Color( 34, 139, 34)), + Fuchsia (new Color(255, 0, 255)), + Gainsboro (new Color(220, 220, 220)), + GhostWhite (new Color(248, 248, 255)), + Gold (new Color(255, 215, 0)), + Goldenrod (new Color(218, 165, 32)), Gray (Color.GRAY), Green (Color.GREEN), - GreenYellow (new Color(173,255, 47)), + GreenYellow (new Color(173, 255, 47)), Grey (Color.GRAY), - Honeydew (new Color(240,255,240)), - HotPink (new Color(255,105,180)), - IndianRed (new Color(205, 92, 92)), - Indigo (new Color( 75, 0,130)), - Ivory (new Color(255,255,240)), - Khaki (new Color(240,230,140)), - Lavender (new Color(230,230,250)), - LavenderBlush (new Color(255,240,245)), - LawnGreen (new Color(124,252, 0)), - LemonChiffon (new Color(255,250,205)), - LightBlue (new Color(173,216,230)), - LightCoral (new Color(240,128,128)), - LightCyan (new Color(224,255,255)), - LightGoldenrodYellow(new Color(250,250,210)), + Honeydew (new Color(240, 255, 240)), + HotPink (new Color(255, 105, 180)), + IndianRed (new Color(205, 92, 92)), + Indigo (new Color( 75, 0, 130)), + Ivory (new Color(255, 255, 240)), + Khaki (new Color(240, 230, 140)), + Lavender (new Color(230, 230, 250)), + LavenderBlush (new Color(255, 240, 245)), + LawnGreen (new Color(124, 252, 0)), + LemonChiffon (new Color(255, 250, 205)), + LightBlue (new Color(173, 216, 230)), + LightCoral (new Color(240, 128, 128)), + LightCyan (new Color(224, 255, 255)), + LightGoldenrodYellow(new Color(250, 250, 210)), LightGray (Color.LIGHT_GRAY), - LightGreen (new Color(144,238,144)), + LightGreen (new Color(144, 238, 144)), LightGrey (Color.LIGHT_GRAY), - LightPink (new Color(255,182,193)), - LightSalmon (new Color(255,160,122)), - LightSeaGreen (new Color( 32,178,170)), - LightSkyBlue (new Color(135,206,250)), - LightSlateGray (new Color(119,136,153)), - LightSlateGrey (new Color(119,136,153)), - LightSteelBlue (new Color(176,196,222)), - LightYellow (new Color(255,255,224)), - Lime (new Color( 0,255, 0)), - LimeGreen (new Color( 50,205, 50)), - Linen (new Color(250,240,230)), + LightPink (new Color(255, 182, 193)), + LightSalmon (new Color(255, 160, 122)), + LightSeaGreen (new Color( 32, 178, 170)), + LightSkyBlue (new Color(135, 206, 250)), + LightSlateGray (new Color(119, 136, 153)), + LightSlateGrey (new Color(119, 136, 153)), + LightSteelBlue (new Color(176, 196, 222)), + LightYellow (new Color(255, 255, 224)), + Lime (new Color( 0, 255, 0)), + LimeGreen (new Color( 50, 205, 50)), + Linen (new Color(250, 240, 230)), Magenta (Color.MAGENTA), - Maroon (new Color(128, 0, 0)), - MediumAquamarine (new Color(102,205,170)), - MediumBlue (new Color( 0, 0,205)), - MediumOrchid (new Color(186, 85,211)), - MediumPurple (new Color(147,112,219)), - MediumSeaGreen (new Color( 60,179,113)), - MediumSlateBlue (new Color(123,104,238)), - MediumSpringGreen (new Color( 0,250,154)), - MediumTurquoise (new Color( 72,209,204)), - MediumVioletRed (new Color(199, 21,133)), - MidnightBlue (new Color( 25, 25,112)), - MintCream (new Color(245,255,250)), - MistyRose (new Color(255,228,225)), - Moccasin (new Color(255,228,181)), - NavajoWhite (new Color(255,222,173)), - Navy (new Color( 0, 0,128)), - OldLace (new Color(253,245,230)), - Olive (new Color(128,128, 0)), - OliveDrab (new Color(107,142, 35)), + Maroon (new Color(128, 0, 0)), + MediumAquamarine (new Color(102, 205, 170)), + MediumBlue (new Color( 0, 0, 205)), + MediumOrchid (new Color(186, 85, 211)), + MediumPurple (new Color(147, 112, 219)), + MediumSeaGreen (new Color( 60, 179, 113)), + MediumSlateBlue (new Color(123, 104, 238)), + MediumSpringGreen (new Color( 0, 250, 154)), + MediumTurquoise (new Color( 72, 209, 204)), + MediumVioletRed (new Color(199, 21, 133)), + MidnightBlue (new Color( 25, 25, 112)), + MintCream (new Color(245, 255, 250)), + MistyRose (new Color(255, 228, 225)), + Moccasin (new Color(255, 228, 181)), + NavajoWhite (new Color(255, 222, 173)), + Navy (new Color( 0, 0, 128)), + OldLace (new Color(253, 245, 230)), + Olive (new Color(128, 128, 0)), + OliveDrab (new Color(107, 142, 35)), Orange (Color.ORANGE), - OrangeRed (new Color(255, 69, 0)), - Orchid (new Color(218,112,214)), - PaleGoldenrod (new Color(238,232,170)), - PaleGreen (new Color(152,251,152)), - PaleTurquoise (new Color(175,238,238)), - PaleVioletRed (new Color(219,112,147)), - PapayaWhip (new Color(255,239,213)), - PeachPuff (new Color(255,218,185)), - Peru (new Color(205,133, 63)), + OrangeRed (new Color(255, 69, 0)), + Orchid (new Color(218, 112, 214)), + PaleGoldenrod (new Color(238, 232, 170)), + PaleGreen (new Color(152, 251, 152)), + PaleTurquoise (new Color(175, 238, 238)), + PaleVioletRed (new Color(219, 112, 147)), + PapayaWhip (new Color(255, 239, 213)), + PeachPuff (new Color(255, 218, 185)), + Peru (new Color(205, 133, 63)), Pink (Color.PINK), - Plum (new Color(221,160,221)), - PowderBlue (new Color(176,224,230)), - Purple (new Color(128, 0,128)), + Plum (new Color(221, 160, 221)), + PowderBlue (new Color(176, 224, 230)), + Purple (new Color(128, 0, 128)), Red (Color.RED), - RosyBrown (new Color(188,143,143)), - RoyalBlue (new Color( 65,105,225)), - SaddleBrown (new Color(139, 69, 19)), - Salmon (new Color(250,128,114)), - SandyBrown (new Color(244,164, 96)), - SeaGreen (new Color( 46,139, 87)), - Seashell (new Color(255,245,238)), - Sienna (new Color(160, 82, 45)), - Silver (new Color(192,192,192)), - SkyBlue (new Color(135,206,235)), - SlateBlue (new Color(106, 90,205)), - SlateGray (new Color(112,128,144)), - SlateGrey (new Color(112,128,144)), - Snow (new Color(255,250,250)), - SpringGreen (new Color( 0,255,127)), - SteelBlue (new Color( 70,130,180)), - Tan (new Color(210,180,140)), - Teal (new Color( 0,128,128)), - Thistle (new Color(216,191,216)), - Tomato (new Color(255, 99, 71)), - Turquoise (new Color( 64,224,208)), - Violet (new Color(238,130,238)), - Wheat (new Color(245,222,179)), + RosyBrown (new Color(188, 143, 143)), + RoyalBlue (new Color( 65, 105, 225)), + SaddleBrown (new Color(139, 69, 19)), + Salmon (new Color(250, 128, 114)), + SandyBrown (new Color(244, 164, 96)), + SeaGreen (new Color( 46, 139, 87)), + Seashell (new Color(255, 245, 238)), + Sienna (new Color(160, 82, 45)), + Silver (new Color(192, 192, 192)), + SkyBlue (new Color(135, 206, 235)), + SlateBlue (new Color(106, 90, 205)), + SlateGray (new Color(112, 128, 144)), + SlateGrey (new Color(112, 128, 144)), + Snow (new Color(255, 250, 250)), + SpringGreen (new Color( 0, 255, 127)), + SteelBlue (new Color( 70, 130, 180)), + Tan (new Color(210, 180, 140)), + Teal (new Color( 0, 128, 128)), + Thistle (new Color(216, 191, 216)), + Tomato (new Color(255, 99, 71)), + Turquoise (new Color( 64, 224, 208)), + Violet (new Color(238, 130, 238)), + Wheat (new Color(245, 222, 179)), White (Color.WHITE), - WhiteSmoke (new Color(245,245,245)), + WhiteSmoke (new Color(245, 245, 245)), Yellow (Color.YELLOW), - YellowGreen (new Color(154,205, 50)); + YellowGreen (new Color(154, 205, 50)); private Color color; private String colorName; - private CSSColor(Color color) { + CSSColor(final Color color) { this.color = color; this.colorName = super.toString().toLowerCase(Locale.ENGLISH); } @@ -207,11 +210,12 @@ public enum CSSColor { * @param colorName The name of a color to match with one of our values. * @throws IllegalArgumentException if the color name cannot be found. */ - public static CSSColor fromString(String colorName) { + public static CSSColor fromString(final String colorName) { String lowerName = colorName.toLowerCase(Locale.ENGLISH); CSSColor color = colorNameMap.get(lowerName); if (color == null) { - throw new IllegalArgumentException("Incorrect Color format. Color name \"" + colorName + "\" is not valid."); + throw new IllegalArgumentException("Incorrect Color format. " + + "Color name \"" + colorName + "\" is not valid."); } return color; } @@ -223,11 +227,12 @@ public enum CSSColor { * @param color The solid color to match with one of our values. * @throws IllegalArgumentException if the color value cannot be found. */ - public static CSSColor fromColor(Color color) { + public static CSSColor fromColor(final Color color) { Color solidColor = new Color(color.getRed(), color.getGreen(), color.getBlue()); CSSColor cssColor = colorValueMap.get(solidColor); if (cssColor == null) { - throw new IllegalArgumentException("Incorrect Color value. " + color.toString() + " does not match any CSS color."); + throw new IllegalArgumentException("Incorrect Color value. " + + color.toString() + " does not match any CSS color."); } return cssColor; } Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/util/ColorUtilities.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/util/ColorUtilities.java?rev=1825686&r1=1825685&r2=1825686&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/util/ColorUtilities.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/util/ColorUtilities.java Thu Mar 1 21:40:11 2018 @@ -28,7 +28,7 @@ import org.apache.pivot.wtk.CSSColor; public final class ColorUtilities { /** - * Private constructor + * Private constructor. */ private ColorUtilities() { } Modified: pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BoundsTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BoundsTest.java?rev=1825686&r1=1825685&r2=1825686&view=diff ============================================================================== --- pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BoundsTest.java (original) +++ pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BoundsTest.java Thu Mar 1 21:40:11 2018 @@ -16,7 +16,6 @@ */ package org.apache.pivot.wtk.test; -import java.awt.Rectangle; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertFalse; @@ -37,7 +36,7 @@ public class BoundsTest { @Test public void test() { - Bounds bnd_1 = new Bounds(-1, -1, 0, 0); + Bounds bndMinus1 = new Bounds(-1, -1, 0, 0); Bounds bnd0 = new Bounds(0, 0, 0, 0); Bounds bnd1 = new Bounds(1, 1, 1, 1); @@ -64,7 +63,7 @@ public class BoundsTest { Bounds bnd6a = new Bounds(2, 3, 4, 5); assertEquals(Bounds.EMPTY, bnd0); - assertNotEquals(bnd_1, bnd0); + assertNotEquals(bndMinus1, bnd0); assertNotEquals(bnd0, bnd1); assertEquals(bnd10a, bnd10b); @@ -73,13 +72,13 @@ public class BoundsTest { assertEquals(bnd2, bnd3); assertEquals(bnd3, bnd3a); - assertEquals(bnd_1.getSize(), dim0); + assertEquals(bndMinus1.getSize(), dim0); assertEquals(bnd0.getSize(), dim0); assertEquals(bnd1.getSize(), dim1); assertFalse(bnd1.contains(bnd0)); - assertFalse(bnd_1.intersects(bnd0)); + assertFalse(bndMinus1.intersects(bnd0)); assertFalse(bnd0.intersects(bnd1)); assertEquals(bnd0.intersect(bnd1), new Bounds(1, 1, -1, -1)); assertTrue(bnd5a.intersects(bnd5b)); Modified: pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ColorUtilitiesTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ColorUtilitiesTest.java?rev=1825686&r1=1825685&r2=1825686&view=diff ============================================================================== --- pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ColorUtilitiesTest.java (original) +++ pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ColorUtilitiesTest.java Thu Mar 1 21:40:11 2018 @@ -19,8 +19,6 @@ package org.apache.pivot.wtk.test; import java.awt.Color; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; @@ -50,7 +48,8 @@ public class ColorUtilitiesTest { fail("almostBlack should not be a CSS color!"); } catch (IllegalArgumentException iae) { System.out.println("Valid exception: " + iae.getMessage()); - assertEquals(iae.getMessage(), "Incorrect Color value. " + almostBlack.toString() + " does not match any CSS color."); + assertEquals(iae.getMessage(), "Incorrect Color value. " + + almostBlack.toString() + " does not match any CSS color."); } Color translucentOrange = ColorUtilities.setTransparencyInColor(CSSColor.Orange, 128); @@ -78,15 +77,18 @@ public class ColorUtilitiesTest { fail("Decode of \"lightGray\" should succeed!"); } - assertEquals((Color)null, GraphicsUtilities.decodeColor("null")); + assertEquals((Color) null, GraphicsUtilities.decodeColor("null")); int transparency = -1; for (CSSColor color : CSSColor.values()) { transparency = (transparency + 1) % 256; Color originalColor = color.getColor(); Color translucentColor = ColorUtilities.setTransparencyInColor(color, transparency); - String value = transparency == 255 ? String.format("#%02X%02X%02X", originalColor.getRed(), originalColor.getGreen(), originalColor.getBlue()) : - String.format("0x%02X%02X%02X%02X", originalColor.getRed(), originalColor.getGreen(), originalColor.getBlue(), transparency); + String value = (transparency == 255) + ? String.format("#%02X%02X%02X", + originalColor.getRed(), originalColor.getGreen(), originalColor.getBlue()) + : String.format("0x%02X%02X%02X%02X", + originalColor.getRed(), originalColor.getGreen(), originalColor.getBlue(), transparency); String testValue = ColorUtilities.toStringValue(translucentColor); assertEquals(value, testValue); } Modified: pivot/trunk/wtk/test/org/apache/pivot/wtk/test/GaugeTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/GaugeTest.java?rev=1825686&r1=1825685&r2=1825686&view=diff ============================================================================== --- pivot/trunk/wtk/test/org/apache/pivot/wtk/test/GaugeTest.java (original) +++ pivot/trunk/wtk/test/org/apache/pivot/wtk/test/GaugeTest.java Thu Mar 1 21:40:11 2018 @@ -17,8 +17,6 @@ package org.apache.pivot.wtk.test; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -27,7 +25,7 @@ import org.apache.pivot.wtk.GaugeListene import org.apache.pivot.wtk.Origin; -public class GaugeTest implements GaugeListener<Integer> { +public final class GaugeTest implements GaugeListener<Integer> { private int originChangeCount = 0; private int valueChangeCount = 0; private int textChangeCount = 0; @@ -35,43 +33,43 @@ public class GaugeTest implements GaugeL private int warningCriticalChangeCount = 0; @Override - public void originChanged(Gauge<Integer> gauge, Origin previousOrigin) { + public void originChanged(final Gauge<Integer> gauge, final Origin previousOrigin) { System.out.println("Origin changed to " + gauge.getOrigin()); originChangeCount++; } @Override - public void valueChanged(Gauge<Integer> gauge, Integer previousValue) { + public void valueChanged(final Gauge<Integer> gauge, final Integer previousValue) { System.out.println("Value changed to " + gauge.getValue()); valueChangeCount++; } @Override - public void textChanged(Gauge<Integer> gauge, String previousText) { + public void textChanged(final Gauge<Integer> gauge, final String previousText) { System.out.println("Text changed to " + gauge.getText()); textChangeCount++; } @Override - public void minValueChanged(Gauge<Integer> gauge, Integer previousMinValue) { + public void minValueChanged(final Gauge<Integer> gauge, final Integer previousMinValue) { System.out.println("Min changed: min=" + gauge.getMinValue()); minMaxChangeCount++; } @Override - public void maxValueChanged(Gauge<Integer> gauge, Integer previousMaxValue) { + public void maxValueChanged(final Gauge<Integer> gauge, final Integer previousMaxValue) { System.out.println("Max changed: max=" + gauge.getMaxValue()); minMaxChangeCount++; } @Override - public void warningLevelChanged(Gauge<Integer> gauge, Integer previousWarningLevel) { + public void warningLevelChanged(final Gauge<Integer> gauge, final Integer previousWarningLevel) { System.out.println("Warning level changed: warning=" + gauge.getWarningLevel()); warningCriticalChangeCount++; } @Override - public void criticalLevelChanged(Gauge<Integer> gauge, Integer previousCriticalLevel) { + public void criticalLevelChanged(final Gauge<Integer> gauge, final Integer previousCriticalLevel) { System.out.println("Critical level changed: critical=" + gauge.getCriticalLevel()); warningCriticalChangeCount++; } Modified: pivot/trunk/wtk/test/org/apache/pivot/wtk/test/InsetsTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/InsetsTest.java?rev=1825686&r1=1825685&r2=1825686&view=diff ============================================================================== --- pivot/trunk/wtk/test/org/apache/pivot/wtk/test/InsetsTest.java (original) +++ pivot/trunk/wtk/test/org/apache/pivot/wtk/test/InsetsTest.java Thu Mar 1 21:40:11 2018 @@ -17,8 +17,6 @@ package org.apache.pivot.wtk.test; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; Modified: pivot/trunk/wtk/test/org/apache/pivot/wtk/test/MeterTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/MeterTest.java?rev=1825686&r1=1825685&r2=1825686&view=diff ============================================================================== --- pivot/trunk/wtk/test/org/apache/pivot/wtk/test/MeterTest.java (original) +++ pivot/trunk/wtk/test/org/apache/pivot/wtk/test/MeterTest.java Thu Mar 1 21:40:11 2018 @@ -17,8 +17,6 @@ package org.apache.pivot.wtk.test; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -27,23 +25,23 @@ import org.apache.pivot.wtk.MeterListene import org.apache.pivot.wtk.Orientation; -public class MeterTest implements MeterListener { +public final class MeterTest implements MeterListener { private int percentChangeCount = 0; private int textChangeCount = 0; private int orientationChangeCount = 0; @Override - public void percentageChanged(Meter meter, double previousPercentage) { + public void percentageChanged(final Meter meter, final double previousPercentage) { percentChangeCount++; } @Override - public void textChanged(Meter meter, String previousText) { + public void textChanged(final Meter meter, final String previousText) { textChangeCount++; } @Override - public void orientationChanged(Meter meter) { + public void orientationChanged(final Meter meter) { orientationChangeCount++; }