Revision: 7926
Author: sp...@google.com
Date: Thu Apr 15 16:35:46 2010
Log: Cherry picking r7924 from trunk, with the following command:
svn merge --ignore-ancestry -r 7923:7924
https://google-web-toolkit.googlecode.com/svn/trunk .
This has PopupPanel handle being attached before it is shown.
http://code.google.com/p/google-web-toolkit/source/detail?r=7926
Modified:
/branches/snapshot-2010.03.29-r7809/user/src/com/google/gwt/user/client/ui/PopupPanel.java
/branches/snapshot-2010.03.29-r7809/user/test/com/google/gwt/user/client/ui/PopupTest.java
=======================================
---
/branches/snapshot-2010.03.29-r7809/user/src/com/google/gwt/user/client/ui/PopupPanel.java
Thu Mar 18 11:37:10 2010
+++
/branches/snapshot-2010.03.29-r7809/user/src/com/google/gwt/user/client/ui/PopupPanel.java
Thu Apr 15 16:35:46 2010
@@ -1001,6 +1001,11 @@
public void show() {
if (showing) {
return;
+ } else if (isAttached()) {
+ // The popup is attached directly to another panel, so we need to
remove
+ // it from its parent before showing it. This is a weird use case,
but
+ // since PopupPanel is a Widget, its legal.
+ this.removeFromParent();
}
resizeAnimation.setState(true, false);
}
=======================================
---
/branches/snapshot-2010.03.29-r7809/user/test/com/google/gwt/user/client/ui/PopupTest.java
Thu Mar 25 10:46:07 2010
+++
/branches/snapshot-2010.03.29-r7809/user/test/com/google/gwt/user/client/ui/PopupTest.java
Thu Apr 15 16:35:46 2010
@@ -425,7 +425,23 @@
}
/**
- * Test the showing a popup while it is hiding will not result in an
illegal
+ * Test that showing a popup while it is attached does not put it in an
+ * invalid state.
+ */
+ public void testShowWhileAttached() {
+ PopupPanel popup = createPopupPanel();
+ RootPanel.get().add(popup);
+ popup.show();
+ assertTrue(popup.isAttached());
+ assertTrue(popup.isShowing());
+
+ popup.hide();
+ assertFalse(popup.isAttached());
+ assertFalse(popup.isShowing());
+ }
+
+ /**
+ * Test that showing a popup while it is hiding will not result in an
illegal
* state.
*/
public void testShowWhileHiding() {
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors