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/12/15 02:27:06 UTC

svn commit: r1818224 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java

Author: rwhitcomb
Date: Fri Dec 15 02:27:05 2017
New Revision: 1818224

URL: http://svn.apache.org/viewvc?rev=1818224&view=rev
Log:
PIVOT-1017:  Add more override methods to set the "markerInsets"
style in RulerSkin, in order to support all the possible ways of
setting this style in BXML (modeled after other "Insets" styles).

Mark all the "set" methods as "public final" as in other skin classes.

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

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java?rev=1818224&r1=1818223&r2=1818224&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java Fri Dec 15 02:27:05 2017
@@ -19,6 +19,8 @@ package org.apache.pivot.wtk.skin;
 import java.awt.Color;
 import java.awt.Graphics2D;
 
+import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.collections.Sequence;
 import org.apache.pivot.util.Utils;
 import org.apache.pivot.wtk.Borders;
 import org.apache.pivot.wtk.Component;
@@ -176,7 +178,7 @@ public class RulerSkin extends Component
      * a "major" (long) marker.  Can be zero to not draw any major
      * markers.
      */
-    public void setMajorDivision(int major) {
+    public final void setMajorDivision(int major) {
         Utils.checkNonNegative(major, "majorDivision");
 
         // TODO: check for sanity of major vs. minor here??
@@ -184,7 +186,7 @@ public class RulerSkin extends Component
         repaintComponent();
     }
 
-    public void setMajorDivision(Number major) {
+    public final void setMajorDivision(Number major) {
         Utils.checkNull(major, "majorDivision");
 
         setMajorDivision(major.intValue());
@@ -205,7 +207,7 @@ public class RulerSkin extends Component
      * a "minor" (slightly longer than normal) marker.  Can be zero
      * to not draw any minor markers.
      */
-    public void setMinorDivision(int minor) {
+    public final void setMinorDivision(int minor) {
         Utils.checkNonNegative(minor, "minorDivision");
 
         // TODO: check for sanity of major vs. minor here??
@@ -213,7 +215,7 @@ public class RulerSkin extends Component
         repaintComponent();
     }
 
-    public void setMinorDivision(Number minor) {
+    public final void setMinorDivision(Number minor) {
         Utils.checkNull(minor, "minorDivision");
 
         setMinorDivision(minor.intValue());
@@ -231,14 +233,14 @@ public class RulerSkin extends Component
      *
      * @param spacing The number of pixels between markers (must be >= 1).
      */
-    public void setMarkerSpacing(int spacing) {
+    public final void setMarkerSpacing(int spacing) {
         Utils.checkPositive(spacing, "markerSpacing");
 
         this.markerSpacing = spacing;
         invalidateComponent();
     }
 
-    public void setMarkerSpacing(Number spacing) {
+    public final void setMarkerSpacing(Number spacing) {
         Utils.checkNull(spacing, "markerSpacing");
 
         setMarkerSpacing(spacing.intValue());
@@ -252,7 +254,7 @@ public class RulerSkin extends Component
         return flip;
     }
 
-    public void setFlip(boolean flip) {
+    public final void setFlip(boolean flip) {
         this.flip = flip;
     }
 
@@ -263,7 +265,7 @@ public class RulerSkin extends Component
         return borders;
     }
 
-    public void setBorders(Borders borders) {
+    public final void setBorders(Borders borders) {
         Utils.checkNull(borders, "borders");
 
         this.borders = borders;
@@ -277,13 +279,33 @@ public class RulerSkin extends Component
         return markerInsets;
     }
 
-    public void setMarkerInsets(Insets insets) {
+    public final void setMarkerInsets(Insets insets) {
         Utils.checkNull(insets, "markerInsets");
 
         this.markerInsets = insets;
         repaintComponent();
     }
 
+    public final void setMarkerInsets(Dictionary<String, ?> insets) {
+        setMarkerInsets(new Insets(insets));
+    }
+
+    public final void setMarkerInsets(Sequence<?> insets) {
+        setMarkerInsets(new Insets(insets));
+    }
+
+    public final void setMarkerInsets(int insets) {
+        setMarkerInsets(new Insets(insets));
+    }
+
+    public final void setMarkerInsets(Number insets) {
+        setMarkerInsets(new Insets(insets));
+    }
+
+    public final void setMarkerInsets(String insets) {
+        setMarkerInsets(Insets.decode(insets));
+    }
+
     /**
      * Returns the foreground color for the markers of the ruler.
      *
@@ -298,7 +320,7 @@ public class RulerSkin extends Component
      *
      * @param color The foreground (that is, the marker) color.
      */
-    public void setColor(Color color) {
+    public final void setColor(Color color) {
         Utils.checkNull(color, "color");
 
         this.color = color;
@@ -311,11 +333,11 @@ public class RulerSkin extends Component
      * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
      * values recognized by Pivot}.
      */
-    public void setColor(String color) {
+    public final void setColor(String color) {
         setColor(GraphicsUtilities.decodeColor(color, "color"));
     }
 
-    public void setColor(int color) {
+    public final void setColor(int color) {
         Theme theme = currentTheme();
         setColor(theme.getColor(color));
     }
@@ -335,7 +357,7 @@ public class RulerSkin extends Component
      * @param backgroundColor New background color value (can be {@code null}
      * for a transparent background).
      */
-    public void setBackgroundColor(Color backgroundColor) {
+    public final void setBackgroundColor(Color backgroundColor) {
         this.backgroundColor = backgroundColor;
         repaintComponent();
     }
@@ -347,11 +369,11 @@ public class RulerSkin extends Component
      * {@linkplain GraphicsUtilities#decodeColor color values recognized by
      * Pivot}.
      */
-    public void setBackgroundColor(String backgroundColor) {
+    public final void setBackgroundColor(String backgroundColor) {
         setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor, "backgroundColor"));
     }
 
-    public void setBackgroundColor(int backgroundColor) {
+    public final void setBackgroundColor(int backgroundColor) {
         Theme theme = currentTheme();
         setBackgroundColor(theme.getColor(backgroundColor));
     }