Author: rwhitcomb Date: Fri Jan 5 22:29:48 2018 New Revision: 1820363 URL: http://svn.apache.org/viewvc?rev=1820363&view=rev Log: PIVOT-1012: Use Utils methods for parameter validation. Some other misc. cleanup in the "wtk/effects" directory: * Some decorators still had the default implementations from the Decorator interface in their code, so remove that. * Rename some variables ("boundsLocal" -> "localBounds") for instance. * Add the color name parameter to "GraphicsUtilities.decodeColor" calls, and then remove the duplicate null string check before that call.
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java?rev=1820363&r1=1820362&r2=1820363&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java Fri Jan 5 22:29:48 2018 @@ -78,9 +78,7 @@ public class DropShadowDecorator impleme * Pivot}. */ public final void setShadowColor(String shadowColor) { - Utils.checkNull(shadowColor, "shadowColor"); - - setShadowColor(GraphicsUtilities.decodeColor(shadowColor)); + setShadowColor(GraphicsUtilities.decodeColor(shadowColor, "shadowColor")); } /** Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java?rev=1820363&r1=1820362&r2=1820363&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java Fri Jan 5 22:29:48 2018 @@ -121,9 +121,7 @@ public class ShadeDecorator implements D * values recognized by Pivot}. */ public final void setColor(String color) { - Utils.checkNull(color, "color"); - - setColor(GraphicsUtilities.decodeColor(color)); + setColor(GraphicsUtilities.decodeColor(color, "color")); } @Override @@ -144,15 +142,5 @@ public class ShadeDecorator implements D graphics = null; } - @Override - public Bounds getBounds(Component componentValue) { - return new Bounds(componentValue.getSize()); - } - - @Override - public AffineTransform getTransform(Component componentArgument) { - return new AffineTransform(); - } - } Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java?rev=1820363&r1=1820362&r2=1820363&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java Fri Jan 5 22:29:48 2018 @@ -125,10 +125,10 @@ public class TagDecorator implements Dec @Override public Bounds getBounds(Component component) { - Bounds boundsLocal; + Bounds localBounds; if (tag == null) { - boundsLocal = null; + localBounds = null; } else { int x, y; @@ -174,14 +174,10 @@ public class TagDecorator implements Dec } } - boundsLocal = new Bounds(x, y, tag.getWidth(), tag.getHeight()); + localBounds = new Bounds(x, y, tag.getWidth(), tag.getHeight()); } - return boundsLocal; + return localBounds; } - @Override - public AffineTransform getTransform(Component component) { - return new AffineTransform(); - } } Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java?rev=1820363&r1=1820362&r2=1820363&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java Fri Jan 5 22:29:48 2018 @@ -19,6 +19,7 @@ package org.apache.pivot.wtk.effects; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; +import org.apache.pivot.util.Utils; import org.apache.pivot.wtk.Bounds; import org.apache.pivot.wtk.Component; import org.apache.pivot.wtk.Point; @@ -65,9 +66,7 @@ public class TranslationDecorator implem } public void setOffset(Point offset) { - if (offset == null) { - throw new IllegalArgumentException("offset is null."); - } + Utils.checkNull(offset, "offset"); setOffset(offset.x, offset.y); }