]> source.dussan.org Git - vaadin-framework.git/commitdiff
symmetric api for position information
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 16 Apr 2009 08:07:38 +0000 (08:07 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 16 Apr 2009 08:07:38 +0000 (08:07 +0000)
svn changeset:7434/svn branch:6.0

src/com/itmill/toolkit/ui/AbsoluteLayout.java

index f3b65e2111e32cbd1a08877f193b4ee8bfbcad52..fd5e72aff6362d8ade7ff4a51b99b003624569f2 100644 (file)
@@ -77,10 +77,10 @@ public class AbsoluteLayout extends AbstractLayout {
     public class ComponentPosition implements Serializable {
 
         private int zIndex = -1;
-        private float top = -1;
-        private float right = -1;
-        private float bottom = -1;
-        private float left = -1;
+        private float topValue = -1;
+        private float rightValue = -1;
+        private float bottomValue = -1;
+        private float leftValue = -1;
 
         private int topUnits;
         private int rightUnits;
@@ -120,16 +120,16 @@ public class AbsoluteLayout extends AbstractLayout {
                     float v = Float.parseFloat(value);
                     int unitInt = parseCssUnit(unit);
                     if (key.equals("top")) {
-                        top = v;
+                        topValue = v;
                         topUnits = unitInt;
                     } else if (key.equals("right")) {
-                        right = v;
+                        rightValue = v;
                         rightUnits = unitInt;
                     } else if (key.equals("bottom")) {
-                        bottom = v;
+                        bottomValue = v;
                         bottomUnits = unitInt;
                     } else if (key.equals("left")) {
-                        left = v;
+                        leftValue = v;
                         leftUnits = unitInt;
                     }
                 }
@@ -148,17 +148,17 @@ public class AbsoluteLayout extends AbstractLayout {
 
         public String getCSSString() {
             String s = "";
-            if (top >= 0) {
-                s += "top:" + top + UNIT_SYMBOLS[topUnits] + ";";
+            if (topValue >= 0) {
+                s += "top:" + topValue + UNIT_SYMBOLS[topUnits] + ";";
             }
-            if (right >= 0) {
-                s += "right:" + right + UNIT_SYMBOLS[rightUnits] + ";";
+            if (rightValue >= 0) {
+                s += "right:" + rightValue + UNIT_SYMBOLS[rightUnits] + ";";
             }
-            if (bottom >= 0) {
-                s += "bottom:" + bottom + UNIT_SYMBOLS[bottomUnits] + ";";
+            if (bottomValue >= 0) {
+                s += "bottom:" + bottomValue + UNIT_SYMBOLS[bottomUnits] + ";";
             }
-            if (left >= 0) {
-                s += "left:" + left + UNIT_SYMBOLS[leftUnits] + ";";
+            if (leftValue >= 0) {
+                s += "left:" + leftValue + UNIT_SYMBOLS[leftUnits] + ";";
             }
             if (zIndex >= 0) {
                 s += "z-index:" + zIndex + ";";
@@ -168,28 +168,28 @@ public class AbsoluteLayout extends AbstractLayout {
 
         public void setTop(float topValue, int topUnits) {
             validateLength(topValue, topUnits);
-            top = topValue;
+            this.topValue = topValue;
             this.topUnits = topUnits;
             requestRepaint();
         }
 
         public void setRight(float rightValue, int rightUnits) {
             validateLength(rightValue, rightUnits);
-            right = rightValue;
+            this.rightValue = rightValue;
             this.rightUnits = rightUnits;
             requestRepaint();
         }
 
         public void setBottom(float bottomValue, int units) {
             validateLength(bottomValue, units);
-            bottom = bottomValue;
+            this.bottomValue = bottomValue;
             bottomUnits = units;
             requestRepaint();
         }
 
         public void setLeft(float leftValue, int units) {
             validateLength(leftValue, units);
-            left = leftValue;
+            this.leftValue = leftValue;
             leftUnits = units;
             requestRepaint();
         }
@@ -199,6 +199,142 @@ public class AbsoluteLayout extends AbstractLayout {
             requestRepaint();
         }
 
+        public void setTopValue(float topValue) {
+            validateLength(topValue, topUnits);
+            this.topValue = topValue;
+            requestRepaint();
+        }
+
+        public float getTopValue() {
+            return topValue;
+        }
+
+        /**
+         * @return the rightValue
+         */
+        public float getRightValue() {
+            return rightValue;
+        }
+
+        /**
+         * @param rightValue
+         *            the rightValue to set
+         */
+        public void setRightValue(float rightValue) {
+            validateLength(rightValue, rightUnits);
+            this.rightValue = rightValue;
+            requestRepaint();
+        }
+
+        /**
+         * @return the bottomValue
+         */
+        public float getBottomValue() {
+            return bottomValue;
+        }
+
+        /**
+         * @param bottomValue
+         *            the bottomValue to set
+         */
+        public void setBottomValue(float bottomValue) {
+            validateLength(bottomValue, bottomUnits);
+            this.bottomValue = bottomValue;
+            requestRepaint();
+        }
+
+        /**
+         * @return the leftValue
+         */
+        public float getLeftValue() {
+            return leftValue;
+        }
+
+        /**
+         * @param leftValue
+         *            the leftValue to set
+         */
+        public void setLeftValue(float leftValue) {
+            validateLength(leftValue, leftUnits);
+            this.leftValue = leftValue;
+            requestRepaint();
+        }
+
+        /**
+         * @return the topUnits
+         */
+        public int getTopUnits() {
+            return topUnits;
+        }
+
+        /**
+         * @param topUnits
+         *            the topUnits to set
+         */
+        public void setTopUnits(int topUnits) {
+            validateLength(topValue, topUnits);
+            this.topUnits = topUnits;
+            requestRepaint();
+        }
+
+        /**
+         * @return the rightUnits
+         */
+        public int getRightUnits() {
+            return rightUnits;
+        }
+
+        /**
+         * @param rightUnits
+         *            the rightUnits to set
+         */
+        public void setRightUnits(int rightUnits) {
+            validateLength(rightValue, rightUnits);
+            this.rightUnits = rightUnits;
+            requestRepaint();
+        }
+
+        /**
+         * @return the bottomUnits
+         */
+        public int getBottomUnits() {
+            return bottomUnits;
+        }
+
+        /**
+         * @param bottomUnits
+         *            the bottomUnits to set
+         */
+        public void setBottomUnits(int bottomUnits) {
+            validateLength(bottomValue, bottomUnits);
+            this.bottomUnits = bottomUnits;
+            requestRepaint();
+        }
+
+        /**
+         * @return the leftUnits
+         */
+        public int getLeftUnits() {
+            return leftUnits;
+        }
+
+        /**
+         * @param leftUnits
+         *            the leftUnits to set
+         */
+        public void setLeftUnits(int leftUnits) {
+            validateLength(leftValue, leftUnits);
+            this.leftUnits = leftUnits;
+            requestRepaint();
+        }
+
+        /**
+         * @return the zIndex
+         */
+        public int getZIndex() {
+            return zIndex;
+        }
+
     }
 
     @Override