You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2017/11/14 00:30:51 UTC

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

Author: rwhitcomb
Date: Tue Nov 14 00:30:50 2017
New Revision: 1815164

URL: http://svn.apache.org/viewvc?rev=1815164&view=rev
Log:
PIVOT-1012:  Add color names to many calls to "GraphicsUtilities.decodeColor" so
the parameter validation messages will have the right parameter name.

Misc. "Utils" calls for other parameter validation.

Modified:
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMeterSkin.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/TerraPanoramaSkin.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/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/TerraRollupSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMeterSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMeterSkin.java?rev=1815164&r1=1815163&r2=1815164&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMeterSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMeterSkin.java Tue Nov 14 00:30:50 2017
@@ -27,6 +27,7 @@ import java.awt.font.LineMetrics;
 import java.awt.geom.Rectangle2D;
 
 import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.util.Utils;
 import org.apache.pivot.wtk.Component;
 import org.apache.pivot.wtk.Dimensions;
 import org.apache.pivot.wtk.GraphicsUtilities;
@@ -49,22 +50,20 @@ public class TerraMeterSkin extends Comp
     private Color textColor;
     private Color textFillColor;
     private Color darkFillColor;
+    private Color brightFillColor;
 
     private static final int DEFAULT_WIDTH = 100;
     private static final int DEFAULT_HEIGHT = 12;
 
     public TerraMeterSkin() {
-        TerraTheme theme = (TerraTheme) Theme.getTheme();
+        setColor(16);
+        Theme theme = currentTheme();
         backgroundColor = theme.getColor(10);
-        fillColor = theme.getColor(16);
         gridColor = theme.getColor(10);
         gridFrequency = 0.25f;
         font = theme.getFont().deriveFont(Font.BOLD);
         textColor = theme.getColor(1);
         textFillColor = theme.getColor(4);
-
-        // Set the derived colors
-        darkFillColor = TerraTheme.darken(fillColor);
     }
 
     @Override
@@ -97,8 +96,7 @@ public class TerraMeterSkin extends Comp
                 preferredWidth = 0;
             }
 
-            // If the meter has no content, its preferred width is hard-coded by
-            // the
+            // If the meter has no content, its preferred width is hard-coded by the
             // class and is not affected by the height constraint
             preferredWidth = Math.max(preferredWidth, DEFAULT_WIDTH);
         } else {
@@ -127,8 +125,7 @@ public class TerraMeterSkin extends Comp
                 preferredHeight = 0;
             }
 
-            // If the meter has no content, its preferred height is hard-coded
-            // by the
+            // If the meter has no content, its preferred height is hard-coded by the
             // class and is not affected by the width constraint
             preferredHeight = Math.max(preferredHeight, DEFAULT_HEIGHT);
         }
@@ -152,8 +149,7 @@ public class TerraMeterSkin extends Comp
             preferredHeight = (int) Math.ceil(lm.getHeight()) + 2;
         }
 
-        // If meter has no content, its preferred size is hard coded by the
-        // class
+        // If meter has no content, its preferred size is hard coded by the class
         preferredWidth = Math.max(preferredWidth, DEFAULT_WIDTH);
         preferredHeight = Math.max(preferredHeight, DEFAULT_HEIGHT);
 
@@ -215,8 +211,8 @@ public class TerraMeterSkin extends Comp
 
         // Paint the interior fill
         if (!themeIsFlat()) {
-            graphics.setPaint(new GradientPaint(0, 0, TerraTheme.brighten(fillColor), 0, height,
-                darkFillColor));
+            graphics.setPaint(new GradientPaint(0, 0, brightFillColor,
+                0, height, darkFillColor));
             graphics.fillRect(0, 0, meterStop, height);
 
             // Paint the grid
@@ -229,17 +225,19 @@ public class TerraMeterSkin extends Comp
                 GraphicsUtilities.drawLine(graphics, gridX, 0, height, Orientation.VERTICAL);
             }
         } else {
-            // Paint the background
-            graphics.setColor(backgroundColor);
-            graphics.fillRect(0, 0, width, height);
-
+            // Paint the meter color up til the stop position
             graphics.setPaint(darkFillColor);
             graphics.fillRect(0, 0, meterStop, height);
+
+            // Then paint the background the rest of the width
+            graphics.setColor(backgroundColor);
+            graphics.fillRect(meterStop, 0, width, height);
+
         }
 
         String text = meter.getText();
         if (text != null && text.length() > 0) {
-            FontRenderContext fontRenderContext = Platform.getFontRenderContext();
+            FontRenderContext fontRenderContext = GraphicsUtilities.prepareForText(graphics);
             LineMetrics lm = font.getLineMetrics("", fontRenderContext);
             float ascent = lm.getAscent();
 
@@ -251,11 +249,6 @@ public class TerraMeterSkin extends Comp
             float textY = (height - textHeight) / 2;
 
             // Paint the text
-            graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
-                fontRenderContext.getAntiAliasingHint());
-            graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
-                fontRenderContext.getFractionalMetricsHint());
-
             Shape clip = graphics.getClip();
             graphics.clipRect(0, 0, meterStop, height);
             graphics.setPaint(textFillColor);
