summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/AbstractOrderedLayout.java
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2010-09-21 07:43:16 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2010-09-21 07:43:16 +0000
commite0a85e864db84846bc6e25615d2ef22892cb6e05 (patch)
tree7db5c1c7b3439ac1815283c415d85463be1030cc /src/com/vaadin/ui/AbstractOrderedLayout.java
parentf82b43282e1a08783bef1ddf6a7123d7223d3e15 (diff)
downloadvaadin-framework-e0a85e864db84846bc6e25615d2ef22892cb6e05.tar.gz
vaadin-framework-e0a85e864db84846bc6e25615d2ef22892cb6e05.zip
Fixes component attach/detach events to trigger at the right times #5625
svn changeset:15091/svn branch:6.4
Diffstat (limited to 'src/com/vaadin/ui/AbstractOrderedLayout.java')
-rw-r--r--src/com/vaadin/ui/AbstractOrderedLayout.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/com/vaadin/ui/AbstractOrderedLayout.java b/src/com/vaadin/ui/AbstractOrderedLayout.java
index 89b72b0f88..b0587f8d38 100644
--- a/src/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/src/com/vaadin/ui/AbstractOrderedLayout.java
@@ -1,4 +1,4 @@
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
@@ -53,9 +53,14 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
*/
@Override
public void addComponent(Component c) {
- super.addComponent(c);
components.add(c);
- requestRepaint();
+ try {
+ super.addComponent(c);
+ requestRepaint();
+ } catch (IllegalArgumentException e) {
+ components.remove(c);
+ throw e;
+ }
}
/**
@@ -66,9 +71,14 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
* the component to be added.
*/
public void addComponentAsFirst(Component c) {
- super.addComponent(c);
components.addFirst(c);
- requestRepaint();
+ try {
+ super.addComponent(c);
+ requestRepaint();
+ } catch (IllegalArgumentException e) {
+ components.remove(c);
+ throw e;
+ }
}
/**
@@ -81,9 +91,14 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
* in and after the position are shifted forwards.
*/
public void addComponent(Component c, int index) {
- super.addComponent(c);
components.add(index, c);
- requestRepaint();
+ try {
+ super.addComponent(c);
+ requestRepaint();
+ } catch (IllegalArgumentException e) {
+ components.remove(c);
+ throw e;
+ }
}
/**
@@ -94,10 +109,10 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
*/
@Override
public void removeComponent(Component c) {
- super.removeComponent(c);
components.remove(c);
componentToAlignment.remove(c);
componentToExpandRatio.remove(c);
+ super.removeComponent(c);
requestRepaint();
}