From 8f78e7c8994a630ff7a09819074f3c11f1c1d976 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 2 Apr 2009 08:22:54 +0000 Subject: fixes #2518, window resize listener svn changeset:7285/svn branch:6.0 --- src/com/itmill/toolkit/terminal/gwt/client/ui/IView.java | 15 +++++++++++++++ .../itmill/toolkit/terminal/gwt/client/ui/IWindow.java | 6 +++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src/com/itmill/toolkit/terminal/gwt') diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IView.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IView.java index 5d4e8c86d9..1e4badc439 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IView.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IView.java @@ -72,6 +72,8 @@ public class IView extends SimplePanel implements Container, private boolean scrollable; + private boolean immediate; + public IView(String elementId) { super(); setStyleName(CLASSNAME); @@ -138,6 +140,8 @@ public class IView extends SimplePanel implements Container, boolean firstPaint = connection == null; connection = client; + immediate = uidl.hasAttribute("immediate"); + String newTheme = uidl.getStringAttribute("theme"); if (theme != null && !newTheme.equals(theme)) { // Complete page refresh is needed due css can affect layout @@ -396,6 +400,8 @@ public class IView extends SimplePanel implements Container, .log( "Running layout functions due window resize"); connection.runDescendentsLayout(IView.this); + + sendClientResized(); } } }; @@ -419,10 +425,19 @@ public class IView extends SimplePanel implements Container, connection.runDescendentsLayout(this); Util.runWebkitOverflowAutoFix(getElement()); + sendClientResized(); } } + /** + * Send new dimensions to the server. + */ + private void sendClientResized() { + connection.updateVariable(id, "height", height, false); + connection.updateVariable(id, "width", width, immediate); + } + public native static void goTo(String url) /*-{ $wnd.location = url; diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java index 764e400df9..e329d410c0 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java @@ -132,6 +132,8 @@ public class IWindow extends IToolkitOverlay implements Container, private String height; + private boolean immediate; + public IWindow() { super(false, false, true); // no autohide, not modal, shadow // Different style of shadow for windows @@ -249,6 +251,8 @@ public class IWindow extends IToolkitOverlay implements Container, return; } + immediate = uidl.hasAttribute("immediate"); + if (uidl.getBooleanAttribute("resizable") != resizable) { setResizable(!resizable); } @@ -756,7 +760,7 @@ public class IWindow extends IToolkitOverlay implements Container, if (updateVariables) { // sending width back always as pixels, no need for unit client.updateVariable(id, "width", w, false); - client.updateVariable(id, "height", h, false); + client.updateVariable(id, "height", h, immediate); } // Update child widget dimensions -- cgit v1.2.3