@@ -275,16 +268,22 @@ public class TerraMeterSkin extends Comp
     }
 
     public void setColor(Color color) {
+        Utils.checkNull(color, "fillColor");
+        // Note: fillColor null is not acceptable because of the brighten
+        // and darken done on it.
         this.fillColor = color;
+        this.darkFillColor = TerraTheme.darken(fillColor);
+        this.brightFillColor = TerraTheme.brighten(fillColor);
         repaintComponent();
     }
 
     public final void setColor(String color) {
-        if (color == null) {
-            throw new IllegalArgumentException("color is null.");
-        }
+        setColor(GraphicsUtilities.decodeColor(color, "color"));
+    }
 
-        setColor(GraphicsUtilities.decodeColor(color));
+    public final void setColor(int color) {
+        Theme theme = currentTheme();
+        setColor(theme.getColor(color));
     }
 
     public Color getGridColor() {
@@ -292,16 +291,13 @@ public class TerraMeterSkin extends Comp
     }
 
     public void setGridColor(Color gridColor) {
+        // Null grid color seems acceptable
         this.gridColor = gridColor;
         repaintComponent();
     }
 
     public final void setGridColor(String gridColor) {
-        if (gridColor == null) {
-            throw new IllegalArgumentException("gridColor is null.");
-        }
-
-        setGridColor(GraphicsUtilities.decodeColor(gridColor));
+        setGridColor(GraphicsUtilities.decodeColor(gridColor, "gridColor"));
     }
 
     public Color getTextColor() {
@@ -314,11 +310,7 @@ public class TerraMeterSkin extends Comp
     }
 
     public final void setTextColor(String color) {
-        if (color == null) {
-            throw new IllegalArgumentException("color is null.");
-        }
-
-        setTextColor(GraphicsUtilities.decodeColor(color));
+        setTextColor(GraphicsUtilities.decodeColor(color, "textColor"));
     }
 
     public Color getTextFillColor() {
@@ -326,16 +318,13 @@ public class TerraMeterSkin extends Comp
     }
 
     public void setTextFillColor(Color color) {
+        // Looks like null is acceptable here
         this.textFillColor = color;
         repaintComponent();
     }
 
     public final void setTextFillColor(String color) {
-        if (color == null) {
-            throw new IllegalArgumentException("color is null.");
-        }
-
-        setTextFillColor(GraphicsUtilities.decodeColor(color));
+        setTextFillColor(GraphicsUtilities.decodeColor(color, "textFillColor"));
     }
 
     public float getGridFrequency() {
@@ -351,9 +340,7 @@ public class TerraMeterSkin extends Comp
     }
 
     public final void setGridFrequency(Number gridFrequency) {
-        if (gridFrequency == null) {
-            throw new IllegalArgumentException("gridFrequency is null.");
-        }
+        Utils.checkNull(gridFrequency, "gridFrequency");
 
         setGridFrequency(gridFrequency.floatValue());
     }
