]> source.dussan.org Git - vaadin-framework.git/commitdiff
using Sizeables UNIT_SYMBOLS, theoretically all units now supported
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Fri, 24 Aug 2007 07:02:42 +0000 (07:02 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Fri, 24 Aug 2007 07:02:42 +0000 (07:02 +0000)
svn changeset:2117/svn branch:trunk

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

index 66158757e14666e9294f1d783b149b4ad8cdb81f..2468d4fcef58cc929f5928f9555112f2adb99778 100644 (file)
@@ -81,7 +81,7 @@ public class SplitPanel extends AbstractComponentContainer implements Layout, Si
 
        private int pos = 50;
 
-       private int posUnit = Sizeable.UNITS_PERCENTAGE;
+       private int posUnit = UNITS_PERCENTAGE;
 
        /**
         * Creates a new split panel. The orientation of the panels is
@@ -212,26 +212,17 @@ public class SplitPanel extends AbstractComponentContainer implements Layout, Si
                
                // TODO refine size attributes
                if(width > 0) {
-                       target.addAttribute("width", width + (widthUnit == Sizeable.UNITS_PIXELS ? "px" : "%"));
+                       target.addAttribute("width", width + UNIT_SYMBOLS[widthUnit]);
                } else {
                        target.addAttribute("width", "100%");
                }
                if(height > 0) {
-                       target.addAttribute("height", height + (heightUnit == Sizeable.UNITS_PIXELS ? "px" : "%"));
+                       target.addAttribute("height", height + UNIT_SYMBOLS[widthUnit]);
                } else {
                        target.addAttribute("height", "100%");
                }
                
-               String position = pos + "";
-               switch (posUnit) {
-               case Sizeable.UNITS_PIXELS:
-                       position += "px";
-                       break;
-               case Sizeable.UNITS_PERCENTAGE:
-               default:
-                       position += "%";
-                       break;
-               }
+               String position = pos + UNIT_SYMBOLS[posUnit];
                
                target.addAttribute("position", position);
 
@@ -287,7 +278,7 @@ public class SplitPanel extends AbstractComponentContainer implements Layout, Si
         * @param pos the new size of the first region in persentage
         */
        public void setSplitPosition(int pos) {
-               setSplitPosition(pos, Sizeable.UNITS_PERCENTAGE);
+               setSplitPosition(pos, UNITS_PERCENTAGE);
        }
 
        /**