sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1701764 - in /sis/branches/JDK8/core/sis-metadata/src: main/java/org/apache/sis/io/wkt/Colors.java main/java/org/apache/sis/io/wkt/Formatter.java test/java/org/apache/sis/io/wkt/ColorsTest.java
Date Tue, 08 Sep 2015 10:14:38 GMT
Author: desruisseaux
Date: Tue Sep  8 10:14:38 2015
New Revision: 1701764

URL: http://svn.apache.org/r1701764
Log:
Minor tweak in syntax coloring for the command-line.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java?rev=1701764&r1=1701763&r2=1701764&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java [UTF-8]
(original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java [UTF-8]
Tue Sep  8 10:14:38 2015
@@ -65,7 +65,8 @@ public class Colors implements Cloneable
         map.put(ElementKind.CODE_LIST,  X364.FOREGROUND_CYAN);
         map.put(ElementKind.PARAMETER,  X364.FOREGROUND_GREEN);
         map.put(ElementKind.METHOD,     X364.FOREGROUND_GREEN);
-        map.put(ElementKind.DATUM,      X364.FOREGROUND_GREEN);
+        map.put(ElementKind.DATUM,      X364.FOREGROUND_BLUE);  // Because datum names in
SIS are like identifiers.
+        map.put(ElementKind.IDENTIFIER, X364.FOREGROUND_BLUE);
         map.put(ElementKind.SCOPE,      X364.FOREGROUND_GRAY);
         map.put(ElementKind.EXTENT,     X364.FOREGROUND_GRAY);
         map.put(ElementKind.CITATION,   X364.FOREGROUND_GRAY);

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1701764&r1=1701763&r2=1701764&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] Tue Sep  8 10:14:38 2015
@@ -760,6 +760,7 @@ public class Formatter implements Locali
             appendForSubtypes(object);
         }
         if (showIDs) {
+            @SuppressWarnings("null")
             Collection<? extends Identifier> identifiers = object.getIdentifiers();
             if (identifiers != null) {  // Paranoiac check
                 if (filterID) {
@@ -1111,7 +1112,11 @@ public class Formatter implements Locali
      */
     public void append(final long number) {
         appendSeparator();
-        setColor(ElementKind.INTEGER);
+        /*
+         * The check for 'isComplement' is a hack for ImmutableIdentifier.formatTo(Formatter).
+         * We do not have a public API for controlling the integer colors (it may not be
desirable).
+         */
+        setColor(isComplement ? ElementKind.IDENTIFIER : ElementKind.INTEGER);
         numberFormat.setMaximumFractionDigits(0);
         numberFormat.format(number, buffer, dummy);
         resetColor();

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java?rev=1701764&r1=1701763&r2=1701764&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java
[UTF-8] Tue Sep  8 10:14:38 2015
@@ -39,7 +39,8 @@ public final strictfp class ColorsTest e
     public void testGetName() {
         final Colors colors = Colors.DEFAULT;
         assertEquals("cyan",  colors.getName(ElementKind.CODE_LIST));
-        assertEquals("green", colors.getName(ElementKind.DATUM));
+        assertEquals("green", colors.getName(ElementKind.METHOD));
+        assertEquals("blue",  colors.getName(ElementKind.DATUM));
         assertEquals("red",   colors.getName(ElementKind.ERROR));
     }
 
@@ -50,9 +51,9 @@ public final strictfp class ColorsTest e
     @DependsOnMethod("testGetName")
     public void testSetName() {
         final Colors colors = new Colors(Colors.DEFAULT);
-        assertEquals("green", colors.getName(ElementKind.DATUM));
-        colors.setName(ElementKind.DATUM, "blue");
-        assertEquals("blue", colors.getName(ElementKind.DATUM));
+        assertEquals("green", colors.getName(ElementKind.METHOD));
+        colors.setName(ElementKind.METHOD, "blue");
+        assertEquals("blue", colors.getName(ElementKind.METHOD));
     }
 
     /**
@@ -61,7 +62,7 @@ public final strictfp class ColorsTest e
     @Test
     public void testImmutability() {
         try {
-            Colors.DEFAULT.setName(ElementKind.DATUM, "blue");
+            Colors.DEFAULT.setName(ElementKind.METHOD, "blue");
             fail("Constant shall be immutable.");
         } catch (UnsupportedOperationException e) {
             // This is the expected exception.
@@ -77,9 +78,9 @@ public final strictfp class ColorsTest e
     public void testSerialization() {
         assertSame(Colors.DEFAULT, assertSerializedEquals(Colors.DEFAULT));
         final Colors colors = new Colors(Colors.DEFAULT);
-        colors.setName(ElementKind.DATUM, "blue");
+        colors.setName(ElementKind.METHOD, "blue");
         final Colors c = assertSerializedEquals(colors);
         assertNotSame(colors, c); // Expect a new instance.
-        assertEquals("blue", c.getName(ElementKind.DATUM));
+        assertEquals("blue", c.getName(ElementKind.METHOD));
     }
 }



Mime
View raw message