diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-03-24 08:07:50 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-03-24 08:07:50 +0000 |
commit | c19b82098d7ff9ed985201a9bce7d9c9a0df25ac (patch) | |
tree | b5637265e1617e45a7c9bdd6c75b886b6c836e97 /src/com/itmill/toolkit/terminal/gwt/server | |
parent | 5451103c5f7120fc79dc31d8985df401cc29cbe7 (diff) | |
download | vaadin-framework-c19b82098d7ff9ed985201a9bce7d9c9a0df25ac.tar.gz vaadin-framework-c19b82098d7ff9ed985201a9bce7d9c9a0df25ac.zip |
Merged test case and fix for #2796: Throw an error if the same debugId is used for multiple components
http://dev.itmill.com/ticket/2796
svn changeset:7139/svn branch:6.0
Diffstat (limited to 'src/com/itmill/toolkit/terminal/gwt/server')
-rw-r--r-- | src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java index 7510c401ef..16281a3c8a 100644 --- a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java +++ b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java @@ -1110,8 +1110,25 @@ public class CommunicationManager implements Paintable.RepaintRequestListener { } else { id = "PID_S" + id; } + Paintable old = idPaintableMap.put(id, paintable); + if (old != null && old != paintable) { + /* + * Two paintables have the same id. We still make sure the old + * one is a component which is still attached to the + * application. This is just a precaution and should not be + * absolutely necessary. + */ + + if (old instanceof Component + && ((Component) old).getApplication() != null) { + throw new IllegalStateException("Two paintables (" + + paintable.getClass().getSimpleName() + "," + + old.getClass().getSimpleName() + + ") have been assigned the same id: " + + paintable.getDebugId()); + } + } paintableIdMap.put(paintable, id); - idPaintableMap.put(id, paintable); } return id; |