diff options
Diffstat (limited to 'src/com/itmill/toolkit/ui/Window.java')
-rw-r--r-- | src/com/itmill/toolkit/ui/Window.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/itmill/toolkit/ui/Window.java b/src/com/itmill/toolkit/ui/Window.java index 8615480553..2d9ce6e9cf 100644 --- a/src/com/itmill/toolkit/ui/Window.java +++ b/src/com/itmill/toolkit/ui/Window.java @@ -1009,13 +1009,19 @@ public class Window extends Panel implements URIHandler, ParameterHandler { public void addWindow(Window window) throws IllegalArgumentException, NullPointerException { - if (getParent() != null) { + if (window == null) { + throw new NullPointerException("Argument must not be null"); + } + + if (application.getWindows().contains(window)) { throw new IllegalArgumentException( - "You can only add windows inside application-level windows"); + "Window was already added to application" + + " - it can not be added to another window also."); } - if (window == null) { - throw new NullPointerException("Argument must not be null"); + if (getParent() != null) { + throw new IllegalArgumentException( + "You can only add windows inside application-level windows"); } subwindows.add(window); |