From 0f41b4a4cb4af1b93dae1687bdba83befdf20aff Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 13 Nov 2008 09:41:55 +0000 Subject: [PATCH] added sanity check svn changeset:5882/svn branch:trunk --- src/com/itmill/toolkit/ui/OrderedLayout.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/itmill/toolkit/ui/OrderedLayout.java b/src/com/itmill/toolkit/ui/OrderedLayout.java index 285f1a5df1..40172a447d 100644 --- a/src/com/itmill/toolkit/ui/OrderedLayout.java +++ b/src/com/itmill/toolkit/ui/OrderedLayout.java @@ -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()"); + } }; /** -- 2.39.5