Revision: 8470
Author: [email protected]
Date: Tue Aug  3 10:58:04 2010
Log: Add the ability to change the size of a widget in the
DockLayoutPanel after it has already been added.

Review at http://gwt-code-reviews.appspot.com/719802

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8470

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

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/DockLayoutPanel.java Thu Apr 22 07:37:11 2010 +++ /trunk/user/src/com/google/gwt/user/client/ui/DockLayoutPanel.java Tue Aug 3 10:58:04 2010
@@ -304,6 +304,26 @@

     return removed;
   }
+
+  /**
+ * Updates the size of the widget passed in as long as it is not the center
+   * widget and updates the layout of the dock.
+   *
+   * @param widget the widget that needs to update its size
+   * @param size the size to update the widget to
+   */
+  public void setWidgetSize(Widget widget, double size) {
+    assertIsChild(widget);
+    LayoutData data = (LayoutData) widget.getLayoutData();
+
+    assert data.direction != Direction.CENTER :
+        "The size of the center widget can not be updated.";
+
+    data.size = size;
+
+    // Update the layout.
+    animate(0);
+  }

   protected Widget getCenter() {
     return center;

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

Reply via email to