]> source.dussan.org Git - vaadin-framework.git/commitdiff
added sanity check
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 13 Nov 2008 09:41:55 +0000 (09:41 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 13 Nov 2008 09:41:55 +0000 (09:41 +0000)
svn changeset:5882/svn branch:trunk

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

index 285f1a5df18016eb2acea575e30aad1f3f72c2ae..40172a447d1b6e524f46db5af77dc5c33f61d74b 100644 (file)
@@ -386,11 +386,16 @@ public class OrderedLayout extends AbstractLayout implements
      * @see Sizeable
      * 
      * @param component
-     *            the component which expand ratio is to be set
+     *            the component in this layout which expand ratio is to be set
      * @param ratio
      */
     public void setExpandRatio(Component component, float ratio) {
-        componentToExpandRatio.put(component, ratio);
+        if (components.contains(component)) {
+            componentToExpandRatio.put(component, ratio);
+        } else {
+            throw new IllegalArgumentException(
+                    "Component must be added to layout before using setExpandRatio()");
+        }
     };
 
     /**