svn commit: r1884971 - in /pivot/trunk/core/src/org/apache/pivot: collections/ArrayList.java util/StringUtils.java

2020-12-30 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Dec 30 23:25:48 2020
New Revision: 1884971

URL: http://svn.apache.org/viewvc?rev=1884971=rev
Log:
Enhance StringUtils.toString and use more places.

Modified:
pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java

Modified: pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java?rev=1884971=1884970=1884971=diff
==
--- pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java Wed Dec 30 
23:25:48 2020
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import java.util.NoSuchElementException;
 
 import org.apache.pivot.util.ListenerList;
+import org.apache.pivot.util.StringUtils;
 import org.apache.pivot.util.Utils;
 
 /**
@@ -609,19 +610,7 @@ public class ArrayList implements Lis
 StringBuilder sb = new StringBuilder();
 
 sb.append(getClass().getSimpleName());
-sb.append(" [");
-
-int i = 0;
-for (T item : this) {
-if (i > 0) {
-sb.append(", ");
-}
-
-sb.append(item);
-i++;
-}
-
-sb.append("]");
+StringUtils.append(sb, this);
 
 return sb.toString();
 }

Modified: pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java?rev=1884971=1884970=1884971=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java Wed Dec 30 
23:25:48 2020
@@ -25,6 +25,7 @@ import java.math.BigInteger;
  * functions.
  */
 public final class StringUtils {
+/** Private constructor since this is a utility class. */
 private StringUtils() {
 }
 
@@ -190,6 +191,8 @@ public final class StringUtils {
  * that looks like:
  * [item1, item2, ...]
  * appending the results to the given string builder for further use.
+ *  If the {@link StringBuilder} has any preceding text (that is, 
length  0)
+ * then append a blank before the list representation.
  *
  * @param  The type of items in the list.
  * @param sb The {@link StringBuilder} already in progress.
@@ -197,7 +200,11 @@ public final class StringUtils {
  * @return The input {@code StringBuilder} for further use.
  */
 public static  StringBuilder append(final StringBuilder sb, final 
Iterable list) {
-sb.append("[");
+// Separate this text from any preceding text
+if (sb.length() > 0) {
+sb.append(' ');
+}
+sb.append('[');
 
 int i = 0;
 for (T item : list) {
@@ -209,7 +216,7 @@ public final class StringUtils {
 i++;
 }
 
-sb.append("]");
+sb.append(']');
 
 return sb;
 }




svn commit: r1884965 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java

2020-12-30 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Dec 30 23:02:39 2020
New Revision: 1884965

URL: http://svn.apache.org/viewvc?rev=1884965=rev
Log:
Add more alternate flavors of DesktopApplicationContext.main for
other situations.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java

Modified: 
pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java?rev=1884965=1884964=1884965=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java 
(original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java Wed 
Dec 30 23:02:39 2020
@@ -882,6 +882,26 @@ public final class DesktopApplicationCon
  * into applications. For example:
  *  public class MyApp implements Application {
  *   public static void main(String[] args) throws Exception {
+ * DesktopApplicationContext.main(MyApp.class);
+ *   }
+ * } 
+ *
+ * @param applicationClass the class of Application entry point
+ */
+public static final void main(Class 
applicationClass) {
+String[] args = new String[1];
+
+args[0] = applicationClass.getName();
+
+main(args);
+}
+
+/**
+/**
+ * Utility method to make it easier to define main() entry-points
+ * into applications. For example:
+ *  public class MyApp implements Application {
+ *   public static void main(String[] args) throws Exception {
  * DesktopApplicationContext.main(MyApp.class, args);
  *   }
  * } 
@@ -892,8 +912,32 @@ public final class DesktopApplicationCon
 public static final void main(Class 
applicationClass,
 String[] applicationArgs) {
 String[] args = new String[applicationArgs.length + 1];
-System.arraycopy(applicationArgs, 0, args, 1, applicationArgs.length);
+
 args[0] = applicationClass.getName();
+
+System.arraycopy(applicationArgs, 0, args, 1, applicationArgs.length);
+
+main(args);
+}
+
+/**
+ * Utility method to make it easier to define main() entry-points
+ * into applications. This is useful if application instance has
+ * already been created, for example from a scripting environment and I set
+ * some external properties in the application for later reuse, so I must
+ * use that instance. But it's important to NOT call usual methods of
+ * application lifecycle before passing it here, to avoid side effects.
+ *
+ * @param applicationInstance an instance of Application entry point
+ */
+public static final void main(Application applicationInstance) {
+String[] args = new String[2];
+
+args[0] = applicationInstance.getClass().getName();
+args[1] = "--" + USE_APPLICATION_INSTANCE_ARGUMENT + "=true";
+
+this.application = applicationInstance;
+
 main(args);
 }
 
@@ -910,10 +954,13 @@ public final class DesktopApplicationCon
  */
 public static final void main(Application applicationInstance, String[] 
applicationArgs) {
 String[] args = new String[applicationArgs.length + 2];
-System.arraycopy(applicationArgs, 0, args, 1, applicationArgs.length);
+
 args[0] = applicationInstance.getClass().getName();
-args[applicationArgs.length + 1] = "--" + 
USE_APPLICATION_INSTANCE_ARGUMENT + "=" + "true";
-application = applicationInstance;
+args[1] = "--" + USE_APPLICATION_INSTANCE_ARGUMENT + "=true";
+
+System.arraycopy(applicationArgs, 0, args, 2, applicationArgs.length);
+this.application = applicationInstance;
+
 main(args);
 }
 




svn commit: r1884970 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

2020-12-30 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Dec 30 23:21:51 2020
New Revision: 1884970

URL: http://svn.apache.org/viewvc?rev=1884970=rev
Log:
New methods in Keyboard class.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java?rev=1884970=1884969=1884970=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java Wed Dec 30 23:21:51 
2020
@@ -50,7 +50,7 @@ public final class Keyboard {
  * @param modifiers The set of modifiers to test.
  * @return The complete mask corresponding to the set.
  */
-public static int getCompleteMask(final Set modifiers) {
+public static int getMask(final Set modifiers) {
int mask = 0;
for (Modifier mod : modifiers) {
mask |= mod.getMask();
@@ -59,8 +59,22 @@ public final class Keyboard {
 }
 
 /**
- * The set of all possible keyboard modifiers (for use with {@link 
#isPressed}
- * or {@link #areAnyPressed}).
+ * Determine the complete mask for all the given modifiers.
+ * @param modifiers The list of modifiers to test.
+ * @return The complete mask corresponding to the list.
+ */
+public static int getMask(final Modifier... modifiers) {
+   int mask = 0;
+   for (Modifier mod : modifiers) {
+   mask |= mod.getMask();
+   }
+   return mask;
+}
+
+/**
+ * The set of all possible keyboard modifiers (for use with {@link 
#isPressed},
+ * or {@link Modifier#getMask(Set)}, {@link #areAllPressed(Set)}, or
+ * {@link #areAnyPressed(Set)}).
  */
 public static final Set ALL_MODIFIERS =
 EnumSet.of(Modifier.SHIFT, Modifier.CTRL, Modifier.ALT, 
Modifier.META);
@@ -309,19 +323,64 @@ public final class Keyboard {
  * otherwise.
  */
 public static boolean isPressed(final Modifier modifier) {
-return (Keyboard.modifiers & modifier.getMask()) > 0;
+return (modifiers & modifier.getMask()) > 0;
 }
 
 /**
  * Are any of the given set of {@link Modifier}s pressed?
  *
- * @param modifiers The set of modifiers to test.
+ * @param modifierSet The set of modifiers to test.
+ * @return true if any of them are pressed, false
+ * if none are pressed.
+ */
+public static boolean areAnyPressed(final Set modifierSet) {
+return (modifiers & Modifier.getMask(modifierSet)) > 0;
+}
+
+/**
+ * Are any of the given list of {@link Modifier}s pressed?
+ *
+ * @param modifierList The list of modifiers to test.
  * @return true if any of them are pressed, false
  * if none are pressed.
  */
-public static boolean areAnyPressed(final Set modifiers) {
-int completeMask = Modifier.getCompleteMask(modifiers);
-return (Keyboard.modifiers & completeMask) > 0;
+public static boolean areAnyPressed(final Modifier... modifierList) {
+return (modifiers & Modifier.getMask(modifierList)) > 0;
+}
+
+/**
+ * Are all of the given set of {@link Modifier}s pressed?
+ *  This is typically used to test two modifiers (like CTRL and SHIFT).
+ *
+ * @param modifierSet The set of modifiers to test.
+ * @return true if all of the modifiers are pressed, 
false
+ * if only some or none are pressed.
+ */
+public static boolean areAllPressed(final Set modifierSet) {
+int mask = Modifier.getMask(modifierSet);
+return (modifiers & mask) == mask;
+}
+
+/**
+ * Are all of the given list of {@link Modifier}s pressed?
+ *  This is typically used to test two modifiers (like CTRL and SHIFT).
+ *
+ * @param modifierList The list of modifiers to test.
+ * @return true if all of the modifiers are pressed, 
false
+ * if only some or none are pressed.
+ */
+public static boolean areAllPressed(final Modifier... modifierList) {
+int mask = Modifier.getMask(modifierList);
+return (modifiers & mask) == mask;
+}
+
+/**
+ * Shortcut method to test if the {@link Platform#getCommandModifier} is 
pressed.
+ *
+ * @return The result of {@code isPressed(Platform.getCommandModifier())}.
+ */
+public static boolean isCmdPressed() {
+return isPressed(Platform.getCommandModifier());
 }
 
 /**
@@ -333,7 +392,7 @@ public final class Keyboard {
 DropAction dropAction = null;
 
 if (Platform.isOSX()) {
-if (isPressed(Modifier.ALT) && isPressed(Modifier.META)) {
+if (areAllPressed(Modifier.ALT, Modifier.META)) {
   

svn commit: r1885468 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java

2021-01-13 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 05:40:34 2021
New Revision: 1885468

URL: http://svn.apache.org/viewvc?rev=1885468=rev
Log:
PIVOT-1051: Correction to font code in Theme.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java?rev=1885468=1885467=1885468=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java Thu Jan 14 05:40:34 2021
@@ -81,6 +81,9 @@ public abstract class Theme {
 /** Key for the font italic style in a font dictionary. */
 public static final String ITALIC_KEY = "italic";
 
+/** Default point size for the theme font. */
+private static final int DEFAULT_POINT_SIZE = 12;
+
 /**
  * The service provider name (see {@link Service#getProvider(String)}).
  */
@@ -314,7 +317,7 @@ public abstract class Theme {
 name = (String) dictionary.get(NAME_KEY);
 }
 
-int size = (font != null) ? font.getSize() : 12;
+int size = (font != null) ? font.getSize() : DEFAULT_POINT_SIZE;
 if (dictionary.containsKey(SIZE_KEY)) {
 size = FontUtilities.decodeFontSize(dictionary.get(SIZE_KEY), 
size);
 }




svn commit: r1885470 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html

2021-01-13 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 06:03:44 2021
New Revision: 1885470

URL: http://svn.apache.org/viewvc?rev=1885470=rev
Log:
Add a little text to the wtk-terra package doc.

Modified:
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html?rev=1885470=1885469=1885470=diff
==
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html 
(original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html Thu 
Jan 14 06:03:44 2021
@@ -150,6 +150,8 @@ For Example, in VM arguments set:
 
-Dorg.apache.pivot.wtk.skin.terra.location=TerraTheme_dark.json
 or
 
-Dorg.apache.pivot.wtk.skin.terra.location=/org/apache/pivot/tests/TerraTheme_test.json
+or in the constructor of your class with:
+System.setProperty("org.apache.pivot.wtk.skin.terra.location", 
"/TerraTheme_dark_flat.json");
 
 
 




svn commit: r1885469 - in /pivot/trunk: demos/src/org/apache/pivot/demos/colors/Colors.java wtk/src/org/apache/pivot/wtk/CSSColor.java

2021-01-13 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 06:01:39 2021
New Revision: 1885469

URL: http://svn.apache.org/viewvc?rev=1885469=rev
Log:
Enhancements to the CSSColor demo.

Modified:
pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java

Modified: pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java?rev=1885469=1885468=1885469=diff
==
--- pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java Thu Jan 14 
06:01:39 2021
@@ -17,14 +17,18 @@
 package org.apache.pivot.demos.colors;
 
 import java.awt.Color;
+import java.awt.Font;
+import java.util.Set;
 import org.apache.pivot.collections.Map;
+import org.apache.pivot.util.StringUtils;
 import org.apache.pivot.wtk.Application;
 import org.apache.pivot.wtk.Border;
 import org.apache.pivot.wtk.BoxPane;
 import org.apache.pivot.wtk.CSSColor;
 import org.apache.pivot.wtk.DesktopApplicationContext;
 import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.FlowPane;
+import org.apache.pivot.wtk.FontUtilities;
+import org.apache.pivot.wtk.GridPane;
 import org.apache.pivot.wtk.HorizontalAlignment;
 import org.apache.pivot.wtk.Label;
 import org.apache.pivot.wtk.Orientation;
@@ -33,38 +37,92 @@ import org.apache.pivot.wtk.Style;
 import org.apache.pivot.wtk.Window;
 
 public final class Colors implements Application {
+private static final int CELLS_PER_ROW = 5;
+
 private Window mainWindow;
+
+private Label makeLabel(final String text) {
+Label label = new Label(text);
+label.getStyles().put(Style.horizontalAlignment, 
HorizontalAlignment.CENTER);
+return label;
+}
+
 @Override
-public void startup(Display display, Map properties) {
-FlowPane flowPane = new FlowPane();
-flowPane.getStyles().put(Style.padding, 6);
+public void startup(final Display display, final Map 
properties) {
+GridPane gridPane = new GridPane(CELLS_PER_ROW);
+gridPane.getStyles().put(Style.padding, 6);
+
+Font fontBold= 
FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.BOLD,   13);
+Font fontRegular = 
FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.PLAIN,  12);
+Font fontItalic  = 
FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.ITALIC, 11);
+
+int cell = 0;
+GridPane.Row row = null;
+
+int numColors = CSSColor.numberOfColors();
+
 for (CSSColor color : CSSColor.values()) {
+if (cell % CELLS_PER_ROW == 0) {
+row = new GridPane.Row(gridPane);
+}
+
 BoxPane container = new BoxPane(Orientation.VERTICAL);
 container.getStyles().put(Style.padding, 4);
 container.getStyles().put(Style.fill, true);
+
 BoxPane colorFill = new BoxPane(Orientation.VERTICAL);
-Color fillColor = color.getColor();
+
+Color fillColor  = color.getColor();
+String colorName = color.toString();
+int r = fillColor.getRed();
+int g = fillColor.getGreen();
+int b = fillColor.getBlue();
+
 colorFill.getStyles().put(Style.backgroundColor, fillColor);
-colorFill.setMinimumWidth(50);
-colorFill.setPreferredHeight(50);
-
colorFill.setTooltipText(String.format("%1$s=R:%2$3d,G:%3$3d,B:%4$3d",
-color.toString(), fillColor.getRed(), 
fillColor.getGreen(), fillColor.getBlue()));
-Label nameLabel = new Label(color.toString());
-nameLabel.getStyles().put(Style.horizontalAlignment, 
HorizontalAlignment.CENTER);
+colorFill.setPreferredWidth(372);
+colorFill.setPreferredHeight(100);
+Set matchingColors = CSSColor.getMatchingColors(color);
+String matches = matchingColors.size() == 0
+? "No matches."
+: "Matches: " + StringUtils.toString(matchingColors);
+colorFill.setTooltipText(matches);
+
+Label nameLabel = makeLabel(color.toString());
+nameLabel.getStyles().put(Style.font, fontBold);
+
+String rgbText = String.format("R=%1$3d, G=%2$3d, B=%3$3d", r, g, 
b);
+Label rgbLabel = makeLabel(rgbText);
+rgbLabel.getStyles().put(Style.font, fontRegular);
+
+float[] hsbValues = Color.RGBtoHSB(r, g, b, null);
+String hsbText = String.format("H=%1$5.3f, S=%2$5.3f, V=%3$5.3f",
+hsbValues[0], hsbValues[1], hsbValues[2]);
+Label hsbLabel = makeLabel(hsbText);
+hsbLabel.getStyles().put(Style.font, fontRegular);
+
+Stri

svn commit: r1885494 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

2021-01-14 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 18:21:01 2021
New Revision: 1885494

URL: http://svn.apache.org/viewvc?rev=1885494=rev
Log:
Improve the parsing of font names inside FontUtilities.decode().

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java?rev=1885494=1885493=1885494=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java Thu Jan 14 
18:21:01 2021
@@ -17,6 +17,7 @@
 package org.apache.pivot.wtk;
 
 import java.awt.Font;
+import java.util.Locale;
 
 import org.apache.pivot.json.JSONSerializer;
 import org.apache.pivot.serialization.SerializationException;
@@ -34,7 +35,16 @@ public final class FontUtilities {
  * A list of "standard" sans-serif fonts, useful when cross-platform
  * support is necessary.
  */
-public static final String SANS_SERIF_FONTS = 
"Verdana,Helvetica,Arial,SansSerif";
+public static final String SANS_SERIF_FONTS = 
+"Verdana, Helvetica, Arial, SansSerif";
+
+/**
+ * A list of monospaced fonts, useful for text editing areas for code, 
where
+ * column position must be consistent.
+ */
+public static final String MONOSPACED_FONTS =
+"Courier, Courier New, Andale Mono, Monaco, Menlo, Monospaced";
+
 
 /** The obvious factor needed to convert a number to a percentage value. */
 private static final float PERCENT_SCALE = 100.0f;
@@ -46,6 +56,72 @@ public final class FontUtilities {
 }
 
 /**
+ * Parse out just the "name" part of a font specification.
+ *  Note: this logic follows the logic in {@link Font#decode(String)}.
+ *
+ * @param str The font specification to parse.
+ * @returnJust the font name part (which could be a list).
+ */
+private static String getFontName(final String str) {
+String fontName = str;
+int lastHyphen  = str.lastIndexOf('-');
+int lastSpace   = str.lastIndexOf(' ');
+char sepChar= (lastHyphen > lastSpace) ? '-' : ' ';
+int sizeIndex   = str.lastIndexOf(sepChar);
+int styleIndex  = str.lastIndexOf(sepChar, sizeIndex - 1);
+int length  = str.length();
+
+if (sizeIndex > 0 && sizeIndex + 1 < length) {
+try {
+Integer.valueOf(str.substring(sizeIndex + 1));
+}
+catch (NumberFormatException nfe) {
+/* Invalid size, maybe this is the style */
+styleIndex = sizeIndex;
+sizeIndex  = length;
+while (sizeIndex > 0 && str.charAt(sizeIndex - 1) == sepChar) {
+sizeIndex--;
+}
+}
+}
+
+if (styleIndex >= 0 && styleIndex + 1 < length) {
+String styleName = str.substring(styleIndex + 1, sizeIndex);
+styleName = styleName.toLowerCase(Locale.ENGLISH);
+switch (styleName) {
+case "bolditalic":
+case "italic":
+case "bold":
+case "plain":
+break;
+default:
+/* Not a recognized style, must be part of the name */
+styleIndex = sizeIndex;
+while (styleIndex > 0 && str.charAt(styleIndex - 1) == 
sepChar) {
+styleIndex--;
+}
+break;
+}
+fontName = str.substring(0, styleIndex);
+}
+else {
+int fontEnd = length;
+if (styleIndex > 0) {
+fontEnd = styleIndex;
+}
+else if (sizeIndex > 0) {
+fontEnd = sizeIndex;
+}
+while (fontEnd > 0 && str.charAt(fontEnd - 1) == sepChar) {
+fontEnd--;
+}
+fontName = str.substring(0, fontEnd);
+}
+
+return fontName;
+}
+
+/**
  * Interpret a string as a font specification.
  *
  * @param value Either a JSON dictionary {@link Theme#deriveFont describing
@@ -99,22 +175,11 @@ public final class FontUtilities {
 }
 
 if (str.indexOf(',') > 0) {
-// Search from the end to find the separator (either ' ' or '-')
-int len = str.length();
-char sep = ' ';
-while (--len >= 0) {
-char ch = str.charAt(len);
-if (ch == ' ' || ch == '-') {
-sep = ch;
-break;
-}
-}
-

svn commit: r1885491 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java

2021-01-14 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 16:56:57 2021
New Revision: 1885491

URL: http://svn.apache.org/viewvc?rev=1885491=rev
Log:
PIVOT-1051: Update some documentation around "decodeFont".

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java?rev=1885491=1885490=1885491=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java Thu Jan 14 
16:56:57 2021
@@ -401,7 +401,9 @@ public abstract class ComponentSkin impl
  *
  * @param value Either a JSON dictionary {@link Theme#deriveFont describing
  * a font relative to the current theme}, or one of the
- * {@link Font#decode(String) standard Java font specifications}.
+ * {@link Font#decode(String) standard Java font specifications}, with the
+ * additional capability of supplying a list of font names 
(comma-separated)
+ * (similar to CSS) if desired.
  * @return The font corresponding to the specification.
  * @throws IllegalArgumentException if the given string is {@code null}
  * or empty or the font specification cannot be decoded.




svn commit: r1885490 - in /pivot/trunk/core/src/org/apache/pivot: collections/ArrayList.java collections/LinkedList.java util/ListenerList.java

2021-01-14 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 16:16:54 2021
New Revision: 1885490

URL: http://svn.apache.org/viewvc?rev=1885490=rev
Log:
Fix the use of StringUtils.toString(List) in several places.

Modified:
pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java

Modified: pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java?rev=1885490=1885489=1885490=diff
==
--- pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java Thu Jan 14 
16:16:54 2021
@@ -607,12 +607,8 @@ public class ArrayList implements Lis
 
 @Override
 public String toString() {
-StringBuilder sb = new StringBuilder();
-
-sb.append(getClass().getSimpleName());
-StringUtils.append(sb, this);
-
-return sb.toString();
+StringBuilder sb = new StringBuilder(getClass().getSimpleName());
+return StringUtils.append(sb, this).toString();
 }
 
 /**

Modified: pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java?rev=1885490=1885489=1885490=diff
==
--- pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java Thu Jan 
14 16:16:54 2021
@@ -634,12 +634,8 @@ public class LinkedList implements Li
 
 @Override
 public String toString() {
-StringBuilder sb = new StringBuilder();
-
-sb.append(getClass().getSimpleName());
-StringUtils.append(sb, this);
-
-return sb.toString();
+StringBuilder sb = new StringBuilder(getClass().getSimpleName());
+return StringUtils.append(sb, this).toString();
 }
 
 }

Modified: pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java?rev=1885490=1885489=1885490=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java Thu Jan 14 
16:16:54 2021
@@ -211,14 +211,8 @@ public abstract class ListenerList im
 
 @Override
 public String toString() {
-StringBuilder sb = new StringBuilder();
-
-sb.append(getClass().getName());
-sb.append(" ");
-
-StringUtils.append(sb, this);
-
-return sb.toString();
+StringBuilder sb = new StringBuilder(getClass().getSimpleName());
+return StringUtils.append(sb, this).toString();
 }
 
 }




svn commit: r1885499 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

2021-01-14 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 19:38:03 2021
New Revision: 1885499

URL: http://svn.apache.org/viewvc?rev=1885499=rev
Log:
Corrected a bug in FontUtilities; corrected style violations there.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java?rev=1885499=1885498=1885499=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java Thu Jan 14 
19:38:03 2021
@@ -35,7 +35,7 @@ public final class FontUtilities {
  * A list of "standard" sans-serif fonts, useful when cross-platform
  * support is necessary.
  */
-public static final String SANS_SERIF_FONTS = 
+public static final String SANS_SERIF_FONTS =
 "Verdana, Helvetica, Arial, SansSerif";
 
 /**
@@ -74,8 +74,7 @@ public final class FontUtilities {
 if (sizeIndex > 0 && sizeIndex + 1 < length) {
 try {
 Integer.valueOf(str.substring(sizeIndex + 1));
-}
-catch (NumberFormatException nfe) {
+} catch (NumberFormatException nfe) {
 /* Invalid size, maybe this is the style */
 styleIndex = sizeIndex;
 sizeIndex  = length;
@@ -103,13 +102,11 @@ public final class FontUtilities {
 break;
 }
 fontName = str.substring(0, styleIndex);
-}
-else {
+} else {
 int fontEnd = length;
 if (styleIndex > 0) {
 fontEnd = styleIndex;
-}
-else if (sizeIndex > 0) {
+} else if (sizeIndex > 0) {
 fontEnd = sizeIndex;
 }
 while (fontEnd > 0 && str.charAt(fontEnd - 1) == sepChar) {
@@ -177,17 +174,17 @@ public final class FontUtilities {
 if (str.indexOf(',') > 0) {
 String name = getFontName(str);
 int pos = name.length();
-String spec = pos < str.length() ? str.substring(0, pos) : "";
+String spec = pos < str.length() ? str.substring(pos) : "";
 
 String[] names = name.split("\\s*,\\s*");
 for (String nm : names) {
 Font f = Font.decode(nm + spec);
-if (f.getName().equals(nm) || f.getFamily().equals(nm)) {
+if (f.getName().equalsIgnoreCase(nm) || 
f.getFamily().equalsIgnoreCase(nm)) {
 return f;
 }
 }
 
-// Nothing quite matched in the name list, so return the default
+// No names matched in the list, so use the default name
 return Font.decode(Font.DIALOG + spec);
 }
 
@@ -213,12 +210,12 @@ public final class FontUtilities {
 String[] names = name.split("\\s*,\\s*");
 for (String nm : names) {
 Font f = new Font(nm, style, size);
-if (f.getName().equals(nm) || f.getFamily().equals(nm)) {
+if (f.getName().equalsIgnoreCase(nm) || 
f.getFamily().equalsIgnoreCase(nm)) {
 return f;
 }
 }
 
-// Nothing quite matched in the name list, so return the default
+// No names matched in the list, so use the default name
 return new Font(Font.DIALOG, style, size);
 }
 




svn commit: r1885500 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java

2021-01-14 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 19:40:51 2021
New Revision: 1885500

URL: http://svn.apache.org/viewvc?rev=1885500=rev
Log:
Fix a tab character.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java

Modified: 
pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java?rev=1885500=1885499=1885500=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java 
(original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java Thu 
Jan 14 19:40:51 2021
@@ -111,7 +111,7 @@ public final class TextAreaOutputStream
  * @param addNewLine Add a newline ('\n') character after any buffered 
text.
  */
 private void flushLineBuffer(final boolean addNewLine) {
-   final String text;
+final String text;
 
 if (lineBuffer.size() > 0) {
 byte[] bytes = lineBuffer.toByteArray();




svn commit: r1885461 - in /pivot/trunk: demos/src/org/apache/pivot/demos/text/TextPaneDemo.java wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java wtk/src/org/apache/pivot/wtk/FontUtilities

2021-01-13 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 01:12:38 2021
New Revision: 1885461

URL: http://svn.apache.org/viewvc?rev=1885461=rev
Log:
PIVOT-1051: First bunch of code changes to support lists of font names.
Not complete yet as we investigate how to implement this.

Modified:
pivot/trunk/demos/src/org/apache/pivot/demos/text/TextPaneDemo.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java

Modified: pivot/trunk/demos/src/org/apache/pivot/demos/text/TextPaneDemo.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/text/TextPaneDemo.java?rev=1885461=1885460=1885461=diff
==
--- pivot/trunk/demos/src/org/apache/pivot/demos/text/TextPaneDemo.java 
(original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/text/TextPaneDemo.java Thu Jan 
14 01:12:38 2021
@@ -106,7 +106,7 @@ public class TextPaneDemo implements App
 super.render(item, index, listView, selected, state, 
highlighted, disabled);
 if (item != null) {
 String fontFamilyName = (String) item;
-label.getStyles().put(Style.font, 
Font.decode(fontFamilyName + "-12"));
+label.getStyles().put(Style.font, 
FontUtilities.decode(fontFamilyName + "-12"));
 }
 }
 });
@@ -116,7 +116,7 @@ public class TextPaneDemo implements App
 super.render(data, button, highlight);
 if (data != null) {
 String fontFamilyName = (String) data;
-label.getStyles().put(Style.font, 
Font.decode(fontFamilyName + "-12"));
+label.getStyles().put(Style.font, 
FontUtilities.decode(fontFamilyName + "-12"));
 }
 }
 });
@@ -129,7 +129,7 @@ public class TextPaneDemo implements App
 public void selectedItemChanged(final ListButton listButton, final 
Object previousSelectedItem) {
 int selectedFontSize = ((Integer) 
fontSizeListButton.getSelectedItem()).intValue();
 String selectedFontFamily = (String) 
fontFamilyListButton.getSelectedItem();
-final Font derivedFont = Font.decode(selectedFontFamily + " " 
+ selectedFontSize);
+final Font derivedFont = 
FontUtilities.decode(selectedFontFamily + " " + selectedFontSize);
 
 applyStyleToSelection(span -> span.setFont(derivedFont));
 requestTextPaneFocus();
@@ -200,7 +200,7 @@ public class TextPaneDemo implements App
 }
 span.setFont(font);
 } else {
-span.setFont(FontUtilities.ARIAL, Font.BOLD, 12);
+span.setFont(FontUtilities.SANS_SERIF_FONTS, Font.BOLD, 
12);
 }
 });
 requestTextPaneFocus();
@@ -220,7 +220,7 @@ public class TextPaneDemo implements App
 }
 span.setFont(font);
 } else {
-span.setFont(FontUtilities.ARIAL, Font.ITALIC, 12);
+span.setFont(FontUtilities.SANS_SERIF_FONTS, Font.ITALIC, 
12);
 }
 });
 requestTextPaneFocus();

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java?rev=1885461=1885460=1885461=diff
==
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java 
(original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java 
Thu Jan 14 01:12:38 2021
@@ -350,7 +350,7 @@ public final class TerraTheme extends Th
 @SuppressWarnings("unchecked")
 Map properties = (Map) 
serializer.readObject(inputStream);
 
-font = Font.decode((String) properties.get(FONT_PROPERTY));
+font = FontUtilities.decodeFont((String) 
properties.get(FONT_PROPERTY));
 
 String defaultStylesName = (String) 
properties.get(DEFAULT_STYLES_PROPERTY);
 if (defaultStylesName != null && !defaultStylesName.isEmpty()) {

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java?rev=1885461=1885460=1885461=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java Thu Jan 14 
01:12:38 2021
@@ -30,7 +30,13 @@ public 

svn commit: r1885467 - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java wtk/src/org/apache/pivot/wtk/FontUtilities.java

2021-01-13 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Jan 14 05:02:17 2021
New Revision: 1885467

URL: http://svn.apache.org/viewvc?rev=1885467=rev
Log:
PIVOT-1051: Finish the code to accept a list of font names.

Modified:
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java?rev=1885467=1885466=1885467=diff
==
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java 
(original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java 
Thu Jan 14 05:02:17 2021
@@ -43,6 +43,7 @@ import org.apache.pivot.wtk.Dialog;
 import org.apache.pivot.wtk.Expander;
 import org.apache.pivot.wtk.FileBrowser;
 import org.apache.pivot.wtk.FileBrowserSheet;
+import org.apache.pivot.wtk.FontUtilities;
 import org.apache.pivot.wtk.Form;
 import org.apache.pivot.wtk.Frame;
 import org.apache.pivot.wtk.Gauge;

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java?rev=1885467=1885466=1885467=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java Thu Jan 14 
05:02:17 2021
@@ -34,7 +34,7 @@ public final class FontUtilities {
  * A list of "standard" sans-serif fonts, useful when cross-platform
  * support is necessary.
  */
-public static final String SANS_SERIF_FONTS = 
"Arial,Verdana,Helvetica,SansSerif";
+public static final String SANS_SERIF_FONTS = 
"Verdana,Helvetica,Arial,SansSerif";
 
 /** The obvious factor needed to convert a number to a percentage value. */
 private static final float PERCENT_SCALE = 100.0f;
@@ -109,17 +109,24 @@ public final class FontUtilities {
 break;
 }
 }
+
 int pos = str.indexOf(sep);
 String name = pos < 0 ? str : str.substring(0, pos);
 String spec = pos < 0 ? "" : str.substring(pos);
+
 String[] names = name.split(",");
 for (String nm : names) {
 Font f = Font.decode(nm + spec);
-System.out.println("getName = " + f.getName() + ", getFontName = " + 
f.getFontName() + ", getFamily = " + f.getFamily());
+if (f.getName().equals(nm) || f.getFamily().equals(nm)) {
+return f;
+}
 }
-} else {
-return Font.decode(str);
+
+// Nothing quite matched in the name list, so return the default
+return Font.decode(Font.DIALOG + spec);
 }
+
+return Font.decode(str);
 }
 
 /**
@@ -141,11 +148,16 @@ System.out.println("getName = " + f.getN
 String[] names = name.split(",");
 for (String nm : names) {
 Font f = new Font(nm, style, size);
-System.out.println("getName = " + f.getName() + ", getFontName = " + 
f.getFontName() + ", getFamily = " + f.getFamily());
+if (f.getName().equals(nm) || f.getFamily().equals(nm)) {
+return f;
+}
 }
-} else {
-return new Font(name, style, size);
+
+// Nothing quite matched in the name list, so return the default
+return new Font(Font.DIALOG, style, size);
 }
+
+return new Font(name, style, size);
 }
 
 /**




svn commit: r1884992 - in /pivot/trunk: core/src/org/apache/pivot/util/StringUtils.java core/src/org/apache/pivot/util/Utils.java wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java w

2020-12-31 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Dec 31 18:19:44 2020
New Revision: 1884992

URL: http://svn.apache.org/viewvc?rev=1884992=rev
Log:
Fixup small Javadoc problems from last submission.

Modified:
pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java
pivot/trunk/core/src/org/apache/pivot/util/Utils.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java

Modified: pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java?rev=1884992=1884991=1884992=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java Thu Dec 31 
18:19:44 2020
@@ -174,7 +174,7 @@ public final class StringUtils {
 /**
  * Given an iterable list of items, construct a string representation of 
the list
  * that looks like:
- * [item1, item2, ...]
+ * [item1, item2, ...].
  *
  * @param  The type of items in the list.
  * @param list The iterable list of items.

Modified: pivot/trunk/core/src/org/apache/pivot/util/Utils.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Utils.java?rev=1884992=1884991=1884992=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/Utils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Utils.java Thu Dec 31 18:19:44 
2020
@@ -151,7 +151,7 @@ public final class Utils {
  * why would you call this method?).
  */
 public static  T ifNull(final T value, final T substituteForNull) {
-   return (value == null) ? substituteForNull : value;
+return (value == null) ? substituteForNull : value;
 }
 
 /**

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java?rev=1884992=1884991=1884992=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
 Thu Dec 31 18:19:44 2020
@@ -221,7 +221,7 @@ public class TerraTreeViewSkin extends C
 public static final byte CHECK_STATE_MASK = CHECK_STATE_CHECKED_MASK
 | CHECK_STATE_MIXED_MASK;
 
-private NodeInfo(TreeView treeView, BranchInfo parent, Object data) {
+protected NodeInfo(TreeView treeView, BranchInfo parent, Object data) {
 this.treeView = treeView;
 this.parent = parent;
 this.data = data;

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java?rev=1884992=1884991=1884992=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java Thu Dec 31 
18:19:44 2020
@@ -33,7 +33,7 @@ import org.apache.pivot.wtk.Keyboard.Mod
  * Extension of {@link ButtonGroup} providing keyboard navigation within the
  * group and modified focus navigation that treats the group as a single
  * focusable entity. {@link KeyCode#UP UP} and {@link KeyCode#LEFT 
LEFT}
- * Select the previous button {@link KeyCode#DOWN DOWN} and 
+ * Select the previous button {@link KeyCode#DOWN DOWN} and
  * {@link KeyCode#RIGHT RIGHT} Select the next button {@link KeyCode#HOME
  * HOME} Select the first button {@link KeyCode#END END} Select the last
  * button (Note that only {@link Component#isFocusable() focusable}




svn commit: r1884993 - in /pivot/trunk: core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/collections/adapter/ core/src/org/apache/pivot/functional/monad/ tests/src/org/apache/pivot/tes

2020-12-31 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Dec 31 18:29:20 2020
New Revision: 1884993

URL: http://svn.apache.org/viewvc?rev=1884993=rev
Log:
More "checkstyle" fixes to "core" classes, plus misc. cleanup.

Modified:
pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java
pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java
pivot/trunk/core/src/org/apache/pivot/collections/Group.java
pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
pivot/trunk/core/src/org/apache/pivot/collections/Queue.java
pivot/trunk/core/src/org/apache/pivot/collections/Stack.java
pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java
pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java

Modified: pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java?rev=1884993=1884992=1884993=diff
==
--- pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java Thu Dec 
31 18:29:20 2020
@@ -25,40 +25,72 @@ import org.apache.pivot.util.ListenerLis
 import org.apache.pivot.util.Utils;
 
 /**
- * Implementation of the {@link Queue} interface that is backed by an array.
+ * Implementation of the {@link Queue} interface that is backed by an {@link 
ArrayList}.
+ *
+ * @param  The type of object stored in this queue.
  */
 public class ArrayQueue implements Queue, Serializable {
 private static final long serialVersionUID = -3856732506886968324L;
 
+/** The underlying array list used to implement this queue. */
 private ArrayList arrayList = new ArrayList<>();
+/** The maximum permitted length of the queue (0 = unlimited). */
 private int maxLength = 0;
+/** List of queue listeners for this queue. */
 private transient QueueListener.Listeners queueListeners = new 
QueueListener.Listeners<>();
 
+/**
+ * Construct an empty queue, with all defaults.
+ */
 public ArrayQueue() {
 this(null);
 }
 
-public ArrayQueue(Comparator comparator) {
+/**
+ * Construct an empty queue with the given comparator used to order the 
elements in it.
+ *
+ * @param comparator A comparator used to sort the elements in the queue 
as they are added.
+ */
+public ArrayQueue(final Comparator comparator) {
 setComparator(comparator);
 }
 
-public ArrayQueue(int capacity) {
+/**
+ * Construct an empty queue with a given initial capacity.
+ *
+ * @param capacity The initial capacity for the queue.
+ */
+public ArrayQueue(final int capacity) {
 ensureCapacity(capacity);
 }
 
-public ArrayQueue(int capacity, int maxLength) {
+/**
+ * Construct an empty queue with a given initial capacity and maxmimum 
length.
+ *
+ * @param capacity The initial capacity for the queue.
+ * @param maxLen   The maximum permitted queue length.
+ */
+public ArrayQueue(final int capacity, final int maxLen) {
 ensureCapacity(capacity);
-setMaxLength(maxLength);
+setMaxLength(maxLen);
 }
 
-public ArrayQueue(int capacity, int maxLength, Comparator comparator) {
+/**
+ * Construct an empty queue with a given initial capacity, maximum length,
+ * and comparator for ordering the queue.
+ *
+ * @param capacity   The initial capacity for the queue.
+ * @param maxLen The maximum permitted queue length.
+ * @param comparator The comparator to use for ordering the elements.
+ */
+public ArrayQueue(final int capacity, final int maxLen, final 
Comparator comparator) {
 ensureCapacity(capacity);
-setMaxLength(maxLength);
+setMaxLength(maxLen);
 setComparator(comparator);
 }
 
 @Override
-public void enqueue(T item) {
+public void enqueue(final T item) {
 if (maxLength == 0 || arrayList.getLength() < maxLength) {
 if (getComparator() == null) {
 arrayList.insert(item, 0);
@@ -118,12 +150,19 @@ public class ArrayQueue implements Qu
 }
 
 @Override
-public void setMaxLength(int maxLength) {
-Utils.checkNonNegative(maxLength, "maxLength");
-this.maxLength = maxLength;
+public void setMaxLength(final int maxLen) {
+Utils.checkNonNegative(maxLen, "maxLen");
+this.maxLength = maxLen;
 }
 
-public void ensureCapacity(int capacity) {
+/**
+ * Ensure that the queue has sufficient internal capacity to satisfy
+ * the given number of elements.
+ *
+ * @param capacity The capacity to ensure (to make sure no further
+ * allocations are done to accommod

svn commit: r1884995 - /pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java

2020-12-31 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Dec 31 18:48:13 2020
New Revision: 1884995

URL: http://svn.apache.org/viewvc?rev=1884995=rev
Log:
Fix obsolete Javadoc constructs.

Modified:
pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java

Modified: 
pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java?rev=1884995=1884994=1884995=diff
==
--- pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java 
Thu Dec 31 18:48:13 2020
@@ -34,8 +34,8 @@ import org.apache.pivot.util.Utils;
 
 /**
  * Implementation of the {@link List} interface that is backed by an instance 
of
- * {@link java.util.List}; in other words, adapting a java.util.List 
to
- * one of our Lists.
+ * {@link java.util.List}; in other words, adapting a {@code java.util.List} to
+ * one of our {@code List}s.
  *
  * @param  Type of elements in the list.
  */




svn commit: r1884996 - /pivot/trunk/build.xml

2020-12-31 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Dec 31 19:31:08 2020
New Revision: 1884996

URL: http://svn.apache.org/viewvc?rev=1884996=rev
Log:
Use a property to compute the build number, not a file.

Modified:
pivot/trunk/build.xml

Modified: pivot/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/pivot/trunk/build.xml?rev=1884996=1884995=1884996=diff
==
--- pivot/trunk/build.xml (original)
+++ pivot/trunk/build.xml Thu Dec 31 19:31:08 2020
@@ -89,10 +89,11 @@ limitations under the License.
 
 
 
-
+
 
 
-
+
+
 
 
 




svn commit: r1884991 [1/3] - in /pivot/trunk: core/src/org/apache/pivot/beans/ core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/collections/adapter/ core/src/org/apache/pivot/serializa

2020-12-31 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Dec 31 18:02:57 2020
New Revision: 1884991

URL: http://svn.apache.org/viewvc?rev=1884991=rev
Log:
Fix obsolete Javadoc constructs.

Added:
pivot/trunk/wtk/src/org/apache/pivot/wtk/util/package.html
Modified:
pivot/trunk/core/src/org/apache/pivot/beans/BXML.java
pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java
pivot/trunk/core/src/org/apache/pivot/collections/List.java
pivot/trunk/core/src/org/apache/pivot/collections/ListListener.java
pivot/trunk/core/src/org/apache/pivot/collections/Queue.java
pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java
pivot/trunk/core/src/org/apache/pivot/collections/Stack.java
pivot/trunk/core/src/org/apache/pivot/collections/adapter/package.html
pivot/trunk/core/src/org/apache/pivot/serialization/CSVSerializer.java
pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java
pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java
pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java
pivot/trunk/core/src/org/apache/pivot/util/BooleanResult.java
pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java
pivot/trunk/core/src/org/apache/pivot/util/ClassUtils.java
pivot/trunk/core/src/org/apache/pivot/util/Constants.java
pivot/trunk/core/src/org/apache/pivot/util/EmptyIterator.java
pivot/trunk/core/src/org/apache/pivot/util/ImmutableIterator.java
pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java
pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java
pivot/trunk/core/src/org/apache/pivot/util/Time.java
pivot/trunk/core/src/org/apache/pivot/util/Utils.java
pivot/trunk/core/src/org/apache/pivot/util/Vote.java
pivot/trunk/core/src/org/apache/pivot/util/VoteResult.java
pivot/trunk/core/src/org/apache/pivot/xml/Element.java
pivot/trunk/demos/src/org/apache/pivot/demos/itunes/SearchDemo.java

pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
pivot/trunk/web/src/org/apache/pivot/web/Query.java
pivot/trunk/web/src/org/apache/pivot/web/QueryException.java
pivot/trunk/web/src/org/apache/pivot/web/package.html

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html
pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/BrowserApplicationContext.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Calendar.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/CalendarButton.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPane.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/ConstrainedVisual.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Editor.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/FillPane.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Gauge.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/GridPane.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Limits.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/ListButton.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/ListViewItemListener.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/RangeSelection.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/ScrollPane.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Skin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Span.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Spinner.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/SplitPane.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/SuggestionPopup.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/TableViewHeader.java
pivot/trunk/wtk/src/org

svn commit: r1884991 [3/3] - in /pivot/trunk: core/src/org/apache/pivot/beans/ core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/collections/adapter/ core/src/org/apache/pivot/serializa

2020-12-31 Thread rwhitcomb
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/BlurDecorator.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/BlurDecorator.java?rev=1884991=1884990=1884991=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/BlurDecorator.java 
(original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/BlurDecorator.java Thu Dec 
31 18:02:57 2020
@@ -26,7 +26,7 @@ import org.apache.pivot.wtk.Component;
 /**
  * Decorator that applies a blur to a component.  Blurs are given an integer
  * magnitude, which represents the intensity of the blur. This value translates
- * to a grid of pixels (blurMagnitude^2), where each pixel value is
+ * to a grid of pixels (blurMagnitude^2), where each pixel value 
is
  * calculated by consulting its neighboring pixels according to the grid.
  * Because of this, note that you will get "prettier" blurring if you choose 
odd
  * values for the blur magnitude; this allows the pixel in question to reside 
at
@@ -47,7 +47,7 @@ public class BlurDecorator implements De
 private Graphics2D bufferedImageGraphics = null;
 
 /**
- * Creates a BlurDecorator with the default blur magnitude.
+ * Creates a {@code BlurDecorator} with the default blur magnitude.
  *
  * @see #BlurDecorator(int)
  */
@@ -56,7 +56,7 @@ public class BlurDecorator implements De
 }
 
 /**
- * Creates a BlurDecorator with the specified blur magnitude.
+ * Creates a {@code BlurDecorator} with the specified blur magnitude.
  *
  * @param blurMagnitude The intensity of the blur.
  */

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Decorator.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Decorator.java?rev=1884991=1884990=1884991=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Decorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Decorator.java Thu Dec 31 
18:02:57 2020
@@ -26,13 +26,13 @@ import org.apache.pivot.wtk.Component;
  * Interface defining a component "decorator". Decorators allow a caller to
  * attach additional visual effects to a component.  Decorators use a 
chained
  * prepare/update model to modify the graphics in which a component is painted.
- * The prepare() method of each decorator in a component's decorator
- * sequence is called in reverse order before the component's paint()
- * method is called. prepare() returns an instance of
- * Graphics2D that is passed to prior decorators, and ultimately to 
the
+ * The {@code prepare()} method of each decorator in a component's decorator
+ * sequence is called in reverse order before the component's {@code paint()}
+ * method is called. {@code prepare()} returns an instance of
+ * {@code Graphics2D} that is passed to prior decorators, and ultimately to the
  * component itself. This allows decorators to modify the graphics context
  * before it reaches the component. After the component has been painted, each
- * decorator's update() method is then called in order to allow the
+ * decorator's {@code update()} method is then called in order to allow the
  * decorator to further modify the resulting output.  Decorators are not
  * restricted to painting within the component's bounds. However, they are
  * clipped to the bounds of the component's parent. They are not clipped to

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java?rev=1884991=1884990=1884991=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java 
(original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java Thu 
Dec 31 18:02:57 2020
@@ -44,15 +44,15 @@ public class ScaleDecorator implements D
 private VerticalAlignment verticalAlignment = VerticalAlignment.CENTER;
 
 /**
- * Creates a new ScaleDecorator with the default scaleX
- * scaleY values of 1.0f.
+ * Creates a new {@code ScaleDecorator} with the default 
scaleX
+ * scaleY values of 1.0f.
  */
 public ScaleDecorator() {
 this(1f, 1f);
 }
 
 /**
- * Creates a new ScaleDecorator with a "square" scaling of the 
given
+ * Creates a new {@code ScaleDecorator} with a "square" scaling of the 
given
  * value in both directions.
  *
  * @param scale The scale to use for both X and Y directions.
@@ -62,8 +62,8 @@ public class ScaleDecorator implements D
 }
 
 /**
- * Creates a new ScaleDecorator with the specified scaleX
- * and scaleY values.
+ * Creates a new {@code ScaleDecorator} with the specified 
scaleX
+ * and scaleY values.
  *
  * @param 

svn commit: r1884991 [2/3] - in /pivot/trunk: core/src/org/apache/pivot/beans/ core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/collections/adapter/ core/src/org/apache/pivot/serializa

2020-12-31 Thread rwhitcomb
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPane.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPane.java?rev=1884991=1884990=1884991=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPane.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPane.java Thu Dec 31 18:02:57 
2020
@@ -35,7 +35,7 @@ public class CardPane extends Container
 /**
  * Returns the currently selected card index.
  *
- * @return The selected card index, or -1 if no card is selected.
+ * @return The selected card index, or -1 if no card is 
selected.
  */
 public int getSelectedIndex() {
 return selectedIndex;
@@ -44,7 +44,7 @@ public class CardPane extends Container
 /**
  * Sets the selected card index.
  *
- * @param selectedIndex The selected card index, or -1 for no
+ * @param selectedIndex The selected card index, or -1 for no
  * selection.
  */
 public void setSelectedIndex(int selectedIndex) {

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java?rev=1884991=1884990=1884991=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ColorChooser.java Thu Dec 31 
18:02:57 2020
@@ -90,7 +90,7 @@ public class ColorChooser extends Contai
 /**
  * Sets the selected color.
  *
- * @param selectedColor The color to select, or "null" to clear 
the
+ * @param selectedColor The color to select, or {@code null} to clear the
  * selection.
  */
 public void setSelectedColor(final String selectedColor) {

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=1884991=1884990=1884991=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Thu Dec 31 18:02:57 
2020
@@ -717,7 +717,7 @@ public abstract class Component implemen
  * Returns the component's constrained preferred width.
  *
  * @param height The height value by which the preferred width should be
- * constrained, or -1 for no constraint.
+ * constrained, or -1 for no constraint.
  * @return The constrained preferred width.
  */
 @Override
@@ -745,7 +745,7 @@ public abstract class Component implemen
 /**
  * Sets the component's preferred width.
  *
- * @param preferredWidth The preferred width value, or -1 to use
+ * @param preferredWidth The preferred width value, or -1 to 
use
  * the default value determined by the skin.
  */
 public void setPreferredWidth(final int preferredWidth) {
@@ -774,7 +774,7 @@ public abstract class Component implemen
  * Returns the component's constrained preferred height.
  *
  * @param width The width value by which the preferred height should be
- * constrained, or -1 for no constraint.
+ * constrained, or -1 for no constraint.
  * @return The constrained preferred height.
  */
 @Override
@@ -802,7 +802,7 @@ public abstract class Component implemen
 /**
  * Sets the component's preferred height.
  *
- * @param preferredHeight The preferred height value, or -1 to use
+ * @param preferredHeight The preferred height value, or -1 
to use
  * the default value determined by the skin.
  */
 public void setPreferredHeight(final int preferredHeight) {
@@ -868,9 +868,9 @@ public abstract class Component implemen
 /**
  * Sets the component's preferred size.
  *
- * @param preferredWidth The preferred width value, or -1 to use
+ * @param preferredWidth The preferred width value, or -1 to 
use
  * the default value determined by the skin.
- * @param preferredHeight The preferred height value, or -1 to use
+ * @param preferredHeight The preferred height value, or -1 
to use
  * the default value determined by the skin.
  */
 public void setPreferredSize(final int preferredWidth, final int 
preferredHeight) {
@@ -1157,7 +1157,7 @@ public abstract class Component implemen
  * Returns the component's baseline.
  *
  * @return The baseline relative to the origin of this component, or
- * -1 if this component does not have a baseline.
+ * -1 if this component does not have a baseline.
  */
 @Override
 public int getBaseline() {
@@ -1172,7 +1172,7 @@ public abstract class Component implemen
  * Returns the component's baseline for a given width and height.
  *
  * @return The baseline relative to the 

svn commit: r1884994 - in /pivot/trunk: StyleChecks.java StyleErrors.java build.xml package-info.java pivot_checks.xml pivot_style_checks.xml

2020-12-31 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Dec 31 18:31:02 2020
New Revision: 1884994

URL: http://svn.apache.org/viewvc?rev=1884994=rev
Log:
Rename "StyleErrors" to StyleChecks, as well as the log files, and code.

Added:
pivot/trunk/StyleChecks.java
  - copied, changed from r1884993, pivot/trunk/StyleErrors.java
pivot/trunk/package-info.java
pivot/trunk/pivot_style_checks.xml
  - copied, changed from r1884993, pivot/trunk/pivot_checks.xml
Removed:
pivot/trunk/StyleErrors.java
pivot/trunk/pivot_checks.xml
Modified:
pivot/trunk/build.xml

Copied: pivot/trunk/StyleChecks.java (from r1884993, 
pivot/trunk/StyleErrors.java)
URL: 
http://svn.apache.org/viewvc/pivot/trunk/StyleChecks.java?p2=pivot/trunk/StyleChecks.java=pivot/trunk/StyleErrors.java=1884993=1884994=1884994=diff
==
--- pivot/trunk/StyleErrors.java (original)
+++ pivot/trunk/StyleChecks.java Thu Dec 31 18:31:02 2020
@@ -30,14 +30,17 @@ import java.util.TreeMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.pivot.util.ExceptionUtils;
+
+
 /**
  * Read the file(s) given on the command line, which are presumed to be
  * the output of the "check styles" process, and generate a summary of the
  * results for each one.
  *  Results can be filtered on one or more file names, and on one or more
- * of the checkstyle category names.
+ * of the checkstyle category names (can be wildcards with "*" or "?").
  */
-public final class StyleErrors {
+public final class StyleChecks {
 /**
  * Enumeration of the severity of a check-style report value.
  *  Corresponds directly to the text found in the report.
@@ -65,7 +68,7 @@ public final class StyleErrors {
 }
 
 /** Private constructor because we only use static methods here. */
-private StyleErrors() {
+private StyleChecks() {
 }
 
 /**
@@ -109,7 +112,7 @@ public final class StyleErrors {
 
 /** @return The saved checkstyle problem name. */
 String getProblemCategory() {
-return problemCategory;
+return String.format("[%1$s]", problemCategory);
 }
 /** @return The severity of this problem. */
 Severity getSeverity() {
@@ -189,10 +192,10 @@ public final class StyleErrors {
 }
 
 /** Default name of the input file if none is given on the command line. */
-private static final String DEFAULT_INPUT_FILE = "style_errors.log";
+private static final String DEFAULT_INPUT_FILE = "style_checks.log";
 /** Pattern used to parse each input line. */
 private static final Pattern LINE_PATTERN = Pattern.compile(
-
"^\\[([A-Z]+)\\]\\s+(([a-zA-Z]\\:)?([^:]+))(\\:[0-9]+\\:)([0-9]+\\:)?\\s+(.+)\\s+(\\[[a-zA-Z]+\\])$"
+
"^\\[([A-Z]+)\\]\\s+(([a-zA-Z]\\:)?([^:]+))(\\:[0-9]+\\:)([0-9]+\\:)?\\s+(.+)\\s+\\[([a-zA-Z]+)\\]$"
 );
 /** The group in the {@link #LINE_PATTERN} that contains the severity of 
the problem. */
 private static final int SEVERITY_GROUP = 1;
@@ -201,13 +204,21 @@ public final class StyleErrors {
 /** The group in the {@link #LINE_PATTERN} that contains the checkstyle 
problem name. */
 private static final int CATEGORY_NAME_GROUP = 8;
 /** Limit on the number of files to enumerate vs just give the number. */
-private static final int NUMBER_OF_FILES_LIMIT = 3;
+private static final int NUMBER_OF_FILES_LIMIT = 4;
+/** A severity of "warning". */
+private static final String SEV_WARN = "WARN";
+/** A severity of "error". */
+private static final String SEV_ERROR = "ERROR";
+/** Report footer title. */
+private static final String TOTAL = "Total";
 /** Format problem info with a number of files suffix. */
 private static final String FORMAT1 = "%1$2d. %2$5s %3$-30s%4$5d (%5$d)%n";
 /** Same as {@link #FORMAT1} except we have a list of file names instead 
of a number. */
 private static final String FORMAT2 = "%1$2d. %2$5s %3$-30s%4$5d %5$s%n";
 /** Format postreport info. */
 private static final String FORMAT3 = "  %1$-30s%2$5d (%3$d)%n";
+/** Format second postreport info. */
+private static final String FORMAT3A = "%1$5s %2$-30s%3$5d (%4$d)%n";
 /** Format string used to print the underlines. */
 private static final String UNDER_FORMAT = "%1$3s %2$5s %3$-30s%4$5s 
%5$s%n";
 /** Three character underline. */
@@ -222,6 +233,10 @@ public final class StyleErrors {
 private static final String FORMAT4 = "%1$-42s %2$5d%n";
 /** The set of unique file names found in the list. */
 private static Set fileNameSet = new HashSet<>();
+/** The set of unique file names with warnings in the list. */
+private st

svn commit: r1886138 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java

2021-02-02 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Feb  2 19:04:32 2021
New Revision: 1886138

URL: http://svn.apache.org/viewvc?rev=1886138=rev
Log:
Finish code in TerraFormSkin to implement message and label fonts. Fix some 
style errors.

Modified:
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java?rev=1886138=1886137=1886138=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java 
Tue Feb  2 19:04:32 2021
@@ -57,11 +57,14 @@ import org.apache.pivot.wtk.skin.Contain
  * change (make this configurable via a style flag)
  */
 public class TerraFormSkin extends ContainerSkin implements FormListener, 
FormAttributeListener {
+/**
+ * The decorator for the popup flags.
+ */
 private class PopupFieldIndicatorDecorator implements Decorator {
 private Graphics2D graphics = null;
 
 @Override
-public Graphics2D prepare(Component component, Graphics2D 
graphicsArgument) {
+public Graphics2D prepare(final Component component, final Graphics2D 
graphicsArgument) {
 this.graphics = graphicsArgument;
 return graphicsArgument;
 }
@@ -87,22 +90,25 @@ public class TerraFormSkin extends Conta
 }
 
 @Override
-public Bounds getBounds(Component component) {
+public Bounds getBounds(final Component component) {
 return new Bounds(POPUP_FIELD_INDICATOR_OFFSET, 
-POPUP_FIELD_INDICATOR_HEIGHT,
 POPUP_FIELD_INDICATOR_WIDTH, POPUP_FIELD_INDICATOR_HEIGHT);
 }
 
 @Override
-public AffineTransform getTransform(Component component) {
+public AffineTransform getTransform(final Component component) {
 return new AffineTransform();
 }
 }
 
+/**
+ * Decorator for the inline flags.
+ */
 private class InlineFlagMessageDecorator implements Decorator {
 private Graphics2D graphics = null;
 
 @Override
-public Graphics2D prepare(Component component, Graphics2D 
graphicsArgument) {
+public Graphics2D prepare(final Component component, final Graphics2D 
graphicsArgument) {
 this.graphics = graphicsArgument;
 return graphicsArgument;
 }
@@ -110,7 +116,7 @@ public class TerraFormSkin extends Conta
 @Override
 public void update() {
 if (showFlagMessagesInline) {
-Form form = (Form) getComponent();
+Form form = getForm();
 Form.SectionSequence sections = form.getSections();
 
 for (int sectionIndex = 0, sectionCount = 
sections.getLength(); sectionIndex < sectionCount;
@@ -195,12 +201,12 @@ public class TerraFormSkin extends Conta
 }
 
 @Override
-public Bounds getBounds(Component component) {
+public Bounds getBounds(final Component component) {
 return new Bounds(0, 0, component.getWidth(), 
component.getHeight());
 }
 
 @Override
-public AffineTransform getTransform(Component component) {
+public AffineTransform getTransform(final Component component) {
 return new AffineTransform();
 }
 }
@@ -245,7 +251,7 @@ public class TerraFormSkin extends Conta
 
 private ComponentMouseListener fieldMouseListener = new 
ComponentMouseListener() {
 @Override
-public void mouseOver(Component component) {
+public void mouseOver(final Component component) {
 if (!showFlagMessagesInline) {
 Form.Flag flag = Form.getFlag(component);
 
@@ -304,7 +310,7 @@ public class TerraFormSkin extends Conta
 }
 
 @Override
-public void mouseOut(Component component) {
+public void mouseOut(final Component component) {
 flagMessageWindow.close();
 }
 };
@@ -380,7 +386,7 @@ public class TerraFormSkin extends Conta
 private ApplicationContext.ScheduledCallback 
scheduledHideFlagMessageCallback = null;
 
 @Override
-public void windowOpened(Window window) {
+public void windowOpened(final Window window) {
 // Set a timer to hide the message
 Runnable hideFlagMessageCallback = new Runnable() {
 @Override
@@ -394,14 +400,18 @@ public class TerraFormSkin extends Conta
 }
 
 @Override
-public void windowClosed(Window window, Display display, Window 
owner) {
+public void windowClosed(final Window window, final Display 
display, final Window ow

svn commit: r1886132 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java

2021-02-02 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Feb  2 18:05:42 2021
New Revision: 1886132

URL: http://svn.apache.org/viewvc?rev=1886132=rev
Log:
Add styles to Form for "labelFont" and "messageFont".

Modified:
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java?rev=1886132=1886131=1886132=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java 
Tue Feb  2 18:05:42 2021
@@ -18,6 +18,7 @@ package org.apache.pivot.wtk.skin.terra;
 
 import java.awt.BasicStroke;
 import java.awt.Color;
+import java.awt.Font;
 import java.awt.Graphics2D;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.GeneralPath;
@@ -220,6 +221,7 @@ public class TerraFormSkin extends Conta
 private boolean showFlagMessagesInline;
 private boolean leftAlignLabels;
 private String delimiter;
+private Font labelFont;
 private Image errorIcon = null;
 private Color errorMessageColor = null;
 private Color errorMessageBackgroundColor = null;
@@ -333,6 +335,10 @@ public class TerraFormSkin extends Conta
 // Get theme icons/colors
 TerraTheme theme = (TerraTheme) Theme.getTheme();
 
+Font themeFont = theme.getFont();
+labelFont = themeFont;
+flagMessageLabel.getStyles().put(Style.font, themeFont);
+
 errorIcon = theme.getSmallMessageIcon(MessageType.ERROR);
 errorMessageColor = theme.getColor(4);
 errorMessageBackgroundColor = theme.getColor(22);
@@ -1067,6 +1073,61 @@ public class TerraFormSkin extends Conta
 
setSeparatorHeadingColor(GraphicsUtilities.decodeColor(separatorHeadingColor, 
"separatorHeadingColor"));
 }
 
+public final Font getLabelFont() {
+return labelFont;
+}
+
+public final void setLabelFont(Font font) {
+Utils.checkNull(font, "labelFont");
+
+labelFont = font;
+
+for (int sectionIndex = 0, sectionCount = sections.getLength(); 
sectionIndex < sectionCount; sectionIndex++) {
+Form.Section section = sections.get(sectionIndex);
+
+for (int fieldIndex = 0, fieldCount = section.getLength(); 
fieldIndex < fieldCount; fieldIndex++) {
+Label label = labels.get(sectionIndex).get(fieldIndex);
+label.getStyles().put(Style.font, labelFont);
+}
+}
+
+invalidateComponent();
+}
+
+public final void setLabelFont(String fontString) {
+Utils.checkNull(fontString, "labelFont");
+
+setLabelFont(decodeFont(fontString));
+}
+
+public final void setLabelFont(Dictionary fontDict) {
+Utils.checkNull(fontDict, "labelFont");
+
+setLabelFont(Theme.deriveFont(fontDict));
+}
+
+public final Font getMessageFont() {
+return flagMessageLabel.getStyles().getFont(Style.font);
+}
+
+public final void setMessageFont(Font font) {
+Utils.checkNull(font, "messageFont");
+
+flagMessageLabel.getStyles().put(Style.font, font);
+}
+
+public final void setMessageFont(String fontString) {
+Utils.checkNull(fontString, "messageFont");
+
+setMessageFont(decodeFont(fontString));
+}
+
+public final void setMessageFont(Dictionary fontDict) {
+Utils.checkNull(fontDict, "messageFont");
+
+setMessageFont(Theme.deriveFont(fontDict));
+}
+
 // Form events
 @Override
 public void sectionInserted(Form form, int index) {
@@ -1165,6 +1226,7 @@ public class TerraFormSkin extends Conta
 
 // Create the label
 Label label = new Label();
+label.getStyles().put(Style.font, labelFont);
 labels.get(sectionIndex).insert(label, index);
 form.add(label);
 




svn commit: r1891156 - /pivot/trunk/build.xml

2021-06-29 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Jun 30 03:36:38 2021
New Revision: 1891156

URL: http://svn.apache.org/viewvc?rev=1891156=rev
Log:
Reduce the number of files to do a "checkstyle" on (basically just the "core" 
classes and not demos, tutorials, etc.).

Modified:
pivot/trunk/build.xml

Modified: pivot/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/pivot/trunk/build.xml?rev=1891156=1891155=1891156=diff
==
--- pivot/trunk/build.xml (original)
+++ pivot/trunk/build.xml Wed Jun 30 03:36:38 2021
@@ -1099,8 +1099,12 @@ limitations under the License.
 
 
 
-
-
+
+
+
+
+
+
 
 
 




svn commit: r1889182 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java

2021-04-25 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Apr 26 02:26:18 2021
New Revision: 1889182

URL: http://svn.apache.org/viewvc?rev=1889182=rev
Log:
Add another variation of Point.decode ("x, y"); fix checkstyle problems.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java?rev=1889182=1889181=1889182=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java Mon Apr 26 02:26:18 2021
@@ -33,24 +33,58 @@ import org.apache.pivot.util.Utils;
 public final class Point implements Serializable {
 private static final long serialVersionUID = 5193175754909343769L;
 
+/**
+ * The (integer) X-value of this point, representing a distance from the
+ * left of the parent object.
+ */
 public final int x;
+/**
+ * The (integer) Y-value of this point, representing a distance down
+ * from the top of the parent object.
+ */
 public final int y;
 
+/**
+ * Map key used to access the X-value.
+ */
 public static final String X_KEY = "x";
+/**
+ * Map key used to access the Y-value.
+ */
 public static final String Y_KEY = "y";
 
-public Point(final int x, final int y) {
-this.x = x;
-this.y = y;
+/**
+ * Construct a point given the X/Y coordinates.
+ *
+ * @param xValue The X-position for the point.
+ * @param yValue The Y-position for the point.
+ */
+public Point(final int xValue, final int yValue) {
+x = xValue;
+y = yValue;
 }
 
+/**
+ * A "copy" constructor to duplicate a point value.
+ *
+ * @param point The other point to copy.
+ */
 public Point(final Point point) {
 Utils.checkNull(point, "point");
 
-this.x = point.x;
-this.y = point.y;
+x = point.x;
+y = point.y;
 }
 
+/**
+ * Construct a point from a dictionary containing the X- and Y-position
+ * values as entries.
+ *
+ * @param point The source dictionary containing the values.
+ * @throws IllegalArgumentException if the input is {@code null}.
+ * @see #X_KEY
+ * @see #Y_KEY
+ */
 public Point(final Dictionary point) {
 Utils.checkNull(point, "point");
 
@@ -58,11 +92,19 @@ public final class Point implements Seri
 this.y = point.getInt(Y_KEY);
 }
 
+/**
+ * Construct a point from a sequence of two number values for the
+ * X- and Y-positions respectively.
+ *
+ * @param point The source sequence containing the values (values must be
+ *  {@link Number}s).
+ * @throws IllegalArgumentException if the input is {@code null}.
+ */
 public Point(final Sequence point) {
 Utils.checkNull(point, "point");
 
-this.x = ((Number) point.get(0)).intValue();
-this.y = ((Number) point.get(1)).intValue();
+x = ((Number) point.get(0)).intValue();
+y = ((Number) point.get(1)).intValue();
 }
 
 /**
@@ -75,8 +117,7 @@ public final class Point implements Seri
  * @param dy The distance to move in the vertical
  * direction (positive moves downward on the screen,
  * and negative to move upward).
- * @return A new object represented the translated
- * location.
+ * @return A new object represented the translated location.
  */
 public Point translate(final int dx, final int dy) {
 return new Point(x + dx, y + dy);
@@ -105,18 +146,22 @@ public final class Point implements Seri
 }
 
 /**
- * Decode a JSON-formatted string (map or list) that contains the two
- * values for a new point.
+ * Decode a string value (which could be a JSON-formatted string (map or 
list))
+ * that contains the two values for a new point.
  *  The format of a JSON map would be:
  * { "x":nnn, "y":nnn }
  *  The format for a JSON list would be:
  * [ x, y ]
+ *  Or the string can simply be two numbers:
+ * x [,;] y
  *
- * @param value The JSON string to be interpreted (must not be {@code 
null}).
+ * @param value The string to be interpreted (must not be {@code null}).
  * @return The new Point object if the string can be decoded successfully.
  * @throws IllegalArgumentException if the input is {@code null} or if the
- * value could not be successfully decoded as either a JSON map or list.
+ * value could not be successfully decoded as a JSON map or list, or simply
+ * two values.
  * @see #Point(Dictionary)
+ * @see #Point(Sequence)
  * @see #Point(int, int)
  */
 public static Point decode(final String value) 

svn commit: r1889346 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputSelectionListener.java

2021-04-30 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Apr 30 22:07:45 2021
New Revision: 1889346

URL: http://svn.apache.org/viewvc?rev=1889346=rev
Log:
PIVOT-1047,PIVOT-1032: Make TextInputSelectionListener back into a 
FunctionalInterface by removing default implementation; fix "checkstyle" 
problems.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputSelectionListener.java

Modified: 
pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputSelectionListener.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputSelectionListener.java?rev=1889346=1889345=1889346=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputSelectionListener.java 
(original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputSelectionListener.java 
Fri Apr 30 22:07:45 2021
@@ -22,17 +22,16 @@ import org.apache.pivot.util.ListenerLis
 /**
  * Text input selection listener interface.
  */
+@FunctionalInterface
 public interface TextInputSelectionListener {
 /**
  * Text input selection listener listeners list.
  */
-public static class Listeners extends 
ListenerList
+class Listeners extends ListenerList
 implements TextInputSelectionListener {
 @Override
-public void selectionChanged(TextInput textInput, int 
previousSelectionStart,
-int previousSelectionLength) {
-forEach(listener -> listener.selectionChanged(textInput, 
previousSelectionStart,
-previousSelectionLength));
+public void selectionChanged(final TextInput textInput, final int 
previousStart, final int previousLength) {
+forEach(listener -> listener.selectionChanged(textInput, 
previousStart, previousLength));
 }
 }
 
@@ -46,7 +45,5 @@ public interface TextInputSelectionListe
  * @param previousSelectionLength If the selection changed directly, the
  * previous selection length. Otherwise, the current selection length.
  */
-default void selectionChanged(TextInput textInput, int 
previousSelectionStart,
-int previousSelectionLength) {
-}
+void selectionChanged(TextInput textInput, int previousSelectionStart, int 
previousSelectionLength);
 }




svn commit: r1889345 [1/2] - in /pivot/trunk: ./ wtk/src/org/apache/pivot/wtk/

2021-04-30 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Apr 30 22:02:41 2021
New Revision: 1889345

URL: http://svn.apache.org/viewvc?rev=1889345=rev
Log:
PIVOT-1032: Reduce file size of ApplicationContext by moving a bunch of stuff 
to other classes; fix "checkstyle" problems in all.

Added:

pivot/trunk/wtk/src/org/apache/pivot/wtk/ComponentTextInputMethodListener.java
Modified:
pivot/trunk/pivot_style_checks.xml
pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/DropAction.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java

Modified: pivot/trunk/pivot_style_checks.xml
URL: 
http://svn.apache.org/viewvc/pivot/trunk/pivot_style_checks.xml?rev=1889345=1889344=1889345=diff
==
--- pivot/trunk/pivot_style_checks.xml (original)
+++ pivot/trunk/pivot_style_checks.xml Fri Apr 30 22:02:41 2021
@@ -121,7 +121,9 @@ limitations under the License.
 
 
 
-
+
+
+
  
 
 

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=1889345=1889344=1889345=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Fri Apr 30 
22:02:41 2021
@@ -22,7 +22,6 @@ import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.GraphicsConfiguration;
 import java.awt.PrintGraphics;
-import java.awt.Rectangle;
 import java.awt.RenderingHints;
 import java.awt.Transparency;
 import java.awt.dnd.DnDConstants;
@@ -44,7 +43,6 @@ import java.awt.event.InputMethodEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseWheelEvent;
-import java.awt.font.TextHitInfo;
 import java.awt.im.InputMethodRequests;
 import java.awt.image.BufferedImage;
 import java.awt.image.VolatileImage;
@@ -56,7 +54,6 @@ import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.text.AttributedCharacterIterator;
 import java.util.Iterator;
 import java.util.Random;
 import java.util.Timer;
@@ -70,7 +67,7 @@ import org.apache.pivot.collections.List
 import org.apache.pivot.collections.Map;
 import org.apache.pivot.json.JSONSerializer;
 import org.apache.pivot.serialization.SerializationException;
-import org.apache.pivot.util.Utils;
+import org.apache.pivot.util.ExceptionUtils;
 import org.apache.pivot.util.Version;
 import org.apache.pivot.wtk.Component.DecoratorSequence;
 import org.apache.pivot.wtk.effects.Decorator;
@@ -99,7 +96,7 @@ public abstract class ApplicationContext
 
 private MenuPopup menuPopup = null;
 
-private double scale = 1;
+private double scale = 1.0;
 
 private boolean debugPaint = false;
 
@@ -115,7 +112,7 @@ public abstract class ApplicationContext
 
 private transient DropTargetListener dropTargetListener = new 
DropTargetListener() {
 @Override
-public void dragEnter(DropTargetDragEvent event) {
+public void dragEnter(final DropTargetDragEvent event) {
 if (dragDescendant != null) {
 throw new IllegalStateException("Local drag already in 
progress.");
 }
@@ -150,7 +147,7 @@ public abstract class ApplicationContext
 }
 
 @Override
-public void dragExit(DropTargetEvent event) {
+public void dragExit(final DropTargetEvent event) {
 // Clear drag location and state
 dragLocation = null;
 dragManifest = null;
@@ -169,7 +166,7 @@ public abstract class ApplicationContext
 }
 
 @Override
-public void dragOver(DropTargetDragEvent event) {
+public void dragOver(final DropTargetDragEvent event) {
 java.awt.Point location = event.getLocation();
 
 // Get the previous and current drop descendant and call
@@ -220,7 +217,7 @@ public abstract class ApplicationContext
 }
 
 @Override
-public void dropActionChanged(DropTargetDragEvent event) {
+public void dropActionChanged(final DropTargetDragEvent event) {
 userDropAction = getDropAction(event.getDropAction());
 
 DropAction dropAction = null;
@@ -251,7 +248,7 @@ public abstract class ApplicationContext
 }
 
 @Override
-public void drop(DropTargetDropEvent event) {
+public void drop(final DropTargetDropEvent event) {
 java.awt.Point location

svn commit: r1889345 [2/2] - in /pivot/trunk: ./ wtk/src/org/apache/pivot/wtk/

2021-04-30 Thread rwhitcomb
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java?rev=1889345=1889344=1889345=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java Fri Apr 30 22:02:41 2021
@@ -17,6 +17,8 @@
 package org.apache.pivot.wtk;
 
 import java.awt.MouseInfo;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
 
 import org.apache.pivot.util.Utils;
 
@@ -34,23 +36,96 @@ public final class Mouse {
  * Enumeration representing mouse buttons.
  */
 public enum Button {
-LEFT, RIGHT, MIDDLE;
+/** The left mouse button (typically the "main" button for clicks, 
etc). */
+LEFT(InputEvent.BUTTON1_DOWN_MASK, MouseEvent.BUTTON1),
+/** The right mouse button (typically for popup menus and such). */
+RIGHT(InputEvent.BUTTON3_DOWN_MASK, MouseEvent.BUTTON3),
+/** The middle mouse button (not used much here). */
+MIDDLE(InputEvent.BUTTON2_DOWN_MASK, MouseEvent.BUTTON2);
+
+/**
+ * The AWT modifier value.
+ */
+private final int awtModifier;
+
+/**
+ * The {@link MouseEvent} button value.
+ */
+private final int awtButton;
+
+/**
+ * Construct, setting the AWT equivalents for our values.
+ *
+ * @param modifier The AWT event modifier mask.
+ * @param button   The AWT button identifier.
+ */
+Button(final int modifier, final int button) {
+awtModifier = modifier;
+awtButton = button;
+}
 
+/**
+ * @return The one-bit mask for this button, which is
+ * {@code 2**ordinal}.
+ */
 public int getMask() {
 return 1 << ordinal();
 }
+
+/**
+ * Figure out the complete mask of our button values, given an AWT
+ * input event set of mouse button modifiers.
+ *
+ * @param modifiers The set of {@link InputEvent} modifiers.
+ * @return  The corresponding mask of our own button values.
+ */
+public static int getButtons(final int modifiers) {
+int buttonsMask = 0;
+for (Button b : values()) {
+if ((modifiers & b.awtModifier) > 0) {
+buttonsMask |= b.getMask();
+}
+}
+return buttonsMask;
+}
+
+/**
+ * Translate the AWT mouse event button to our own button value.
+ *
+ * @param eventButton The {@link MouseEvent} button value.
+ * @returnThe corresponding enum value, or {@code null}
+ *if there is no correspondence (should never 
happen).
+ */
+public static Button getButton(final int eventButton) {
+for (Button b : values()) {
+if (eventButton == b.awtButton) {
+return b;
+}
+}
+return null;
+}
 }
 
 /**
  * Enumeration defining supported scroll types.
  */
 public enum ScrollType {
-UNIT, BLOCK
+/** Mouse wheel scrolling by units. */
+UNIT,
+/** Mouse wheel scrolling in blocks. */
+BLOCK
 }
 
+/**
+ * The current set of mouse buttons that are pressed.
+ */
 private static int buttons = 0;
+/**
+ * The component that currently has the mouse captured (if any).
+ */
 private static Component capturer = null;
 
+
 /**
  * @return A bitfield representing the mouse buttons that are currently
  * pressed.
@@ -59,12 +134,19 @@ public final class Mouse {
 return buttons;
 }
 
-protected static void setButtons(final int buttons) {
-Mouse.buttons = buttons;
+/**
+ * Set the current bitmask of the buttons that are pressed (only callable
+ * from this package).
+ *
+ * @param pressedButtons The current button bitmask.
+ * @see Button#getButtons
+ */
+protected static void setButtons(final int pressedButtons) {
+buttons = pressedButtons;
 }
 
 /**
- * Tests the pressed state of a button.
+ * Tests the pressed state of a mouse button.
  *
  * @param button The button to test.
  * @return {@code true} if the button is pressed; {@code false}, otherwise.
@@ -84,21 +166,21 @@ public final class Mouse {
  * "Captures" the mouse, causing all mouse input to be delegated to the
  * given component rather than propagating down the component hierarchy.
  *
- * @param capturerArgument The component that wants to capture the mouse.
+ * @param capturerComponent The component that wants to capture the mouse.
  * The mouse pointer must currently be over the 

svn commit: r1889343 - in /pivot/trunk: charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/collections/concurrent/ core/src/org/apache/pivot/f

2021-04-30 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Apr 30 21:53:24 2021
New Revision: 1889343

URL: http://svn.apache.org/viewvc?rev=1889343=rev
Log:
PIVOT-1032: Fix as many of the "checkstyle" problems in these files as possible.

Modified:
pivot/trunk/charts/src/org/apache/pivot/charts/content/Interval.java
pivot/trunk/charts/src/org/apache/pivot/charts/content/Point.java
pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java

pivot/trunk/core/src/org/apache/pivot/collections/concurrent/SynchronizedSet.java
pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java
pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java
pivot/trunk/core/test/org/apache/pivot/util/test/ImmutableIteratorTest.java
pivot/trunk/core/test/org/apache/pivot/util/test/MIMETypeTest.java
pivot/trunk/core/test/org/apache/pivot/util/test/StringUtilsTest.java
pivot/trunk/core/test/org/apache/pivot/util/test/VoteResultTest.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java

Modified: pivot/trunk/charts/src/org/apache/pivot/charts/content/Interval.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/charts/src/org/apache/pivot/charts/content/Interval.java?rev=1889343=1889342=1889343=diff
==
--- pivot/trunk/charts/src/org/apache/pivot/charts/content/Interval.java 
(original)
+++ pivot/trunk/charts/src/org/apache/pivot/charts/content/Interval.java Fri 
Apr 30 21:53:24 2021
@@ -20,13 +20,23 @@ package org.apache.pivot.charts.content;
  * Represents value data for interval chart views.
  */
 public class Interval extends Point {
+/**
+ * The interval data.
+ */
 private float width = 0;
 
+/**
+ * @return The data value.
+ */
 public float getWidth() {
 return width;
 }
 
-public void setWidth(float width) {
-this.width = width;
+/**
+ * Set the data value.
+ * @param newWidth The new data value.
+ */
+public void setWidth(final float newWidth) {
+width = newWidth;
 }
 }

Modified: pivot/trunk/charts/src/org/apache/pivot/charts/content/Point.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/charts/src/org/apache/pivot/charts/content/Point.java?rev=1889343=1889342=1889343=diff
==
--- pivot/trunk/charts/src/org/apache/pivot/charts/content/Point.java (original)
+++ pivot/trunk/charts/src/org/apache/pivot/charts/content/Point.java Fri Apr 
30 21:53:24 2021
@@ -17,25 +17,45 @@
 package org.apache.pivot.charts.content;
 
 /**
- * Represents value data for x/y chart views.
+ * Represents value data for X/Y chart views.
  */
 public class Point {
+/**
+ * The X-position data.
+ */
 private float x = 0;
+/**
+ * The Y-position data.
+ */
 private float y = 0;
 
+/**
+ * @return The X-position data.
+ */
 public float getX() {
 return x;
 }
 
-public void setX(float x) {
-this.x = x;
+/**
+ * Set the X-position data.
+ * @param xValue The X-position value.
+ */
+public void setX(final float xValue) {
+x = xValue;
 }
 
+/**
+ * @return The Y-position data.
+ */
 public float getY() {
 return y;
 }
 
-public void setY(float y) {
-this.y = y;
+/**
+ * Set the Y-position data.
+ * @param yValue The Y-position value.
+ */
+public void setY(final float yValue) {
+y = yValue;
 }
 }

Modified: pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java?rev=1889343=1889342=1889343=diff
==
--- pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/EnumList.java Fri Apr 30 
21:53:24 2021
@@ -24,6 +24,7 @@ import java.util.NoSuchElementException;
 
 import org.apache.pivot.annotations.UnsupportedOperation;
 import org.apache.pivot.util.ListenerList;
+import org.apache.pivot.util.StringUtils;
 import org.apache.pivot.util.Utils;
 
 /**
@@ -41,7 +42,11 @@ import org.apache.pivot.util.Utils;
 public class EnumList> extends ReadOnlySequence 
implements List, Serializable {
 private static final long serialVersionUID = 5104856822133576300L;
 
+/**
+ * Iterator over the list items.
+ */
 private class ItemIterator implements Iterator {
+/** Index into the array of elements. */
 private int i = 0;
 
 @Override
@@ -65,21 +70,36 @@ public class EnumList>
 }
 }
 
+
+/**
+ * The enum class of the elements.
+ */
 private

svn commit: r1889344 - in /pivot/trunk: core/src/org/apache/pivot/json/JSONSerializer.java core/src/org/apache/pivot/util/ExceptionUtils.java wtk/src/org/apache/pivot/wtk/Insets.java wtk/src/org/apach

2021-04-30 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Apr 30 21:54:42 2021
New Revision: 1889344

URL: http://svn.apache.org/viewvc?rev=1889344=rev
Log:
Tweak some error messages and comments.

Modified:
pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java

Modified: pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java?rev=1889344=1889343=1889344=diff
==
--- pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java Fri Apr 30 
21:54:42 2021
@@ -372,7 +372,6 @@ public class JSONSerializer implements S
 unicodeBuilder.append((char) c);
 c = reader.read();
 }
-
 } else {
 unicodeBuilder.append((char) c);
 while (unicodeBuilder.length() < 4) {

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=1889344=1889343=1889344=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java Fri Apr 30 
21:54:42 2021
@@ -67,9 +67,10 @@ public final class ExceptionUtils {
  *
  * @paramexThe exception to report.
  * @parambuf   The buffer used to build the content.
+ * @return The input buffer.
  */
-public static void toString(final Throwable ex, final StringBuilder buf) {
-toString(ex, buf, false, false, false);
+public static StringBuilder toString(final Throwable ex, final 
StringBuilder buf) {
+return toString(ex, buf, false, false, false);
 }
 
 /**
@@ -115,8 +116,9 @@ public final class ExceptionUtils {
  *   the chained exceptions.
  * @paramconvertTabs Convert any tab characters to single spaces (for 
use in controls
  *   that don't deal with tabs correctly; some do).
+ * @return   The input buffer.
  */
-public static void toString(
+public static StringBuilder toString(
 final Throwable ex,
 final StringBuilder buf,
 final boolean useToString,
@@ -144,8 +146,9 @@ public final class ExceptionUtils {
 || (next instanceof FileNotFoundException)
 || (next instanceof NoSuchFileException)
 || (next instanceof UnsupportedOperationException)
-|| (next instanceof NumberFormatException)) {
-msg = String.format("%1$s \"%2$s\"", name, msg);
+|| (next instanceof NumberFormatException)
+|| (next instanceof IndexOutOfBoundsException)) {
+msg = String.format("%1$s '%2$s'", name, msg);
 }
 }
 buf.append(msg);
@@ -163,6 +166,8 @@ public final class ExceptionUtils {
 buf.setCharAt(ix++, ' ');
 }
 }
+
+return buf;
 }
 
 }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java?rev=1889344=1889343=1889344=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java Fri Apr 30 21:54:42 
2021
@@ -335,7 +335,7 @@ public final class Insets implements Ser
 throw new IllegalArgumentException(ex);
 }
 } else {
-throw new IllegalArgumentException("Unknown format for Insets: 
" + value);
+throw new IllegalArgumentException("Invalid format for Insets: 
'" + value + "'");
 }
 }
 

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java?rev=1889344=1889343=1889344=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java Fri Apr 30 21:54:42 
2021
@@ -393,7 +393,7 @@ public class Window extends Container {
  *
  * @param window The window whic

svn commit: r1889254 - in /pivot/trunk/core: src/org/apache/pivot/util/Version.java test/org/apache/pivot/util/test/VersionTest.java

2021-04-27 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Apr 28 05:59:50 2021
New Revision: 1889254

URL: http://svn.apache.org/viewvc?rev=1889254=rev
Log:
Add "safelyDecode" into Version itself (from ApplicationContext).

Modified:
pivot/trunk/core/src/org/apache/pivot/util/Version.java
pivot/trunk/core/test/org/apache/pivot/util/test/VersionTest.java

Modified: pivot/trunk/core/src/org/apache/pivot/util/Version.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Version.java?rev=1889254=1889253=1889254=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/Version.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Version.java Wed Apr 28 05:59:50 
2021
@@ -18,6 +18,7 @@ package org.apache.pivot.util;
 
 import java.io.Serializable;
 
+
 /**
  * Represents a version number. Version numbers are defined as: 
  * major.minor.maintenance_update  for example,
@@ -26,50 +27,102 @@ import java.io.Serializable;
 public class Version implements Comparable, Serializable {
 private static final long serialVersionUID = -363163272115116L;
 
-private short majorRevision = 0;
-private short minorRevision = 0;
-private short maintenanceRevision = 0;
+/**
+ * The default version object (0, 0, 0, 0).
+ */
+public static final Version ZERO_VERSION = new Version(0, 0, 0, 0L);
+
+/**
+ * The real major version number.
+ */
+private short majorVersion = 0;
+/**
+ * The real minor version number.
+ */
+private short minorVersion = 0;
+/**
+ * The real maintenance version number.
+ */
+private short maintenanceVersion = 0;
+/**
+ * The real update version number.
+ */
 private long updateRevision = 0;
+/**
+ * The build string.
+ */
 private String build = null;
 
-public Version(final int majorRevision, final int minorRevision, final int 
maintenanceRevision,
-final long updateRevision) {
-this(majorRevision, minorRevision, maintenanceRevision, 
updateRevision, null);
-}
-
-public Version(final int majorRevision, final int minorRevision, final int 
maintenanceRevision,
-final long updateRevision, final String build) {
-Utils.checkInRangeOfShort(majorRevision, "majorRevision");
-Utils.checkInRangeOfShort(minorRevision, "minorRevision");
-Utils.checkInRangeOfShort(maintenanceRevision, "maintenanceRevision");
-
-this.majorRevision = (short) majorRevision;
-this.minorRevision = (short) minorRevision;
-this.maintenanceRevision = (short) maintenanceRevision;
-this.updateRevision = updateRevision;
-this.build = build;
+/**
+ * Construct a version given all the numeric values.
+ *
+ * @param major   The new major version.
+ * @param minor   The new minor version.
+ * @param maintenance The new maintenance version.
+ * @param update  The new update version.
+ */
+public Version(final int major, final int minor, final int maintenance, 
final long update) {
+this(major, minor, maintenance, update, null);
+}
+
+/**
+ * Construct a version given all the information.
+ *
+ * @param major   The new major version.
+ * @param minor   The new minor version.
+ * @param maintenance The new maintenance version.
+ * @param update  The new update version.
+ * @param buildString The new build string.
+ */
+public Version(final int major, final int minor, final int maintenance, 
final long update,
+final String buildString) {
+Utils.checkInRangeOfShort(major, "majorVersion");
+Utils.checkInRangeOfShort(minor, "minorVersion");
+Utils.checkInRangeOfShort(maintenance, "maintenanceVersion");
+
+majorVersion = (short) major;
+minorVersion = (short) minor;
+maintenanceVersion = (short) maintenance;
+updateRevision = update;
+build = buildString;
 }
 
+/**
+ * @return The major version number.
+ */
 public short getMajorRevision() {
-return majorRevision;
+return majorVersion;
 }
 
+/**
+ * @return The minor version number.
+ */
 public short getMinorRevision() {
-return minorRevision;
+return minorVersion;
 }
 
+/**
+ * @return The maintenance version number.
+ */
 public short getMaintenanceRevision() {
-return maintenanceRevision;
+return maintenanceVersion;
 }
 
+/**
+ * @return The update revision number.
+ */
 public long getUpdateRevision() {
 return updateRevision;
 }
 
+/**
+ * @return A composite value, consisting of all the numeric components
+ * shifted into parts of a long.
+ */
 public long getNumber() 

svn commit: r1888040 - /pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java

2021-03-24 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Mar 24 20:32:51 2021
New Revision: 1888040

URL: http://svn.apache.org/viewvc?rev=1888040=rev
Log:
PIVOT-1056: Some small code cleanup and optimizations (I hope) in MacroReader
since this could be used in reading the default styles file.

Modified:
pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java

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=1888040=1888039=1888040=diff
==
--- pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java Wed 
Mar 24 20:32:51 2021
@@ -74,13 +74,13 @@ public final class MacroReader extends R
 }
 
 /**
- * Add all the characters of the given string to the lookahead queue
- * for reprocessing.
- * @param str The string to be queued up again.
+ * Add all the characters of the given character sequence to the
+ * lookahead queue for reprocessing.
+ * @param seq The character sequence to be queued up again.
  */
-private void queue(final String str) {
-for (int i = 0; i < str.length(); i++) {
-lookaheadQueue.add((int) str.charAt(i));
+private void queue(final CharSequence seq) {
+for (int i = 0; i < seq.length(); i++) {
+lookaheadQueue.add((int) seq.charAt(i));
 }
 }
 
@@ -96,6 +96,7 @@ public final class MacroReader extends R
 do {
 ch = getNextChar(true);
 } while (ch != -1 && Character.isWhitespace(ch));
+
 if (ch != -1) {
 buf.append((char) ch);
 while ((ch = getNextChar(true)) != -1
@@ -103,6 +104,7 @@ public final class MacroReader extends R
 || (buf.length() > 0 && 
Character.isUnicodeIdentifierPart(ch {
 buf.append((char) ch);
 }
+
 // Re-queue the character that terminated the word
 queue(ch);
 }
@@ -110,10 +112,6 @@ public final class MacroReader extends R
 }
 
 private void skipToEol() throws IOException {
-int ch;
-do {
-ch = getNextChar(true);
-} while (ch != -1 && ch != '\n');
 }
 
 /**
@@ -131,82 +129,109 @@ public final class MacroReader extends R
  */
 private int getNextChar(final boolean handleMacros) throws IOException {
 int ret = -1;
-if (!lookaheadQueue.isEmpty()) {
-ret = lookaheadQueue.poll().intValue();
+Integer queuedChar = lookaheadQueue.poll();
+if (queuedChar != null) {
+ret = queuedChar.intValue();
 } else {
 ret = in.read();
 }
-// Check for macro define or undefine (starting with "#"
-// at the beginning of a line) (unless we're recursing to
-// skip an unknown declaration keyword).
-if (ret == '#' && lastCh == '\n' && handleMacros) {
-String keyword = getNextWord();
-if (keyword.equalsIgnoreCase("undef")) {
-String name = getNextWord();
-skipToEol();
-variableMap.remove(name);
-return getNextChar(true);
-} else if (!keyword.equalsIgnoreCase("define")) {
-// Basically ignore any commands we don't understand
-// by simply queueing the text back to be read again
-// but with the flag set to ignore this command (so
-// we don't get into infinite recursion!)
-queue(ret);
-queue(keyword);
-queue(' ');
-return getNextChar(false);
-}
-// Define a macro
-String name = getNextWord();
-StringBuilder buf = new StringBuilder();
+
+if (handleMacros) {
 int ch;
-do {
-ch = getNextChar(true);
-} while (ch != -1 && Character.isWhitespace(ch) && ch != '\\' && 
ch != '\n');
-queue(ch);
-do {
-while ((ch = getNextChar(true)) != -1 && ch != '\\' && ch != 
'\n') {
-buf.append((char) ch);
+
+// Check for macro define or undefine (starting with "#"
+// at the beginning of a line) (unless we're recursing to
+// skip an unknown declaration keyword).
+if (ret == '#' && lastCh == '\n') {
+String keyword = getNextWord();
+
+if (keyword.equalsIgnoreCase("undef")) {
+String name = getNextWord();
+
+do {
+ch = getNextChar(false);
+  

svn commit: r1888039 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java

2021-03-24 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Mar 24 20:29:57 2021
New Revision: 1888039

URL: http://svn.apache.org/viewvc?rev=1888039=rev
Log:
PIVOT-1056: For the new "message" styles in Prompt, use the reduced number
of setter methods paradigm.

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java?rev=1888039=1888038=1888039=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java 
Wed Mar 24 20:29:57 2021
@@ -221,25 +221,7 @@ public class TerraPromptSkin extends Ter
  *
  * @param font The new font used to render the message label text.
  */
-public final void setMessageFont(final Font font) {
-messageLabel.putStyle(Style.font, font);
-}
-
-/**
- * Sets the font used in rendering the message label's text.
- *
- * @param font A font specification.
- */
-public final void setMessageFont(final String font) {
-messageLabel.putStyle(Style.font, font);
-}
-
-/**
- * Sets the font used in rendering the message label's text.
- *
- * @param font A dictionary describing a font.
- */
-public final void setMessageFont(final Dictionary font) {
+public final void setMessageFont(final Object font) {
 messageLabel.putStyle(Style.font, font);
 }
 
@@ -255,16 +237,7 @@ public class TerraPromptSkin extends Ter
  *
  * @param color The new foreground color for the label text.
  */
-public final void setMessageColor(final Color color) {
-messageLabel.putStyle(Style.color, color);
-}
-
-/**
- * Sets the foreground color of the text of the message label.
- *
- * @param color Any of the recognized color values.
- */
-public final void setMessageColor(final String color) {
+public final void setMessageColor(final Object color) {
 messageLabel.putStyle(Style.color, color);
 }
 
@@ -281,16 +254,7 @@ public class TerraPromptSkin extends Ter
  * @param backgroundColor The new background color for the message label
  * (can be {@code null} to let the parent background show through).
  */
-public final void setMessageBackgroundColor(final Color backgroundColor) {
-messageLabel.putStyle(Style.backgroundColor, backgroundColor);
-}
-
-/**
- * Sets the background color of the message label.
- *
- * @param backgroundColor Any of the recognized color values.
- */
-public final void setMessageBackgroundColor(final String backgroundColor) {
+public final void setMessageBackgroundColor(final Object backgroundColor) {
 messageLabel.putStyle(Style.backgroundColor, backgroundColor);
 }
 




svn commit: r1888038 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java

2021-03-24 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Mar 24 20:24:37 2021
New Revision: 1888038

URL: http://svn.apache.org/viewvc?rev=1888038=rev
Log:
Clear up one more obsolete Javadoc construct.

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java?rev=1888038=1888037=1888038=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
 Wed Mar 24 20:24:37 2021
@@ -1183,8 +1183,8 @@ public class TerraTreeViewSkin extends C
 }
 
 /**
- * @return The bounding box defined by the specified node, or 
null if
- * the node is not currently visible.
+ * @return The bounding box defined by the specified node, or {@code null}
+ * if the node is not currently visible.
  * @param nodeInfo The node information to search for.
  */
 protected final Bounds getNodeBounds(final NodeInfo nodeInfo) {




svn commit: r1888092 - /pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java

2021-03-26 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 26 17:51:11 2021
New Revision: 1888092

URL: http://svn.apache.org/viewvc?rev=1888092=rev
Log:
Remove empty code from MacroReader (after last change).

Modified:
pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java

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=1888092=1888091=1888092=diff
==
--- pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java Fri 
Mar 26 17:51:11 2021
@@ -111,9 +111,6 @@ public final class MacroReader extends R
 return buf.toString();
 }
 
-private void skipToEol() throws IOException {
-}
-
 /**
  * Get the next character in the input stream, either from the
  * {@link #lookaheadQueue} if anything is queued, or by reading




svn commit: r1888187 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java

2021-03-29 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Mar 30 03:15:45 2021
New Revision: 1888187

URL: http://svn.apache.org/viewvc?rev=1888187=rev
Log:
Allow Insets as valid source for Insets.fromObject.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java?rev=1888187=1888186=1888187=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java Tue Mar 30 03:15:45 
2021
@@ -261,7 +261,9 @@ public final class Insets implements Ser
 public static Insets fromObject(final Object source, final String message) 
{
 Utils.checkNull(source, message);
 
-if (source instanceof String) {
+if (source instanceof Insets) {
+return (Insets) source;
+} else if (source instanceof String) {
 return decode((String) source);
 } else if (source instanceof Integer) {
 return new Insets((Integer) source);




svn commit: r1888250 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

2021-03-31 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Mar 31 19:13:49 2021
New Revision: 1888250

URL: http://svn.apache.org/viewvc?rev=1888250=rev
Log:
Tweak some doc and an error message in Component.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=1888250=1888249=1888250=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Wed Mar 31 19:13:49 
2021
@@ -94,7 +94,7 @@ public abstract class Component implemen
  * null due to the use of BeanAdapter to set the the new
  * value. (BeanAdapter does not look up the previous value for
  * performance reasons) This also means that the logic
- * determining whether to fire the the event differs from other Pivot
+ * determining whether to fire the event differs from other Pivot
  * event firing code. The event will be fired each time this method is
  * executed, regardless of whether the new value differs from the old
  * value or not. This behaviour may change in the future so
@@ -113,8 +113,8 @@ public abstract class Component implemen
 previousValue = styles.put(key, value);
 componentStyleListeners.styleUpdated(Component.this, key, 
previousValue);
 } catch (PropertyNotFoundException exception) {
-System.err.println("\"" + key + "\" is not a valid style for "
-+ Component.this.getClass().getName());
+System.err.println("\"" + key + "\" is not a valid style for 
an "
++ Component.this.getClass().getName() + " component");
 }
 
 return previousValue;




svn commit: r1888284 - in /pivot/trunk/wtk/src/org/apache/pivot/wtk: FontUtilities.java skin/ComponentSkin.java util/ColorUtilities.java

2021-04-01 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Apr  2 03:57:08 2021
New Revision: 1888284

URL: http://svn.apache.org/viewvc?rev=1888284=rev
Log:
PIVOT-1056,PIVOT-1014: Move the new "xxxFromObject" methods from ComponentSkin
into FontUtilities and ColorUtilities so they can be used in other places
(decorators, for example).

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/util/ColorUtilities.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java?rev=1888284=1888283=1888284=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java Fri Apr  2 
03:57:08 2021
@@ -19,6 +19,7 @@ package org.apache.pivot.wtk;
 import java.awt.Font;
 import java.util.Locale;
 
+import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.json.JSONSerializer;
 import org.apache.pivot.serialization.SerializationException;
 import org.apache.pivot.util.Utils;
@@ -259,4 +260,32 @@ public final class FontUtilities {
 return adjustedSize;
 }
 
+/**
+ * Convert any object we support into its corresponding font.
+ *  Uses {@link #decodeFont} or {@link Theme#deriveFont}
+ * to do the work.
+ *
+ * @param fontValue The object to be converted to a font.
+ * @return The converted font.
+ * @throws IllegalArgumentException if the value is {@code null} or
+ * cannot be converted.
+ */
+public static Font fromObject(final Object fontValue) {
+Utils.checkNull(fontValue, "font");
+
+if (fontValue instanceof Font) {
+return (Font) fontValue;
+} else if (fontValue instanceof String) {
+return decodeFont((String) fontValue);
+} else if (fontValue instanceof Dictionary) {
+@SuppressWarnings("unchecked")
+Dictionary fontDictionary = (Dictionary) 
fontValue;
+return Theme.deriveFont(fontDictionary);
+} else {
+throw new IllegalArgumentException("Unable to convert "
++ fontValue.getClass().getSimpleName() + " to Font!");
+}
+}
+
+
 }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java?rev=1888284=1888283=1888284=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java Fri Apr  2 
03:57:08 2021
@@ -19,7 +19,6 @@ package org.apache.pivot.wtk.skin;
 import java.awt.Color;
 import java.awt.Font;
 
-import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.collections.EnumSet;
 import org.apache.pivot.util.Utils;
 import org.apache.pivot.wtk.Bounds;
@@ -54,6 +53,7 @@ import org.apache.pivot.wtk.Style;
 import org.apache.pivot.wtk.TextInputMethodListener;
 import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.Tooltip;
+import org.apache.pivot.wtk.util.ColorUtilities;
 
 /**
  * Abstract base class for component skins.
@@ -496,22 +496,10 @@ public abstract class ComponentSkin impl
  * @return The converted font.
  * @throws IllegalArgumentException if the value is {@code null} or
  * cannot be converted.
+ * @see FontUtilities#fromObject
  */
 public Font fontFromObject(final Object fontValue) {
-Utils.checkNull(fontValue, "font");
-
-if (fontValue instanceof Font) {
-return (Font) fontValue;
-} else if (fontValue instanceof String) {
-return FontUtilities.decodeFont((String) fontValue);
-} else if (fontValue instanceof Dictionary) {
-@SuppressWarnings("unchecked")
-Dictionary fontDictionary = (Dictionary) 
fontValue;
-return Theme.deriveFont(fontDictionary);
-} else {
-throw new IllegalArgumentException("Unable to convert "
-+ fontValue.getClass().getSimpleName() + " to Font!");
-}
+return FontUtilities.fromObject(fontValue);
 }
 
 /**
@@ -595,9 +583,10 @@ public abstract class ComponentSkin impl
  * color palette.
  * @return The real {@link Color} value.
  * @throws IllegalArgumentException if the {@code colorValue} is {@code 
null} or of a type we don't recognize.
+ * @see ColorUtilities#fromObject
  */
 public final Color colorFromObject(final Object colorValue) {
-return colorFromObject(colorValue, null, false);
+return ColorUtilities.f

svn commit: r1888286 - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java wtk/src/org/apache/pivot/wtk/skin/TabPaneSkin.java

2021-04-02 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Apr  2 06:19:12 2021
New Revision: 1888286

URL: http://svn.apache.org/viewvc?rev=1888286=rev
Log:
PIVOT-1056,PIVOT-1014: Make the changes to TerraTabPaneSkin (and related 
changes in TabPaneSkin).

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TabPaneSkin.java

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=1888286=1888285=1888286=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 
Fri Apr  2 06:19:12 2021
@@ -25,7 +25,6 @@ import java.awt.geom.Line2D;
 import java.awt.geom.RoundRectangle2D;
 
 import org.apache.pivot.annotations.UnsupportedOperation;
-import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.collections.Sequence;
 import org.apache.pivot.util.Utils;
 import org.apache.pivot.util.Vote;
@@ -75,8 +74,8 @@ public class TerraTabPaneSkin extends Ta
 public class TabButton extends Button {
 private final Component tab;
 
-public TabButton(Component tab) {
-this.tab = tab;
+public TabButton(final Component tabValue) {
+tab = tabValue;
 super.setToggleButton(true);
 
 setSkin(new TabButtonSkin());
@@ -89,19 +88,19 @@ public class TerraTabPaneSkin extends Ta
 
 @Override
 @UnsupportedOperation
-public void setButtonData(Object buttonData) {
+public void setButtonData(final Object buttonData) {
 throw new UnsupportedOperationException();
 }
 
 @Override
 public Button.DataRenderer getDataRenderer() {
-TabPane tabPane = (TabPane) TerraTabPaneSkin.this.getComponent();
+TabPane tabPane = getTabPane();
 return tabPane.getTabDataRenderer();
 }
 
 @Override
 @UnsupportedOperation
-public void setDataRenderer(Button.DataRenderer dataRenderer) {
+public void setDataRenderer(final Button.DataRenderer dataRenderer) {
 throw new UnsupportedOperationException();
 }
 
@@ -112,19 +111,19 @@ public class TerraTabPaneSkin extends Ta
 
 @Override
 @UnsupportedOperation
-public void setTooltipText(String tooltipText) {
+public void setTooltipText(final String tooltipText) {
 throw new UnsupportedOperationException();
 }
 
 @Override
 @UnsupportedOperation
-public void setToggleButton(boolean toggleButton) {
+public void setToggleButton(final boolean toggleButton) {
 throw new UnsupportedOperationException();
 }
 
 @Override
 @UnsupportedOperation
-public void setTriState(boolean triState) {
+public void setTriState(final boolean triState) {
 throw new UnsupportedOperationException();
 }
 
@@ -132,7 +131,7 @@ public class TerraTabPaneSkin extends Ta
 public void press() {
 // If the tab pane is collapsible, toggle the button selection;
 // otherwise, select it
-TabPane tabPane = (TabPane) TerraTabPaneSkin.this.getComponent();
+TabPane tabPane = getTabPane();
 setSelected(tabPane.isCollapsible() ? !isSelected() : true);
 super.press();
 }
@@ -143,22 +142,26 @@ public class TerraTabPaneSkin extends Ta
  * constraints, because it will never be called to use them.
  */
 public class TabButtonSkin extends ButtonSkin {
+private TabButton getTabButton() {
+return (TabButton) getComponent();
+}
+
 @Override
-public int getPreferredWidth(int height) {
+public int getPreferredWidth(final int height) {
 Dimensions preferredSize = getPreferredSize();
 return preferredSize.width;
 }
 
 @Override
-public int getPreferredHeight(int width) {
+public int getPreferredHeight(final int width) {
 Dimensions preferredSize = getPreferredSize();
 return preferredSize.height;
 }
 
 @Override
 public Dimensions getPreferredSize() {
-TabButton tabButton = (TabButton) getComponent();
-TabPane tabPane = (TabPane) TerraTabPaneSkin.this.getComponent();
+TabButton tabButton = getTabButton();
+TabPane tabPane = getTabPane();
 
 Button.DataRenderer dataRenderer = tabButton.getDataRenderer();
 dataRenderer.render(tabButton.getButtonData(), tabButton, false);
@@ -167,13 +170,11 @@ public class TerraTabPaneSkin extends Ta

svn commit: r1888287 - in /pivot/trunk: core/src/org/apache/pivot/json/ demos/src/org/apache/pivot/demos/xml/ wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/ wtk/src/org/a

2021-04-02 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Apr  2 06:29:30 2021
New Revision: 1888287

URL: http://svn.apache.org/viewvc?rev=1888287=rev
Log:
PIVOT-1032: Changes to reduce "checkstyle" violations.

Modified:
pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
pivot/trunk/demos/src/org/apache/pivot/demos/xml/NodeRenderer.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/WTKTaskListener.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinParagraphView.java

Modified: pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java?rev=1888287=1888286=1888287=diff
==
--- pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java Fri Apr  2 
06:29:30 2021
@@ -68,30 +68,33 @@ public class JSONSerializer implements S
 
 private JSONSerializerListener.Listeners jsonSerializerListeners = null;
 
+private static final String NULL_STRING = "null";
+
 public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
 public static final Type DEFAULT_TYPE = Object.class;
 
 public static final String JSON_EXTENSION = "json";
 public static final String MIME_TYPE = "application/json";
 
+
 public JSONSerializer() {
 this(DEFAULT_CHARSET, DEFAULT_TYPE);
 }
 
-public JSONSerializer(final Charset charset) {
-this(charset, DEFAULT_TYPE);
+public JSONSerializer(final Charset cs) {
+this(cs, DEFAULT_TYPE);
 }
 
-public JSONSerializer(final Type type) {
-this(DEFAULT_CHARSET, type);
+public JSONSerializer(final Type objType) {
+this(DEFAULT_CHARSET, objType);
 }
 
-public JSONSerializer(final Charset charset, final Type type) {
-Utils.checkNull(charset, "charset");
-Utils.checkNull(type, "type");
+public JSONSerializer(final Charset cs, final Type objType) {
+Utils.checkNull(cs, "charset");
+Utils.checkNull(objType, "type");
 
-this.charset = charset;
-this.type = type;
+charset = cs;
+type = objType;
 }
 
 /**
@@ -126,11 +129,11 @@ public class JSONSerializer implements S
 /**
  * Sets a flag indicating that map keys should always be quote-delimited.
  *
- * @param alwaysDelimitMapKeys {@code true} to bound map keys in double
+ * @param delimitKeys {@code true} to bound map keys in double
  * quotes; {@code false} to only quote-delimit keys as necessary.
  */
-public void setAlwaysDelimitMapKeys(final boolean alwaysDelimitMapKeys) {
-this.alwaysDelimitMapKeys = alwaysDelimitMapKeys;
+public void setAlwaysDelimitMapKeys(final boolean delimitKeys) {
+alwaysDelimitMapKeys = delimitKeys;
 }
 
 /**
@@ -145,10 +148,10 @@ public class JSONSerializer implements S
  * Sets the serializer's verbosity flag. When verbosity is enabled, all 
data
  * read or written will be echoed to the console.
  *
- * @param verbose {@code true} to set verbose mode, {@code false} to 
disable.
+ * @param verboseValue {@code true} to set verbose mode, {@code false} to 
disable.
  */
-public void setVerbose(final boolean verbose) {
-this.verbose = verbose;
+public void setVerbose(final boolean verboseValue) {
+verbose = verboseValue;
 }
 
 /**
@@ -164,12 +167,12 @@ public class JSONSerializer implements S
  * a non-standard feature.  See the documentation in {@link MacroReader} 
for more details
  * on the specification of macros.
  *  Note: must be called before {@link #readObject} is called.
- * @param macros Flag indicating whether macros are allowed (default is 
{@code false}).
+ * @param allowMacros Flag indicating whether macros are allowed (default 
is {@code false}).
  * The flag must be set to true in order to activate this feature, because 
there is a
  * definitely measured 25x slowdown when using it, even if no macros are 
defined.
  */
-public void setAllowMacros(final boolean macros) {
-this.macros = macros;
+public void setAllowMacros(final boolean allowMacros) {
+macros = allowMacros;
 }
 
 /**
@@ -240,7 +243,7 @@ public class JSONSerializer implements S
 return object;
 }
 
-private Object readValue(final Reader reader, final Type typeArgument, 
final String key)
+private Object readValue(final Reader reader, final Type objTypeValue, 
final String key)
 throws IOException, Serializatio

svn commit: r1887549 - in /pivot/trunk: charts/src/org/apache/pivot/charts/ core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/json/ core/src/org/apache/pivot/util/ core/src/org/apache/p

2021-03-12 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 12 19:50:08 2021
New Revision: 1887549

URL: http://svn.apache.org/viewvc?rev=1887549=rev
Log:
PIVOT-1032: Changes to eliminate checkstyle violations in the non-wtk Listener 
classes.

Modified:

pivot/trunk/charts/src/org/apache/pivot/charts/ChartViewCategoryListener.java
pivot/trunk/charts/src/org/apache/pivot/charts/ChartViewListener.java
pivot/trunk/charts/src/org/apache/pivot/charts/ChartViewSeriesListener.java
pivot/trunk/core/src/org/apache/pivot/collections/ListListener.java
pivot/trunk/core/src/org/apache/pivot/collections/MapListener.java
pivot/trunk/core/src/org/apache/pivot/collections/QueueListener.java
pivot/trunk/core/src/org/apache/pivot/collections/SetListener.java
pivot/trunk/core/src/org/apache/pivot/collections/StackListener.java
pivot/trunk/core/src/org/apache/pivot/json/JSONSerializerListener.java
pivot/trunk/core/src/org/apache/pivot/util/MessageBusListener.java
pivot/trunk/core/src/org/apache/pivot/xml/ElementListener.java
pivot/trunk/core/src/org/apache/pivot/xml/NodeListener.java
pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializerListener.java

pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowListener.java

pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/tools/ComponentInspectorListener.java

pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/tools/EventLoggerListener.java
pivot/trunk/web/src/org/apache/pivot/web/QueryListener.java

Modified: 
pivot/trunk/charts/src/org/apache/pivot/charts/ChartViewCategoryListener.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/charts/src/org/apache/pivot/charts/ChartViewCategoryListener.java?rev=1887549=1887548=1887549=diff
==
--- 
pivot/trunk/charts/src/org/apache/pivot/charts/ChartViewCategoryListener.java 
(original)
+++ 
pivot/trunk/charts/src/org/apache/pivot/charts/ChartViewCategoryListener.java 
Fri Mar 12 19:50:08 2021
@@ -26,26 +26,25 @@ public interface ChartViewCategoryListen
 /**
  * Chart view category listener list.
  */
-public static class Listeners extends 
ListenerList
-implements ChartViewCategoryListener {
+final class Listeners extends ListenerList 
implements ChartViewCategoryListener {
 @Override
-public void categoryInserted(ChartView chartView, int index) {
+public void categoryInserted(final ChartView chartView, final int 
index) {
 forEach(listener -> listener.categoryInserted(chartView, index));
 }
 
 @Override
-public void categoriesRemoved(ChartView chartView, int index,
-Sequence categories) {
+public void categoriesRemoved(final ChartView chartView, final int 
index,
+final Sequence categories) {
 forEach(listener -> listener.categoriesRemoved(chartView, index, 
categories));
 }
 
 @Override
-public void categoryKeyChanged(ChartView chartView, int index, String 
previousKey) {
+public void categoryKeyChanged(final ChartView chartView, final int 
index, final String previousKey) {
 forEach(listener -> listener.categoryKeyChanged(chartView, index, 
previousKey));
 }
 
 @Override
-public void categoryLabelChanged(ChartView chartView, int index, 
String previousLabel) {
+public void categoryLabelChanged(final ChartView chartView, final int 
index, final String previousLabel) {
 forEach(listener -> listener.categoryLabelChanged(chartView, 
index, previousLabel));
 }
 }
@@ -56,7 +55,7 @@ public interface ChartViewCategoryListen
  * @param chartView The chart that is changing.
  * @param index The index of the new category that was inserted.
  */
-public void categoryInserted(ChartView chartView, int index);
+void categoryInserted(ChartView chartView, int index);
 
 /**
  * Fired when a category is removed from a chart view.
@@ -65,7 +64,7 @@ public interface ChartViewCategoryListen
  * @param index The index of the first category that was removed.
  * @param categories The list of removed categories.
  */
-public void categoriesRemoved(ChartView chartView, int index,
+void categoriesRemoved(ChartView chartView, int index,
 Sequence categories);
 
 /**
@@ -75,7 +74,7 @@ public interface ChartViewCategoryListen
  * @param index The index of the category whose key changed.
  * @param previousKey Previous value of the changed key.
  */
-public void categoryKeyChanged(ChartView chartView, int index, String 
previousKey);
+void categoryKeyChanged(ChartView chartView, int index, String 
previousKey);
 
 /**
  * Fired when a chart view's category label changes.
@@ -84,5 +83,5 @@ public interface ChartViewCategoryListen
  * @param index The index of the category

svn commit: r1887552 - in /pivot/trunk: core/src/org/apache/pivot/util/ wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/content/

2021-03-12 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 12 20:58:56 2021
New Revision: 1887552

URL: http://svn.apache.org/viewvc?rev=1887552=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=1887551=1887552=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=1887551=1887552=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=1887551=1887552=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 stati

svn commit: r1887544 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/ButtonPressListener.java

2021-03-12 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 12 18:05:37 2021
New Revision: 1887544

URL: http://svn.apache.org/viewvc?rev=1887544=rev
Log:
PIVOT-1032: Changes to reduce "checkstyle" violations.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/ButtonPressListener.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ButtonPressListener.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ButtonPressListener.java?rev=1887544=1887543=1887544=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ButtonPressListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ButtonPressListener.java Fri Mar 
12 18:05:37 2021
@@ -21,14 +21,15 @@ import org.apache.pivot.util.ListenerLis
 /**
  * Button press listener interface.
  */
+@FunctionalInterface
 public interface ButtonPressListener {
 /**
  * Button press listeners.
  */
-public static class Listeners extends ListenerList
+final class Listeners extends ListenerList
 implements ButtonPressListener {
 @Override
-public void buttonPressed(Button button) {
+public void buttonPressed(final Button button) {
 forEach(listener -> listener.buttonPressed(button));
 }
 }
@@ -38,5 +39,5 @@ public interface ButtonPressListener {
  *
  * @param button The button that was just pressed.
  */
-public void buttonPressed(Button button);
+void buttonPressed(Button button);
 }




svn commit: r1887545 - /pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java

2021-03-12 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 12 18:09:34 2021
New Revision: 1887545

URL: http://svn.apache.org/viewvc?rev=1887545=rev
Log:
Updates to ExceptionUtils to recognize more classes that need
this treatment, and to make the exception names more readable.

Modified:
pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java

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=1887545=1887544=1887545=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 
18:09:34 2021
@@ -19,6 +19,8 @@ package org.apache.pivot.util;
 import java.io.FileNotFoundException;
 import java.net.UnknownHostException;
 import java.nio.charset.CharacterCodingException;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
 import java.nio.file.NoSuchFileException;
 
 
@@ -71,6 +73,38 @@ public final class ExceptionUtils {
 }
 
 /**
+ * Produce a more readable exception name from the given exception.
+ *
+ * @param   ex  The exception in question.
+ * @return  A "nicer" or more readable name to use in 
reporting.
+ */
+private static String exceptionName(Throwable ex) {
+String simpleName = ex.getClass().getSimpleName();
+String nicerName  = simpleName;
+
+switch (simpleName) {
+case "CharacterCodingException":
+case "NumberFormatException":
+break;
+default:
+nicerName = simpleName.replace("Exception", 
"").replace("Error", "");
+break;
+}
+
+// Make the exception name a little easier to read
+StringBuilder buf = new StringBuilder(nicerName.length() * 2);
+for (int i = 0; i < nicerName.length(); i++) {
+char ch = nicerName.charAt(i);
+if (i > 0 && Character.isUpperCase(ch)) {
+buf.append(' ');
+}
+buf.append(ch);
+}
+
+return buf.toString();
+}
+
+/**
  * Incremental version with more options.
  *
  * @paramex  The exception to report.
@@ -90,26 +124,28 @@ public final class ExceptionUtils {
 final boolean convertTabs) {
 
 for (Throwable next = ex; next != null;) {
-String msg, className;
+String msg, name;
 
 if (useToString) {
 msg = next.toString();
 } else {
-msg   = next.getLocalizedMessage();
-className = next.getClass().getSimpleName();
+msg  = next.getLocalizedMessage();
+name = exceptionName(next);
 
 if (msg == null) {
-msg = className;
+msg = name;
 } else if ((next instanceof UnknownHostException)
 || (next instanceof NoClassDefFoundError)
 || (next instanceof ClassNotFoundException)
 || (next instanceof NullPointerException)
 || (next instanceof CharacterCodingException)
+|| (next instanceof IllegalCharsetNameException)
+|| (next instanceof UnsupportedCharsetException)
 || (next instanceof FileNotFoundException)
 || (next instanceof NoSuchFileException)
 || (next instanceof UnsupportedOperationException)
 || (next instanceof NumberFormatException)) {
-msg = String.format("%1$s: %2$s", className, msg);
+msg = String.format("%1$s \"%2$s\"", name, msg);
 }
 }
 buf.append(msg);




svn commit: r1887553 [3/3] - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/skin/

2021-03-12 Thread rwhitcomb
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java?rev=1887553=1887552=1887553=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java Fri Mar 12 
21:04:51 2021
@@ -41,28 +41,33 @@ import org.apache.pivot.wtk.Theme;
  * Separator skin.
  */
 public class SeparatorSkin extends ComponentSkin implements SeparatorListener {
+/** Current font used to render any text for the separator. */
 private Font font;
+/** Color used to draw the separator. */
 private Color color;
+/** Color used to paint the heading text. */
 private Color headingColor;
+/** Thickness of the separator line. */
 private int thickness;
+/** Padding around the separator. */
 private Insets padding;
 
+/** Construct and set defaults. */
 public SeparatorSkin() {
 }
 
 @Override
-public void install(Component component) {
+public void install(final Component component) {
 super.install(component);
 
-Theme theme = currentTheme();
-theme.setDefaultStyles(this);
+setDefaultStyles();
 
 Separator separator = (Separator) component;
 separator.getSeparatorListeners().add(this);
 }
 
 @Override
-public int getPreferredWidth(int height) {
+public int getPreferredWidth(final int height) {
 int preferredWidth = 0;
 
 Separator separator = (Separator) getComponent();
@@ -78,7 +83,7 @@ public class SeparatorSkin extends Compo
 }
 
 @Override
-public int getPreferredHeight(int width) {
+public int getPreferredHeight(final int width) {
 int preferredHeight = thickness;
 
 Separator separator = (Separator) getComponent();
@@ -127,7 +132,7 @@ public class SeparatorSkin extends Compo
 }
 
 @Override
-public void paint(Graphics2D graphics) {
+public void paint(final Graphics2D graphics) {
 Separator separator = (Separator) getComponent();
 int width = getWidth();
 int separatorY = padding.top;
@@ -173,31 +178,31 @@ public class SeparatorSkin extends Compo
 /**
  * Sets the font used in rendering the Separator's heading.
  *
- * @param font The new font for the heading.
+ * @param newFont The new font for the heading.
  */
-public void setFont(Font font) {
-Utils.checkNull(font, "font");
+public void setFont(final Font newFont) {
+Utils.checkNull(newFont, "font");
 
-this.font = font;
+this.font = newFont;
 invalidateComponent();
 }
 
 /**
  * Sets the font used in rendering the Separator's heading.
  *
- * @param font A {@linkplain ComponentSkin#decodeFont(String) font 
specification}.
+ * @param fontString A {@linkplain ComponentSkin#decodeFont(String) font 
specification}.
  */
-public final void setFont(String font) {
-setFont(decodeFont(font));
+public final void setFont(final String fontString) {
+setFont(decodeFont(fontString));
 }
 
 /**
  * Sets the font used in rendering the Separator's heading.
  *
- * @param font A dictionary {@link Theme#deriveFont describing a font}.
+ * @param fontDictionary A dictionary {@link Theme#deriveFont describing a 
font}.
  */
-public final void setFont(Dictionary font) {
-setFont(Theme.deriveFont(font));
+public final void setFont(final Dictionary fontDictionary) {
+setFont(Theme.deriveFont(fontDictionary));
 }
 
 /**
@@ -210,23 +215,23 @@ public class SeparatorSkin extends Compo
 /**
  * Sets the color of the Separator's horizontal rule.
  *
- * @param color The new color for the horizontal rule.
+ * @param newColor The new color for the horizontal rule.
  */
-public void setColor(Color color) {
-Utils.checkNull(color, "color");
+public void setColor(final Color newColor) {
+Utils.checkNull(newColor, "color");
 
-this.color = color;
+this.color = newColor;
 repaintComponent();
 }
 
 /**
  * Sets the color of the Separator's horizontal rule.
  *
- * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
+ * @param colorString Any of the {@linkplain GraphicsUtilities#decodeColor 
color
  * values recognized by Pivot}.
  */
-public final void setColor(String color) {
-setColor(GraphicsUtilities.decodeColor(color, "color"));
+public final void setColor(final String colorString) {
+setColor(GraphicsUtilities.decodeColor(colorString, "color"));
 }
 
 /**
@@ -239,23 +244,23 @@ public class SeparatorSkin extends Compo
 /**
  * Sets the color of the text in the heading.
  *
- 

svn commit: r1887553 [1/3] - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/skin/

2021-03-12 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 12 21:04:51 2021
New Revision: 1887553

URL: http://svn.apache.org/viewvc?rev=1887553=rev
Log:
Improvements to code that needs to get info from the theme:
- methods in Component to get the theme font and colors
- add some "getxxx" methods in the skins to reduce code to do the casting
- this change involves a bunch of "checkstyle" fixes also
- move more of the initial theme value settings to the JSON file

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSeparatorSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextAreaSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextPaneSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SliderSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java?rev=1887553=1887552=1887553=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
 Fri Mar 12 21:04:51 2021
@@ -255,8 +255,7 @@ public class TerraExpanderSkin extends E
 titleRow.add(titleBoxPane);
 titleRow.add(buttonBoxPane);
 
-Theme theme = currentTheme();
-Font titleFont = theme.getFont().deriveFont(Font.BOLD);
+Font titleFont = getThemeFont().deriveFont(Font.BOLD);
 titleLabel.getStyles().put(Style.font, titleFont);
 titleBoxPane.add(titleLabel);
 
@@ -277,8 +276,7 @@ public class TerraExpanderSkin extends E
 
 shadeButton.getButtonPressListeners().add(this);
 
-Theme theme = currentTheme();
-theme.setDefaultStyles(this);
+setDefaultStyles();
 
 titleChanged(expander, null);
 collapsibleChanged(expander);
@@ -490,8 +488,7 @@ public class TerraExpanderSkin extends E
 }
 
 public final void setTitleBarColor(int titleBarColor) {
-Theme theme = currentTheme();
-setTitleBarColor(theme.getColor(titleBarColor));
+setTitleBarColor(getColor(titleBarColor));
 }
 
 public Color getTitleBarBackgroundColor() {
@@ -509,8 +506,7 @@ public class TerraExpanderSkin extends E
 }
 
 public final void setTitleBarBackgroundColor(int titleBarBackgroundColor) {
-Theme theme = currentTheme();
-setTitleBarBackgroundColor(theme.getColor(titleBarBackgroundColor));
+setTitleBarBackgroundColor(getColor(titleBarBackgroundColor));
 }
 
 public Color getTitleBarBorderColor() {
@@ -527,8 +523,7 @@ public class TerraExpanderSkin extends E
 }
 
 public final void setTitleBarBorderColor(int titleBarBorderColor) {
-Theme theme = currentTheme();
-setTitleBarBorderColor(theme.getColor(titleBarBorderColor));
+setTitleBarBorderColor(getColor(titleBarBorderColor));
 }
 
 public Color getShadeButtonColor() {
@@ -545,8 +540,7 @@ public class TerraExpanderSkin extends E
 }
 
 public final void setShadeButtonColor(int shadeButtonColor) {
-Theme theme = currentTheme();
-setShadeButtonColor(theme.getColor(shadeButtonColor));
+setShadeButtonColor(getColor(shadeButtonColor));
 }
 
 public Color getDisabledShadeButtonColor() {
@@ -564,8 +558,7 @@ public class TerraExpanderSkin extends E
 }
 
 public final void setDisabledShadeButtonColor(int 
disabledShadeButtonColor) {
-Theme theme = currentTheme();
-setDisabledShadeButtonColor(theme.getColor(disabledShadeButtonColor));
+setDisabledShadeButtonColor(getColor(disa

svn commit: r1887553 [2/3] - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/skin/

2021-03-12 Thread rwhitcomb
Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java?rev=1887553=1887552=1887553=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
 Fri Mar 12 21:04:51 2021
@@ -74,7 +74,7 @@ public class TerraTreeViewSkin extends C
  *
  * @param nodeInfo The object to visit
  */
-public void visit(NodeInfo nodeInfo);
+void visit(NodeInfo nodeInfo);
 }
 
 /**
@@ -98,16 +98,16 @@ public class TerraTreeViewSkin extends C
  * Creates a new visible node iterator that will iterate over a portion
  * of the visible nodes list (useful during painting).
  *
- * @param start The start index, inclusive
- * @param end The end index, inclusive
+ * @param startIndex The start index, inclusive
+ * @param endIndex The end index, inclusive
  */
-public VisibleNodeIterator(int start, int end) {
-if (start < 0 || end >= visibleNodes.getLength()) {
+public VisibleNodeIterator(final int startIndex, final int endIndex) {
+if (startIndex < 0 || endIndex >= visibleNodes.getLength()) {
 throw new IndexOutOfBoundsException();
 }
 
-this.index = start;
-this.end = end;
+this.index = startIndex;
+this.end = endIndex;
 }
 
 /**
@@ -199,7 +199,7 @@ public class TerraTreeViewSkin extends C
  * cached here to provide further optimizations during painting and user
  * input.
  */
-protected static class NodeInfo {
+private static class NodeInfo {
 // Core metadata
 final TreeView treeView;
 final BranchInfo parent;
@@ -221,10 +221,11 @@ public class TerraTreeViewSkin extends C
 public static final byte CHECK_STATE_MASK = CHECK_STATE_CHECKED_MASK
 | CHECK_STATE_MIXED_MASK;
 
-protected NodeInfo(TreeView treeView, BranchInfo parent, Object data) {
-this.treeView = treeView;
-this.parent = parent;
-this.data = data;
+public NodeInfo(final TreeView treeViewValue, final BranchInfo 
parentValue,
+final Object dataValue) {
+this.treeView = treeViewValue;
+this.parent = parentValue;
+this.data = dataValue;
 
 depth = (parent == null) ? 0 : parent.depth + 1;
 
@@ -246,7 +247,7 @@ public class TerraTreeViewSkin extends C
 }
 
 @SuppressWarnings("unchecked")
-private static NodeInfo newInstance(TreeView treeView, BranchInfo 
parent, Object data) {
+public static NodeInfo newInstance(final TreeView treeView, final 
BranchInfo parent, final Object data) {
 NodeInfo nodeInfo = null;
 
 if (data instanceof List) {
@@ -279,7 +280,7 @@ public class TerraTreeViewSkin extends C
 return ((fields & HIGHLIGHTED_MASK) != 0);
 }
 
-public void setHighlighted(boolean highlighted) {
+public void setHighlighted(final boolean highlighted) {
 if (highlighted) {
 fields |= HIGHLIGHTED_MASK;
 } else {
@@ -291,7 +292,7 @@ public class TerraTreeViewSkin extends C
 return ((fields & SELECTED_MASK) != 0);
 }
 
-public void setSelected(boolean selected) {
+public void setSelected(final boolean selected) {
 if (selected) {
 fields |= SELECTED_MASK;
 } else {
@@ -303,7 +304,7 @@ public class TerraTreeViewSkin extends C
 return ((fields & DISABLED_MASK) != 0);
 }
 
-public void setDisabled(boolean disabled) {
+public void setDisabled(final boolean disabled) {
 if (disabled) {
 fields |= DISABLED_MASK;
 } else {
@@ -315,7 +316,7 @@ public class TerraTreeViewSkin extends C
 return ((fields & CHECKMARK_DISABLED_MASK) != 0);
 }
 
-public void setCheckmarkDisabled(boolean checkmarkDisabled) {
+public void setCheckmarkDisabled(final boolean checkmarkDisabled) {
 if (checkmarkDisabled) {
 fields |= CHECKMARK_DISABLED_MASK;
 } else {
@@ -345,7 +346,7 @@ public class TerraTreeViewSkin extends C
 return ((fields & CHECK_STATE_CHECKED_MASK) != 0);
 }
 
-public void setCheckState(TreeView.NodeCheckState checkState) {
+public void setCheckState(final TreeView.NodeCheckState checkState) {
 fields &= ~CHECK_STATE_MASK;
 
 switch (checkState) {
@@ -362,7 +363,7 @@ public class TerraTreeViewSkin extends C
 

svn commit: r1887554 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

2021-03-12 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 12 21:29:26 2021
New Revision: 1887554

URL: http://svn.apache.org/viewvc?rev=1887554=rev
Log:
PIVOT-1053: Also add new "getStyle" and "getStyleXXX" methods to Component.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=1887554=1887553=1887554=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Fri Mar 12 21:29:26 
2021
@@ -2242,6 +2242,106 @@ public abstract class Component implemen
 }
 
 /**
+ * Get the style value corresponding to the given style key.
+ *
+ * @param style The enumerated style key.
+ * @return The value for this style.
+ */
+public final Object getStyle(final Style style) {
+return styleDictionary.get(style);
+}
+
+/**
+ * Get the style value corresponding to the given style key.
+ *
+ * @param style The style key.
+ * @return The value for this style.
+ */
+public final Object getStyle(final String style) {
+return styleDictionary.get(style);
+}
+
+/**
+ * Get the color value corresponding to the given style key.
+ *
+ * @param style The enumerated style key.
+ * @return The color value for that style.
+ */
+public Color getStyleColor(final Style style) {
+return styleDictionary.getColor(style);
+}
+
+/**
+ * Get the color value corresponding to the given style key.
+ *
+ * @param style The style key.
+ * @return The color value for that style.
+ */
+public Color getStyleColor(final String style) {
+return styleDictionary.getColor(style);
+}
+
+/**
+ * Get the font value corresponding to the given style key.
+ *
+ * @param style The enumerated style key.
+ * @return The font value for that style.
+ */
+public Font getStyleFont(final Style style) {
+return styleDictionary.getFont(style);
+}
+
+/**
+ * Get the font value corresponding to the given style key.
+ *
+ * @param style The style key.
+ * @return The font value for that style.
+ */
+public Font getStyleFont(final String style) {
+return styleDictionary.getFont(style);
+}
+
+/**
+ * Get the integer value corresponding to the given style key.
+ *
+ * @param style The enumerated style key.
+ * @return The integer value for that style.
+ */
+public int getStyleInt(final Style style) {
+return styleDictionary.getInt(style);
+}
+
+/**
+ * Get the integer value corresponding to the given style key.
+ *
+ * @param style The style key.
+ * @return The integer value for that style.
+ */
+public int getStyleInt(final String style) {
+return styleDictionary.getInt(style);
+}
+
+/**
+ * Get the boolean value corresponding to the given style key.
+ *
+ * @param style The enumerated style key.
+ * @return The boolean value for that style.
+ */
+public boolean getStyleBoolean(final Style style) {
+return styleDictionary.getBoolean(style);
+}
+
+/**
+ * Get the boolean value corresponding to the given style key.
+ *
+ * @param style The style key.
+ * @return The boolean value for that style.
+ */
+public boolean getStyleBoolean(final String style) {
+return styleDictionary.getBoolean(style);
+}
+
+/**
  * Put the given key/value style into the style dictionary.
  *
  * @param style The enumerated style key.




svn commit: r1887551 - in /pivot/trunk: demos/src/org/apache/pivot/demos/colors/Colors.java wtk/src/org/apache/pivot/wtk/Component.java

2021-03-12 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 12 20:46:45 2021
New Revision: 1887551

URL: http://svn.apache.org/viewvc?rev=1887551=rev
Log:
Add new "putStyle" methods in Component to make setting styles less verbose.
Named "putStyle" as reminiscent of the "getStyles().put(...)" code it
replaces, and to avoid confusion with "putStyles" which is a different
beast.

Modified:
pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Modified: pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java?rev=1887551=1887550=1887551=diff
==
--- pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java Fri Mar 12 
20:46:45 2021
@@ -43,14 +43,14 @@ public final class Colors implements App
 
 private Label makeLabel(final String text) {
 Label label = new Label(text);
-label.getStyles().put(Style.horizontalAlignment, 
HorizontalAlignment.CENTER);
+label.putStyle(Style.horizontalAlignment, HorizontalAlignment.CENTER);
 return label;
 }
 
 @Override
 public void startup(final Display display, final Map 
properties) {
 GridPane gridPane = new GridPane(CELLS_PER_ROW);
-gridPane.getStyles().put(Style.padding, 6);
+gridPane.putStyle(Style.padding, 6);
 
 Font fontBold= 
FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.BOLD,   13);
 Font fontRegular = 
FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.PLAIN,  12);
@@ -67,8 +67,8 @@ public final class Colors implements App
 }
 
 BoxPane container = new BoxPane(Orientation.VERTICAL);
-container.getStyles().put(Style.padding, 4);
-container.getStyles().put(Style.fill, true);
+container.putStyle(Style.padding, 4);
+container.putStyle(Style.fill, true);
 
 BoxPane colorFill = new BoxPane(Orientation.VERTICAL);
 
@@ -78,7 +78,7 @@ public final class Colors implements App
 int g = fillColor.getGreen();
 int b = fillColor.getBlue();
 
-colorFill.getStyles().put(Style.backgroundColor, fillColor);
+colorFill.putStyle(Style.backgroundColor, fillColor);
 colorFill.setPreferredWidth(372);
 colorFill.setPreferredHeight(100);
 Set matchingColors = CSSColor.getMatchingColors(color);
@@ -88,21 +88,21 @@ public final class Colors implements App
 colorFill.setTooltipText(matches);
 
 Label nameLabel = makeLabel(color.toString());
-nameLabel.getStyles().put(Style.font, fontBold);
+nameLabel.putStyle(Style.font, fontBold);
 
 String rgbText = String.format("R=%1$3d, G=%2$3d, B=%3$3d", r, g, 
b);
 Label rgbLabel = makeLabel(rgbText);
-rgbLabel.getStyles().put(Style.font, fontRegular);
+rgbLabel.putStyle(Style.font, fontRegular);
 
 float[] hsbValues = Color.RGBtoHSB(r, g, b, null);
 String hsbText = String.format("H=%1$5.3f, S=%2$5.3f, V=%3$5.3f",
 hsbValues[0], hsbValues[1], hsbValues[2]);
 Label hsbLabel = makeLabel(hsbText);
-hsbLabel.getStyles().put(Style.font, fontRegular);
+hsbLabel.putStyle(Style.font, fontRegular);
 
 String seqText = String.format("%1$d / %2$d", cell + 1, numColors);
 Label seqLabel = makeLabel(seqText);
-seqLabel.getStyles().put(Style.font, fontItalic);
+seqLabel.putStyle(Style.font, fontItalic);
 
 container.add(colorFill);
 container.add(nameLabel);

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=1887551=1887550=1887551=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Fri Mar 12 20:46:45 
2021
@@ -2242,6 +2242,26 @@ public abstract class Component implemen
 }
 
 /**
+ * Put the given key/value style into the style dictionary.
+ *
+ * @param style The enumerated style key.
+ * @param value The value for this style.
+ */
+public final void putStyle(final Style style, final Object value) {
+styleDictionary.put(style, value);
+}
+
+/**
+ * Put the given key/value style into the style dictionary.
+ *
+ * @param style The style key.
+ * @param value The value for this style.
+ */
+public final void putStyle(final String 

svn commit: r1887556 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/

2021-03-12 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 12 23:46:34 2021
New Revision: 1887556

URL: http://svn.apache.org/viewvc?rev=1887556=rev
Log:
PIVOT-1053: Convert the "wtk-terra" code to using new "putStyle", "getStyle", 
and "copyStyle" methods in Component.

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAlertSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuBarItemSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuItemSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuPopupSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.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/TerraVFSBrowserSheetSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAlertSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAlertSkin.java?rev=1887556=1887555=1887556=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAlertSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAlertSkin.java 
Fri Mar 12 23:46:34 2021
@@ -209,7 +209,7 @@ public class TerraAlertSkin extends Terr
 this.borderBackgroundColor = borderBackgroundColor;
 
 if (messageBorder != null) {
-messageBorder.getStyles().put(Style.backgroundColor, 
borderBackgroundColor);
+messageBorder.putStyle(Style.backgroundColor, 
borderBackgroundColor);
 }
 }
 
@@ -233,7 +233,7 @@ public class TerraAlertSkin extends Terr
 this.borderColor = borderColor;
 
 if (messageBorder != null) {
-messageBorder.getStyles().put(Style.color, borderColor);
+messageBorder.putStyle(Style.color, borderColor);
 }
 }
 

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java?rev=1887556=1887555=1887556=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
 Fri Mar 12 23:46:34 2021
@@ -169,8 +169,8 @@ public class TerraCalendarButtonSkin ext
 
 // Create the border
 calendarBorder = new Border(calendar);
-calendarBorder.getStyles().put(Style.padding, Insets.NONE);
-calendarBorder.getStyles().put(Style.color, borderColor);
+calendarBorder.putStyle(Style.padding, Insets.NONE);
+calendarBorder.putStyle(Style.color, borderColor);
 
 // Set the popup content
 calendarPopup.setContent(calendarBorder);
@@ -458,7 +458,7 @@ public class TerraCalendarButtonSkin ext
 Utils.checkNull(borderColor, "borderColor");
 
 this.borderColor = borderColor;
-calendarBorder.getStyles().put(Style.color, borderColor);
+calendarBorder.putStyle(Style.color, borderColor);
 repaintComponent();
 }
 

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java?rev=1887556=1887555=1887556=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terr

svn commit: r1887788 - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java

2021-03-18 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Mar 18 16:11:51 2021
New Revision: 1887788

URL: http://svn.apache.org/viewvc?rev=1887788=rev
Log:
PIVOT-1054: Fix the drawing problem with border titles at larger font sizes.

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java?rev=1887788=1887787=1887788=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java 
Thu Mar 18 16:11:51 2021
@@ -16,7 +16,6 @@
  */
 package org.apache.pivot.wtk.skin.terra;
 
-import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.skin.BorderSkin;
 
 /**
@@ -31,13 +30,11 @@ public class TerraBorderSkin extends Bor
 }
 
 public final void setColor(int color) {
-Theme theme = currentTheme();
-setColor(theme.getColor(color));
+setColor(getColor(color));
 }
 
 public final void setTitleColor(int titleColor) {
-Theme theme = currentTheme();
-setTitleColor(theme.getColor(titleColor));
+setTitleColor(getColor(titleColor));
 }
 
 }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java?rev=1887788=1887787=1887788=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java Thu Mar 18 
16:11:51 2021
@@ -55,24 +55,29 @@ public class BorderSkin extends Containe
 private CornerRadii cornerRadii;
 
 public BorderSkin() {
-font = currentTheme().getFont().deriveFont(Font.BOLD);
+font = getThemeFont().deriveFont(Font.BOLD);
 
 setBackgroundColor(defaultBackgroundColor());
 color = defaultForegroundColor();
 titleColor = defaultForegroundColor();
 
-thickness = topThickness = 1;
-titleAscent = 0.0f;
+thickness = 1;
 padding = Insets.NONE;
 cornerRadii = CornerRadii.NONE;
 }
 
+private Border getBorder() {
+return (Border) getComponent();
+}
+
 @Override
 public void install(Component component) {
 super.install(component);
 
 Border border = (Border) component;
 border.getBorderListeners().add(this);
+
+calculateTitleSize();
 }
 
 private int paddingThicknessWidth() {
@@ -87,7 +92,7 @@ public class BorderSkin extends Containe
 public int getPreferredWidth(int height) {
 int preferredWidth = 0;
 
-Border border = (Border) getComponent();
+Border border = getBorder();
 
 String title = border.getTitle();
 if (title != null && title.length() > 0) {
@@ -115,7 +120,7 @@ public class BorderSkin extends Containe
 public int getPreferredHeight(int width) {
 int preferredHeight = 0;
 
-Border border = (Border) getComponent();
+Border border = getBorder();
 
 Component content = border.getContent();
 if (content != null) {
@@ -137,7 +142,7 @@ public class BorderSkin extends Containe
 int preferredWidth = 0;
 int preferredHeight = 0;
 
-Border border = (Border) getComponent();
+Border border = getBorder();
 
 String title = border.getTitle();
 if (title != null && title.length() > 0) {
@@ -163,7 +168,7 @@ public class BorderSkin extends Containe
 public int getBaseline(int width, int height) {
 int baseline = -1;
 
-Border border = (Border) getComponent();
+Border border = getBorder();
 
 // Delegate baseline calculation to the content component
 Component content = border.getContent();
@@ -187,7 +192,7 @@ public class BorderSkin extends Containe
 int width = getWidth();
 int height = getHeight();
 
-Border border = (Border) getComponent();
+Border border = getBorder();
 
 Component content = border.getContent();
 if (content != null) {
@@ -202,7 +207,7 @@ public class BorderSkin extends Containe
 
 @Override
 public void paint(Graphics2D graphics) {
-Border border = (Border) getComponent();
+Border border = getBorder();
 
 String title = border.getTitle();
 
@@ -245,8 +250,7 @@ public class BorderSkin extends Containe
 padding.left + thickness, (topThickness - 
titleBounds.getHeight()) / 2,
 titleBounds.getWidth() + 1,

svn commit: r1887917 - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/skin/

2021-03-22 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Mar 22 06:29:02 2021
New Revision: 1887917

URL: http://svn.apache.org/viewvc?rev=1887917=rev
Log:
PIVOT-1056,PIVOT-1014: First POC commit of the Color, Font, Insets, and 
CornerRadii
"fromObject" methods, used now in LabelSkin and BorderSkin. Coupled with their
default styles being moved to "terra_theme_defaults.json", this finishes the
conversion work in these two components.

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraLabelSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_styles.json
pivot/trunk/wtk/src/org/apache/pivot/wtk/CornerRadii.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java?rev=1887917=1887916=1887917=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraBorderSkin.java 
Mon Mar 22 06:29:02 2021
@@ -19,22 +19,16 @@ package org.apache.pivot.wtk.skin.terra;
 import org.apache.pivot.wtk.skin.BorderSkin;
 
 /**
- * Terra Border skin. Deals with colors that depend on
- * the current theme.
+ * Terra Border skin. Nothing to do here.
  */
 public class TerraBorderSkin extends BorderSkin {
-public TerraBorderSkin() {
-setBackgroundColor(4);
-setColor(7);
-setTitleColor(12);
-}
 
-public final void setColor(int color) {
-setColor(getColor(color));
-}
-
-public final void setTitleColor(int titleColor) {
-setTitleColor(getColor(titleColor));
+/**
+ * Specific constructor with nothing to do.
+ *  Default colors, etc. set by call to {@link 
TerraTheme#setDefaultStyles}
+ * from {@link BorderSkin#install}.
+ */
+public TerraBorderSkin() {
 }
 
 }

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraLabelSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraLabelSkin.java?rev=1887917=1887916=1887917=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraLabelSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraLabelSkin.java 
Mon Mar 22 06:29:02 2021
@@ -16,32 +16,19 @@
  */
 package org.apache.pivot.wtk.skin.terra;
 
-import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.skin.LabelSkin;
 
 /**
- * Terra Label skin.  Only deals with colors that depend on
- * the current theme.
+ * Terra Label skin. Nothing to do here.
  */
 public class TerraLabelSkin extends LabelSkin {
-public TerraLabelSkin() {
-setColor(1);
-setDisabledColor(7);
-}
-
-public final void setColor(int color) {
-Theme theme = currentTheme();
-setColor(theme.getColor(color));
-}
 
-public final void setDisabledColor(int color) {
-Theme theme = currentTheme();
-setDisabledColor(theme.getColor(color));
-}
-
-public final void setBackgroundColor(int backgroundColor) {
-Theme theme = currentTheme();
-setBackgroundColor(theme.getColor(backgroundColor));
+/**
+ * Specific constructor with nothing to do.
+ *  Default colors, etc. set by call to {@link 
TerraTheme#setDefaultStyles}
+ * from {@link LabelSkin#install}.
+ */
+public TerraLabelSkin() {
 }
 
 }

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json?rev=1887917=1887916=1887917=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
 Mon Mar 22 06:29:02 2021
@@ -40,21 +40,24 @@
 },
 
 TerraSeparatorSkin : {
-// TODO: conflicts between SeparatorSkin and TerraSeparatorSkin
-
-// color = defaultForegroundColor();
-// headingColor = defaultForegroundColor();
-
 font : { bold : true },
 thickness : 1,
 padding : [ 4, 0, 4, 4 ],
 
-// These are fro

svn commit: r1887830 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java

2021-03-19 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 19 22:33:29 2021
New Revision: 1887830

URL: http://svn.apache.org/viewvc?rev=1887830=rev
Log:
Simplification to Bounds.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java?rev=1887830=1887829=1887830=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java Fri Mar 19 22:33:29 
2021
@@ -320,7 +320,7 @@ public final class Bounds implements Ser
  * @return A new enlarged bounds.
  */
 public Bounds enlarge(final int amt) {
-return new Bounds(x - amt, y - amt, width + (2 * amt), height + (2 * 
amt));
+return enlarge(amt, amt);
 }
 
 /**




svn commit: r1887831 - /pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java

2021-03-19 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 19 23:16:18 2021
New Revision: 1887831

URL: http://svn.apache.org/viewvc?rev=1887831=rev
Log:
PIVOT-1056: Some code cleanup and (maybe) optimization in BeanAdapter.

Modified:
pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java

Modified: pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java?rev=1887831=1887830=1887831=diff
==
--- pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java Fri Mar 19 
23:16:18 2021
@@ -51,27 +51,29 @@ import org.apache.pivot.util.Utils;
  */
 public class BeanAdapter implements Map {
 /**
- * Property iterator. Returns a value for each getter method and public,
+ * Property iterator. Returns a property name for each getter method and 
public,
  * non-final field defined by the bean.
  */
 private class PropertyIterator implements Iterator {
 private Method[] methods = null;
 private Field[] fields = null;
 
-private int i = 0;
-private int j = 0;
-private String nextProperty = null;
-
-public PropertyIterator() {
-Class type = bean.getClass();
-methods = type.getMethods();
-fields = type.getFields();
+private int methodIndex = 0;
+private int fieldIndex = 0;
+private String nextPropertyName = null;
+
+/**
+ * Construct the property iterator over our bean object.
+ */
+PropertyIterator() {
+methods = beanClass.getMethods();
+fields = beanClass.getFields();
 nextProperty();
 }
 
 @Override
 public boolean hasNext() {
-return (nextProperty != null);
+return (nextPropertyName != null);
 }
 
 @Override
@@ -80,17 +82,20 @@ public class BeanAdapter implements Map<
 throw new NoSuchElementException();
 }
 
-String nextPropertyLocal = this.nextProperty;
+String nameToReturn = nextPropertyName;
 nextProperty();
 
-return nextPropertyLocal;
+return nameToReturn;
 }
 
+/**
+ * Iterate to the next acceptable property method/field in the bean 
object.
+ */
 private void nextProperty() {
-nextProperty = null;
+nextPropertyName = null;
 
-while (i < methods.length && nextProperty == null) {
-Method method = methods[i++];
+while (methodIndex < methods.length && nextPropertyName == null) {
+Method method = methods[methodIndex++];
 
 if (method.getParameterTypes().length == 0
 && (method.getModifiers() & Modifier.STATIC) == 0) {
@@ -107,33 +112,27 @@ public class BeanAdapter implements Map<
 
 if (prefix != null) {
 int propertyOffset = prefix.length();
-nextProperty = 
Character.toLowerCase(methodName.charAt(propertyOffset))
+String propertyName = 
Character.toLowerCase(methodName.charAt(propertyOffset))
 + methodName.substring(propertyOffset + 1);
 
-if (nextProperty.equals("class")) {
-nextProperty = null;
+if (!propertyName.equals("class")) {
+if (!ignoreReadOnlyProperties || 
!isReadOnly(propertyName)) {
+   nextPropertyName = propertyName;
+}
 }
 }
-
-if (nextProperty != null && ignoreReadOnlyProperties
-&& isReadOnly(nextProperty)) {
-nextProperty = null;
-}
 }
 }
 
-if (nextProperty == null) {
-while (j < fields.length && nextProperty == null) {
-Field field = fields[j++];
+if (nextPropertyName == null) {
+while (fieldIndex < fields.length && nextPropertyName == null) 
{
+Field field = fields[fieldIndex++];
 
 int modifiers = field.getModifiers();
 if ((modifiers & Modifier.PUBLIC) != 0 && (modifiers & 
Modifier.STATIC) == 0) {
-nextProperty = field.getName();
-}
-
-if (nextProperty != null && ignoreReadOnlyProperties
-&& (modifiers & Modifier.FINAL) != 0) {
-   

svn commit: r1887833 - /pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java

2021-03-19 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 19 23:48:27 2021
New Revision: 1887833

URL: http://svn.apache.org/viewvc?rev=1887833=rev
Log:
Some tweaks to BeanAdapter.

Modified:
pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java

Modified: pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java?rev=1887833=1887832=1887833=diff
==
--- pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java Fri Mar 19 
23:48:27 2021
@@ -55,11 +55,26 @@ public class BeanAdapter implements Map<
  * non-final field defined by the bean.
  */
 private class PropertyIterator implements Iterator {
+/**
+ * The list of methods in the bean object.
+ */
 private Method[] methods = null;
+/**
+ * The list of fields in the bean object.
+ */
 private Field[] fields = null;
 
+/**
+ * Current index into the {@link #methods} array.
+ */
 private int methodIndex = 0;
+/**
+ * Current index into the {@link #fields} array.
+ */
 private int fieldIndex = 0;
+/**
+ * The next property name to return (if any) during the iteration.
+ */
 private String nextPropertyName = null;
 
 /**
@@ -145,21 +160,43 @@ public class BeanAdapter implements Map<
 }
 }
 
+/**
+ * The POJO object we are wrapping in order to get/set its properties.
+ */
 private final Object bean;
+/**
+ * For convenience, the class of the bean object.
+ */
 private final Class beanClass;
+/**
+ * For convenience, name of the bean object's class.
+ */
 private final String beanClassName;
+/**
+ * Flag to say whether or not we ignore properties that have no "setting" 
methods
+ * and are thus "readonly".
+ */
 private final boolean ignoreReadOnlyProperties;
 
+/**
+ * List of listeners for changes to properties (that is, values) in this 
map (bean).
+ */
 private MapListener.Listeners mapListeners = new 
MapListener.Listeners<>();
 
+/** Prefix for "getProperty" method names. */
 public static final String GET_PREFIX = "get";
+/** Prefix for "isProperty" method names. */
 public static final String IS_PREFIX = "is";
+/** Prefix for "setProperty" method names. */
 public static final String SET_PREFIX = "set";
 
+/** Method name of an enum class to return an enum value from a String. */
 private static final String ENUM_VALUE_OF_METHOD_NAME = "valueOf";
 
+/** Error message format for illegal access exceptions. */
 private static final String ILLEGAL_ACCESS_EXCEPTION_MESSAGE_FORMAT =
 "Unable to access property \"%s\" for type %s.";
+/** Error message for failed attempt to coerce to an enum value. */
 private static final String ENUM_COERCION_EXCEPTION_MESSAGE =
 "Unable to coerce %s (\"%s\") to %s.\nValid enum constants - %s";
 
@@ -407,7 +444,7 @@ public class BeanAdapter implements Map<
 }
 
 @Override
-public Comparator getComparator() {
+public final Comparator getComparator() {
 return null;
 }
 
@@ -464,7 +501,7 @@ public class BeanAdapter implements Map<
 }
 
 @Override
-public ListenerList> getMapListeners() {
+public final ListenerList> getMapListeners() {
 return mapListeners;
 }
 
@@ -643,7 +680,9 @@ public class BeanAdapter implements Map<
 if (setterMethod == null) {
 // Look for a match on the value's super type
 Class superType = valueType.getSuperclass();
-setterMethod = internalGetSetterMethod(beanClass, methodName, 
superType);
+if (superType != null) {
+setterMethod = internalGetSetterMethod(beanClass, methodName, 
superType);
+}
 }
 
 if (setterMethod == null) {




svn commit: r1887832 - /pivot/trunk/StyleChecks.java

2021-03-19 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Mar 19 23:24:04 2021
New Revision: 1887832

URL: http://svn.apache.org/viewvc?rev=1887832=rev
Log:
Spiff up the output of StyleChecks a little bit.

Modified:
pivot/trunk/StyleChecks.java

Modified: pivot/trunk/StyleChecks.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/StyleChecks.java?rev=1887832=1887831=1887832=diff
==
--- pivot/trunk/StyleChecks.java (original)
+++ pivot/trunk/StyleChecks.java Fri Mar 19 23:24:04 2021
@@ -642,8 +642,9 @@ public final class StyleChecks {
 sortedList.add(info);
 }
 
-System.out.println("Style Check Results");
-System.out.println("---");
+System.out.println("=");
+System.out.println(" Style Check Results");
+System.out.println("=");
 System.out.println();
 
 if (sortedList.isEmpty()) {
@@ -703,6 +704,7 @@ public final class StyleChecks {
 // The list is sorted by count, with highest count first
 fileCountList.sort((o1, o2) -> o2.getCount() - o1.getCount());
 System.out.println(twoReports ? "Files with the most 
problems:" : "File problem counts:");
+System.out.println(twoReports ? 
"-" : "");
 int num = 1;
 for (FileInfo info : fileCountList) {
 System.out.format(FORMAT4, info.getName(), 
info.getCount());
@@ -717,6 +719,7 @@ public final class StyleChecks {
 // The list is sorted by count, with lowest count first
 fileCountList.sort((o1, o2) -> o1.getCount() - 
o2.getCount());
 System.out.println("Files with the fewest problems:");
+System.out.println("---");
 for (int i = leastRemaining; i > 0; i--) {
 FileInfo info = fileCountList.get(i - 1);
 System.out.format(FORMAT4, info.getName(), 
info.getCount());




svn commit: r1886926 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

2021-02-25 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Feb 25 16:56:55 2021
New Revision: 1886926

URL: http://svn.apache.org/viewvc?rev=1886926=rev
Log:
Refactor Keyboard a little bit and add "arePressed" methods.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java?rev=1886926=1886925=1886926=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java Thu Feb 25 16:56:55 
2021
@@ -301,18 +301,21 @@ public final class Keyboard {
 public static final int UNDEFINED = KeyEvent.VK_UNDEFINED;
 }
 
-private static int modifiers = 0;
+/**
+ * The current set of pressed modifier keys.
+ */
+private static int currentModifiers = 0;
 
 /**
  * @return A bitfield representing the keyboard modifiers that are 
currently
  * pressed.
  */
 public static int getModifiers() {
-return modifiers;
+return currentModifiers;
 }
 
 protected static void setModifiers(final int modifiers) {
-Keyboard.modifiers = modifiers;
+currentModifiers = modifiers;
 }
 
 /**
@@ -323,7 +326,29 @@ public final class Keyboard {
  * otherwise.
  */
 public static boolean isPressed(final Modifier modifier) {
-return (modifiers & modifier.getMask()) > 0;
+return (currentModifiers & modifier.getMask()) > 0;
+}
+
+/**
+ * Test to see if and only if the given set of modifier(s) are pressed.
+ *
+ * @param modifierSet The set of modifiers to test.
+ * @return {@code true} if only those modifiers (and no others)
+ * are pressed.
+ */
+public static boolean arePressed(final Set modifierSet) {
+   return currentModifiers == Modifier.getMask(modifierSet);
+}
+
+/**
+ * Test to see if and only if the given modifier(s) are pressed.
+ *
+ * @param modifiers The modifiers to test.
+ * @return {@code true} if only those modifiers (and no others)
+ * are pressed.
+ */
+public static boolean arePressed(final Modifier... modifiers) {
+   return currentModifiers == Modifier.getMask(modifiers);
 }
 
 /**
@@ -334,18 +359,18 @@ public final class Keyboard {
  * if none are pressed.
  */
 public static boolean areAnyPressed(final Set modifierSet) {
-return (modifiers & Modifier.getMask(modifierSet)) > 0;
+return (currentModifiers & Modifier.getMask(modifierSet)) > 0;
 }
 
 /**
  * Are any of the given list of {@link Modifier}s pressed?
  *
- * @param modifierList The list of modifiers to test.
+ * @param modifiers The modifiers to test.
  * @return {@code true} if any of them are pressed, {@code false}
  * if none are pressed.
  */
-public static boolean areAnyPressed(final Modifier... modifierList) {
-return (modifiers & Modifier.getMask(modifierList)) > 0;
+public static boolean areAnyPressed(final Modifier... modifiers {
+return (currentModifiers & Modifier.getMask(modifiers)) > 0;
 }
 
 /**
@@ -358,20 +383,20 @@ public final class Keyboard {
  */
 public static boolean areAllPressed(final Set modifierSet) {
 int mask = Modifier.getMask(modifierSet);
-return (modifiers & mask) == mask;
+return (currentModifiers & mask) == mask;
 }
 
 /**
  * Are all of the given list of {@link Modifier}s pressed?
  *  This is typically used to test two modifiers (like CTRL and SHIFT).
  *
- * @param modifierList The list of modifiers to test.
+ * @param modifiers The modifiers to test.
  * @return {@code true} if all of the modifiers are pressed, {@code false}
  * if only some or none are pressed.
  */
-public static boolean areAllPressed(final Modifier... modifierList) {
-int mask = Modifier.getMask(modifierList);
-return (modifiers & mask) == mask;
+public static boolean areAllPressed(final Modifier... modifiers) {
+int mask = Modifier.getMask(modifiers);
+return (currentModifiers & mask) == mask;
 }
 
 /**
@@ -392,26 +417,26 @@ public final class Keyboard {
 DropAction dropAction = null;
 
 if (Platform.isOSX()) {
-if (areAllPressed(Modifier.ALT, Modifier.META)) {
+if (arePressed(Modifier.ALT, Modifier.META)) {
 dropAction = DropAction.LINK;
-} else if (isPressed(Modifier.ALT)) {
+} else if (arePressed(Modifier.ALT)) {
 dropAction = DropAction.COPY;
 } else {
 dropAction = DropAction.MOVE;
 }
 } else if (Platform.isWindows()) {
-if (areAllP

svn commit: r1886970 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java

2021-02-26 Thread rwhitcomb
Author: rwhitcomb
Date: Sat Feb 27 05:34:52 2021
New Revision: 1886970

URL: http://svn.apache.org/viewvc?rev=1886970=rev
Log:
Add styles to set font, colors, and text decoration of the Prompt message.

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java?rev=1886970=1886969=1886970=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java 
Sat Feb 27 05:34:52 2021
@@ -16,7 +16,11 @@
  */
 package org.apache.pivot.wtk.skin.terra;
 
+import java.awt.Color;
+import java.awt.Font;
+
 import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.collections.Sequence;
 import org.apache.pivot.util.Vote;
 import org.apache.pivot.wtk.BoxPane;
@@ -30,6 +34,8 @@ import org.apache.pivot.wtk.Prompt;
 import org.apache.pivot.wtk.PromptListener;
 import org.apache.pivot.wtk.PushButton;
 import org.apache.pivot.wtk.Sheet;
+import org.apache.pivot.wtk.Style;
+import org.apache.pivot.wtk.TextDecoration;
 import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.Window;
 
@@ -37,16 +43,34 @@ import org.apache.pivot.wtk.Window;
  * Prompt skin.
  */
 public class TerraPromptSkin extends TerraSheetSkin implements PromptListener {
+/**
+ * The image view that contains the prompt icon.
+ */
 private ImageView typeImageView = null;
+/**
+ * Label containing the message text.
+ */
 private Label messageLabel = null;
+/**
+ * Box pane that contains the prompt body.
+ */
 private BoxPane messageBoxPane = null;
+/**
+ * Box pane containing the option buttons.
+ */
 private BoxPane optionButtonBoxPane = null;
+/**
+ * The command button style for the option buttons.
+ */
 private static final String BUTTON_STYLE_NAME =
 TerraPromptSkin.class.getPackage().getName() + "." + 
TerraTheme.COMMAND_BUTTON_STYLE;
 
+/**
+ * Button press listener to select the prompt response and close the 
prompt.
+ */
 private ButtonPressListener optionButtonPressListener = new 
ButtonPressListener() {
 @Override
-public void buttonPressed(Button button) {
+public void buttonPressed(final Button button) {
 int optionIndex = optionButtonBoxPane.indexOf(button);
 
 if (optionIndex >= 0) {
@@ -57,12 +81,15 @@ public class TerraPromptSkin extends Ter
 }
 };
 
+/**
+ * Default constructor.
+ */
 public TerraPromptSkin() {
 setResizable(true);
 }
 
 @Override
-public void install(Component component) {
+public void install(final Component component) {
 super.install(component);
 
 Prompt prompt = (Prompt) component;
@@ -103,7 +130,7 @@ public class TerraPromptSkin extends Ter
 }
 
 @Override
-public void windowOpened(Window window) {
+public void windowOpened(final Window window) {
 super.windowOpened(window);
 
 Prompt prompt = (Prompt) window;
@@ -117,19 +144,19 @@ public class TerraPromptSkin extends Ter
 }
 
 @Override
-public void messageTypeChanged(Prompt prompt, MessageType 
previousMessageType) {
+public void messageTypeChanged(final Prompt prompt, final MessageType 
previousMessageType) {
 TerraTheme theme = (TerraTheme) Theme.getTheme();
 typeImageView.setImage(theme.getMessageIcon(prompt.getMessageType()));
 }
 
 @Override
-public void messageChanged(Prompt prompt, String previousMessage) {
+public void messageChanged(final Prompt prompt, final String 
previousMessage) {
 String message = prompt.getMessage();
 messageLabel.setText(message != null ? message : "");
 }
 
 @Override
-public void bodyChanged(Prompt prompt, Component previousBody) {
+public void bodyChanged(final Prompt prompt, final Component previousBody) 
{
 if (previousBody != null) {
 messageBoxPane.remove(previousBody);
 }
@@ -141,7 +168,7 @@ public class TerraPromptSkin extends Ter
 }
 
 @Override
-public void optionInserted(Prompt prompt, int index) {
+public void optionInserted(final Prompt prompt, final int index) {
 Object option = prompt.getOptions().get(index);
 
 PushButton optionButton = new PushButton(option);
@@ -152,12 +179,12 @@ public class TerraPromptSkin extends Ter
 }
 
 @Override
-public void optionsRemoved(Prompt prompt, int index, Sequence removed) {
+public void optionsRemoved(final Prompt prompt, final int index, 

svn commit: r1886971 - in /pivot/trunk/wtk: src/org/apache/pivot/wtk/Bounds.java test/org/apache/pivot/wtk/test/BoundsTest.java

2021-02-26 Thread rwhitcomb
Author: rwhitcomb
Date: Sat Feb 27 05:43:47 2021
New Revision: 1886971

URL: http://svn.apache.org/viewvc?rev=1886971=rev
Log:
Add "enlarge" methods to Bounds and upgrade BoundsTest.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BoundsTest.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java?rev=1886971=1886970=1886971=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java Sat Feb 27 05:43:47 
2021
@@ -311,6 +311,31 @@ public final class Bounds implements Ser
 }
 
 /**
+ * Create a new bounds object that is both offset and expanded by a single
+ * amount in both directions.  The X- and Y-offset values are moved up/left
+ * and the width and height are expanded by twice the amount. The center 
point
+ * of the bounds remains the same.
+ *  This has the same effect as {@code translate(amt, 
amt).expand(2*amt, 2*amt)}.
+ * @param amt The amount to expand both the X- and Y- directions.
+ * @return A new enlarged bounds.
+ */
+public Bounds enlarge(final int amt) {
+return new Bounds(x - amt, y - amt, width + (2 * amt), height + (2 * 
amt));
+}
+
+/**
+ * Create a new bounds object that is enlarged by different amounts in the
+ * X- and Y-directions. The center point of the bounds remains the same.
+ *  This has the same effect as {@code translate(dx, dy).expand(2*dx, 
2*dy)}.
+ * @param dx The amount to enlarge in the X-direction.
+ * @param dy The amount to enlarge in the Y-direction.
+ * @return A new enlarged bounds.
+ */
+public Bounds enlarge(final int dx, final int dy) {
+return new Bounds(x - dx, y - dy, width + (2 * dx), height + (2 * dy));
+}
+
+/**
  * @return Whether this bounded area contains the given point.
  * @param point The other point to test (must not be {@code null}).
  * @throws IllegalArgumentException if the point argument is {@code null}.

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=1886971=1886970=1886971=diff
==
--- pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BoundsTest.java (original)
+++ pivot/trunk/wtk/test/org/apache/pivot/wtk/test/BoundsTest.java Sat Feb 27 
05:43:47 2021
@@ -42,6 +42,7 @@ public class BoundsTest {
 
 Dimensions dim0 = new Dimensions(0, 0);
 Dimensions dim1 = new Dimensions(1, 1);
+Dimensions dim5 = new Dimensions(5);
 Point p10 = new Point(10, 10);
 Bounds bnd10 = new Bounds(p10, dim1);
 Bounds bnd10a = new Bounds(dim1);
@@ -62,6 +63,9 @@ public class BoundsTest {
 Bounds bnd6 = Bounds.decode("2, 3;  4,  5");
 Bounds bnd6a = new Bounds(2, 3, 4, 5);
 
+Bounds bnd7 = bnd6a.enlarge(2);
+Bounds bnd7a = bnd6a.enlarge(1, 3);
+
 assertEquals(Bounds.EMPTY, bnd0);
 assertNotEquals(bndMinus1, bnd0);
 assertNotEquals(bnd0, bnd1);
@@ -72,15 +76,15 @@ public class BoundsTest {
 assertEquals(bnd2, bnd3);
 assertEquals(bnd3, bnd3a);
 
-assertEquals(bndMinus1.getSize(), dim0);
-assertEquals(bnd0.getSize(), dim0);
-assertEquals(bnd1.getSize(), dim1);
+assertEquals(dim0, bndMinus1.getSize());
+assertEquals(dim0, bnd0.getSize());
+assertEquals(dim1, bnd1.getSize());
 
 assertFalse(bnd1.contains(bnd0));
 
 assertFalse(bndMinus1.intersects(bnd0));
 assertFalse(bnd0.intersects(bnd1));
-assertEquals(bnd0.intersect(bnd1), new Bounds(1, 1, -1, -1));
+assertEquals(new Bounds(1, 1, -1, -1), bnd0.intersect(bnd1));
 assertTrue(bnd5a.intersects(bnd5b));
 assertTrue(bnd0.union(bnd1).equals(new Bounds(0, 0, 2, 2)));
 
@@ -90,7 +94,10 @@ public class BoundsTest {
 assertEquals(bndN, bndAll);
 
 assertEquals(bnd6, bnd6a);
-assertEquals(bnd6a.toString(), "Bounds [2,3;4x5]");
+assertEquals("Bounds [2,3;4x5]", bnd6a.toString());
+
+assertEquals("Bounds [0,1;8x9]", bnd7.toString());
+assertEquals("Bounds [1,0;6x11]", bnd7a.toString());
 }
 
 }




svn commit: r1887074 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java

2021-03-01 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Mar  2 04:11:40 2021
New Revision: 1887074

URL: http://svn.apache.org/viewvc?rev=1887074=rev
Log:
Changes to reduce "checkstyle" violations.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java?rev=1887074=1887073=1887074=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java Tue Mar  2 04:11:40 
2021
@@ -34,6 +34,7 @@ import org.apache.pivot.collections.Arra
 import org.apache.pivot.collections.LinkedStack;
 import org.apache.pivot.collections.Sequence;
 import org.apache.pivot.json.JSON;
+import org.apache.pivot.text.AttributedStringCharacterIterator;
 import org.apache.pivot.text.CharSpan;
 import org.apache.pivot.util.ImmutableIterator;
 import org.apache.pivot.util.ListenerList;
@@ -53,15 +54,26 @@ public class TextArea extends Component
 
 private ParagraphListener.Listeners paragraphListeners = new 
ParagraphListener.Listeners();
 
+/**
+ * @return The characters in this paragraph.
+ */
 public CharSequence getCharacters() {
 return characters;
 }
 
+/**
+ * @return The {@code TextArea} this paragraph belongs to.
+ */
 public TextArea getTextArea() {
 return textArea;
 }
 
-public void append(char character) {
+/**
+ * Append the given character to this paragraph.
+ *
+ * @param character The character to append.
+ */
+public void append(final char character) {
 if (textArea != null) {
 throw new IllegalStateException();
 }
@@ -69,6 +81,9 @@ public class TextArea extends Component
 characters.append(character);
 }
 
+/**
+ * Clear all the characters in this paragraph.
+ */
 public void clear() {
 if (textArea != null) {
 throw new IllegalStateException();
@@ -77,7 +92,13 @@ public class TextArea extends Component
 characters.delete(0, characters.length());
 }
 
-public void insertText(CharSequence text, int index) {
+/**
+ * Insert the characters at the given index into this paragraph.
+ *
+ * @param text  The sequence of characters to insert.
+ * @param index The index into this paragraph where to insert the text.
+ */
+public void insertText(final CharSequence text, final int index) {
 Utils.checkNull(text, "Text to insert");
 
 indexBoundsCheck("index", index, 0, characters.length());
@@ -106,18 +127,29 @@ public class TextArea extends Component
 textArea.textAreaContentListeners.textChanged(textArea);
 
 if (textArea.selectionStart != previousSelectionStart
-|| textArea.selectionLength != previousSelectionLength) {
+ || textArea.selectionLength != previousSelectionLength) {
 
textArea.textAreaSelectionListeners.selectionChanged(textArea,
 textArea.selectionStart, textArea.selectionLength);
 }
 }
 }
 
-public void removeText(int index) {
+/**
+ * Remove all the text in this paragraph starting at the index.
+ *
+ * @param index The starting index in the paragraph where to remove 
the text.
+ */
+public void removeText(final int index) {
 removeText(index, characters.length() - index);
 }
 
-public void removeText(int index, int count) {
+/**
+ * Remove some of the text in this paragraph.
+ *
+ * @param index Index in the paragraph where to start to remove the 
text.
+ * @param count Number of characters to remove starting at the index.
+ */
+public void removeText(final int index, final int count) {
 Utils.checkIndexBounds(index, count, 0, characters.length());
 
 characters.delete(index, index + count);
@@ -138,17 +170,24 @@ public class TextArea extends Component
 textArea.textAreaContentListeners.textChanged(textArea);
 
 if (textArea.selectionStart != previousSelectionStart
-|| textArea.selectionLength != previousSelectionLength) {
+ || textArea.selectionLength != previousSelectionLength) {
 
textArea.textAreaSelectionListeners.selectionChanged(textArea,
 textArea.selectionStart, textArea.selectionLength);
 }
 }
 }
 
+/**
+ * @return The relative offset

svn commit: r1887070 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

2021-03-01 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Mar  2 04:03:59 2021
New Revision: 1887070

URL: http://svn.apache.org/viewvc?rev=1887070=rev
Log:
Tweak some Javadoc in Component.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=1887070=1887069=1887070=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Tue Mar  2 04:03:59 
2021
@@ -2606,16 +2606,19 @@ public abstract class Component implemen
 
 /**
  * Check an index value against the provided bounds and throw a nicely 
formatted
- * exception, including the index name, for out of range values.
+ * exception, including the index name, for out of range values. Index 
must be
+ * in the range of {@code [min..max]}.
  *
  * @param indexName The name of the index to be checked.
  * @param index Index to be checked against the bounds.
  * @param min Minimum allowed value of the index.
  * @param max Maximum allowed value of the index.
- * @throws IndexOutOfBoundsException if index is out of range.
+ * @throws IllegalArgumentException if given {@code max < min}.
+ * @throws IndexOutOfBoundsException if index is out of range ({@code 
index < min}
+ * or {@code index > max}).
  */
-protected static final void indexBoundsCheck(final String indexName, final 
int index, final int min, final int max)
-throws IndexOutOfBoundsException {
+protected static final void indexBoundsCheck(final String indexName, final 
int index,
+final int min, final int max) {
 if (max < min) {
 throw new IllegalArgumentException("max (" + max + ") < " + "min 
(" + min + ")");
 }




svn commit: r1887073 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java

2021-03-01 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Mar  2 04:07:43 2021
New Revision: 1887073

URL: http://svn.apache.org/viewvc?rev=1887073=rev
Log:
Tweak some Javadoc in TablePane.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java?rev=1887073=1887072=1887073=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java Tue Mar  2 04:07:43 
2021
@@ -28,8 +28,8 @@ import org.apache.pivot.util.Utils;
 
 /**
  * Container that arranges components in a two-dimensional grid, optionally
- * spanning multiple rows and columns, much like an HTML {@code }
- * element.  Note that unlike an HTML {@code }, components that
+ * spanning multiple rows and columns, much like an HTML 
table
+ * element.  Note that unlike an HTML tablei, 
components that
  * span multiple rows or columns will not "push" other components out of their
  * way. Instead, the spanning components will simply overlay the cells into
  * which they span. This means that application developers may have to use




svn commit: r1887075 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java

2021-03-01 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Mar  2 04:13:08 2021
New Revision: 1887075

URL: http://svn.apache.org/viewvc?rev=1887075=rev
Log:
Changes to reduce "checkstyle" violations.

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java?rev=1887075=1887074=1887075=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
 Tue Mar  2 04:13:08 2021
@@ -75,7 +75,7 @@ public class TerraTextInputSkin extends
 TextInputContentListener, TextInputSelectionListener {
 
 private Rectangle getCaretRectangle(final TextHitInfo textCaret) {
-TextInput textInput = (TextInput) getComponent();
+TextInput textInput = getTextInput();
 AttributedStringCharacterIterator composedText = 
textInput.getComposedText();
 Bounds selectionStartBounds = 
getCharacterBounds(textInput.getSelectionStart());
 return GraphicsUtilities.getCaretRectangle(textCaret, composedText, 
selectionStartBounds.x, padding.top + 1);
@@ -90,20 +90,18 @@ public class TerraTextInputSkin extends
 @Override
 public AttributedCharacterIterator getCommittedText(final int 
beginIndex, final int endIndex,
 final AttributedCharacterIterator.Attribute[] attributes) {
-TextInput textInput = (TextInput) getComponent();
+TextInput textInput = getTextInput();
 return new AttributedStringCharacterIterator(textInput.getText(), 
beginIndex, endIndex, attributes);
 }
 
 @Override
 public int getCommittedTextLength() {
-TextInput textInput = (TextInput) getComponent();
-return textInput.getCharacterCount();
+return getTextInput().getCharacterCount();
 }
 
 @Override
 public int getInsertPositionOffset() {
-TextInput textInput = (TextInput) getComponent();
-return textInput.getSelectionStart();
+return getTextInput().getSelectionStart();
 }
 
 @Override
@@ -113,18 +111,17 @@ public class TerraTextInputSkin extends
 
 @Override
 public AttributedCharacterIterator getSelectedText(final 
AttributedCharacterIterator.Attribute[] attributes) {
-TextInput textInput = (TextInput) getComponent();
+TextInput textInput = getTextInput();
 return new 
AttributedStringCharacterIterator(textInput.getSelectedText(), attributes);
 }
 
 private Rectangle offsetToScreen(final Rectangle clientRectangle) {
-TextInput textInput = (TextInput) getComponent();
-return textInput.offsetToScreen(clientRectangle);
+return getTextInput().offsetToScreen(clientRectangle);
 }
 
 @Override
 public Rectangle getTextLocation(final TextHitInfo offset) {
-TextInput textInput = (TextInput) getComponent();
+TextInput textInput = getTextInput();
 AttributedStringCharacterIterator composedText = 
textInput.getComposedText();
 
 if (composedText == null) {
@@ -161,7 +158,7 @@ public class TerraTextInputSkin extends
 
 @Override
 public void inputMethodTextChanged(final InputMethodEvent event) {
-TextInput textInput = (TextInput) getComponent();
+TextInput textInput = getTextInput();
 AttributedCharacterIterator iter = event.getText();
 AttributedStringCharacterIterator composedIter = null;
 
@@ -191,13 +188,13 @@ public class TerraTextInputSkin extends
 
 @Override
 public void caretPositionChanged(final InputMethodEvent event) {
-TextInput textInput = (TextInput) getComponent();
+TextInput textInput = getTextInput();
 // TODO:  so far I have not seen this called, so ???
 }
 
 }
 
-private TextLayout textLayout = null;
+private TextLayout currentTextLayout = null;
 
 private int anchor = -1;
 private SelectDirection selectDirection = null;
@@ -218,13 +215,12 @@ public class TerraTextInputSkin extends
 caretOn = !caretOn;
 
 if (caret != null) {
-TextInput textInput = (TextInput) getComponent();
-textInput.repaint(caret.x, caret.y, caret.width, caret.height);
+getTextInput().repaint(caret.x, caret.y, caret.width, 
caret.height);
 }
 };
 
 private Runnable scrollSelectionCallback = () -> {
-TextInput textInput = (TextInput) getComponent();
+TextInput textInput = getTextInput();
 int s

svn commit: r1887121 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

2021-03-02 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Mar  2 21:09:48 2021
New Revision: 1887121

URL: http://svn.apache.org/viewvc?rev=1887121=rev
Log:
Changes to reduce "checkstyle" violations.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java?rev=1887121=1887120=1887121=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java Tue Mar  2 21:09:48 
2021
@@ -41,6 +41,10 @@ public final class Keyboard {
 public enum Modifier {
 SHIFT, CTRL, ALT, META;
 
+/**
+ * @return The one-bit mask for this modifier, which is
+ * {@code 2**ordinal}.
+ */
 public int getMask() {
 return 1 << ordinal();
 }
@@ -96,15 +100,28 @@ public final class Keyboard {
 
 public static final String COMMAND_ABBREVIATION = "CMD";
 
-public KeyStroke(final int keyCode, final int modifiers) {
-this.keyCode = keyCode;
+/**
+ * Construct from a key code and the bit mask of the desired modifiers.
+ * @param code The key code desired.
+ * @param modifiers The bit mask of modifiers to use.
+ * @see Keyboard.KeyCode
+ * @see Keyboard.Modifier
+ */
+public KeyStroke(final int code, final int modifiers) {
+this.keyCode = code;
 this.keyModifiers = modifiers;
 }
 
+/**
+ * @return The key code associated with this keystroke.
+ */
 public int getKeyCode() {
 return keyCode;
 }
 
+/**
+ * @return The bit mask of modifiers associated with this keystroke.
+ */
 public int getModifiers() {
 return keyModifiers;
 }
@@ -160,6 +177,15 @@ public final class Keyboard {
 return KeyEvent.getKeyText(keyCode);
 }
 
+/**
+ * Decode a keystroke value from its string representation.
+ *
+ * @param value Input value, such as {@code "Cmd-F1"} or
+ *  {@code "Ctrl-Shift-Left"}.
+ * @return  The corresponding {@code KeyStroke} value.
+ * @throws IllegalArgumentException if the input string cannot be
+ * decoded.
+ */
 public static KeyStroke decode(final String value) {
 Utils.checkNull(value, "value");
 
@@ -169,7 +195,7 @@ public final class Keyboard {
 String[] keys = value.split("-");
 for (int i = 0, n = keys.length; i < n; i++) {
 if (i < n - 1) {
-// Modifier
+// The first n-1 parts are Modifier values
 String modifierAbbreviation = 
keys[i].toUpperCase(Locale.ENGLISH);
 
 Modifier modifier;
@@ -181,7 +207,7 @@ public final class Keyboard {
 
 keyModifiers |= modifier.getMask();
 } else {
-// Keycode
+// The final part is the KeyCode itself
 try {
 Field keyCodeField = 
KeyCode.class.getField(keys[i].toUpperCase(Locale.ENGLISH));
 keyCode = ((Integer) 
keyCodeField.get(null)).intValue();
@@ -314,6 +340,11 @@ public final class Keyboard {
 return currentModifiers;
 }
 
+/**
+ * Set the current set of pressed keyboard modifiers.
+ *
+ * @param modifiers The complete bit mask of current modifiers.
+ */
 protected static void setModifiers(final int modifiers) {
 currentModifiers = modifiers;
 }
@@ -321,6 +352,14 @@ public final class Keyboard {
 /**
  * Tests the pressed state of a modifier.
  *
+ *  Note: this method tests whether or not one modifier is pressed.
+ * It does not, however, test if this is the ONLY modifier pressed. Use
+ * one of the {@code arePressed(...)} methods for that purpose. To test
+ * efficiently for whether more than one modifier is pressed, use one
+ * of the {@code areAnyPressed(...)} or {@code areAllPressed(...)} methods.
+ * And finally, to succinctly test for the "Cmd" key (which is
+ * platform-dependent) being pressed, use {@link isCmdPressed}.
+ *
  * @param modifier The modifier to test.
  * @return {@code true} if the modifier is pressed; {@code false},
  * otherwise.




svn commit: r1887117 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

2021-03-02 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Mar  2 20:44:09 2021
New Revision: 1887117

URL: http://svn.apache.org/viewvc?rev=1887117=rev
Log:
Fix typo in last change to Keyboard.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java?rev=1887117=1887116=1887117=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java Tue Mar  2 20:44:09 
2021
@@ -369,7 +369,7 @@ public final class Keyboard {
  * @return {@code true} if any of them are pressed, {@code false}
  * if none are pressed.
  */
-public static boolean areAnyPressed(final Modifier... modifiers {
+public static boolean areAnyPressed(final Modifier... modifiers) {
 return (currentModifiers & Modifier.getMask(modifiers)) > 0;
 }
 




svn commit: r1886850 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

2021-02-23 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Feb 23 18:13:31 2021
New Revision: 1886850

URL: http://svn.apache.org/viewvc?rev=1886850=rev
Log:
Add a "performAction" static method to Action to simplify performing a named 
action.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java?rev=1886850=1886849=1886850=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java Tue Feb 23 18:13:31 
2021
@@ -142,6 +142,25 @@ public abstract class Action {
  */
 public abstract void perform(Component source);
 
+/**
+ * Perform the named action.
+ *  This is the equivalent of
+ * 
Action.getNamedActions().get(actionName).perform(comp).
+ *
+ * @param actionName One of the previously defined action names.
+ * @param comp   The component initiating the action.
+ * @throws IllegalArgumentException if the actionName is {@code null} or 
if there is
+ * no action with that name.
+ */
+public static void performAction(final String actionName, final Component 
comp) {
+Utils.checkNull(actionName, "action name");
+
+Action action = namedActionDictionary.get(actionName);
+Utils.checkNull(action, "action");
+
+action.perform(comp);
+}
+
 public boolean isEnabled() {
 return enabled;
 }




svn commit: r1886907 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

2021-02-24 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Feb 25 04:37:07 2021
New Revision: 1886907

URL: http://svn.apache.org/viewvc?rev=1886907=rev
Log:
Update an error message in Component.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=1886907=1886906=1886907=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Thu Feb 25 04:37:07 
2021
@@ -113,7 +113,8 @@ public abstract class Component implemen
 previousValue = styles.put(key, value);
 componentStyleListeners.styleUpdated(Component.this, key, 
previousValue);
 } catch (PropertyNotFoundException exception) {
-System.err.println("\"" + key + "\" is not a valid style for " 
+ Component.this);
+System.err.println("\"" + key + "\" is not a valid style for "
++ Component.this.getClass().getName());
 }
 
 return previousValue;




svn commit: r1888797 - in /pivot/trunk/core: src/org/apache/pivot/json/JSONSerializer.java test/org/apache/pivot/json/test/JSONSerializerTest.java test/org/apache/pivot/json/test/map.json

2021-04-15 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Apr 15 16:42:26 2021
New Revision: 1888797

URL: http://svn.apache.org/viewvc?rev=1888797=rev
Log:
Implement extended Unicode escapes in JSON parsing: \u{x}.

Modified:
pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java
pivot/trunk/core/test/org/apache/pivot/json/test/map.json

Modified: pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java?rev=1888797=1888796=1888797=diff
==
--- pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java Thu Apr 15 
16:42:26 2021
@@ -365,13 +365,31 @@ public class JSONSerializer implements S
 c = '\t';
 } else if (c == 'u') {
 StringBuilder unicodeBuilder = new StringBuilder();
-while (unicodeBuilder.length() < 4) {
+c = reader.read();
+if (c == '{') {
 c = reader.read();
+while (c != '}') {
+unicodeBuilder.append((char) c);
+c = reader.read();
+}
+
+} else {
 unicodeBuilder.append((char) c);
+while (unicodeBuilder.length() < 4) {
+c = reader.read();
+unicodeBuilder.append((char) c);
+}
 }
 
 String unicode = unicodeBuilder.toString();
-c = (char) Integer.parseInt(unicode, 16);
+int cp = Integer.parseInt(unicode, 16);
+if (cp <= 0x) {
+c = cp;
+} else {
+stringBuilder.appendCodePoint(cp);
+c = reader.read();
+continue;
+}
 } else {
 if (!(c == '\\' || c == '/' || c == '\"' || c == '\'' 
|| c == t)) {
 throw new SerializationException(

Modified: 
pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java?rev=1888797=1888796=1888797=diff
==
--- pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java 
(original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java 
Thu Apr 15 16:42:26 2021
@@ -151,6 +151,8 @@ public class JSONSerializerTest {
 assertEquals(JSON.get(o2, "k[2].c"), "300");
 assertEquals((Integer) JSON.get(o2, "j"), (Integer) 200);
 assertEquals(JSON.get(o2, "n"), "This is a \"test\" of the 'quoting' 
in \\JSON\\");
+assertEquals(JSON.get(o2, "emoji"), "Trying out an emoji unicode value 
\uD83D\uDC4F!");
+assertEquals(JSON.get(o2, "uni"), "Regular unicode escape \u2318.");
 
 assertTrue(o1.equals(o2));
 

Modified: pivot/trunk/core/test/org/apache/pivot/json/test/map.json
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/map.json?rev=1888797=1888796=1888797=diff
==
--- pivot/trunk/core/test/org/apache/pivot/json/test/map.json (original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/map.json Thu Apr 15 
16:42:26 2021
@@ -37,5 +37,7 @@
 {a:1${ZERO}${ZERO}, b:${TWO_HUNDRED}, c:"${THREE_HUNDRED}"}
 ],
 m: "Hello\r\n\tWorld!",
-n: "This is a \"test\" of the \'quoting\' in \\JSON\\"
+n: "This is a \"test\" of the \'quoting\' in \\JSON\\",
+emoji: 'Trying out an emoji unicode value \u{1f44f}!',
+uni: 'Regular unicode escape \u2318.'
 }




svn commit: r1888684 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

2021-04-12 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Apr 12 20:03:01 2021
New Revision: 1888684

URL: http://svn.apache.org/viewvc?rev=1888684=rev
Log:
Add a convenience method to Action for adding items to the dictionary.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java?rev=1888684=1888683=1888684=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java Mon Apr 12 20:03:01 
2021
@@ -88,11 +88,11 @@ public abstract class Action {
 private Action action;
 private Component source;
 
-public Callback(final Action action, final Component source) {
-Utils.checkNull(action, "action");
+public Callback(final Action actionToPerform, final Component 
actionSource) {
+Utils.checkNull(actionToPerform, "action");
 
-this.action = action;
-this.source = source;
+action = actionToPerform;
+source = actionSource;
 }
 
 @Override
@@ -119,10 +119,10 @@ public abstract class Action {
 
 /**
  * Constructor to build the action and set the enabled state at the 
beginning.
- * @param enabled Whether the action is to be initially enabled.
+ * @param initialEnable Whether the action is to be initially enabled.
  */
-public Action(final boolean enabled) {
-setEnabled(enabled);
+public Action(final boolean initialEnable) {
+setEnabled(initialEnable);
 }
 
 /**
@@ -165,13 +165,25 @@ public abstract class Action {
 return enabled;
 }
 
-public void setEnabled(final boolean enabled) {
-if (this.enabled != enabled) {
-this.enabled = enabled;
+public void setEnabled(final boolean enabledState) {
+if (enabled != enabledState) {
+enabled = enabledState;
 actionListeners.enabledChanged(this);
 }
 }
 
+/**
+ * Add this action to the named action dictionary.
+ *  This is equivalent to getNamedActions().put(id, 
action)
+ *
+ * @param id The name to store this action under (can be referenced 
from button actions, etc.)
+ * @param action The action to be performed under this name.
+ * @return   The previous action (if any) listed under this name.
+ */
+public static Action addNamedAction(final String id, final Action action) {
+return namedActionDictionary.put(id, action);
+}
+
 public static NamedActionDictionary getNamedActions() {
 return namedActionDictionary;
 }




svn commit: r1888682 - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/skin/

2021-04-12 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Apr 12 19:44:50 2021
New Revision: 1888682

URL: http://svn.apache.org/viewvc?rev=1888682=rev
Log:
PIVOT-1014,PIVOT-1032,PIVOT-1056: Changes to NumberRuler:
* Reduce skin "setter" methods
* Move default settings to theme defaults file
* Fix "checkstyle" messages


Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
pivot/trunk/wtk/src/org/apache/pivot/wtk/NumberRuler.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/NumberRulerListener.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/NumberRulerSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json?rev=1888682=1888681=1888682=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
 Mon Apr 12 19:44:50 2021
@@ -162,6 +162,17 @@
 backgroundColor : 4,
 color : 7,
 titleColor : 12
+},
+
+NumberRulerSkin : {
+color : 0,
+backgroundColor : 19,
+markerSpacing : 5,
+markerInsets : 0,
+rowPadding : 0,
+showZeroNumber : false,
+showMajorNumbers : true,
+showMinorNumbers : false
 }
 
 /* More to come ... */

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/NumberRuler.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/NumberRuler.java?rev=1888682=1888681=1888682=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/NumberRuler.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/NumberRuler.java Mon Apr 12 
19:44:50 2021
@@ -31,7 +31,7 @@ public class NumberRuler extends Compone
 /** Default number of digits to display for numbers in vertical rulers. */
 private static final int DEFAULT_TEXT_SIZE = 5;
 
-/** Default orientation for one of these (most commonly used for line 
numbering). */
+/** Current orientation for one of these (defaults to vertical, since most 
commonly used for line numbering). */
 private Orientation orientation = Orientation.VERTICAL;
 
 /**
@@ -46,21 +46,36 @@ public class NumberRuler extends Compone
  */
 private int textSize = DEFAULT_TEXT_SIZE;
 
+/**
+ * The listeners for changes here.
+ */
 private NumberRulerListener.Listeners rulerListeners = new 
NumberRulerListener.Listeners();
 
+/**
+ * Default constructor - instantiate our skin.
+ */
 public NumberRuler() {
 installSkin(NumberRuler.class);
 }
 
+/**
+ * @return The current orientation of this ruler.
+ */
 public Orientation getOrientation() {
 return orientation;
 }
 
-public void setOrientation(final Orientation orientation) {
-Utils.checkNull(orientation, "orientation");
+/**
+ * Set the ruler orientation.
+ *
+ * @param newOrientation The new orientation of this ruler: vertical for a 
line number ruler,
+ * or horizontal for a character number ruler.
+ */
+public void setOrientation(final Orientation newOrientation) {
+Utils.checkNull(newOrientation, "orientation");
 
-if (this.orientation != orientation) {
-this.orientation = orientation;
+if (newOrientation != orientation) {
+orientation = newOrientation;
 rulerListeners.orientationChanged(this);
 }
 }
@@ -91,6 +106,21 @@ public class NumberRuler extends Compone
 /**
  * Set the number of digits of space to allow for the numbers.
  *
+ * @param size The (integer) number of digits to allow in vertical
+ * ruler numbers. The default of {@link #DEFAULT_TEXT_SIZE} allows
+ * for 99,999 maximum rows.
+ * @throws IllegalArgumentException if the value is negative,
+ * or exceeds {@link #MAX_TEXT_SIZE}.
+ */
+public void setTextSize(final Number size) {
+Utils.checkNullOrEmpty(size, "size");
+
+setTextSize(size.intValue());
+}
+
+/**
+ * Set the number of digits of space to allow for the numbers.
+ *
  * @param size The number of digits to allow in vertical ruler numbers.
  * The default of {@link #DEFAULT_TEXT_SIZE} allows
  * for 99,999 maximum rows.
@@ -104,12 +134,15 @@ public class NumberRuler extends Compone
 }
 
 if (size != textSize) {
-int previousSize = this.textSize;
-this.textSize = size;
+int previousSize = textSize;
+textSize = size;
 rulerListeners.textSizeChanged(this, previousSize);
 }
 }
 
+/**
+ *

svn commit: r1888683 - in /pivot/trunk: tests/src/org/apache/pivot/tests/ wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/skin/

2021-04-12 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Apr 12 19:59:27 2021
New Revision: 1888683

URL: http://svn.apache.org/viewvc?rev=1888683=rev
Log:
PIVOT-1057: Add "thick" focus rectangle support to TerraTheme.
* Add the new property to theme description files.
* Add code and property to TerraTheme.
* Add new method and constants to GraphicsUtilities to select a nice "thick" 
stroke.
* Consolidate the determination of the focus rectangle stroke to a new method
  in ComponentSkin, which everyone calls.
* Tweak drawing in a couple of places to make the thicker focus rectangle play
  nicer with the other drawing code.

Modified:
pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json
pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_dark.json

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_default.json
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html
pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json
URL: 
http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json?rev=1888683=1888682=1888683=diff
==
--- pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json 
(original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json Mon 
Apr 12 19:59:27 2021
@@ -24,6 +24,8 @@
 
 transitionEnabled: false,
 
+thickFocusRectangle: false,
+
 colors: [
 "#f5f5f5",
 "#141414",

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json
URL: 
http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json?rev=1888683=1888682=1888683=diff
==
--- pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json Mon Apr 
12 19:59:27 2021
@@ -24,6 +24,8 @@
 
 transitionEnabled: false,
 
+thickFocusRectangle: false,
+
 colors: [
 "#0a0a0a",
 "#ebebeb",

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java?rev=1888683=1888682=1888683=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
 Mon Apr 12 19:59:27 2021
@@ -315,9 +315,7 @@ public class TerraCalendarButtonSkin ext
 
 // Paint the focus state
 if (calendarButton.isFocused()) {
-BasicStroke dashStroke = new BasicStroke(1.0f, 
BasicStroke.CAP_ROUND,
-BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-graphics.setStroke(dashStroke);
+graphics.setStroke(getFocusRectangleStroke());
 graphics.setColor(this.borderColor);
 graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width 
- 5, 0), Math.max(
 height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 2));

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java?rev=1888683=1888682=1888683=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
 (original)
++

svn commit: r1888738 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

2021-04-13 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Apr 13 17:50:59 2021
New Revision: 1888738

URL: http://svn.apache.org/viewvc?rev=1888738=rev
Log:
PIVOT-1032: Fix "checkstyle" problems in Action; check "isEnabled" before 
calling "perform"
in the Callback class and performAction method; add "getNamedAction" 
convenience method;
add Javadoc.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java?rev=1888738=1888737=1888738=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java Tue Apr 13 17:50:59 
2021
@@ -26,14 +26,19 @@ import org.apache.pivot.util.Utils;
 
 /**
  * Abstract base class for "actions". Actions are common application behaviors
- * generally triggered by buttons and keyboard shortcuts.
+ * generally triggered by buttons, menu items, and keyboard shortcuts.
  */
 public abstract class Action {
 /**
  * Action dictionary implementation.
+ *  We wrap the underlying {@code Map<>} implementation so that only a 
few methods
+ * are available for use.
  */
 public static final class NamedActionDictionary implements 
Dictionary,
 Iterable {
+/**
+ * Private constructor so only we can construct the singleton instance.
+ */
 private NamedActionDictionary() {
 }
 
@@ -60,14 +65,14 @@ public abstract class Action {
 
 @Override
 public Action remove(final String id) {
-Action action = null;
+Action removedAction = null;
 
 if (containsKey(id)) {
-action = namedActions.remove(id);
-actionClassListeners.actionRemoved(id, action);
+removedAction = namedActions.remove(id);
+actionClassListeners.actionRemoved(id, removedAction);
 }
 
-return action;
+return removedAction;
 }
 
 @Override
@@ -82,12 +87,25 @@ public abstract class Action {
 }
 
 /**
- * A callback for the GUI thread to perform the given action there.
+ * A callback for the GUI thread to perform the given action there, unless 
the
+ * action is disabled at the time {@code run()} is called.
  */
-public static class Callback implements Runnable {
+public static final class Callback implements Runnable {
+/**
+ * The action to be performed in this callback.
+ */
 private Action action;
+/**
+ * The source component that initiated the action.
+ */
 private Component source;
 
+/**
+ * Construct a callback to perform the action on the GUI (EDT) thread.
+ *
+ * @param actionToPerform The action.
+ * @param actionSourceThe source component.
+ */
 public Callback(final Action actionToPerform, final Component 
actionSource) {
 Utils.checkNull(actionToPerform, "action");
 
@@ -97,19 +115,37 @@ public abstract class Action {
 
 @Override
 public void run() {
-action.perform(source);
+if (action.isEnabled()) {
+action.perform(source);
+}
 }
 }
 
+/**
+ * Flag as to whether this action is currently enabled or not.
+ */
 private boolean enabled = true;
 
+/**
+ * List per action of the listeners for activity on that action.
+ */
 private ActionListener.Listeners actionListeners = new 
ActionListener.Listeners();
 
+/**
+ * The backing map for the named action dictionary.
+ */
 private static HashMap namedActions = new HashMap<>();
+/**
+ * The global dictionary associating action ids with their implementations.
+ */
 private static NamedActionDictionary namedActionDictionary = new 
NamedActionDictionary();
 
+/**
+ * Global list of listeners for all action activity.
+ */
 private static ActionClassListener.Listeners actionClassListeners = new 
ActionClassListener.Listeners();
 
+
 /**
  * Constructor which builds the action and sets it enabled to begin with.
  */
@@ -119,6 +155,7 @@ public abstract class Action {
 
 /**
  * Constructor to build the action and set the enabled state at the 
beginning.
+ *
  * @param initialEnable Whether the action is to be initially enabled.
  */
 public Action(final boolean initialEnable) {
@@ -143,7 +180,7 @@ public abstract class Action {
 public abstract void perform(Component source);
 
 /**
- * Perform the named action.
+ * Perform the named action, unless the action is disabled.
  *  This is the equivalent of
  * 
Action.getNamedActio

svn commit: r1888779 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

2021-04-14 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Apr 14 21:27:35 2021
New Revision: 1888779

URL: http://svn.apache.org/viewvc?rev=1888779=rev
Log:
Fix and expand keystroke decoding in Keyboard (generalized to also include OSX 
Unicode symbols).

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java?rev=1888779=1888778=1888779=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java Wed Apr 14 21:27:35 
2021
@@ -20,6 +20,8 @@ import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.lang.reflect.Field;
 import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.pivot.collections.EnumSet;
 import org.apache.pivot.collections.Set;
@@ -59,7 +61,7 @@ public final class Keyboard {
  *
  * @param modifier The AWT modifier for this enum.
  */
-private Modifier(final int modifier) {
+Modifier(final int modifier) {
 awtModifier = modifier;
 keySymbol = InputEvent.getModifiersExText(modifier);
 }
@@ -132,7 +134,7 @@ public final class Keyboard {
  * @throws IllegalArgumentException if the input cannot be recognized
  * @throws NullPointerException if the input value is {@code null}
  */
- public static final Modifier decode(final String input) {
+ public static Modifier decode(final String input) {
  if (input == null) {
  throw new NullPointerException("Null input to 
Modifier.decode");
  }
@@ -166,6 +168,20 @@ public final class Keyboard {
 public static final String COMMAND_ABBREVIATION = "CMD";
 
 /**
+ * Pattern to recognize modifiers and key values. Note: this supports 
the "current" Unicode symbols used
+ * on OSX to display keystrokes (and what is returned by {@link 
InputEvent#getModifiersExText})
+ * but could, potentially, be subject to change.
+ *  Supported patterns include: F12 (key by itself), 
Cmd+A ("Cmd" modifier,
+ * which is platform-specific, using "+" separator), 
Ctrl-Shift-Alt-Left (multiple modifiers,
+ * using "-" separator), Right (OSX-style 
modifiers without separator),
+ * --F4 (OSX-style with separators), or 
ALT+ctrl+R (upper- or
+ * lower-case modifiers).
+ * @see KeyStroke#decode
+ */
+private static final Pattern KEYSTROKE_PATTERN =
+
Pattern.compile("([\u21E7\u2303\u2325\u2318]+|(([a-zA-Z]+|[\u21E7\u2303\u2325\u2318])[\\-\\+])+)?(.+)");
+
+/**
  * Construct from a key code and the bit mask of the desired modifiers.
  * @param code The key code desired.
  * @param modifiers The bit mask of modifiers to use.
@@ -208,7 +224,7 @@ public final class Keyboard {
 public int hashCode() {
 // NOTE Key codes are currently defined as 16-bit values, so
 // shifting by 4 bits to append the modifiers should be OK.
-// However, i:w f Sun changes the key code values in the future,
+// However, if Sun changes the key code values in the future,
 // this may no longer be safe.
 int hashCode = keyCode << 4 | keyModifiers;
 return hashCode;
@@ -231,7 +247,7 @@ public final class Keyboard {
  * Decode a keystroke value from its string representation.
  *
  * @param value Input value, such as {@code "Cmd-F1"},
- *  {@code "Ctrl-Shift-Left"}, or even 
"F1".
+ *  {@code "Ctrl+Shift+Left"}, or even 
"F1".
  * @return  The corresponding {@code KeyStroke} value.
  * @throws IllegalArgumentException if the input string cannot be
  * decoded.
@@ -244,30 +260,40 @@ public final class Keyboard {
 String sep = Platform.getKeyStrokeModifierSeparator();
 boolean emptySep = sep.equals("");
 
-String[] keys = value.split(sep);
-for (int i = 0, n = keys.length; i < n; i++) {
-if ((emptySep && keys[i].charAt(0) < 0x1000) || (i < n - 1)) {
-// The first n-1 parts are Modifier values
-String modifierAbbreviation = 
keys[i].toUpperCase(Locale.ENGLISH);
-
-Modifier modifier;
-if (modifierAbbreviation.equals(COMMAND_ABBREVIATION)) {
-modifier = Platform.getCommandModifier();
+Matcher m = KEYSTROKE_PATTERN.matcher(value);
+  

svn commit: r1888774 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

2021-04-14 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Apr 14 19:55:19 2021
New Revision: 1888774

URL: http://svn.apache.org/viewvc?rev=1888774=rev
Log:
Enhancements to Keyboard to recognize the OSX modifier key symbols.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java?rev=1888774=1888773=1888774=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java Wed Apr 14 19:55:19 
2021
@@ -39,7 +39,30 @@ public final class Keyboard {
  * Enumeration representing keyboard modifiers.
  */
 public enum Modifier {
-SHIFT, CTRL, ALT, META;
+SHIFT(InputEvent.SHIFT_DOWN_MASK),
+CTRL(InputEvent.CTRL_DOWN_MASK),
+ALT(InputEvent.ALT_DOWN_MASK),
+META(InputEvent.META_DOWN_MASK);
+
+/**
+ * The AWT modifier value.
+ */
+private final int awtModifier;
+
+/**
+ * The standard modifier text appropriate for the platform.
+ */
+private final String keySymbol;
+
+/**
+ * Define the enum value, along with the AWT modifier value.
+ *
+ * @param modifier The AWT modifier for this enum.
+ */
+private Modifier(final int modifier) {
+awtModifier = modifier;
+keySymbol = InputEvent.getModifiersExText(modifier);
+}
 
 /**
  * @return The one-bit mask for this modifier, which is
@@ -76,12 +99,54 @@ public final class Keyboard {
 }
 
 /**
+ * Determine the complete set of AWT modifiers for a set of mask 
values.
+ *
+ * @param mask The complete mask set of our modifiers.
+ * @return The complete mask for AWT use.
+ */
+public static int getAWTMask(final int mask) {
+int awtMask = 0;
+for (Modifier m : values()) {
+if ((mask & m.getMask()) > 0) {
+awtMask |= m.awtModifier;
+}
+}
+return awtMask;
+}
+
+/**
  * The set of all possible keyboard modifiers (for use with {@link 
#isPressed},
  * or {@link Modifier#getMask(Set)}, {@link #areAllPressed(Set)}, or
  * {@link #areAnyPressed(Set)}).
  */
 public static final Set ALL_MODIFIERS =
 EnumSet.of(Modifier.SHIFT, Modifier.CTRL, Modifier.ALT, 
Modifier.META);
+
+/**
+ * Convert the input string into one of our enum values.
+ *
+ * @param input Should be one of the enum constants, but we will also
+ *  recognize the constant regardless of case, and also
+ *  allow the Unicode character equivalent to be valid.
+ * @return The enum value corresponding to the input.
+ * @throws IllegalArgumentException if the input cannot be recognized
+ * @throws NullPointerException if the input value is {@code null}
+ */
+ public static final Modifier decode(final String input) {
+ if (input == null) {
+ throw new NullPointerException("Null input to 
Modifier.decode");
+ }
+
+ for (Modifier m : values()) {
+ if (m.toString().equalsIgnoreCase(input)) {
+ return m;
+ } else if (m.keySymbol.equals(input)) {
+ return m;
+ }
+ }
+
+ throw new IllegalArgumentException("Illegal input to 
Modifier.decode: '" + input + "'");
+}
 }
 
 /**
@@ -108,8 +173,8 @@ public final class Keyboard {
  * @see Keyboard.Modifier
  */
 public KeyStroke(final int code, final int modifiers) {
-this.keyCode = code;
-this.keyModifiers = modifiers;
+keyCode = code;
+keyModifiers = modifiers;
 }
 
 /**
@@ -143,7 +208,7 @@ public final class Keyboard {
 public int hashCode() {
 // NOTE Key codes are currently defined as 16-bit values, so
 // shifting by 4 bits to append the modifiers should be OK.
-// However, if Sun changes the key code values in the future,
+// However, i:w f Sun changes the key code values in the future,
 // this may no longer be safe.
 int hashCode = keyCode << 4 | keyModifiers;
 return hashCode;
@@ -151,27 +216,12 @@ public final class Keyboard {
 
 @Override
 public String toString() {
-int awtModifiers = 0x00;
-
-if (((keyModifiers & Modifier.META.getMask()) > 0)) {
-awtModifiers |= InputEvent.META_DOWN_MASK

svn commit: r1888842 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/FileBrowser.java

2021-04-17 Thread rwhitcomb
Author: rwhitcomb
Date: Sat Apr 17 06:26:19 2021
New Revision: 142

URL: http://svn.apache.org/viewvc?rev=142=rev
Log:
PIVOT-1058,PIVOT-1032: When dealing with files in FileBrowser, use the 
canonical version
in order to tell if the file really belongs to the root directory (necessary if 
the root
is "." or "..", for instance). Fix "checkstyle" problems.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/FileBrowser.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FileBrowser.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FileBrowser.java?rev=142=141=142=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FileBrowser.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FileBrowser.java Sat Apr 17 
06:26:19 2021
@@ -17,6 +17,7 @@
 package org.apache.pivot.wtk;
 
 import java.io.File;
+import java.io.IOException;
 
 import org.apache.pivot.collections.ArrayList;
 import org.apache.pivot.collections.Sequence;
@@ -34,21 +35,46 @@ public class FileBrowser extends Contain
  * File browser skin interface.
  */
 public interface Skin extends org.apache.pivot.wtk.Skin {
-public File getFileAt(int x, int y);
+/**
+ * Get the file selection at the given X/Y coordinates.
+ * @param x The mouse X-position.
+ * @param y The mouse Y-position.
+ * @return The file displayed at the given coordinates.
+ */
+File getFileAt(int x, int y);
 }
 
+/**
+ * Value of the {@code "user.home"} system property (default root 
directory).
+ */
 private static final String USER_HOME = System.getProperty("user.home");
 
+/**
+ * The current root directory (usually set by constructor).
+ */
 private File rootDirectory;
+/**
+ * Current list of selected files (one for single select, can be many for 
multi-select).
+ */
 private FileList selectedFiles = new FileList();
+/**
+ * Whether multiple selection is enabled.
+ */
 private boolean multiSelect = false;
+/**
+ * Filter for files to disable (make non-selectable).
+ */
 private Filter disabledFileFilter = null;
 
+/**
+ * List of listeners for events on this file browser.
+ */
 private FileBrowserListener.Listeners fileBrowserListeners = new 
FileBrowserListener.Listeners();
 
 /**
- * Creates a new FileBrowser  Note that this version set by default mode
- * to open.
+ * Creates a new FileBrowser with the root directory set to the
+ * "user.home" value.
+ *  Note that this version sets the mode to "open".
  */
 public FileBrowser() {
 this(USER_HOME);
@@ -56,24 +82,30 @@ public class FileBrowser extends Contain
 
 /**
  * Creates a new FileBrowser  Note that this version of the constructor
- * must be used when a custom root folder has to be set.
+ * must be used when a custom root directory has to be set.
  *
- * @param rootFolder The root folder full name.
+ * @param rootDirectoryName The root directory full name.
  */
-public FileBrowser(String rootFolder) {
-Utils.checkNull(rootFolder, "rootFolder");
-
-rootDirectory = new File(rootFolder);
-if (!rootDirectory.isDirectory()) {
-throw new IllegalArgumentException(rootFolder + " is not a 
directory.");
-}
+public FileBrowser(final String rootDirectoryName) {
+Utils.checkNull(rootDirectoryName, "rootDirectoryName");
+internalSetRootDirectory(new File(rootDirectoryName), false);
 
 installSkin(FileBrowser.class);
 }
 
 /**
- * Returns the current root directory.
+ * Creates a new FileBrowser  Note that this version of the constructor
+ * must be used when a custom root directory has to be set.
  *
+ * @param initialRootDirectory The initial root directory.
+ */
+public FileBrowser(final File initialRootDirectory) {
+internalSetRootDirectory(initialRootDirectory, false);
+
+installSkin(FileBrowser.class);
+}
+
+/**
  * @return The current root directory.
  */
 public File getRootDirectory() {
@@ -83,27 +115,51 @@ public class FileBrowser extends Contain
 /**
  * Sets the root directory. Clears any existing file selection.
  *
- * @param rootDirectory The new root directory to browse in.
+ * @param rootDir The new root directory to browse in.
  * @throws IllegalArgumentException if the argument is {@code null}
  * or is not a directory.
  */
-public void setRootDirectory(File rootDirectory) {
-Utils.checkNull(rootDirectory, "rootDirectory");
+public void setRootDirectory(final File rootDir) {
+internalSetRootDirectory(rootDir, true);

svn commit: r1886549 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Span.java

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 15 21:49:54 2021
New Revision: 1886549

URL: http://svn.apache.org/viewvc?rev=1886549=rev
Log:
Tweak the Javadoc comments in Span.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Span.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Span.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Span.java?rev=1886549=1886548=1886549=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Span.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Span.java Mon Feb 15 21:49:54 2021
@@ -26,8 +26,9 @@ import org.apache.pivot.util.Utils;
 
 /**
  * Class representing a range of integer values. The range includes all values
- * in the interval [start, end]. Values may be negative, and the value 
of
- * {@code start} may be less than or equal to the value of {@code end}.
+ * in the interval [start, end] (inclusive). Values may be negative,
+ * and the value of {@code start} may be less than or equal to the value of
+ * {@code end}.
  */
 public final class Span {
 public final int start;




svn commit: r1886548 - /pivot/trunk/core/src/org/apache/pivot/util/Utils.java

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 15 21:48:58 2021
New Revision: 1886548

URL: http://svn.apache.org/viewvc?rev=1886548=rev
Log:
Two new methods in Utils.

Modified:
pivot/trunk/core/src/org/apache/pivot/util/Utils.java

Modified: pivot/trunk/core/src/org/apache/pivot/util/Utils.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Utils.java?rev=1886548=1886547=1886548=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/Utils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Utils.java Mon Feb 15 21:48:58 
2021
@@ -45,6 +45,24 @@ public final class Utils {
 }
 
 /**
+ * Does an "equals" check, taking care that null object references are 
handled
+ * appropriately.
+ *
+ * @param obj1 The first object to compare (could be {@code null}).
+ * @param obj2 The second object to compare (could be {@code null}).
+ * @return {@code true} if the two objects are non-null and equal 
(according
+ * to their {@code Object#equals} method), or are both {@code 
null}.
+ */
+public static boolean equals(final Object obj1, final Object obj2) {
+if (obj1 != null && obj2 != null) {
+return obj1.equals(obj2);
+} else if (obj1 == null && obj2 == null) {
+return true;
+}
+return false;
+}
+
+/**
  * Check if the input argument is {@code null} and throw an
  * {@link IllegalArgumentException} if so, with an optional
  * message derived from the given string.
@@ -404,4 +422,33 @@ public final class Utils {
 }
 }
 
+/**
+ * Check the count of new or additional characters exceeding the specified 
maximum.
+ *
+ * @param currentCount For a "new" text operation (from {@code setText} 
this should be  zero
+ * (that is, a different message is thrown), otherwise the current count 
for an {@code insertText}
+ * operation.
+ * @param newCount If {@code currentCount} is negative, this is the 
complete count of text that
+ * will be set, otherwise this is the incremental new amount of text to 
add to the current.
+ * @param maximum The current maximum length.
+ * @throws IllegalArgumentException if the count exceeds the maximum.
+ */
+public static void checkTextMaximumLength(final int currentCount, final 
int newCount, final int maximum) {
+if (currentCount < 0) {
+if (newCount > maximum) {
+throw new IllegalArgumentException(String.format(
+"New text length of %1$,d exceeds the maximum length of 
%2$,d.",
+newCount, maximum));
+}
+} else {
+if (currentCount + newCount > maximum) {
+throw new IllegalArgumentException(String.format(
+"Insertion of %1$,d characters to existing length of %2$,d 
would "
+  + "exceed the maximum length of %3$,d.",
+newCount, currentCount, maximum));
+}
+}
+}
+
+
 }




svn commit: r1886550 - in /pivot/trunk/core: src/org/apache/pivot/text/CharSpan.java test/org/apache/pivot/text/ test/org/apache/pivot/text/test/ test/org/apache/pivot/text/test/CharSpanTest.java

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 15 21:55:20 2021
New Revision: 1886550

URL: http://svn.apache.org/viewvc?rev=1886550=rev
Log:
Do some code cleanup in CharSpan; add functionality there; add a test module 
for it.

Added:
pivot/trunk/core/test/org/apache/pivot/text/
pivot/trunk/core/test/org/apache/pivot/text/test/
pivot/trunk/core/test/org/apache/pivot/text/test/CharSpanTest.java
Modified:
pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java

Modified: pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java?rev=1886550=1886549=1886550=diff
==
--- pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java Mon Feb 15 
21:55:20 2021
@@ -23,104 +23,138 @@ import org.apache.pivot.serialization.Se
 import org.apache.pivot.util.Utils;
 
 /**
- * Class representing a span of characters. The range includes all values
- * in the interval [start, start+length-1] inclusive.  
This is the paradigm
- * used in a lot of places (notably the text controls) to indicate a selection.
+ * Immutable class representing a span of characters. The range includes all 
values
+ * in the interval [start, start+length-1] inclusive.  
This is
+ * the paradigm used in a lot of places (notably the text controls) to 
indicate a selection.
  *  A zero-length span indicates a single caret position at the given start.
  *  Negative lengths are not supported and will throw exceptions, as will
  * negative start positions.
  */
 public final class CharSpan {
+/** The starting location of this span (zero-based). */
 public final int start;
+/** The length of this span (non-negative). */
 public final int length;
 
+/** The dictionary key used to retrieve the start location. */
 public static final String START_KEY = "start";
+/** The dictionary key used to retrieve the length. */
 public static final String LENGTH_KEY = "length";
 
 /**
+ * A span of length zero, starting at position zero.
+ */
+public static final CharSpan ZERO = new CharSpan();
+
+
+/**
+ * Construct a default span of length zero at location zero.
+ */
+public CharSpan() {
+this(0);
+}
+
+/**
  * Construct a new char span of length zero at the given location.
  *
- * @param start The start of this char span.
+ * @param startValue The start of this char span.
+ * @throws IllegalArgumentException if the value is negative.
  */
-public CharSpan(final int start) {
-Utils.checkNonNegative(start, "start");
-this.start = start;
-this.length = 0;
+public CharSpan(final int startValue) {
+this(startValue, 0);
 }
 
 /**
  * Construct a new char span with the given values.
- * @param start The start of this char span.
- * @param length The length of this char span.
- */
-public CharSpan(final int start, final int length) {
-Utils.checkNonNegative(start, "start");
-Utils.checkNonNegative(length, "length");
-this.start = start;
-this.length = length;
+ *
+ * @param startValue The start of this char span.
+ * @param lengthValue The length of this char span.
+ * @throws IllegalArgumentException if either value is negative.
+ */
+public CharSpan(final int startValue, final int lengthValue) {
+Utils.checkNonNegative(startValue, "start");
+Utils.checkNonNegative(lengthValue, "length");
+
+start = startValue;
+length = lengthValue;
 }
 
 /**
  * Construct a new char span from another one (a "copy constructor").
  *
- * @param charSpan An existing char span (which must not be {@code null}).
+ * @param existingCharSpan An existing char span (which must not be {@code 
null}).
  * @throws IllegalArgumentException if the given char span is {@code null}.
  */
-public CharSpan(final CharSpan charSpan) {
-Utils.checkNull(charSpan, "charSpan");
+public CharSpan(final CharSpan existingCharSpan) {
+Utils.checkNull(existingCharSpan, "existingCharSpan");
 
-this.start = charSpan.start;
-this.length = charSpan.length;
+start = existingCharSpan.start;
+length = existingCharSpan.length;
 }
 
 /**
- * Construct a new char span from the given dictionary which must
- * contain the {@link #START_KEY} and {@link #LENGTH_KEY} keys.
+ * Construct a new char span from the given dictionary which must contain
+ * the {@link #START_KEY} and can also contain the {@link #LENGTH_KEY} key.
  *
- * @param charSpan A dictionary containing start and end values.
- * @throws IllegalArgumentExce

svn commit: r1886557 - /pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Feb 16 00:10:45 2021
New Revision: 1886557

URL: http://svn.apache.org/viewvc?rev=1886557=rev
Log:
Changes to reduce "checkstyle" violations.

Modified:
pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java

Modified: pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java?rev=1886557=1886556=1886557=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java Tue Feb 16 
00:10:45 2021
@@ -34,13 +34,13 @@ public abstract class ListenerList im
 
 /**
  * Iterator through the current array of elements.
- *
- * @param  The listener type to iterate over.
  */
 private class NodeIterator implements Iterator {
+/** The current position in the list for the iteration. */
 private int index;
 
-public NodeIterator() {
+/** Construct and start iteration at the beginning. */
+NodeIterator() {
 this.index = 0;
 }
 
@@ -65,14 +65,17 @@ public abstract class ListenerList im
 }
 }
 
+/** We don't expect many listeners (1 or 2 typically), so start off with 
this size. */
 private static final int DEFAULT_SIZE = 5;
 
-// The current array of items (some of which are null)
-// All non-null objects are at the beginning of the array
-// and the array is reorganized on "remove"
-@SuppressWarnings({ "unchecked" })
+/**
+ * The current array of items (some of which are null).
+ *  All non-null objects are at the beginning of the array
+ * and the array is reorganized on "remove".
+ */
+@SuppressWarnings("unchecked")
 private T[] list = (T[]) new Object[DEFAULT_SIZE];
-// The current length of the active list
+/** The current length of the active list. */
 private int last = 0;
 
 /**
@@ -110,7 +113,7 @@ public abstract class ListenerList im
 
 // If no slot is available, increase the size of the array
 if (last >= list.length) {
-@SuppressWarnings({ "unchecked" })
+@SuppressWarnings("unchecked")
 T[] newList = (T[]) new Object[list.length + DEFAULT_SIZE];
 if (index > 0) {
 System.arraycopy(list, 0, newList, 0, index);
@@ -151,7 +154,14 @@ public abstract class ListenerList im
 list[--last] = null;
 }
 
-private int indexOf(T listener) {
+/**
+ * Search for the given listener in the list.
+ *
+ * @param listener The listener to find.
+ * @return The index {@code >= 0} of the listener if found, or {@code -1}
+ * if not found.
+ */
+private int indexOf(final T listener) {
 Utils.checkNull(listener, "listener");
 
 for (int i = 0; i < last; i++) {
@@ -205,12 +215,12 @@ public abstract class ListenerList im
 }
 
 @Override
-public Iterator iterator() {
+public final Iterator iterator() {
 return new NodeIterator();
 }
 
 @Override
-public String toString() {
+public final String toString() {
 StringBuilder sb = new StringBuilder(getClass().getSimpleName());
 return StringUtils.append(sb, this).toString();
 }




svn commit: r1886551 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 15 21:56:38 2021
New Revision: 1886551

URL: http://svn.apache.org/viewvc?rev=1886551=rev
Log:
Use new Utils methods for error checking in TextArea.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java?rev=1886551=1886550=1886551=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java Mon Feb 15 21:56:38 
2021
@@ -85,7 +85,7 @@ public class TextArea extends Component
 int count = text.length();
 
 if (textArea != null) {
-textArea.checkMaximumLength(count, false);
+Utils.checkTextMaximumLength(textArea.characterCount, count, 
textArea.maximumLength);
 }
 
 characters.insert(index, text);
@@ -332,7 +332,8 @@ public class TextArea extends Component
 characterCountLocal++;
 }
 
-checkMaximumLength(characterCountLocal, false);
+Utils.checkTextMaximumLength(TextArea.this.characterCount, 
characterCountLocal,
+TextArea.this.maximumLength);
 
 // Set the paragraph offset
 if (index == paragraphs.getLength()) {
@@ -599,39 +600,13 @@ public class TextArea extends Component
 }
 
 /**
- * Check the count of new or additional characters exceeding the specified
- * maximum.
- * @param count if {@code overwrite == true} specifies a new count (from 
{@code setText()})
- * that will replace the existing text, or if {@code overwrite == false} 
from an insert that
- * will add to the existing count.
- * @throws IllegalArgumentException if the count exceeds the maximum.
- */
-private void checkMaximumLength(int count, boolean overwrite) {
-if (overwrite) {
-if (count > maximumLength) {
-throw new IllegalArgumentException(String.format(
-"New text length of %1$,d exceeds the maximum length of 
%2$,d.",
-count, maximumLength));
-}
-} else {
-if (characterCount + count > maximumLength) {
-throw new IllegalArgumentException(String.format(
-"Insertion of %1$,d characters to existing length of %2$,d 
would "
-  + "exceed the maximum length of %3$,d.",
-count, characterCount, maximumLength));
-}
-}
-}
-
-/**
  * Sets the text content of the text area.
  *
  * @param text The new text for the control (cannot be {@code null}).
  */
 public void setText(String text) {
 Utils.checkNull(text, "Text");
-
-checkMaximumLength(text.length(), true);
+Utils.checkTextMaximumLength(-1, text.length(), maximumLength);
 
 try {
 if (!text.equals(this.getText())) {
@@ -675,7 +650,7 @@ public class TextArea extends Component
 
 int c = textReader.read();
 while (c != -1) {
-checkMaximumLength(++characterCountLocal, true);
+Utils.checkTextMaximumLength(characterCount, 
++characterCountLocal, maximumLength);
 
 if (c == '\n') {
 paragraphsLocal.add(paragraph);
@@ -684,7 +659,7 @@ public class TextArea extends Component
 } else if (c == '\t' && expandTabs) {
 int spaces = tabWidth - (tabPosition % tabWidth);
 for (int i = 0; i < spaces; i++) {
-checkMaximumLength(++characterCountLocal, true);
+Utils.checkTextMaximumLength(characterCount, 
++characterCountLocal, maximumLength);
 paragraph.append(' ');
 }
 tabPosition += spaces;
@@ -715,6 +690,7 @@ public class TextArea extends Component
 
 private void insertText(CharSequence text, int index, boolean 
addToEditHistory) {
 Utils.checkNull(text, "Text to insert");
+Utils.checkTextMaximumLength(characterCount, text.length(), 
maximumLength);
 
 indexBoundsCheck("index", index, 0, characterCount);
 




svn commit: r1886556 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 15 23:21:57 2021
New Revision: 1886556

URL: http://svn.apache.org/viewvc?rev=1886556=rev
Log:
Tweak Javadoc comments.

Modified:

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java?rev=1886556=1886555=1886556=diff
==
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java
 Mon Feb 15 23:21:57 2021
@@ -23,6 +23,11 @@ import org.apache.pivot.wtk.skin.ScrollP
  */
 public class TerraScrollPaneSkin extends ScrollPaneSkin {
 
+/**
+ * Specific constructor with nothing to do.
+ *  Default colors, etc. set by call to {@link 
TerraTheme#setDefaultStyles}
+ * from {@link ScrollPaneSkin#install}.
+ */
 public TerraScrollPaneSkin() {
 super();
 




svn commit: r1886546 - /pivot/trunk/build.xml

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 15 21:47:21 2021
New Revision: 1886546

URL: http://svn.apache.org/viewvc?rev=1886546=rev
Log:
Compile Javadoc to "private" level for debug builds.

Modified:
pivot/trunk/build.xml

Modified: pivot/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/pivot/trunk/build.xml?rev=1886546=1886545=1886546=diff
==
--- pivot/trunk/build.xml (original)
+++ pivot/trunk/build.xml Mon Feb 15 21:47:21 2021
@@ -53,6 +53,9 @@ limitations under the License.
 
 
 
+
+
+
 
 
 
@@ -606,6 +609,7 @@ limitations under the License.
 
 
 




svn commit: r1886554 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 15 22:48:55 2021
New Revision: 1886554

URL: http://svn.apache.org/viewvc?rev=1886554=rev
Log:
Tweak Javadoc comments.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java?rev=1886554=1886553=1886554=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java Mon Feb 15 
22:48:55 2021
@@ -1054,7 +1054,8 @@ public class TablePaneSkin extends Conta
  * caller to factor such components into the column widths calculation.
  *
  * @param columnIndex The index of the column whose preferred width we're
- * calculating
+ * calculating.
+ * @return The preferred width of the given column.
  */
 private int getPreferredColumnWidth(int columnIndex) {
 TablePane tablePane = (TablePane) getComponent();
@@ -1115,9 +1116,10 @@ public class TablePaneSkin extends Conta
  * heights calculation.
  *
  * @param rowIndex The index of the row whose preferred height we're
- * calculating
+ * calculating.
  * @param columnWidthsArgument An array of column width values 
corresponding
- * to the columns of the table pane
+ * to the columns of the table pane.
+ * @return The preferred height of the row.
  */
 private int getPreferredRowHeight(int rowIndex, int[] 
columnWidthsArgument) {
 Utils.checkNull(columnWidthsArgument, "columnWidths");




svn commit: r1886543 - /pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java

2021-02-15 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 15 20:14:40 2021
New Revision: 1886543

URL: http://svn.apache.org/viewvc?rev=1886543=rev
Log:
Allow Dictionary.getInt and getBoolean to parse Strings to get the values.

Modified:
pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.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=1886543=1886542=1886543=diff
==
--- pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java Mon Feb 
15 20:14:40 2021
@@ -33,7 +33,7 @@ public interface Dictionary {
  * @param  Type of the key part of the pair.
  * @param  Type of the value in the pair.
  */
-public static final class Pair implements Serializable {
+final class Pair implements Serializable {
 private static final long serialVersionUID = 5010958035775950649L;
 
 /** The key of this key-value pair. */
@@ -45,15 +45,15 @@ public interface Dictionary {
  * The only constructor for this class that takes both the
  * key and the value to be stored, ensuring they are both set
  * all the time.
- * @param key The key to be stored.
- * @param value The value to be associated with that key.
- * @throws IllegalArgumentException if the key value is {@code null}.
+ * @param newKey The key to be stored.
+ * @param newValue The value to be associated with that 
key.
+ * @throws IllegalArgumentException if the key is {@code null}.
  */
-public Pair(final K key, final V value) {
-Utils.checkNull(key, "key");
+public Pair(final K newKey, final V newValue) {
+Utils.checkNull(newKey, "key");
 
-this.key = key;
-this.value = value;
+key = newKey;
+value = newValue;
 }
 
 @Override
@@ -205,7 +205,12 @@ public interface Dictionary {
  */
 default int getInt(K key, int defaultValue) {
 if (containsKey(key)) {
-return ((Number) get(key)).intValue();
+Object value = get(key);
+if (value instanceof Number) {
+return ((Number) value).intValue();
+} else if (value instanceof String) {
+return Integer.parseInt((String) value);
+}
 }
 return defaultValue;
 }
@@ -233,7 +238,12 @@ public interface Dictionary {
  */
 default boolean getBoolean(K key, boolean defaultValue) {
 if (containsKey(key)) {
-return ((Boolean) get(key)).booleanValue();
+Object value = get(key);
+if (value instanceof Boolean) {
+return ((Boolean) value).booleanValue();
+} else if (value instanceof String) {
+return Boolean.valueOf((String) value);
+}
 }
 return defaultValue;
 }




svn commit: r1886667 - /pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java

2021-02-18 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Feb 18 16:15:57 2021
New Revision: 1886667

URL: http://svn.apache.org/viewvc?rev=1886667=rev
Log:
Tweak the "selectWord" method in CharUtils.

Modified:
pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java

Modified: pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java?rev=1886667=188=1886667=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java Thu Feb 18 
16:15:57 2021
@@ -41,11 +41,12 @@ public final class CharUtils {
  * cannot be made (which could be because the input sequence is {@code 
null}).
  */
 public static CharSpan selectWord(final CharSequence sequence, final int 
start) {
-if (sequence == null) {
+int length = sequence.length();
+
+if (sequence == null || length == 0) {
 return null;
 }
 
-int length = sequence.length();
 int adjustedStart = start;
 char ch;
 




svn commit: r1886805 - in /pivot/trunk: package-info.java pivot.css pivot_style_checks.xml script script.bat setenv setenv.bat tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java unset

2021-02-22 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Feb 22 17:01:12 2021
New Revision: 1886805

URL: http://svn.apache.org/viewvc?rev=1886805=rev
Log:
Changes to fix RAT errors (missing licenses).

Modified:
pivot/trunk/package-info.java
pivot/trunk/pivot.css
pivot/trunk/pivot_style_checks.xml
pivot/trunk/script
pivot/trunk/script.bat
pivot/trunk/setenv
pivot/trunk/setenv.bat

pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java
pivot/trunk/unsetenv
pivot/trunk/unsetenv.bat

Modified: pivot/trunk/package-info.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/package-info.java?rev=1886805=1886804=1886805=diff
==
--- pivot/trunk/package-info.java (original)
+++ pivot/trunk/package-info.java Mon Feb 22 17:01:12 2021
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 /**
  * Various build-related scripts and programs.
  */

Modified: pivot/trunk/pivot.css
URL: 
http://svn.apache.org/viewvc/pivot/trunk/pivot.css?rev=1886805=1886804=1886805=diff
==
--- pivot/trunk/pivot.css (original)
+++ pivot/trunk/pivot.css Mon Feb 22 17:01:12 2021
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 #proptable {
 border-collapse: collapse;
 caption-side: bottom;

Modified: pivot/trunk/pivot_style_checks.xml
URL: 
http://svn.apache.org/viewvc/pivot/trunk/pivot_style_checks.xml?rev=1886805=1886804=1886805=diff
==
--- pivot/trunk/pivot_style_checks.xml (original)
+++ pivot/trunk/pivot_style_checks.xml Mon Feb 22 17:01:12 2021
@@ -4,6 +4,23 @@
   "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd;>
 
 
+
+

svn commit: r1892628 - /pivot/trunk/StyleChecks.java

2021-08-27 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Aug 27 06:38:53 2021
New Revision: 1892628

URL: http://svn.apache.org/viewvc?rev=1892628=rev
Log:
PIVOT-1032: In the StyleChecks program, make sure the file names for the "-f" 
parameter actually exist,
and that the categories for "-c" are actually tested in our style file. Also 
fix a bug due to duplicate
file names in different subtrees that caused counts to be off between the top 
list and the final counts.

Modified:
pivot/trunk/StyleChecks.java

Modified: pivot/trunk/StyleChecks.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/StyleChecks.java?rev=1892628=1892627=1892628=diff
==
--- pivot/trunk/StyleChecks.java (original)
+++ pivot/trunk/StyleChecks.java Fri Aug 27 06:38:53 2021
@@ -19,6 +19,7 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -150,10 +151,18 @@ public final class StyleChecks {
 String getName() {
 return fileName;
 }
+/** @return The name only in this object. */
+String getNameOnly() {
+return fileNameOnly(fileName);
+}
 /** @return The count for this object. */
 int getCount() {
 return count;
 }
+@Override
+public String toString() {
+return fileName;
+}
 }
 
 /**
@@ -174,6 +183,46 @@ public final class StyleChecks {
 };
 
 /**
+ * Our file name lists have "short" names that are all relative to
+ * the {@link ORG_APACHE_PIVOT} path. But to report names properly
+ * that may be duplicates in the name, but not in the full path
+ * we need to decide if there are any such duplicates before beginning
+ * to print. That's what we do here.
+ *
+ * @param strings The set of strings we are preparing to print.
+ * @returnWhether there are any duplicates in name only.
+ */
+private static boolean anyDuplicateNames(final Iterable strings) {
+Set nonDuplicateNames = new HashSet<>();
+// The strategy is to take the name only and put into the non-duplicate
+// set, which will eliminate duplicate names. If the final size of that
+// set is less than the original list size, then there are duplicate
+// names in the original list.
+int count = 0;
+for (String s : strings) {
+count++;
+nonDuplicateNames.add(fileNameOnly(s));
+}
+return nonDuplicateNames.size() < count;
+}
+
+/**
+ * Search for duplicate names in a list of {@link FileInfo} objects.
+ *
+ * @param infos The set of info objects.
+ * @return  Whether or not there are duplicate names.
+ */
+private static boolean anyDuplicateInfos(final Iterable infos) {
+Set nonDuplicateNames = new HashSet<>();
+int count = 0;
+for (FileInfo info : infos) {
+count++;
+nonDuplicateNames.add(fileNameOnly(info.getName()));
+}
+return nonDuplicateNames.size() < count;
+}
+
+/**
  * Get a list of strings as a parenthesized list.
  * @param strings The set of strings to traverse.
  * @return A nicely formatted list.
@@ -191,6 +240,90 @@ public final class StyleChecks {
 return buf.toString();
 }
 
+/**
+ * Get a list of the short form of strings as a parenthesized list,
+ * using the names only if there are no duplicates, otherwise show
+ * the full names to disambiguate the duplicates.
+ *
+ * @param strings The set of strings to traverse.
+ * @return A nicely formatted list.
+ */
+private static String listShortName(final Iterable strings) {
+boolean duplicates = anyDuplicateNames(strings);
+StringBuilder buf = new StringBuilder("(");
+int i = 0;
+for (String s : strings) {
+if (i++ > 0) {
+buf.append(", ");
+}
+buf.append(duplicates ? s : fileNameOnly(s));
+}
+buf.append(')');
+return buf.toString();
+}
+
+/**
+ * Find a file by name if it exists starting at the given directory 
location.
+ *  This is used to ensure that the "-f" file names 
actually exist,
+ * and aren't not found because the name is a typo.
+ *
+ * @param file   The starting directory to search.
+ * @param search The file name to search for.
+ * @return   {@code true} or {@code false} depending on whether the 
file is
+ *   found anywhere in the directory hierarchy.
+ */
+private static boolean findFile(final File file, final String search) {
+if (file.isDirectory()) {
+

svn commit: r1892626 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

2021-08-26 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Aug 27 04:04:29 2021
New Revision: 1892626

URL: http://svn.apache.org/viewvc?rev=1892626=rev
Log:
Update FontUtilities.decodeCapable to default to a monospaced font if the list 
was for monospaced.
Update the list of monospaced fonts to be more comprehensive for all platforms.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java?rev=1892626=1892625=1892626=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java Fri Aug 27 
04:04:29 2021
@@ -42,9 +42,15 @@ public final class FontUtilities {
 /**
  * A list of monospaced fonts, useful for text editing areas for code, 
where
  * column position must be consistent.
+ *  Note: this list is adapted from the list at
+ * https://en.wikipedia.org/wiki/List_of_monospaced_typefaces;>
+ * https://en.wikipedia.org/wiki/List_of_monospaced_typefaces with the 
most-popular or
+ * readily available ones listed here.
  */
 public static final String MONOSPACED_FONTS =
-"Courier, Courier New, Andale Mono, Monaco, Menlo, Monospaced";
+"Courier New, Andale Mono, Cascadia Code, Consolas, Courier, DejaVu 
Sans Mono, "
+  + "Droid Sans Mono, FreeMono, Inconsolata, Letter Gothic, Liberation 
Mono, "
+  + "Lucida Console, Menlo, Monaco, Noto Mono, Overpass Mono, Monospaced";
 
 
 /** The obvious factor needed to convert a number to a percentage value. */
@@ -235,14 +241,18 @@ public final class FontUtilities {
 for (String nm : names) {
 Font f = Font.decode(nm + spec);
 if (f.getName().equalsIgnoreCase(nm) || 
f.getFamily().equalsIgnoreCase(nm)) {
-if (testString == null || f.canDisplayUpTo(testString) < 
0) {
+if (testString == null || testString.isEmpty() || 
f.canDisplayUpTo(testString) < 0) {
 return f;
 }
 }
 }
 
-// No names matched in the list, so use the default name
-return Font.decode(Font.DIALOG + spec);
+// No names matched in the list, so use the default name (either 
monospaced or not)
+if (str.indexOf("Mono") >= 0) {
+return Font.decode(Font.MONOSPACED + spec);
+} else {
+return Font.decode(Font.DIALOG + spec);
+}
 }
 
 return Font.decode(str);




svn commit: r1892625 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Alert.java

2021-08-26 Thread rwhitcomb
Author: rwhitcomb
Date: Fri Aug 27 04:01:48 2021
New Revision: 1892625

URL: http://svn.apache.org/viewvc?rev=1892625=rev
Log:
Add another shortcut method to Alert.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Alert.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Alert.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Alert.java?rev=1892625=1892624=1892625=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Alert.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Alert.java Fri Aug 27 04:01:48 2021
@@ -315,6 +315,10 @@ public class Alert extends Dialog {
 alert(messageType, message, null, null, owner, null);
 }
 
+public static void alert(MessageType messageType, String message, String 
title, Window owner) {
+alert(messageType, message, title, null, owner, null);
+}
+
 public static void alert(MessageType messageType, String message, Window 
owner,
 DialogCloseListener dialogCloseListener) {
 alert(messageType, message, null, null, owner, dialogCloseListener);




svn commit: r1892457 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

2021-08-19 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Aug 19 21:38:48 2021
New Revision: 1892457

URL: http://svn.apache.org/viewvc?rev=1892457=rev
Log:
Add new "decodeCapable" method to FontUtilities to select the first font
from the list (if any) that is capable of displaying the desired characters.
This supports the new capability of specifying a list of fonts for use, where
some may not be suitable because of their limited number of glyphs.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java?rev=1892457=1892456=1892457=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java Thu Aug 19 
21:38:48 2021
@@ -193,6 +193,61 @@ public final class FontUtilities {
 }
 
 /**
+ * Decode a font specification, choosing the first font in the list 
capable of displaying
+ * the given characters. If only one font name is given, that font will be 
selected
+ * regardless of its ability to display the test string of characters. If 
no fonts in the
+ * list are capable of displaying the characters then the default system 
font (DIALOG)
+ * will be returned.
+ *  This is the same as {@link Font#decode(String)} except that we will 
allow multiple
+ * font/family names separated by commas as the 
fontname part of the
+ * spec (much the same as CSS allows), with the proviso that any font 
chosen from the list must be
+ * capable of displaying all the given characters.
+ * The list of allowed formats is:
+ * fontname-style-pointsize
+ * fontname-pointsize
+ * fontname-style
+ * fontname
+ * fontname style pointsize
+ * fontname pointsize
+ * fontname style
+ * fontname
+ * 
+ * where fontname can be fontname[,fontname]*.
+ *
+ * @param strThe font specification as above.
+ * @param testString The characters that must have glyphs available to 
display (can be null
+ *   to skip the "capable" test) (only applicable if 
multiple font names are given to
+ *   choose from).
+ * @return   The font according to the desired specification as 
much as possible.
+ * @see  Font#decode(String)
+ */
+public static Font decodeCapable(final String str, final String 
testString) {
+if (Utils.isNullOrEmpty(str)) {
+return Font.decode(str);
+}
+
+if (str.indexOf(',') > 0) {
+String name = getFontName(str);
+int pos = name.length();
+String spec = pos < str.length() ? str.substring(pos) : "";
+
+String[] names = name.split("\\s*,\\s*");
+for (String nm : names) {
+Font f = Font.decode(nm + spec);
+if (f.getName().equalsIgnoreCase(nm) || 
f.getFamily().equalsIgnoreCase(nm)) {
+if (testString == null || f.canDisplayUpTo(testString) < 
0) {
+return f;
+}
+}
+}
+
+// No names matched in the list, so use the default name
+return Font.decode(Font.DIALOG + spec);
+}
+
+return Font.decode(str);
+}
+/**
  * Get a new font with the given name, style, and size.
  *  The {@code name} can be a comma-separated list of names, and the 
first one matched will be used.
  *




svn commit: r1892549 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java

2021-08-23 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Aug 23 19:03:05 2021
New Revision: 1892549

URL: http://svn.apache.org/viewvc?rev=1892549=rev
Log:
Tweaks to TextAreaOutputStream, including fixing scrolling problems for wrapped 
lines.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java

Modified: 
pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java?rev=1892549=1892548=1892549=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java 
(original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/util/TextAreaOutputStream.java Mon 
Aug 23 19:03:05 2021
@@ -37,7 +37,7 @@ public final class TextAreaOutputStream
 private TextArea textArea;
 
 /** Default line buffer size (can be overridden through a constructor). */
-private static final int DEFAULT_BUFFER_SIZE = 256;
+private static final int DEFAULT_BUFFER_SIZE = 2_048;
 
 /** Buffer size to use for incoming lines of text. */
 private int lineBufferSize;
@@ -49,7 +49,8 @@ public final class TextAreaOutputStream
 private ByteArrayOutputStream lineBuffer;
 
 /**
- * Simple constructor given the {@link TextArea} to stream to.
+ * Simple constructor given the {@link TextArea} to stream to; uses the 
system
+ * default charset for conversion, and the default buffer size.
  *
  * @param textAreaToUse The TextArea to use for output.
  */
@@ -59,7 +60,7 @@ public final class TextAreaOutputStream
 
 /**
  * Constructor given the {@link TextArea} to stream to, and the
- * non-default line buffer size to use.
+ * non-default line buffer size to use; uses the system default charset.
  *
  * @param textAreaToUse The TextArea to use for output.
  * @param lineBufferSizeToUse The non-default size for the input line 
buffer.
@@ -70,7 +71,7 @@ public final class TextAreaOutputStream
 
 /**
  * Constructor given the {@link TextArea} to stream to, and the charset to 
use
- * for decoding the incoming bytes into characters.
+ * for decoding the incoming bytes into characters; uses the default line 
buffer size.
  *
  * @param textAreaToUse The TextArea to use for output.
  * @param charsetToUse The charset used to convert incoming bytes to 
characters
@@ -91,10 +92,10 @@ public final class TextAreaOutputStream
  */
 public TextAreaOutputStream(final TextArea textAreaToUse, final Charset 
charsetToUse,
 final int lineBufferSizeToUse) {
-this.textArea= textAreaToUse;
-this.incomingCharset = (charsetToUse == null) ? 
Charset.defaultCharset() : charsetToUse;
-this.lineBufferSize  = lineBufferSizeToUse;
-this.lineBuffer  = new ByteArrayOutputStream(lineBufferSize);
+textArea= textAreaToUse;
+incomingCharset = (charsetToUse == null) ? Charset.defaultCharset() : 
charsetToUse;
+lineBufferSize  = lineBufferSizeToUse;
+lineBuffer  = new ByteArrayOutputStream(lineBufferSize);
 }
 
 /**
@@ -136,8 +137,14 @@ public final class TextAreaOutputStream
 textArea.insertText("\n", newLength++);
 }
 
-Bounds lastCharBounds = textArea.getCharacterBounds(newLength);
-textArea.scrollAreaToVisible(lastCharBounds);
+final int lastCharPos = newLength;
+
+// In order to allow time for the skin to render the latest 
additions,
+// queue the actual scrolling until that is done
+ApplicationContext.queueCallback(() -> {
+Bounds lastCharBounds = 
textArea.getCharacterBounds(lastCharPos);
+textArea.scrollAreaToVisible(lastCharBounds);
+});
 });
 }
 }
@@ -145,9 +152,9 @@ public final class TextAreaOutputStream
 @Override
 public void close() throws IOException {
 flush();
-this.textArea= null;
-this.incomingCharset = null;
-this.lineBuffer  = null;
+textArea= null;
+incomingCharset = null;
+lineBuffer  = null;
 }
 
 @Override




svn commit: r1892800 - /pivot/trunk/StyleChecks.java

2021-09-01 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Sep  2 05:59:34 2021
New Revision: 1892800

URL: http://svn.apache.org/viewvc?rev=1892800=rev
Log:
PIVOT-1032: The main method of StyleChecks was too long, counts need 1000s 
separators,
properly display long/short names in the file names list if any are duplicates. 
Handle
files with the same name properly for the "-f" option. Spiff up the top banner.

Modified:
pivot/trunk/StyleChecks.java

Modified: pivot/trunk/StyleChecks.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/StyleChecks.java?rev=1892800=1892799=1892800=diff
==
--- pivot/trunk/StyleChecks.java (original)
+++ pivot/trunk/StyleChecks.java Thu Sep  2 05:59:34 2021
@@ -184,7 +184,7 @@ public final class StyleChecks {
 
 /**
  * Our file name lists have "short" names that are all relative to
- * the {@link ORG_APACHE_PIVOT} path. But to report names properly
+ * the {@link #PATH_PREFIX} path. But to report names properly
  * that may be duplicates in the name, but not in the full path
  * we need to decide if there are any such duplicates before beginning
  * to print. That's what we do here.
@@ -212,7 +212,7 @@ public final class StyleChecks {
  * @param infos The set of info objects.
  * @return  Whether or not there are duplicate names.
  */
-private static boolean anyDuplicateInfos(final Iterable infos) {
+private static boolean anyDuplicateFileInfos(final Iterable 
infos) {
 Set nonDuplicateNames = new HashSet<>();
 int count = 0;
 for (FileInfo info : infos) {
@@ -242,62 +242,89 @@ public final class StyleChecks {
 
 /**
  * Get a list of the short form of strings as a parenthesized list,
- * using the names only if there are no duplicates, otherwise show
- * the full names to disambiguate the duplicates.
+ * using the names only (for the case of no duplicates).
  *
  * @param strings The set of strings to traverse.
  * @return A nicely formatted list.
  */
 private static String listShortName(final Iterable strings) {
-boolean duplicates = anyDuplicateNames(strings);
 StringBuilder buf = new StringBuilder("(");
 int i = 0;
 for (String s : strings) {
 if (i++ > 0) {
 buf.append(", ");
 }
-buf.append(duplicates ? s : fileNameOnly(s));
+buf.append(fileNameOnly(s));
 }
 buf.append(')');
 return buf.toString();
 }
 
 /**
- * Find a file by name if it exists starting at the given directory 
location.
+ * Find one or more files by name if any exist starting at the given 
directory location.
  *  This is used to ensure that the "-f" file names 
actually exist,
- * and aren't not found because the name is a typo.
+ * and aren't not found in the style log just because the name is a typo.
  *
- * @param file   The starting directory to search.
- * @param search The file name to search for.
- * @return   {@code true} or {@code false} depending on whether the 
file is
- *   found anywhere in the directory hierarchy.
- */
-private static boolean findFile(final File file, final String search) {
-if (file.isDirectory()) {
-for (File f : file.listFiles()) {
-if (findFile(f, search)) {
-return true;
+ * @param baseFile   The starting directory to search.
+ * @param searchName The file name to search for, which could be a partial 
path.
+ * @param fileList   The list of files to add to as they are found.
+ * @return   {@code true} or {@code false} depending on whether 
any files
+ *   with the given name were found.
+ */
+private static boolean findFiles(final File baseFile, final String 
searchName, final List fileList) {
+boolean foundAny = false;
+
+if (baseFile.isDirectory()) {
+// Skip (some) directory hierarchies that will be unfruitful no 
matter what
+if (baseFile.getName().equals("ant-bin")) {
+return foundAny;
+}
+
+File newFile = new File(baseFile, searchName);
+if (newFile.exists() && newFile.isFile()) {
+fileList.add(newFile);
+foundAny = true;
+} else {
+for (File f : baseFile.listFiles()) {
+if (findFiles(f, searchName, fileList)) {
+foundAny = true;
+}
 }
 }
 } else {
-if (search.equals(file.getName())) {
-return true;
+if (searchName.equals(baseFile.getName())) {
+fileList.add(baseFile);
+foundAny = true

svn commit: r1892828 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

2021-09-02 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Sep  2 19:09:48 2021
New Revision: 1892828

URL: http://svn.apache.org/viewvc?rev=1892828=rev
Log:
Add two new methods to FontUtilities to register a new font for use, either 
from a file or an input stream.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java?rev=1892828=1892827=1892828=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java Thu Sep  2 
19:09:48 2021
@@ -17,6 +17,11 @@
 package org.apache.pivot.wtk;
 
 import java.awt.Font;
+import java.awt.FontFormatException;
+import java.awt.GraphicsEnvironment;
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
 import java.util.Locale;
 
 import org.apache.pivot.collections.Dictionary;
@@ -352,5 +357,53 @@ public final class FontUtilities {
 }
 }
 
+/**
+ * Install a new font for use by this program (only).
+ *
+ * @param fullFontFilePath The complete path (on disk) to the local font 
file
+ * (must be a TrueType font in this case).
+ * @return The newly created / registered font if successful, 
null otherwise.
+ * @throws IOException if there was a problem reading the font from the 
file.
+ * @throws FontFormatException if the font file itself was malformed.
+ */
+public static Font registerFont(final File fullFontFilePath)
+throws IOException, FontFormatException
+{
+try {
+GraphicsEnvironment ge = 
GraphicsEnvironment.getLocalGraphicsEnvironment();
+Font f = Font.createFont(Font.TRUETYPE_FONT, fullFontFilePath);
+if (ge.registerFont(f)) {
+return f;
+}
+return null;
+} catch (IOException | FontFormatException ex) {
+throw ex;
+}
+}
+
+/**
+ * Install a new font for use by this program (only).
+ *
+ * @param fontInputStream The stream of bytes describing this font
+ *(must be a TrueType font in this case). Also 
note that the
+ *caller is responsible for closing this input 
stream.
+ * @return The newly created / registered font if successful, 
null otherwise.
+ * @throws IOException if there was a problem reading the font from the 
file.
+ * @throws FontFormatException if the font file itself was malformed.
+ */
+public static Font registerFont(final InputStream fontInputStream)
+throws IOException, FontFormatException
+{
+try {
+GraphicsEnvironment ge = 
GraphicsEnvironment.getLocalGraphicsEnvironment();
+Font f = Font.createFont(Font.TRUETYPE_FONT, fontInputStream);
+if (ge.registerFont(f)) {
+return f;
+}
+return null;
+} catch (IOException | FontFormatException ex) {
+throw ex;
+}
+}
 
 }




svn commit: r1897109 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

2022-01-15 Thread rwhitcomb
Author: rwhitcomb
Date: Sun Jan 16 01:36:47 2022
New Revision: 1897109

URL: http://svn.apache.org/viewvc?rev=1897109=rev
Log:
Enhance "Action" to add overrides to facilitate actions that are Enum values.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java?rev=1897109=1897108=1897109=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java Sun Jan 16 01:36:47 
2022
@@ -201,6 +201,21 @@ public abstract class Action {
 }
 
 /**
+ * Perform the named action, unless the action is disabled.
+ *  This is the equivalent of
+ * 
Action.getNamedActions().get(actionName).perform(comp).
+ *
+ * @param actionName An enum value whose toString() value is 
used as the action name.
+ * @param comp   The component initiating the action.
+ * @throws IllegalArgumentException if the actionName is {@code null} or 
if there is
+ * no action with that name.
+ */
+public static void performAction(final Enum actionName, 
final Component comp) {
+Utils.checkNull(actionName, "action name");
+performAction(actionName.toString(), comp);
+}
+
+/**
  * Check if this action is currently enabled.
  *
  * @return Whether or not this action is currently enabled.
@@ -243,6 +258,20 @@ public abstract class Action {
 }
 
 /**
+ * Add this action to the named action dictionary.
+ *  This is equivalent to getNamedActions().put(id, 
action)
+ *
+ * @param actionName An enum whose toString() value is used 
as the ID for the action.
+ * @param action The action to be performed under this name.
+ * @return   The previous action (if any) listed under this name.
+ * @throws IllegalArgumentException if the actionName is {@code null}.
+ */
+public static Action addNamedAction(final Enum actionName, 
final Action action) {
+Utils.checkNull(actionName, "action name");
+return addNamedAction(actionName.toString(), action);
+}
+
+/**
  * Get the named action from the dictionary.
  *  This is the equivalent of 
getNamedActions().get(id)
  *
@@ -255,6 +284,20 @@ public abstract class Action {
 }
 
 /**
+ * Get the named action from the dictionary.
+ *  This is the equivalent of 
getNamedActions().get(id)
+ *
+ * @param actionName An enum whose toString() method is used 
as the ID for the action.
+ * @return   The action currently associated with this id (or 
{@code null} if
+ *   there is no saved action with that id value).
+ * @throws IllegalArgumentException if the actionName is {@code null}.
+ */
+public static Action getNamedAction(final Enum actionName) 
{
+Utils.checkNull(actionName, "action name");
+return getNamedAction(actionName.toString());
+}
+
+/**
  * @return The global named action dictionary.
  */
 public static NamedActionDictionary getNamedActions() {




svn commit: r1897111 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

2022-01-15 Thread rwhitcomb
Author: rwhitcomb
Date: Sun Jan 16 03:03:30 2022
New Revision: 1897111

URL: http://svn.apache.org/viewvc?rev=1897111=rev
Log:
Further changes to Action to refine the Enum support and regularize the 
parameter names.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java?rev=1897111=1897110=1897111=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java Sun Jan 16 03:03:30 
2022
@@ -43,41 +43,41 @@ public abstract class Action {
 }
 
 @Override
-public Action get(final String id) {
-return namedActions.get(id);
+public Action get(final String actionName) {
+return namedActions.get(actionName);
 }
 
 @Override
-public Action put(final String id, final Action action) {
+public Action put(final String actionName, final Action action) {
 Utils.checkNull(action, "action");
 
-boolean update = containsKey(id);
-Action previousAction = namedActions.put(id, action);
+boolean update = containsKey(actionName);
+Action previousAction = namedActions.put(actionName, action);
 
 if (update) {
-actionClassListeners.actionUpdated(id, previousAction);
+actionClassListeners.actionUpdated(actionName, previousAction);
 } else {
-actionClassListeners.actionAdded(id);
+actionClassListeners.actionAdded(actionName);
 }
 
 return previousAction;
 }
 
 @Override
-public Action remove(final String id) {
+public Action remove(final String actionName) {
 Action removedAction = null;
 
-if (containsKey(id)) {
-removedAction = namedActions.remove(id);
-actionClassListeners.actionRemoved(id, removedAction);
+if (containsKey(actionName)) {
+removedAction = namedActions.remove(actionName);
+actionClassListeners.actionRemoved(actionName, removedAction);
 }
 
 return removedAction;
 }
 
 @Override
-public boolean containsKey(final String id) {
-return namedActions.containsKey(id);
+public boolean containsKey(final String actionName) {
+return namedActions.containsKey(actionName);
 }
 
 @Override
@@ -136,7 +136,7 @@ public abstract class Action {
  */
 private static HashMap namedActions = new HashMap<>();
 /**
- * The global dictionary associating action ids with their implementations.
+ * The global dictionary associating action names with their 
implementations.
  */
 private static NamedActionDictionary namedActionDictionary = new 
NamedActionDictionary();
 
@@ -205,12 +205,13 @@ public abstract class Action {
  *  This is the equivalent of
  * 
Action.getNamedActions().get(actionName).perform(comp).
  *
+ * @param Enum type that gives the action name.
  * @param actionName An enum value whose toString() value is 
used as the action name.
  * @param comp   The component initiating the action.
  * @throws IllegalArgumentException if the actionName is {@code null} or 
if there is
  * no action with that name.
  */
-public static void performAction(final Enum actionName, 
final Component comp) {
+public static > void performAction(final E actionName, 
final Component comp) {
 Utils.checkNull(actionName, "action name");
 performAction(actionName.toString(), comp);
 }
@@ -247,52 +248,54 @@ public abstract class Action {
 
 /**
  * Add this action to the named action dictionary.
- *  This is equivalent to getNamedActions().put(id, 
action)
+ *  This is equivalent to 
getNamedActions().put(actionName, action)
  *
- * @param id The name to store this action under (can be referenced 
from button actions, etc.)
- * @param action The action to be performed under this name.
- * @return   The previous action (if any) listed under this name.
+ * @param actionName The name to store this action under (can be 
referenced from button actions, etc.)
+ * @param action The action to be performed under this name.
+ * @return   The previous action (if any) listed under this name.
  */
-public static Action addNamedAction(final String id, final Action action) {
-return namedActionDictionary.put(id, action);
+public static Action addNamedAction(final String actionName, final Action 
action) {
+return namedActionDictionary.put(actionName, action);

svn commit: r1898762 - /pivot/site/trunk/www/download.xml

2022-03-08 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Mar  9 02:40:04 2022
New Revision: 1898762

URL: http://svn.apache.org/viewvc?rev=1898762=rev
Log:
PIVOT-1063: Use https: for download links.

Modified:
pivot/site/trunk/www/download.xml

Modified: pivot/site/trunk/www/download.xml
URL: 
http://svn.apache.org/viewvc/pivot/site/trunk/www/download.xml?rev=1898762=1898761=1898762=diff
==
--- pivot/site/trunk/www/download.xml (original)
+++ pivot/site/trunk/www/download.xml Wed Mar  9 02:40:04 2022
@@ -32,10 +32,10 @@ limitations under the License.
 
 
 
-http://www.apache.org/dist/pivot/KEYS;>KEYS |
+https://www.apache.org/dist/pivot/KEYS;>KEYS |
  |
 Browse |
-http://archive.apache.org/dist/pivot/;>Archives
+https://archive.apache.org/dist/pivot/;>Archives
 
 
 
@@ -43,7 +43,7 @@ limitations under the License.
 
 You must verify the integrity of the downloaded files. We 
provide PGP
 signatures for every release file. This signature should be 
matched against the
-http://www.apache.org/dist/pivot/KEYS;>KEYS file 
containing the PGP keys of Pivot's
+https://www.apache.org/dist/pivot/KEYS;>KEYS file 
containing the PGP keys of Pivot's
 Release Managers. We also provide an MD5 checksum 
and a
 SHA checksum for every release file. After you 
download the file, you
 should calculate a checksum for your download and make sure it 
is the same as ours.
@@ -89,15 +89,15 @@ limitations under the License.
 
 
 zip
-(http://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.zip.asc;>pgp,
-http://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.zip.md5;>md5,
-http://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.zip.sha;>sha)
+(https://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.zip.asc;>pgp,
+https://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.zip.md5;>md5,
+https://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.zip.sha;>sha)
 
 
 tar.gz
-(http://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.tar.gz.asc;>pgp,
-http://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.tar.gz.md5;>md5,
-http://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.tar.gz.sha;>sha)
+(https://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.tar.gz.asc;>pgp,
+https://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.tar.gz.md5;>md5,
+https://www.apache.org/dist/pivot/binaries/apache-pivot-{$version}.tar.gz.sha;>sha)
 
 
 
@@ -106,15 +106,15 @@ limitations under the License.
 
 
 tar.gz
-(http://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.tar.gz.asc;>pgp,
-http://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.tar.gz.md5;>md5,
-http://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.tar.gz.sha;>sha)
+(https://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.tar.gz.asc;>pgp,
+https://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.tar.gz.md5;>md5,
+https://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.tar.gz.sha;>sha)
 
 
 zip
-(http://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.zip.asc;>pgp,
-http://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.zip.md5;>md5,
-http://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.zip.sha;>sha)
+(https://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.zip.asc;>pgp,
+https://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.zip.md5;>md5,
+https://www.apache.org/dist/pivot/source/apache-pivot-{$version}-src.zip.sha;>sha)
 
 
 




svn commit: r1898141 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java

2022-02-16 Thread rwhitcomb
Author: rwhitcomb
Date: Thu Feb 17 05:14:09 2022
New Revision: 1898141

URL: http://svn.apache.org/viewvc?rev=1898141=rev
Log:
Window.remove is unsupported to remove the content - add message to exception.

Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java?rev=1898141=1898140=1898141=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java Thu Feb 17 05:14:09 
2022
@@ -337,7 +337,7 @@ public class Window extends Container {
 for (int i = index, n = index + count; i < n; i++) {
 Component component = get(i);
 if (component == content) {
-throw new UnsupportedOperationException();
+throw new UnsupportedOperationException("Window content cannot 
be removed.");
 }
 }
 




svn commit: r1897168 - /pivot/trunk/StyleChecks.java

2022-01-18 Thread rwhitcomb
Author: rwhitcomb
Date: Tue Jan 18 08:24:10 2022
New Revision: 1897168

URL: http://svn.apache.org/viewvc?rev=1897168=rev
Log:
Spruce up the output of StyleChecks using single box drawing characters 
everywhere.

Modified:
pivot/trunk/StyleChecks.java

Modified: pivot/trunk/StyleChecks.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/StyleChecks.java?rev=1897168=1897167=1897168=diff
==
--- pivot/trunk/StyleChecks.java (original)
+++ pivot/trunk/StyleChecks.java Tue Jan 18 08:24:10 2022
@@ -411,16 +411,18 @@ public final class StyleChecks {
 private static final String FORMAT3A = "%1$5s %2$-30s%3$,6d (%4$,d)%n";
 /** Format string used to print the underlines. */
 private static final String UNDER_FORMAT = "%1$3s %2$5s %3$-30s%4$6s 
%5$s%n";
-/** Three character underline. */
-private static final String THREE = "---";
-/** Five character underline. */
-private static final String FIVE = "-";
-/** Six character underline. */
-private static final String SIX = "--";
-/** File name underline. */
-private static final String FILE = "---";
-/** Category name underline. */
-private static final String CATEGORY = "";
+
+/** First column header: number. */
+private static final String HDR_NUMBER = " # ";
+/** Second column header: severity. */
+private static final String HDR_SEVERITY =  " Sev ";
+/** Third column header: category. */
+private static final String HDR_CATEGORY =  "Category";
+/** Fourth column header: count. */
+private static final String HDR_COUNT =  " Count";
+/** Last column header: file list. */
+private static final String HDR_FILES =  "File(s)";
+
 /** Format string for the file vs problem count report. */
 private static final String FORMAT4 = "%1$-42s %2$,6d%n";
 /** Alternate format string for the file vs problem count report. */
@@ -513,21 +515,40 @@ public final class StyleChecks {
 };
 
 
-/** Upper-left corner character (double line). */
-private static final char ULC = '\u2554';
-/** Upper-right corner character (double line). */
-private static final char URC = '\u2557';
-/** Horizontal line character (double line). */
-private static final char HZL = '\u2550';
-/** Vertical line character (double line). */
-private static final char VTL = '\u2551';
-/** Lower-left corner character (double line). */
-private static final char LLC = '\u255A';
-/** Lower-right corner character (double line). */
-private static final char LRC = '\u255D';
+/** Upper-left rounded corner character (single line). */
+private static final char ULC = '\u256D';
+/** Upper-right rounded corner character (single line). */
+private static final char URC = '\u256E';
+/** Horizontal line character (single line). */
+private static final char HZL = '\u2500';
+/** Vertical line character (single line). */
+private static final char VTL = '\u2502';
+/** Lower-left rounded corner character (single line). */
+private static final char LLC = '\u2570';
+/** Lower-right rounded corner character (single line). */
+private static final char LRC = '\u256F';
 
 /** Width of our banner (pretty arbitrary). */
-private static final int WIDTH = 57;
+private static final int WIDTH = 66;
+/** Width of the Category column. */
+private static final int CATEGORY_WIDTH = 28;
+/** Width of the File(s) column. */
+private static final int FILES_WIDTH = 19;
+
+
+/**
+ * Line types.
+ */
+private enum LineType {
+/** The top border of the banner box. */
+TOP,
+/** The bottom border of the banner box. */
+BOTTOM,
+/** One of the middle lines of the banner box. */
+MIDDLE,
+/** A line under a heading. */
+UNDER
+}
 
 
 /**
@@ -537,39 +558,44 @@ public final class StyleChecks {
  * @param message  message for type 2
  * @return Constructed line to print.
  */
-private static String constructBoxLine(final int lineType, final int 
width, final String message) {
+private static String constructBoxLine(final LineType lineType, final int 
width, final String message) {
 char[] chars = new char[width];
 
 switch (lineType) {
-case 0:
+case TOP:
 chars[0] = ULC;
 chars[width - 1] = URC;
 break;
-case 1:
+case BOTTOM:
 chars[0] = LLC;
 chars[width - 1] = LRC;
 break;
-case 2:
+case MIDDLE:
 chars[0] = VTL;
 chars[width - 1

svn commit: r1913476 - in /pivot/trunk: core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/util/ core/src/org/apache/pivot/util/concurrent/ core/test/org/apache/pivot/util/test/ tests/sr

2023-10-31 Thread rwhitcomb
Author: rwhitcomb
Date: Wed Nov  1 02:16:53 2023
New Revision: 1913476

URL: http://svn.apache.org/viewvc?rev=1913476=rev
Log:
PIVOT-1032: Last set of changes to reduce "checkstyle" violations, plus some 
code enhancements.

Modified:
pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java
pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java
pivot/trunk/core/src/org/apache/pivot/util/Utils.java
pivot/trunk/core/src/org/apache/pivot/util/concurrent/Task.java
pivot/trunk/core/src/org/apache/pivot/util/concurrent/TimeoutException.java
pivot/trunk/core/test/org/apache/pivot/util/test/StringUtilsTest.java
pivot/trunk/tests/src/org/apache/pivot/tests/console_test.bxml

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java

pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputListener.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java

pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java

Modified: pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java?rev=1913476=1913475=1913476=diff
==
--- pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java Wed Nov  1 
02:16:53 2023
@@ -35,7 +35,7 @@ public class HashSet implements Set iterator) {
+public ElementIterator(final Iterator iterator) {
 Utils.checkNull(iterator, "iterator");
 
 this.iterator = iterator;
@@ -79,25 +79,25 @@ public class HashSet implements Set set) {
+public HashSet(final Set set) {
 for (E element : set) {
 add(element);
 }
 }
 
 @SafeVarargs
-public HashSet(E... elements) {
+public HashSet(final E... elements) {
 for (E element : elements) {
 add(element);
 }
 }
 
-public HashSet(Comparator comparator) {
+public HashSet(final Comparator comparator) {
 setComparator(comparator);
 }
 
 @Override
-public boolean add(E element) {
+public boolean add(final E element) {
 boolean added = false;
 
 if (!hashMap.containsKey(element)) {
@@ -113,7 +113,7 @@ public class HashSet implements Set implements Set implements Set comparator) {
+public void setComparator(final Comparator comparator) {
 Comparator previousComparator = getComparator();
 
 hashMap.setComparator(comparator);
@@ -186,7 +186,7 @@ public class HashSet implements Set implements Sethttp://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java?rev=1913476=1913475=1913476=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java Wed Nov  1 
02:16:53 2023
@@ -18,6 +18,7 @@ package org.apache.pivot.util;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.Arrays;
 
 
 /**
@@ -50,16 +51,10 @@ public final class StringUtils {
throw new IllegalArgumentException("Requested string size " + n + " 
is out of range.");
 }
 
-// Nothing fancy here, but allocate the space and set length upfront
-// because we know how big the result should be.
-StringBuilder builder = new StringBuilder(n);
-builder.setLength(n);
-if (ch != '\0') {
-for (int i = 0; i < n; i++) {
-builder.setCharAt(i, ch);
-}
-}
-return builder.toString();
+char[] chars = new char[n];
+Arrays.fill(chars, ch);
+
+return new String(chars);
 }
 
 /**

Modified: pivot/trunk/core/src/org/apache/pivot/util/Utils.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Utils.java?rev=1913476=1913475=1913476=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/Utils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Utils.java Wed Nov  1 02:16:53 
2023
@@ -450,5 +450,19 @@ public final class Utils {
 }
 }
 
+/**
+ * Check and throw an exception if the given object is not of the given 
class.
+ *
+ * @param nm  A suitable object name for the 

svn commit: r1913446 - in /pivot/trunk: core/src/org/apache/pivot/util/CharUtils.java wtk/src/org/apache/pivot/wtk/Display.java wtk/src/org/apache/pivot/wtk/DropAction.java wtk/src/org/apache/pivot/wt

2023-10-30 Thread rwhitcomb
Author: rwhitcomb
Date: Mon Oct 30 16:54:16 2023
New Revision: 1913446

URL: http://svn.apache.org/viewvc?rev=1913446=rev
Log:
PIVOT-1032: Small style changes in a few more places.

Modified:
pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Display.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/DropAction.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/FontUtilities.java

Modified: pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java?rev=1913446=1913445=1913446=diff
==
--- pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java Mon Oct 30 
16:54:16 2023
@@ -29,6 +29,14 @@ public final class CharUtils {
 }
 
 /**
+ * @return Whether the given character is one of the line-ending chars.
+ * @param ch The character to check.
+ */
+private static boolean isLineEnding(final char ch) {
+return (ch == '\r' || ch == '\n');
+}
+
+/**
  * Return a {@link CharSpan} describing a "word" which contains the given
  * starting location in the character sequence.
  *  "Words" are defined as sequences of "Unicode Identifier Part" 
characters
@@ -48,7 +56,6 @@ public final class CharUtils {
 }
 
 int adjustedStart = start;
-char ch;
 
 // Adjust the start position to put it within the sequence length
 // and skip any trailing line endings at that point
@@ -57,7 +64,7 @@ public final class CharUtils {
 if (adjustedStart < 0) {
 return null;
 }
-while ((ch = sequence.charAt(adjustedStart)) == '\r' || ch == 
'\n') {
+while (isLineEnding(sequence.charAt(adjustedStart))) {
 adjustedStart--;
 }
 }
@@ -67,7 +74,7 @@ public final class CharUtils {
 
 int selectionStart = adjustedStart;
 int selectionLength = 1;
-ch = sequence.charAt(selectionStart);
+char ch = sequence.charAt(selectionStart);
 if (Character.isWhitespace(ch)) {
 // Move backward to beginning of whitespace block
 // but not before the beginning of the text.

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Display.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Display.java?rev=1913446=1913445=1913446=diff
==
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Display.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Display.java Mon Oct 30 16:54:16 
2023
@@ -25,17 +25,31 @@ import org.apache.pivot.wtk.skin.Display
  * Container that serves as the root of a component hierarchy.
  */
 public final class Display extends Container {
+/**
+ * The display host (bridge to AWT) that really implements this display.
+ */
 private ApplicationContext.DisplayHost displayHost;
 
-public Display(ApplicationContext.DisplayHost displayHost) {
-this.displayHost = displayHost;
+/**
+ * Construct a display on the given {@link ApplicationContext.DisplayHost}.
+ *
+ * @param host The display host that implements this display.
+ */
+public Display(final ApplicationContext.DisplayHost host) {
+displayHost = host;
 super.setSkin(new DisplaySkin());
 }
 
+/**
+ * @return The display host attached to this display.
+ */
 public ApplicationContext.DisplayHost getDisplayHost() {
 return displayHost;
 }
 
+/**
+ * @return The AWT host window of this display.
+ */
 public java.awt.Window getHostWindow() {
 java.awt.Container parent = displayHost.getParent();
 while (parent != null && !(parent instanceof java.awt.Window)) {
@@ -51,41 +65,41 @@ public final class Display extends Conta
 
 @Override
 @UnsupportedOperation
-protected void setSkin(Skin skin) {
+protected void setSkin(final Skin skin) {
 throw new UnsupportedOperationException("Can't replace Display skin.");
 }
 
 @Override
 @UnsupportedOperation
-protected void setParent(Container parent) {
+protected void setParent(final Container parent) {
 throw new UnsupportedOperationException("Display can't have a 
parent.");
 }
 
 @Override
 @UnsupportedOperation
-public void setLocation(int x, int y) {
+public void setLocation(final int x, final int y) {
 throw new UnsupportedOperationException("Can't change the location of 
the display.");
 }
 
 @Override
 @UnsupportedOperation
-public void setVisible(boolean visible) {
+public void setVisible(final boolean visible) {
  

<    3   4   5   6   7   8   9   >