@@ -363,27 +350,17 @@ public class TerraMeterSkin extends Comp
     }
 
     public void setFont(Font font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
+        Utils.checkNull(font, "font");
 
         this.font = font;
         invalidateComponent();
     }
 
     public final void setFont(String font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
-
         setFont(decodeFont(font));
     }
 
     public final void setFont(Dictionary<String, ?> font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
-
         setFont(Theme.deriveFont(font));
     }
 

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java?rev=1815164&r1=1815163&r2=1815164&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java Tue Nov 14 00:30:50 2017
@@ -163,7 +163,7 @@ public class TerraPaletteSkin extends Wi
 
     @SuppressWarnings("unused")
     public TerraPaletteSkin() {
-        TerraTheme theme = (TerraTheme) Theme.getTheme();
+        Theme theme = currentTheme();
         Color backgroundColor = theme.getColor(10);
         setBackgroundColor(ColorUtilities.setTransparencyInColor(backgroundColor, ALPHA));
 

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPanoramaSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPanoramaSkin.java?rev=1815164&r1=1815163&r2=1815164&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPanoramaSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPanoramaSkin.java Tue Nov 14 00:30:50 2017
@@ -501,7 +501,7 @@ public class TerraPanoramaSkin extends C
     }
 
     public final void setButtonColor(String buttonColor) {
-        setButtonColor(GraphicsUtilities.decodeColor(buttonColor));
+        setButtonColor(GraphicsUtilities.decodeColor(buttonColor, "buttonColor"));
     }
 
     public Color getButtonBackgroundColor() {
@@ -515,7 +515,7 @@ public class TerraPanoramaSkin extends C
     }
 
     public final void setButtonBackgroundColor(String buttonBackgroundColor) {
-        setButtonBackgroundColor(GraphicsUtilities.decodeColor(buttonBackgroundColor));
+        setButtonBackgroundColor(GraphicsUtilities.decodeColor(buttonBackgroundColor, "buttonBackgroundColor"));
     }
 
     public final void setButtonBackgroundColor(int buttonBackgroundColor) {

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=1815164&r1=1815163&r2=1815164&view=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 Tue Nov 14 00:30:50 2017
@@ -41,6 +41,8 @@ public class TerraPromptSkin extends Ter
     private Label messageLabel = null;
     private BoxPane messageBoxPane = null;
     private BoxPane optionButtonBoxPane = null;
+    private static final String BUTTON_STYLE_NAME =
+            TerraPromptSkin.class.getPackage().getName() + "." + TerraTheme.COMMAND_BUTTON_STYLE;
 
     private ButtonPressListener optionButtonPressListener = new ButtonPressListener() {
         @Override
@@ -89,8 +91,7 @@ public class TerraPromptSkin extends Ter
 
         for (Object option : prompt.getOptions()) {
             PushButton optionButton = new PushButton(option);
-            optionButton.setStyleName(TerraPromptSkin.class.getPackage().getName() + "."
-                + TerraTheme.COMMAND_BUTTON_STYLE);
+            optionButton.setStyleName(BUTTON_STYLE_NAME);
             optionButton.getButtonPressListeners().add(optionButtonPressListener);
 
             optionButtonBoxPane.add(optionButton);
@@ -144,8 +145,7 @@ public class TerraPromptSkin extends Ter
         Object option = prompt.getOptions().get(index);
 
         PushButton optionButton = new PushButton(option);
-        optionButton.setStyleName(TerraPromptSkin.class.getPackage().getName() + "."
-            + TerraTheme.COMMAND_BUTTON_STYLE);
+        optionButton.setStyleName(BUTTON_STYLE_NAME);
         optionButton.getButtonPressListeners().add(optionButtonPressListener);
 
         optionButtonBoxPane.insert(optionButton, index);

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java?rev=1815164&r1=1815163&r2=1815164&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java Tue Nov 14 00:30:50 2017
@@ -226,8 +226,7 @@ public class TerraPushButtonSkin extends
         }
 
         // Paint the content
-        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-            RenderingHints.VALUE_ANTIALIAS_OFF);
+        GraphicsUtilities.setAntialiasingOff(graphics);
 
         Button.DataRenderer dataRenderer = pushButton.getDataRenderer();
         dataRenderer.render(pushButton.getButtonData(), pushButton, highlighted);
@@ -240,8 +239,7 @@ public class TerraPushButtonSkin extends
         dataRenderer.paint(contentGraphics);
         contentGraphics.dispose();
 
-        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-            RenderingHints.VALUE_ANTIALIAS_ON);
+        GraphicsUtilities.setAntialiasingOn(graphics);
 
         // Paint the border
         if (borderColorLocal != null && !themeIsFlat()) {
@@ -278,27 +276,17 @@ public class TerraPushButtonSkin extends
     }
 
     public void setFont(Font font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
+        Utils.checkNull(font, "font");
 
         this.font = font;
         invalidateComponent();
     }
 
     public final void setFont(String font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
-
         setFont(decodeFont(font));
     }
 
     public final void setFont(Dictionary<String, ?> font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
-
         setFont(Theme.deriveFont(font));
     }
 
