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.
git-svn-id: https://svn.apache.org/repos/asf/pivot/trunk@1820363 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java b/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
index a6e6e85..b74e473 100644
--- a/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
+++ b/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
@@ -78,9 +78,7 @@
* Pivot}.
*/
public final void setShadowColor(String shadowColor) {
- Utils.checkNull(shadowColor, "shadowColor");
-
- setShadowColor(GraphicsUtilities.decodeColor(shadowColor));
+ setShadowColor(GraphicsUtilities.decodeColor(shadowColor, "shadowColor"));
}
/**
diff --git a/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java b/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java
index c5c0ffd..11893b1 100644
--- a/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java
+++ b/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java
@@ -121,9 +121,7 @@
* 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 @@
graphics = null;
}
- @Override
- public Bounds getBounds(Component componentValue) {
- return new Bounds(componentValue.getSize());
- }
-
- @Override
- public AffineTransform getTransform(Component componentArgument) {
- return new AffineTransform();
- }
-
}
diff --git a/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java b/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java
index d552e62..77c4be8 100644
--- a/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java
+++ b/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java
@@ -125,10 +125,10 @@
@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 @@
}
}
- 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();
- }
}
diff --git a/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java b/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java
index ae687e5..ae24684 100644
--- a/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java
+++ b/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java
@@ -19,6 +19,7 @@
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 void setOffset(Point offset) {
- if (offset == null) {
- throw new IllegalArgumentException("offset is null.");
- }
+ Utils.checkNull(offset, "offset");
setOffset(offset.x, offset.y);
}