]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes #3215: Popup shadow doesn't resize with panel
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Mon, 31 Aug 2009 09:25:47 +0000 (09:25 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Mon, 31 Aug 2009 09:25:47 +0000 (09:25 +0000)
Fixes #3247: VPopupView contains hard coded text "Loading..."
-loading text replaced with a spinning loading icon (in CSS).

svn changeset:8594/svn branch:6.1

src/com/vaadin/terminal/gwt/client/ui/VPopupView.java

index 69acd0962dc45882ccce23e688acc8f7fac78b5f..46e35f2cb8a2395dc9a8800ae61b44d7b2cefdb3 100644 (file)
@@ -5,13 +5,14 @@ import java.util.Set;
 
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.ui.Focusable;
 import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.PopupListener;
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.Widget;
@@ -38,7 +39,7 @@ public class VPopupView extends HTML implements Container {
     private boolean hostPopupVisible;
 
     private final CustomPopup popup;
-    private final Label loading = new Label("Loading...");
+    private final Label loading = new Label();
 
     /**
      * loading constructor
@@ -49,8 +50,9 @@ public class VPopupView extends HTML implements Container {
 
         setStyleName(CLASSNAME);
         popup.setStylePrimaryName(CLASSNAME + "-popup");
+        loading.setStyleName(CLASSNAME + "-loading");
 
-        setHTML("(No HTML defined for PopupView)");
+        setHTML("");
         popup.setWidget(loading);
 
         // When we click to open the popup...
@@ -61,8 +63,8 @@ public class VPopupView extends HTML implements Container {
         });
 
         // ..and when we close it
-        popup.addPopupListener(new PopupListener() {
-            public void onPopupClosed(PopupPanel sender, boolean autoClosed) {
+        popup.addCloseHandler(new CloseHandler<PopupPanel>() {
+            public void onClose(CloseEvent<PopupPanel> event) {
                 updateState(false);
             }
         });
@@ -72,8 +74,8 @@ public class VPopupView extends HTML implements Container {
     }
 
     /**
-     *
-     *
+     * 
+     * 
      * @see com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL,
      *      com.vaadin.terminal.gwt.client.ApplicationConnection)
      */
@@ -128,7 +130,7 @@ public class VPopupView extends HTML implements Container {
 
     /**
      * Update popup visibility to server
-     *
+     * 
      * @param visibility
      */
     private void updateState(boolean visible) {
@@ -185,7 +187,7 @@ public class VPopupView extends HTML implements Container {
 
     /**
      * Make sure that we remove the popup when the main widget is removed.
-     *
+     * 
      * @see com.google.gwt.user.client.ui.Widget#onUnload()
      */
     @Override
@@ -322,13 +324,13 @@ public class VPopupView extends HTML implements Container {
         }
 
         /*
-         *
+         * 
          * We need a hack make popup act as a child of VPopupView in Vaadin's
          * component tree, but work in default GWT manner when closing or
          * opening.
-         *
+         * 
          * (non-Javadoc)
-         *
+         * 
          * @see com.google.gwt.user.client.ui.Widget#getParent()
          */
         @Override
@@ -365,7 +367,7 @@ public class VPopupView extends HTML implements Container {
 
     /**
      * Calculate extra space taken by the popup decorations
-     *
+     * 
      * @return
      */
     protected Size calculatePopupExtra() {
@@ -393,6 +395,7 @@ public class VPopupView extends HTML implements Container {
     }
 
     public boolean requestLayout(Set<Paintable> child) {
+        popup.updateShadowSizeAndPosition();
         return true;
     }