@@ -314,7 +302,7 @@ public class TerraPushButtonSkin extends
     }
 
     public final void setColor(String color) {
-        setColor(GraphicsUtilities.decodeColor(color));
+        setColor(GraphicsUtilities.decodeColor(color, "color"));
     }
 
     public final void setColor(int color) {
@@ -334,7 +322,7 @@ public class TerraPushButtonSkin extends
     }
 
     public final void setDisabledColor(String disabledColor) {
-        setDisabledColor(GraphicsUtilities.decodeColor(disabledColor));
+        setDisabledColor(GraphicsUtilities.decodeColor(disabledColor, "disabledColor"));
     }
 
     public final void setDisabledColor(int disabledColor) {
@@ -356,7 +344,7 @@ public class TerraPushButtonSkin extends
     }
 
     public final void setBackgroundColor(String backgroundColor) {
-        setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor));
+        setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor, "backgroundColor"));
     }
 
     public final void setBackgroundColor(int backgroundColor) {
@@ -377,7 +365,7 @@ public class TerraPushButtonSkin extends
     }
 
     public final void setDisabledBackgroundColor(String disabledBackgroundColor) {
-        setDisabledBackgroundColor(GraphicsUtilities.decodeColor(disabledBackgroundColor));
+        setDisabledBackgroundColor(GraphicsUtilities.decodeColor(disabledBackgroundColor, "disabledBackgroundColor"));
     }
 
     public final void setDisabledBackgroundColor(int disabledBackgroundColor) {
@@ -397,7 +385,7 @@ public class TerraPushButtonSkin extends
     }
 
     public final void setBorderColor(String borderColor) {
-        setBorderColor(GraphicsUtilities.decodeColor(borderColor));
+        setBorderColor(GraphicsUtilities.decodeColor(borderColor, "borderColor"));
     }
 
     public final void setBorderColor(int borderColor) {
@@ -417,7 +405,7 @@ public class TerraPushButtonSkin extends
     }
 
     public final void setDisabledBorderColor(String disabledBorderColor) {
-        setDisabledBorderColor(GraphicsUtilities.decodeColor(disabledBorderColor));
+        setDisabledBorderColor(GraphicsUtilities.decodeColor(disabledBorderColor, "disabledBorderColor"));
     }
 
     public final void setDisabledBorderColor(int disabledBorderColor) {

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java?rev=1815164&r1=1815163&r2=1815164&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java Tue Nov 14 00:30:50 2017
@@ -27,6 +27,7 @@ import java.awt.geom.Ellipse2D;
 import java.awt.geom.Rectangle2D;
 
 import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.util.Utils;
 import org.apache.pivot.wtk.Button;
 import org.apache.pivot.wtk.Dimensions;
 import org.apache.pivot.wtk.GraphicsUtilities;
@@ -56,7 +57,7 @@ public class TerraRadioButtonSkin extend
     private static final int ALPHA = 68;
 
     public TerraRadioButtonSkin() {
-        TerraTheme theme = (TerraTheme) Theme.getTheme();
+        Theme theme = currentTheme();
         font = theme.getFont();
         color = theme.getColor(1);
         disabledColor = theme.getColor(7);
@@ -178,8 +179,7 @@ public class TerraRadioButtonSkin extend
                 graphics.setStroke(dashStroke);
                 graphics.setColor(buttonBorderColor);
 
-                graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                    RenderingHints.VALUE_ANTIALIAS_ON);
+                GraphicsUtilities.setAntialiasingOn(graphics);
 
                 Rectangle2D focusRectangle = new Rectangle2D.Double(BUTTON_DIAMETER + 1, 0.5,
                     dataRenderer.getWidth() + spacing * 2 - 2, dataRenderer.getHeight() - 1);
@@ -214,8 +214,7 @@ public class TerraRadioButtonSkin extend
             buttonSelectionColorLocal = disabledButtonSelectionColor;
         }
 
-        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-            RenderingHints.VALUE_ANTIALIAS_ON);
+        GraphicsUtilities.setAntialiasingOn(graphics);
 
         // Paint the border
         if (!themeIsFlat()) {
@@ -237,8 +236,7 @@ public class TerraRadioButtonSkin extend
             graphics.fill(buttonSelectionCircle);
         }
 
