Author: rwhitcomb Date: Wed Apr 4 18:13:04 2018 New Revision: 1828370 URL: http://svn.apache.org/viewvc?rev=1828370&view=rev Log: PIVOT-1032: Fix a number of the "easy" style errors in various files.
Modified: pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java pivot/trunk/core/src/org/apache/pivot/functional/functions/FunctionN.java pivot/trunk/core/src/org/apache/pivot/functional/functions/ProcedureN.java pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java pivot/trunk/core/src/org/apache/pivot/text/CompositeIterator.java pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java pivot/trunk/core/src/org/apache/pivot/util/Console.java pivot/trunk/core/src/org/apache/pivot/util/Time.java pivot/trunk/core/src/org/apache/pivot/xml/Element.java pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java pivot/trunk/demos/src/org/apache/pivot/demos/swing/SwingDemo.java pivot/trunk/examples/src/org/apache/pivot/examples/sheets/SheetSlideDirectionWindow.java pivot/trunk/tests/src/org/apache/pivot/tests/IterationTest.java pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindow.java pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java pivot/trunk/wtk/src/org/apache/pivot/wtk/Checkbox.java pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java pivot/trunk/wtk/src/org/apache/pivot/wtk/MenuButton.java pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButton.java pivot/trunk/wtk/src/org/apache/pivot/wtk/Ruler.java pivot/trunk/wtk/src/org/apache/pivot/wtk/TextPane.java pivot/trunk/wtk/src/org/apache/pivot/wtk/content/CalendarDateSpinnerData.java pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinDocumentView.java pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java Modified: pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java (original) +++ pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java Wed Apr 4 18:13:04 2018 @@ -20,7 +20,6 @@ import java.awt.Color; import java.awt.Font; import java.io.Serializable; -import org.apache.pivot.collections.Map; import org.apache.pivot.util.Utils; /** Modified: pivot/trunk/core/src/org/apache/pivot/functional/functions/FunctionN.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/functions/FunctionN.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/functional/functions/FunctionN.java (original) +++ pivot/trunk/core/src/org/apache/pivot/functional/functions/FunctionN.java Wed Apr 4 18:13:04 2018 @@ -22,5 +22,5 @@ package org.apache.pivot.functional.func */ public interface FunctionN<R, T> { @SuppressWarnings("unchecked") - public R apply(T ... a); + public R apply(T... a); } Modified: pivot/trunk/core/src/org/apache/pivot/functional/functions/ProcedureN.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/functions/ProcedureN.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/functional/functions/ProcedureN.java (original) +++ pivot/trunk/core/src/org/apache/pivot/functional/functions/ProcedureN.java Wed Apr 4 18:13:04 2018 @@ -22,5 +22,5 @@ package org.apache.pivot.functional.func */ public interface ProcedureN<T> { @SuppressWarnings("unchecked") - public void apply(T ... a); + public void apply(T... a); } Modified: pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java (original) +++ pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java Wed Apr 4 18:13:04 2018 @@ -77,9 +77,9 @@ public class MacroReader extends Reader private String getNextWord() throws IOException { StringBuilder buf = new StringBuilder(); int ch; - while ((ch = getNextChar(true)) != -1 && Character.isWhitespace(ch)) { - ; - } + do { + ch = getNextChar(true); + } while (ch != -1 && Character.isWhitespace(ch)); if (ch != -1) { buf.append((char)ch); while ((ch = getNextChar(true)) != -1 && @@ -95,9 +95,9 @@ public class MacroReader extends Reader private void skipToEol() throws IOException { int ch; - while ((ch = getNextChar(true)) != -1 && ch != '\n') { - ; - } + do { + ch = getNextChar(true); + } while (ch != -1 && ch != '\n'); } /** @@ -144,9 +144,9 @@ public class MacroReader extends Reader String name = getNextWord(); StringBuilder buf = new StringBuilder(); int ch; - while ((ch = getNextChar(true)) != -1 && Character.isWhitespace(ch) && ch != '\\' && ch != '\n') { - ; - } + do { + ch = getNextChar(true); + } while (ch != -1 && Character.isWhitespace(ch) && ch != '\\' && ch != '\n'); queue(ch); do { while ((ch = getNextChar(true)) != -1 && ch != '\\' && ch != '\n') { Modified: pivot/trunk/core/src/org/apache/pivot/text/CompositeIterator.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/text/CompositeIterator.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/text/CompositeIterator.java (original) +++ pivot/trunk/core/src/org/apache/pivot/text/CompositeIterator.java Wed Apr 4 18:13:04 2018 @@ -55,26 +55,26 @@ public class CompositeIterator implement fullLength += range; } this.endIndex = fullLength; - __setIndex(0); + setIndex0(0); } // CharacterIterator implementations public char first() { - return __setIndex(0); + return setIndex0(0); } public char last() { if (endIndex == 0) { - return __setIndex(endIndex); + return setIndex0(endIndex); } else { - return __setIndex(endIndex - 1); + return setIndex0(endIndex - 1); } } public char next() { if (currentIndex < endIndex) { - return __setIndex(currentIndex + 1); + return setIndex0(currentIndex + 1); } else { return DONE; } @@ -82,7 +82,7 @@ public class CompositeIterator implement public char previous() { if (currentIndex > 0) { - return __setIndex(currentIndex - 1); + return setIndex0(currentIndex - 1); } else { return DONE; } @@ -96,10 +96,10 @@ public class CompositeIterator implement // Note: this is a (0 < position <= endIndex) check, since "endIndex" is a valid value here Utils.checkIndexBounds(position, 0, endIndex); - return __setIndex(position); + return setIndex0(position); } - private char __setIndex(int position) { + private char setIndex0(int position) { currentIndex = position; int cumLength = 0; for (AttributedCharacterIterator iter : iterators) { Modified: pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java (original) +++ pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java Wed Apr 4 18:13:04 2018 @@ -25,7 +25,7 @@ import java.text.ParsePosition; * Converts a file size into a human-readable representation using binary * prefixes (1KB = 1024 bytes). */ -public class FileSizeFormat extends Format { +public final class FileSizeFormat extends Format { private static final long serialVersionUID = 9126510513247641698L; public static final int KILOBYTE = 1024; Modified: pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java Wed Apr 4 18:13:04 2018 @@ -392,7 +392,7 @@ public final class CalendarDate implemen long t1 = c1.getTimeInMillis(); long t2 = c2.getTimeInMillis(); - return (int) ((t1 - t2) / (1000l * 60 * 60 * 24)); + return (int) ((t1 - t2) / (1000L * 60 * 60 * 24)); } /** Modified: pivot/trunk/core/src/org/apache/pivot/util/Console.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Console.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/util/Console.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/Console.java Wed Apr 4 18:13:04 2018 @@ -19,7 +19,7 @@ package org.apache.pivot.util; /** * Utility class for a simple log to the console, for example from scripts. */ -public class Console { +public final class Console { private Console() { } Modified: pivot/trunk/core/src/org/apache/pivot/util/Time.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Time.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/util/Time.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/Time.java Wed Apr 4 18:13:04 2018 @@ -29,7 +29,6 @@ import org.apache.pivot.collections.List import org.apache.pivot.collections.Sequence; import org.apache.pivot.json.JSONSerializer; import org.apache.pivot.serialization.SerializationException; -import org.apache.pivot.util.Utils; /** * Class representing a time of day, independent of any particular time zone. Modified: pivot/trunk/core/src/org/apache/pivot/xml/Element.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/Element.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/src/org/apache/pivot/xml/Element.java (original) +++ pivot/trunk/core/src/org/apache/pivot/xml/Element.java Wed Apr 4 18:13:04 2018 @@ -173,7 +173,7 @@ public class Element extends Node implem /** * Sequence representing the attributes declared by this element. */ - public class AttributeSequence implements Sequence<Attribute>, Iterable<Attribute> { + public final class AttributeSequence implements Sequence<Attribute>, Iterable<Attribute> { private AttributeSequence() { } @@ -312,7 +312,7 @@ public class Element extends Node implem /** * Dictionary representing the namespaces declared by this element. */ - public class NamespaceDictionary implements Dictionary<String, String>, Iterable<String> { + public final class NamespaceDictionary implements Dictionary<String, String>, Iterable<String> { private NamespaceDictionary() { } @@ -393,7 +393,7 @@ public class Element extends Node implem /** * Dictionary representing the attributes declared by this element. */ - public class ElementDictionary implements Dictionary<String, String> { + public final class ElementDictionary implements Dictionary<String, String> { private ElementDictionary() { } Modified: pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java (original) +++ pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java Wed Apr 4 18:13:04 2018 @@ -38,11 +38,11 @@ public class BeanAdapterTest { private static Random rnd; - BeanAdapterSampleObject src_test; + BeanAdapterSampleObject srcTest; JSONSerializer jsonSerializer; StringWriter writer; StringReader reader; - BeanAdapterSampleObject target_test; + BeanAdapterSampleObject targetTest; @BeforeClass public static void setUpClass() { @@ -58,87 +58,87 @@ public class BeanAdapterTest { @Before public void setUp() { - src_test = new BeanAdapterSampleObject(); + srcTest = new BeanAdapterSampleObject(); jsonSerializer = new JSONSerializer(BeanAdapterSampleObject.class); writer = new StringWriter(); } @After public void tearDown() { - src_test = null; + srcTest = null; jsonSerializer = null; writer = null; reader = null; - target_test = null; + targetTest = null; } @Test public void testSerializeBigDecimal() { System.out.println("testSerializeBigDecimal"); - double random_double = rnd.nextDouble(); - System.out.println("random_double = " + random_double + double randomDouble = rnd.nextDouble(); + System.out.println("randomDouble = " + randomDouble + " (value will be truncated to 4 digits in this test)"); - src_test.setBd(new BigDecimal(random_double, new MathContext(4))); + srcTest.setBd(new BigDecimal(randomDouble, new MathContext(4))); try { - jsonSerializer.writeObject(src_test, writer); + jsonSerializer.writeObject(srcTest, writer); } catch (Exception e) { e.printStackTrace(); fail(); return; } - System.out.println("json string from src_test = " + writer.toString()); - System.out.println("src_test.getBd() = " + src_test.getBd()); + System.out.println("json string from srcTest = " + writer.toString()); + System.out.println("srcTest.getBd() = " + srcTest.getBd()); reader = new StringReader(writer.toString()); try { - target_test = (BeanAdapterSampleObject) jsonSerializer.readObject(reader); + targetTest = (BeanAdapterSampleObject) jsonSerializer.readObject(reader); } catch (Exception e) { e.printStackTrace(); fail(); return; } - System.out.println("target_test.getBd() = " + target_test.getBd()); - assertEquals(src_test.getBd().doubleValue(), target_test.getBd().doubleValue(), 0.0001); + System.out.println("targetTest.getBd() = " + targetTest.getBd()); + assertEquals(srcTest.getBd().doubleValue(), targetTest.getBd().doubleValue(), 0.0001); } @Test public void testSerializeBigInteger() { System.out.println("testSerializeBigInteger"); - int random_int = rnd.nextInt(); - System.out.println("random_int = " + random_int); + int randomInt = rnd.nextInt(); + System.out.println("randomInt = " + randomInt); - src_test.setBi(new BigInteger(String.valueOf(random_int))); + srcTest.setBi(new BigInteger(String.valueOf(randomInt))); try { - jsonSerializer.writeObject(src_test, writer); + jsonSerializer.writeObject(srcTest, writer); } catch (Exception e) { e.printStackTrace(); fail(); return; } - System.out.println("json string from src_test = " + writer.toString()); - System.out.println("src_test.getBi() = " + src_test.getBi()); + System.out.println("json string from srcTest = " + writer.toString()); + System.out.println("srcTest.getBi() = " + srcTest.getBi()); reader = new StringReader(writer.toString()); try { - target_test = (BeanAdapterSampleObject) jsonSerializer.readObject(reader); + targetTest = (BeanAdapterSampleObject) jsonSerializer.readObject(reader); } catch (Exception e) { e.printStackTrace(); fail(); return; } - System.out.println("target_test.getBi() = " + target_test.getBi()); - assertEquals(src_test.getBi(), target_test.getBi()); + System.out.println("targetTest.getBi() = " + targetTest.getBi()); + assertEquals(srcTest.getBi(), targetTest.getBi()); } @Test @@ -148,31 +148,31 @@ public class BeanAdapterTest { String value = "A test String"; System.out.println("String value = \"" + value + "\""); - src_test.setString(value); + srcTest.setString(value); try { - jsonSerializer.writeObject(src_test, writer); + jsonSerializer.writeObject(srcTest, writer); } catch (Exception e) { e.printStackTrace(); fail(); return; } - System.out.println("json string from src_test = " + writer.toString()); - System.out.println("src_test.getString() = \"" + src_test.getString() + "\""); + System.out.println("json string from srcTest = " + writer.toString()); + System.out.println("srcTest.getString() = \"" + srcTest.getString() + "\""); reader = new StringReader(writer.toString()); try { - target_test = (BeanAdapterSampleObject) jsonSerializer.readObject(reader); + targetTest = (BeanAdapterSampleObject) jsonSerializer.readObject(reader); } catch (Exception e) { e.printStackTrace(); fail(); return; } - System.out.println("target_test.getString() = \"" + target_test.getString() + "\""); - assertEquals(src_test.getString(), target_test.getString()); + System.out.println("targetTest.getString() = \"" + targetTest.getString() + "\""); + assertEquals(srcTest.getString(), targetTest.getString()); } } Modified: pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java (original) +++ pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java Wed Apr 4 18:13:04 2018 @@ -32,44 +32,65 @@ import org.apache.pivot.serialization.Se import org.apache.pivot.serialization.StringSerializer; import org.junit.Test; -public class StringSerializerTest { +/** + * Test functionality of the {@link StringSerializer} class. + */ +public final class StringSerializerTest { + /** The standard UTF-8 character set. */ private static final Charset UTF_8 = StandardCharsets.UTF_8; - // Note: include a real Unicode character to test the UTF-8 encoding - public static final String testString = "// \n" + "// Hello from " + /** A test string that includes a real Unicode character to test the UTF-8 encoding. */ + public static final String TEST_STRING = "// \n" + "// Hello from " + StringSerializerTest.class.getSimpleName() + "\n" + "// \u03C0 r square \n" + "// \n"; - public static final byte[] testBytes = testString.getBytes(UTF_8); + /** The UTF-8 bytes of the {@link #TEST_STRING} for use in comparisons. */ + public static final byte[] TEST_BYTES = TEST_STRING.getBytes(UTF_8); - public void log(String msg) { + /** Log a message to the console. + * @param msg The message string to display. + */ + public void log(final String msg) { System.out.println(msg); } - public void logBytes(String msg, byte[] b) { + /** + * Dump the given string of bytes along with a message to the console + * using the {@link #log} method. + * @param msg The assocated message to display. + * @param b The string of bytes to display. + */ + public void logBytes(final String msg, final byte[] b) { StringBuilder buf = new StringBuilder(b.length * 4); buf.append('['); for (int i = 0; i < b.length; i++) { - if (i > 0) + if (i > 0) { buf.append(','); - int ib = ((int)b[i]) & 0xFF; + } + int ib = ((int) b[i]) & 0xFF; String hex = Integer.toHexString(ib).toUpperCase(); - if (hex.length() < 2) + if (hex.length() < 2) { buf.append('0'); + } buf.append(hex); } buf.append(']'); log(msg + ": " + buf.toString() + "\n"); } + /** + * Test reading of values using the serializer. + * @throws IOException because we use streams. + * @throws SerializationException because it is a serializer. + */ @Test public void readValues() throws IOException, SerializationException { log("readValues()"); Serializer<String> serializer = new StringSerializer(UTF_8); - ByteArrayInputStream inputStream = new ByteArrayInputStream(testBytes); + ByteArrayInputStream inputStream = new ByteArrayInputStream(TEST_BYTES); String result = serializer.readObject(inputStream); assertNotNull(result); - assertEquals(result, testString); + assertEquals(result, TEST_STRING); // dump content, but useful only for text resources ... String dump = result; @@ -81,30 +102,35 @@ public class StringSerializerTest { assertTrue(dumpLength > 0); } + /** + * Test writing of values using the serializer. + * @throws IOException because we use streams. + * @throws SerializationException because it is a serializer. + */ @Test public void writeValues() throws IOException, SerializationException { log("writeValues()"); -log("test string = \"" + testString + "\""); +log("test string = \"" + TEST_STRING + "\""); // Note: assume the default Charset for StringSerializer is UTF-8, which we are using here Serializer<String> serializer = new StringSerializer(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - serializer.writeObject(testString, outputStream); + serializer.writeObject(TEST_STRING, outputStream); outputStream.flush(); outputStream.close(); String result = outputStream.toString(UTF_8.name()); assertNotNull(result); - assertEquals(result, testString); + assertEquals(result, TEST_STRING); byte[] resultBytes = outputStream.toByteArray(); - assertArrayEquals(resultBytes, testBytes); + assertArrayEquals(resultBytes, TEST_BYTES); // dump content, but useful only for text resources ... log("Result: " + resultBytes.length + " bytes \n" + result); logBytes("Result bytes", resultBytes); - logBytes(" Test bytes", testBytes); + logBytes(" Test bytes", TEST_BYTES); assertTrue(resultBytes.length > 0); } Modified: pivot/trunk/demos/src/org/apache/pivot/demos/swing/SwingDemo.java URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/swing/SwingDemo.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/demos/swing/SwingDemo.java (original) +++ pivot/trunk/demos/src/org/apache/pivot/demos/swing/SwingDemo.java Wed Apr 4 18:13:04 2018 @@ -175,4 +175,5 @@ public class SwingDemo extends Applicati throw new RuntimeException(exception); } } -} \ No newline at end of file +} + Modified: pivot/trunk/examples/src/org/apache/pivot/examples/sheets/SheetSlideDirectionWindow.java URL: http://svn.apache.org/viewvc/pivot/trunk/examples/src/org/apache/pivot/examples/sheets/SheetSlideDirectionWindow.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/examples/src/org/apache/pivot/examples/sheets/SheetSlideDirectionWindow.java (original) +++ pivot/trunk/examples/src/org/apache/pivot/examples/sheets/SheetSlideDirectionWindow.java Wed Apr 4 18:13:04 2018 @@ -118,4 +118,5 @@ public class SheetSlideDirectionWindow e }); } -} \ No newline at end of file +} + Modified: pivot/trunk/tests/src/org/apache/pivot/tests/IterationTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/IterationTest.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/IterationTest.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/IterationTest.java Wed Apr 4 18:13:04 2018 @@ -16,11 +16,22 @@ */ package org.apache.pivot.tests; -public class IterationTest { - public static void main(String[] args) { - long t0 = System.currentTimeMillis(); +/** + * Test the speed of doing integer increments. + */ +public final class IterationTest { + /** Private constructor since we use only static methods. */ + private IterationTest() { + } - final int COUNT = 100000000; + /** The number of iterations we want to perform. */ + static final int COUNT = 100000000; + + /** Run the test. + * @param args The command line arguments (which are ignored here). + */ + public static void main(final String[] args) { + long t0 = System.currentTimeMillis(); int i = 0; while (i < COUNT) { Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java Wed Apr 4 18:13:04 2018 @@ -22,7 +22,7 @@ import org.apache.pivot.wtk.content.Tabl /** * Minimal sample for a customized version of table cell renderer. Renders cell * contents as a string, but in this case, transformed. <br/> Note that here - * it's possible to "extends Label implements TableView.CellRenderer", + * it's possible to "extends Label implements TableView.CellRenderer", * or even to extend directly TableViewCellRenderer (because it already extends * Label and implements TableView.CellRenderer). */ Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java Wed Apr 4 18:13:04 2018 @@ -45,7 +45,7 @@ public class Pivot964Swing extends javax /** Creates new form SVGIconDemo */ public Pivot964Swing() { initComponents(); - panel_display.add(panel, BorderLayout.CENTER); + panelDisplay.add(panel, BorderLayout.CENTER); pack(); } @@ -56,14 +56,14 @@ public class Pivot964Swing extends javax */ // <editor-fold defaultstate="collapsed" desc=" Generated Code "> private void initComponents() { - panel_display = new javax.swing.JPanel(); + panelDisplay = new javax.swing.JPanel(); button1 = new javax.swing.JButton(); button2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - panel_display.setLayout(new java.awt.BorderLayout()); + panelDisplay.setLayout(new java.awt.BorderLayout()); - getContentPane().add(panel_display, java.awt.BorderLayout.CENTER); + getContentPane().add(panelDisplay, java.awt.BorderLayout.CENTER); button1.setText("Visible"); button1.addActionListener(new java.awt.event.ActionListener() { @@ -99,8 +99,8 @@ public class Pivot964Swing extends javax } }); - panel_display.add(button1, java.awt.BorderLayout.EAST); - panel_display.add(button2, java.awt.BorderLayout.WEST); + panelDisplay.add(button1, java.awt.BorderLayout.EAST); + panelDisplay.add(button2, java.awt.BorderLayout.WEST); pack(); } // </editor-fold> @@ -117,7 +117,7 @@ public class Pivot964Swing extends javax // Variables declaration - do not modify private javax.swing.JButton button1; private javax.swing.JButton button2; - private javax.swing.JPanel panel_display; + private javax.swing.JPanel panelDisplay; // End of variables declaration } Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindow.java URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindow.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindow.java (original) +++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindow.java Wed Apr 4 18:13:04 2018 @@ -41,10 +41,10 @@ public class FakeWindow extends Containe public final Window window; - public FakeWindow(Window _window) { - Component contentLocal = _window.getContent(); - _window.setContent(null); - this.window = _window; + public FakeWindow(Window realWindow) { + Component contentLocal = realWindow.getContent(); + realWindow.setContent(null); + this.window = realWindow; window.getWindowListeners().add(new WindowListener() { @Override Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java Wed Apr 4 18:13:04 2018 @@ -1486,15 +1486,17 @@ public class TerraTabPaneSkin extends Ta case Keyboard.KeyCode.TAB: selectedIndex = tabPane.getSelectedIndex(); if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) { - if (selectedIndex <= 0) + if (selectedIndex <= 0) { selectedIndex = tabs.getLength() - 1; - else + } else { selectedIndex--; + } } else { - if (selectedIndex >= tabs.getLength() - 1) + if (selectedIndex >= tabs.getLength() - 1) { selectedIndex = 0; - else + } else { selectedIndex++; + } } break; Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java Wed Apr 4 18:13:04 2018 @@ -164,8 +164,9 @@ public class TerraVFSBrowserSkin extends try { boolean hidden = false; if (file != null) { - if (file.getName().getBaseName().length() != 0 && file.isHidden()) + if (file.getName().getBaseName().length() != 0 && file.isHidden()) { hidden = true; + } } return hidden; } Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Wed Apr 4 18:13:04 2018 @@ -1782,7 +1782,7 @@ public abstract class ApplicationContext /** * Class representing a queued callback. */ - public static class QueuedCallback implements Runnable { + public static final class QueuedCallback implements Runnable { private Runnable callback; private volatile boolean executed = false; private volatile boolean cancelled = false; Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Checkbox.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Checkbox.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Checkbox.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Checkbox.java Wed Apr 4 18:13:04 2018 @@ -18,7 +18,6 @@ package org.apache.pivot.wtk; import org.apache.pivot.annotations.UnsupportedOperation; import org.apache.pivot.beans.DefaultProperty; -import org.apache.pivot.wtk.Style; import org.apache.pivot.wtk.content.ButtonDataRenderer; /** Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java Wed Apr 4 18:13:04 2018 @@ -816,7 +816,7 @@ public abstract class Container extends return containerMouseListeners; } - public interface EDT_Checker { + public interface EDTChecker { public void check(Component component); } @@ -824,7 +824,7 @@ public abstract class Container extends assertEventDispatchThread(this); } - private static EDT_Checker EDT_CHECKER = new EDT_Checker() { + private static EDTChecker EDT_CHECKER = new EDTChecker() { @Override public void check(Component component) { String threadName = Thread.currentThread().getName(); @@ -861,7 +861,7 @@ public abstract class Container extends } } - public static final void setEventDispatchThreadChecker(EDT_Checker runnable) { + public static final void setEventDispatchThreadChecker(EDTChecker runnable) { EDT_CHECKER = runnable; } } Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/MenuButton.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/MenuButton.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/MenuButton.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/MenuButton.java Wed Apr 4 18:13:04 2018 @@ -18,7 +18,6 @@ package org.apache.pivot.wtk; import org.apache.pivot.beans.DefaultProperty; import org.apache.pivot.util.ListenerList; -import org.apache.pivot.wtk.Style; import org.apache.pivot.wtk.content.ButtonDataRenderer; /** Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButton.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButton.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButton.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButton.java Wed Apr 4 18:13:04 2018 @@ -17,7 +17,6 @@ package org.apache.pivot.wtk; import org.apache.pivot.beans.DefaultProperty; -import org.apache.pivot.wtk.Style; import org.apache.pivot.wtk.content.ButtonDataRenderer; /** Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Ruler.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Ruler.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Ruler.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Ruler.java Wed Apr 4 18:13:04 2018 @@ -18,8 +18,6 @@ package org.apache.pivot.wtk; import org.apache.pivot.util.ListenerList; import org.apache.pivot.util.Utils; -import org.apache.pivot.wtk.Component; -import org.apache.pivot.wtk.Orientation; /** * A viewport header that displays a ruler along either the top or left side. Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TextPane.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextPane.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/TextPane.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TextPane.java Wed Apr 4 18:13:04 2018 @@ -32,7 +32,6 @@ import org.apache.pivot.text.CharSpan; import org.apache.pivot.util.ListenerList; import org.apache.pivot.util.StringUtils; import org.apache.pivot.util.Utils; -import org.apache.pivot.wtk.Span; import org.apache.pivot.wtk.media.Image; import org.apache.pivot.wtk.text.Block; import org.apache.pivot.wtk.text.ComponentNode; Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/content/CalendarDateSpinnerData.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/CalendarDateSpinnerData.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/content/CalendarDateSpinnerData.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/content/CalendarDateSpinnerData.java Wed Apr 4 18:13:04 2018 @@ -108,7 +108,7 @@ public class CalendarDateSpinnerData imp upperBoundCalendar.setTimeZone(TimeZone.getTimeZone("GMT")); long lowerBoundMilliseconds = calendar.getTimeInMillis(); long upperBoundMilliseconds = upperBoundCalendar.getTimeInMillis(); - long indexDiff = (upperBoundMilliseconds - lowerBoundMilliseconds) / (1000l * 60 * 60 * 24); + long indexDiff = (upperBoundMilliseconds - lowerBoundMilliseconds) / (1000L * 60 * 60 * 24); length = (int) indexDiff + 1; } @@ -183,7 +183,7 @@ public class CalendarDateSpinnerData imp tmpCalendar.setTimeZone(TimeZone.getTimeZone("GMT")); long itemMilliseconds = tmpCalendar.getTimeInMillis(); - long indexDiff = (itemMilliseconds - currentMilliseconds) / (1000l * 60 * 60 * 24); + long indexDiff = (itemMilliseconds - currentMilliseconds) / (1000L * 60 * 60 * 24); int index = calendarIndex + (int) indexDiff; return (index < 0 || index >= length) ? -1 : index; Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java Wed Apr 4 18:13:04 2018 @@ -155,4 +155,5 @@ class TextPaneSkinComponentNodeView exte previousComponent.getComponentListeners().remove(myComponentListener); } } -} \ No newline at end of file +} + Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinDocumentView.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinDocumentView.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinDocumentView.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinDocumentView.java Wed Apr 4 18:13:04 2018 @@ -40,4 +40,5 @@ class TextPaneSkinDocumentView extends T textPaneSkin.invalidateComponent(); } -} \ No newline at end of file +} + Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java Wed Apr 4 18:13:04 2018 @@ -158,4 +158,5 @@ class TextPaneSkinImageNodeView extends public void regionUpdated(Image image, int x, int y, int width, int height) { repaint(x, y, width, height); } -} \ No newline at end of file +} + Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java?rev=1828370&r1=1828369&r2=1828370&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java Wed Apr 4 18:13:04 2018 @@ -79,4 +79,5 @@ class TextPaneSkinListItemView extends T public int getIndexTextWidth() { return indexTextNodeView.getWidth(); } -} \ No newline at end of file +} +