You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/10/15 17:53:12 UTC

svn commit: r825536 - in /incubator/pivot/trunk: charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/collections/adapter/ core/src/org/apache/pivot/text/ core/src/org/apache/pivot/util/ web/src/o...

Author: gbrown
Date: Thu Oct 15 15:53:09 2009
New Revision: 825536

URL: http://svn.apache.org/viewvc?rev=825536&view=rev
Log:
Allow insets to contain negative values; trim whitespace.

Modified:
    incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/CategorySeries.java
    incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/ValueSeries.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedQueue.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedStack.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java
    incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java
    incubator/pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java
    incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java
    incubator/pivot/trunk/web/src/org/apache/pivot/web/QueryException.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CornerRadii.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dimensions.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Limits.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java

Modified: incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/CategorySeries.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/CategorySeries.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/CategorySeries.java (original)
+++ incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/CategorySeries.java Thu Oct 15 15:53:09 2009
@@ -23,7 +23,7 @@
  */
 public class CategorySeries extends HashMap<String, Object> {
     private static final long serialVersionUID = -4844271294542231973L;
-    
+
     public static final String NAME_KEY = "name";
 
     public CategorySeries() {

Modified: incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/ValueSeries.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/ValueSeries.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/ValueSeries.java (original)
+++ incubator/pivot/trunk/charts/src/org/apache/pivot/charts/content/ValueSeries.java Thu Oct 15 15:53:09 2009
@@ -23,7 +23,7 @@
  */
 public class ValueSeries<T> extends ArrayList<T> {
     private static final long serialVersionUID = 301207354854079022L;
-    
+
     private String name = null;
 
     public ValueSeries() {

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java Thu Oct 15 15:53:09 2009
@@ -30,7 +30,7 @@
  */
 public class ArrayQueue<T> implements Queue<T>, Serializable {
     private static final long serialVersionUID = -3856732506886968324L;
-    
+
     private ArrayList<T> arrayList = new ArrayList<T>();
     private transient QueueListenerList<T> queueListeners = new QueueListenerList<T>();
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java Thu Oct 15 15:53:09 2009
@@ -30,7 +30,7 @@
  */
 public class ArrayStack<T> implements Stack<T>, Serializable {
     private static final long serialVersionUID = 3175064065273930731L;
-    
+
     private ArrayList<T> arrayList = new ArrayList<T>();
     private transient StackListenerList<T> stackListeners = new StackListenerList<T>();
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/EnumMap.java Thu Oct 15 15:53:09 2009
@@ -29,7 +29,7 @@
  */
 public class EnumMap<E extends Enum<E>, V> implements Map<E, V>, Serializable {
     private static final long serialVersionUID = -8446839779287452516L;
-    
+
     private EnumSet<E> keySet;
     private Object[] values;
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java Thu Oct 15 15:53:09 2009
@@ -37,7 +37,7 @@
 
     private static class Node<T> implements Serializable {
         private static final long serialVersionUID = -848937850230412572L;
-        
+
         private Node<T> previous;
         private Node<T> next;
         private T item;

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedQueue.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedQueue.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedQueue.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedQueue.java Thu Oct 15 15:53:09 2009
@@ -30,7 +30,7 @@
  */
 public class LinkedQueue<T> implements Queue<T>, Serializable {
     private static final long serialVersionUID = 1598074020226109253L;
-    
+
     private LinkedList<T> linkedList = new LinkedList<T>();
     private transient QueueListenerList<T> queueListeners = new QueueListenerList<T>();
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedStack.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedStack.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedStack.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/LinkedStack.java Thu Oct 15 15:53:09 2009
@@ -29,7 +29,7 @@
  */
 public class LinkedStack<T> implements Stack<T>, Serializable {
     private static final long serialVersionUID = -6276454328308188689L;
-    
+
     private LinkedList<T> linkedList = new LinkedList<T>();
     private transient StackListenerList<T> stackListeners = new StackListenerList<T>();
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java Thu Oct 15 15:53:09 2009
@@ -35,7 +35,7 @@
  */
 public class ListAdapter<T> implements List<T>, Serializable {
     private static final long serialVersionUID = 1649736907064653706L;
-    
+
     private java.util.List<T> list = null;
     private Comparator<T> comparator = null;
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java Thu Oct 15 15:53:09 2009
@@ -34,7 +34,7 @@
  */
 public class MapAdapter<K, V> implements Map<K, V>, Serializable {
     private static final long serialVersionUID = 4005649560306864969L;
-    
+
     private java.util.Map<K, V> map = null;
     private transient MapListenerList<K, V> mapListeners = new MapListenerList<K, V>();
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java Thu Oct 15 15:53:09 2009
@@ -33,7 +33,7 @@
  */
 public class SetAdapter<E> implements Set<E>, Serializable {
     private static final long serialVersionUID = -816891924416727900L;
-    
+
     private java.util.Set<E> set = null;
     private transient SetListenerList<E> setListeners = new SetListenerList<E>();
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/text/FileSizeFormat.java Thu Oct 15 15:53:09 2009
@@ -27,7 +27,7 @@
  */
 public class FileSizeFormat extends Format {
     private static final long serialVersionUID = 9126510513247641698L;
-    
+
     public static final int KILOBYTE = 1024;
     public static final String[] ABBREVIATIONS = {"K", "M", "G", "T", "P", "E", "Z", "Y"};
 

Modified: incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java Thu Oct 15 15:53:09 2009
@@ -27,7 +27,7 @@
  */
 public class Version implements Comparable<Version>, Serializable {
     private static final long serialVersionUID = -3677773163272115116L;
-    
+
     private byte majorRevision = 0;
     private byte minorRevision = 0;
     private byte maintenanceRevision = 0;

Modified: incubator/pivot/trunk/web/src/org/apache/pivot/web/QueryException.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/web/src/org/apache/pivot/web/QueryException.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/web/src/org/apache/pivot/web/QueryException.java (original)
+++ incubator/pivot/trunk/web/src/org/apache/pivot/web/QueryException.java Thu Oct 15 15:53:09 2009
@@ -23,7 +23,7 @@
  */
 public class QueryException extends TaskExecutionException {
     private static final long serialVersionUID = -4949157889229298652L;
-    
+
     private int status;
 
     public QueryException(int status) {

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java Thu Oct 15 15:53:09 2009
@@ -27,7 +27,7 @@
  */
 public final class Bounds implements Serializable {
     private static final long serialVersionUID = -2473226417628417475L;
-    
+
     public final int x;
     public final int y;
     public final int width;

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CornerRadii.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CornerRadii.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CornerRadii.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/CornerRadii.java Thu Oct 15 15:53:09 2009
@@ -27,7 +27,7 @@
  */
 public final class CornerRadii implements Serializable {
     private static final long serialVersionUID = -433469769555042467L;
-    
+
     public final int topLeft;
     public final int topRight;
     public final int bottomLeft;
@@ -52,6 +52,22 @@
             throw new IllegalArgumentException("cornerRadii is null.");
         }
 
+        if (cornerRadii.topLeft < 0) {
+            throw new IllegalArgumentException("cornerRadii.topLeft is negative.");
+        }
+
+        if (cornerRadii.topRight < 0) {
+            throw new IllegalArgumentException("cornerRadii.topRight is negative.");
+        }
+
+        if (cornerRadii.bottomLeft < 0) {
+            throw new IllegalArgumentException("cornerRadii.bottomLeft is negative.");
+        }
+
+        if (cornerRadii.bottomRight < 0) {
+            throw new IllegalArgumentException("cornerRadii.bottomRight is negative.");
+        }
+
         this.topLeft = cornerRadii.topLeft;
         this.topRight = cornerRadii.topRight;
         this.bottomLeft = cornerRadii.bottomLeft;
@@ -60,17 +76,21 @@
 
     public CornerRadii(int topLeft, int topRight, int bottomLeft, int bottomRight) {
         if (topLeft < 0) {
-            throw new IllegalArgumentException("corner radii negative, topLeft=" + topLeft);
+            throw new IllegalArgumentException("topLeft is negative.");
         }
+
         if (topRight < 0) {
-            throw new IllegalArgumentException("corner radii negative, topRight=" + topRight);
+            throw new IllegalArgumentException("topRight is negative.");
         }
+
         if (bottomLeft < 0) {
-            throw new IllegalArgumentException("corner radii negative, bottom=" + bottomLeft);
+            throw new IllegalArgumentException("bottomLeft is negative.");
         }
+
         if (bottomRight < 0) {
-            throw new IllegalArgumentException("corner radii negative, bottomRight=" + bottomRight);
+            throw new IllegalArgumentException("bottomRight is negative.");
         }
+
         this.topLeft = topLeft;
         this.topRight = topRight;
         this.bottomLeft = bottomLeft;
@@ -84,39 +104,43 @@
 
         if (cornerRadii.containsKey(TOP_LEFT_KEY)) {
             topLeft = (Integer)cornerRadii.get(TOP_LEFT_KEY);
+
+            if (topLeft < 0) {
+                throw new IllegalArgumentException("\"topLeft\" is negative.");
+            }
         } else {
             topLeft = 0;
         }
 
         if (cornerRadii.containsKey(TOP_RIGHT_KEY)) {
             topRight = (Integer)cornerRadii.get(TOP_RIGHT_KEY);
+
+            if (topRight < 0) {
+                throw new IllegalArgumentException("\"topRight\" is negative.");
+            }
         } else {
             topRight = 0;
         }
 
         if (cornerRadii.containsKey(BOTTOM_LEFT_KEY)) {
             bottomLeft = (Integer)cornerRadii.get(BOTTOM_LEFT_KEY);
+
+            if (bottomLeft < 0) {
+                throw new IllegalArgumentException("\"bottomLeft\" is negative.");
+            }
         } else {
             bottomLeft = 0;
         }
 
         if (cornerRadii.containsKey(BOTTOM_RIGHT_KEY)) {
             bottomRight = (Integer)cornerRadii.get(BOTTOM_RIGHT_KEY);
+
+            if (bottomRight < 0) {
+                throw new IllegalArgumentException("\"bottomRight\" is negative.");
+            }
         } else {
             bottomRight = 0;
         }
-        if (topLeft < 0) {
-            throw new IllegalArgumentException("corner radii negative, topLeft=" + topLeft);
-        }
-        if (topRight < 0) {
-            throw new IllegalArgumentException("corner radii negative, topRight=" + topRight);
-        }
-        if (bottomLeft < 0) {
-            throw new IllegalArgumentException("corner radii negative, bottom=" + bottomLeft);
-        }
-        if (bottomRight < 0) {
-            throw new IllegalArgumentException("corner radii negative, bottomRight=" + bottomRight);
-        }
     }
 
     @Override

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dimensions.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dimensions.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dimensions.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dimensions.java Thu Oct 15 15:53:09 2009
@@ -27,7 +27,7 @@
  */
 public final class Dimensions implements Serializable {
     private static final long serialVersionUID = -3644511824857807902L;
-    
+
     public final int width;
     public final int height;
 

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Insets.java Thu Oct 15 15:53:09 2009
@@ -27,7 +27,7 @@
  */
 public final class Insets implements Serializable {
     private static final long serialVersionUID = -8528862892185591370L;
-    
+
     public final int top;
     public final int left;
     public final int bottom;
@@ -44,9 +44,6 @@
     public static final Insets NONE = new Insets(0);
 
     public Insets(int inset) {
-        if (inset < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, inset=" + inset);
-        }
         this.top = inset;
         this.left = inset;
         this.bottom = inset;
@@ -54,19 +51,6 @@
     }
 
     public Insets(int top, int left, int bottom, int right) {
-        if (top < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, top=" + top);
-        }
-        if (left < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, left=" + left);
-        }
-        if (bottom < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, bottom=" + bottom);
-        }
-        if (right < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, right=" + right);
-        }
-
         this.top = top;
         this.left = left;
         this.bottom = bottom;
@@ -112,19 +96,6 @@
         } else {
             right = 0;
         }
-        
-        if (top < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, top=" + top);
-        }
-        if (left < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, left=" + left);
-        }
-        if (bottom < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, bottom=" + bottom);
-        }
-        if (right < 0) {
-            throw new IllegalArgumentException("an inset can never be < 0, right=" + right);
-        }
     }
 
     @Override

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Limits.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Limits.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Limits.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Limits.java Thu Oct 15 15:53:09 2009
@@ -27,7 +27,7 @@
  */
 public final class Limits implements Serializable {
     private static final long serialVersionUID = -1420266625812552298L;
-    
+
     public final int min;
     public final int max;
 

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java?rev=825536&r1=825535&r2=825536&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Point.java Thu Oct 15 15:53:09 2009
@@ -27,7 +27,7 @@
  */
 public final class Point implements Serializable {
     private static final long serialVersionUID = 5193175754909343769L;
-    
+
     public final int x;
     public final int y;
 



Re: svn commit: r825536

Posted by Greg Brown <gk...@mac.com>.
FYI, this change reverted the previous change to Insets (negative values are OK here). However, we should probably check in the skins themselves for negative inset values.