-        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-            RenderingHints.VALUE_ANTIALIAS_OFF);
+        GraphicsUtilities.setAntialiasingOff(graphics);
     }
 
     public Font getFont() {
@@ -246,27 +244,17 @@ public class TerraRadioButtonSkin extend
     }
 
     public void setFont(Font font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
+        Utils.checkNull(font, "font");
 
         this.font = font;
         invalidateComponent();
     }
 
     public final void setFont(String font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
-
         setFont(decodeFont(font));
     }
 
     public final void setFont(Dictionary<String, ?> font) {
-        if (font == null) {
-            throw new IllegalArgumentException("font is null.");
-        }
-
         setFont(Theme.deriveFont(font));
     }
 
@@ -275,20 +263,14 @@ public class TerraRadioButtonSkin extend
     }
 
     public void setColor(Color color) {
-        if (color == null) {
-            throw new IllegalArgumentException("color is null.");
-        }
+        Utils.checkNull(color, "color");
 
         this.color = color;
         repaintComponent();
     }
 
     public final void setColor(String color) {
-        if (color == null) {
-            throw new IllegalArgumentException("color is null.");
-        }
-
-        setColor(GraphicsUtilities.decodeColor(color));
+        setColor(GraphicsUtilities.decodeColor(color, "color"));
     }
 
     public Color getDisabledColor() {
@@ -296,20 +278,14 @@ public class TerraRadioButtonSkin extend
     }
 
     public void setDisabledColor(Color disabledColor) {
-        if (disabledColor == null) {
-            throw new IllegalArgumentException("disabledColor is null.");
-        }
+        Utils.checkNull(disabledColor, "disabledColor");
 
         this.disabledColor = disabledColor;
         repaintComponent();
     }
 
     public final void setDisabledColor(String disabledColor) {
-        if (disabledColor == null) {
-            throw new IllegalArgumentException("disabledColor is null.");
-        }
-
-        setDisabledColor(GraphicsUtilities.decodeColor(disabledColor));
+        setDisabledColor(GraphicsUtilities.decodeColor(disabledColor, "disabledColor"));
     }
 
     public int getSpacing() {
@@ -317,17 +293,14 @@ public class TerraRadioButtonSkin extend
     }
 
     public void setSpacing(int spacing) {
-        if (spacing < 0) {
-            throw new IllegalArgumentException("spacing is negative.");
-        }
+        Utils.checkNonNegative(spacing, "spacing");
+
         this.spacing = spacing;
         invalidateComponent();
     }
 
     public final void setSpacing(Number spacing) {
-        if (spacing == null) {
-            throw new IllegalArgumentException("spacing is null.");
-        }
+        Utils.checkNull(spacing, "spacing");
 
         setSpacing(spacing.intValue());
     }

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java?rev=1815164&r1=1815163&r2=1815164&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java Tue Nov 14 00:30:50 2017
@@ -22,6 +22,7 @@ import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.RoundRectangle2D;
 
+import org.apache.pivot.util.Utils;
 import org.apache.pivot.util.Vote;
 import org.apache.pivot.wtk.Component;
 import org.apache.pivot.wtk.ComponentMouseButtonListener;
