Revision: 7225
Author: [email protected]
Date: Tue Dec  1 15:35:53 2009
Log: Removes the use of FinallyCommand in StackLayoutPanel. This works  
around
a Scheduler bug that's causing StackLayoutPanel to misbehave slightly.
Review: http://gwt-code-reviews.appspot.com/115804
http://code.google.com/p/google-web-toolkit/source/detail?r=7225

Modified:
  /trunk/user/src/com/google/gwt/user/client/ui/CustomButton.java
  /trunk/user/src/com/google/gwt/user/client/ui/StackLayoutPanel.java

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/CustomButton.java     Tue  
Dec  1 15:21:10 2009
+++ /trunk/user/src/com/google/gwt/user/client/ui/CustomButton.java     Tue  
Dec  1 15:35:53 2009
@@ -20,7 +20,6 @@
  import com.google.gwt.dom.client.NativeEvent;
  import com.google.gwt.event.dom.client.ClickEvent;
  import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.resources.client.ImageResource;
  import com.google.gwt.user.client.DOM;
  import com.google.gwt.user.client.Element;
  import com.google.gwt.user.client.Event;
=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/StackLayoutPanel.java Tue  
Dec  1 15:21:10 2009
+++ /trunk/user/src/com/google/gwt/user/client/ui/StackLayoutPanel.java Tue  
Dec  1 15:35:53 2009
@@ -15,8 +15,6 @@
   */
  package com.google.gwt.user.client.ui;

-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
  import com.google.gwt.dom.client.Style.Unit;
  import com.google.gwt.user.client.Event;

@@ -132,7 +130,7 @@
     * @param header the header widget
     * @param headerSize the size of the header widget
     */
-  public void add(Widget widget, Widget header, double headerSize) {
+  public void add(final Widget widget, Widget header, double headerSize) {
      ClickWrapper wrapper = new ClickWrapper(widget, header);
      layoutPanel.add(wrapper);
      layoutPanel.add(widget);
@@ -144,8 +142,9 @@
      layoutData.add(data);

      if (visibleWidget == null) {
-      // Don't animate the initial widget display.
-      showWidget(widget, 0);
+      // If there's no visible widget, display the first one. The layout  
will
+      // be updated onLoad().
+      visibleWidget = widget;
      }
    }

@@ -204,6 +203,12 @@
    public void showWidget(Widget widget) {
      showWidget(widget, ANIMATION_TIME);
    }
+
+  @Override
+  protected void onLoad() {
+    // When the widget becomes attached, update its layout.
+    animate(0);
+  }

    private void animate(int duration) {
      int top = 0, bottom = 0;
@@ -241,10 +246,6 @@

    private void showWidget(Widget widget, final int duration) {
      visibleWidget = widget;
-    Scheduler.get().scheduleFinally(new ScheduledCommand() {
-      public void execute() {
-        animate(duration);
-      }
-    });
+    animate(duration);
    }
  }

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to