@@ -97,6 +98,9 @@ public class TerraRollupSkin extends Rol
      * Skin for the rollup button.
      */
     protected class RollupButtonSkin extends ComponentSkin {
+        private static final int WIDTH = 7;
+        private static final int HEIGHT = 7;
+
         @Override
         public boolean isFocusable() {
             return false;
@@ -104,17 +108,17 @@ public class TerraRollupSkin extends Rol
 
         @Override
         public int getPreferredWidth(int height) {
-            return 7;
+            return WIDTH;
         }
 
         @Override
         public int getPreferredHeight(int width) {
-            return 7;
+            return HEIGHT;
         }
 
         @Override
         public Dimensions getPreferredSize() {
-            return new Dimensions(7, 7);
+            return new Dimensions(WIDTH, HEIGHT);
         }
 
         @Override
@@ -132,8 +136,7 @@ public class TerraRollupSkin extends Rol
             } else {
                 graphics.setPaint(disabledButtonColor);
             }
-            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                RenderingHints.VALUE_ANTIALIAS_ON);
+            GraphicsUtilities.setAntialiasingOn(graphics);
 
             if (rollup.isCollapsible()) {
                 if (rollup.isExpanded()) {
@@ -199,7 +202,7 @@ public class TerraRollupSkin extends Rol
     private static final int DEFAULT_EXPAND_RATE = 30;
 
     public TerraRollupSkin() {
-        TerraTheme theme = (TerraTheme) Theme.getTheme();
+        Theme theme = currentTheme();
 
         buttonColor = theme.getColor(1);
         disabledButtonColor = theme.getColor(7);
@@ -340,24 +343,21 @@ public class TerraRollupSkin extends Rol
         }
 
         if (content != null) {
+            boolean contentVisible = false;
             if (rollup.isExpanded() || (expandTransition != null && !expandTransition.isReversed())) {
-                int contentWidth, contentHeight;
+                Dimensions size;
                 if (fill) {
-                    contentWidth = justifiedWidth;
-                    contentHeight = content.getPreferredHeight(contentWidth);
+                    size = new Dimensions(justifiedWidth, content.getPreferredHeight(justifiedWidth));
                 } else {
-                    Dimensions contentPreferredSize = content.getPreferredSize();
-                    contentWidth = contentPreferredSize.width;
-                    contentHeight = contentPreferredSize.height;
+                    size = content.getPreferredSize();
                 }
 
                 content.setLocation(x, y);
-                content.setSize(contentWidth, contentHeight);
+                content.setSize(size);
 
-                content.setVisible(true);
-            } else {
-                content.setVisible(false);
+                contentVisible = true;
             }
+            content.setVisible(contentVisible);
 
         }
 
@@ -371,25 +371,19 @@ public class TerraRollupSkin extends Rol
     }
 
     public final void setButtonColor(int color) {
-        TerraTheme theme = (TerraTheme) Theme.getTheme();
+        Theme theme = currentTheme();
         setButtonColor(theme.getColor(color));
     }
 
     public void setButtonColor(Color buttonColor) {
-        if (buttonColor == null) {
-            throw new IllegalArgumentException("buttonColor is null.");
-        }
+        Utils.checkNull(buttonColor, "buttonColor");
 
         this.buttonColor = buttonColor;
         rollupButton.repaint();
     }
 
     public final void setButtonColor(String buttonColor) {
-        if (buttonColor == null) {
-            throw new IllegalArgumentException("buttonColor is null.");
-        }
-
-        setButtonColor(GraphicsUtilities.decodeColor(buttonColor));
+        setButtonColor(GraphicsUtilities.decodeColor(buttonColor, "buttonColor"));
     }
 
     public Color getDisabledButtonColor() {
@@ -397,25 +391,19 @@ public class TerraRollupSkin extends Rol
     }
 
     public final void setDisabledButtonColor(int color) {
-        TerraTheme theme = (TerraTheme) Theme.getTheme();
+        Theme theme = currentTheme();
         setDisabledButtonColor(theme.getColor(color));
     }
 
     public void setDisabledButtonColor(Color buttonColor) {
-        if (buttonColor == null) {
-            throw new IllegalArgumentException("buttonColor is null.");
-        }
+        Utils.checkNull(buttonColor, "buttonColor");
 
         this.disabledButtonColor = buttonColor;
         rollupButton.repaint();
     }
 
     public final void setDisabledButtonColor(String buttonColor) {
-        if (buttonColor == null) {
-            throw new IllegalArgumentException("buttonColor is null.");
-        }
-
-        setDisabledButtonColor(GraphicsUtilities.decodeColor(buttonColor));
+        setDisabledButtonColor(GraphicsUtilities.decodeColor(buttonColor, "buttonColor"));
     }
 
     public int getSpacing() {
@@ -423,9 +411,7 @@ public class TerraRollupSkin extends Rol
     }
 
     public void setSpacing(int spacing) {
-        if (spacing < 0) {
-            throw new IllegalArgumentException("spacing is negative.");
-        }
+        Utils.checkNonNegative(spacing, "spacing");
         this.spacing = spacing;
 
         Rollup rollup = (Rollup) getComponent();
@@ -434,6 +420,12 @@ public class TerraRollupSkin extends Rol
         }
     }
 
+    public void setSpacing(Number spacing) {
+        Utils.checkNull(spacing, "spacing");
+
+        setSpacing(spacing.intValue());
+    }
+
     public int getBuffer() {
         return buffer;
     }

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=1815164&r1=1815163&r2=1815164&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java Tue Nov 14 00:30:50 2017
@@ -333,8 +333,7 @@ public class TerraTabPaneSkin extends Ta
             dataRenderer.render(tabButton.getButtonData(), tabButton, false);
 
             Graphics2D contentGraphics = (Graphics2D) graphics.create();
-            contentGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                RenderingHints.VALUE_ANTIALIAS_OFF);
+            GraphicsUtilities.setAntialiasingOff(contentGraphics);
 
             switch (tabOrientation) {
                 case HORIZONTAL: {