From c1cf0cb575703307efb88c90f35d6e3c80e44423 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Wed, 24 Apr 2013 10:52:53 +0300 Subject: Fix for IE8 forgetting to move error indicator when component is resized #11693" Change-Id: I09d4e77f5f8f5b8846e8083b3bfbf3155281038d --- .../com/vaadin/client/ui/orderedlayout/Slot.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java index 795b724292..4fb5acf287 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java @@ -24,8 +24,11 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.UIObject; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.LayoutManager; import com.vaadin.client.StyleConstants; +import com.vaadin.client.Util; +import com.vaadin.client.ui.layout.ElementResizeEvent; import com.vaadin.client.ui.layout.ElementResizeListener; import com.vaadin.shared.ui.AlignmentInfo; @@ -92,6 +95,18 @@ public final class Slot extends SimplePanel { private ElementResizeListener spacingResizeListener; + /* + * This listener is applied only in IE8 to workaround browser issue where + * IE8 forgets to update the error indicator position when the slot gets + * resized by widget resizing itself. #11693 + */ + private ElementResizeListener ie8CaptionElementResizeUpdateListener = new ElementResizeListener() { + + @Override + public void onElementResize(ElementResizeEvent e) { + Util.forceIE8Redraw(getCaptionElement()); + } + }; // Caption is placed after component unless there is some part which // moves it above. @@ -161,6 +176,11 @@ public final class Slot extends SimplePanel { lm.addElementResizeListener(getSpacingElement(), spacingResizeListener); } + + if (BrowserInfo.get().isIE8()) { + lm.addElementResizeListener(getWidget().getElement(), + ie8CaptionElementResizeUpdateListener); + } } } @@ -182,6 +202,11 @@ public final class Slot extends SimplePanel { lm.removeElementResizeListener(getSpacingElement(), spacingResizeListener); } + + if (BrowserInfo.get().isIE8()) { + lm.removeElementResizeListener(getWidget().getElement(), + ie8CaptionElementResizeUpdateListener); + } } } -- cgit v1.2.3 From 20e9c8e24ff1e957a35ecc9527071af82c078328 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Thu, 25 Apr 2013 11:00:28 +0300 Subject: Add content length header for static resources (#11699) Change-Id: Ie307198a05e5c4f1b8bd74ec17185b9086ff0577 --- server/src/com/vaadin/server/VaadinServlet.java | 32 +++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 4fde870f74..35d5fd7cc1 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -896,14 +896,32 @@ public class VaadinServlet extends HttpServlet implements Constants { protected void writeStaticResourceResponse(HttpServletRequest request, HttpServletResponse response, URL resourceUrl) throws IOException { // Write the resource to the client. - final OutputStream os = response.getOutputStream(); - final byte buffer[] = new byte[DEFAULT_BUFFER_SIZE]; - int bytes; - InputStream is = resourceUrl.openStream(); - while ((bytes = is.read(buffer)) >= 0) { - os.write(buffer, 0, bytes); + URLConnection connection = resourceUrl.openConnection(); + try { + int length = connection.getContentLength(); + if (length >= 0) { + response.setContentLength(length); + } + } catch (Throwable e) { + // This can be ignored, content length header is not required. + // Need to close the input stream because of + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4257700 to + // prevent it from hanging, but that is done below. + } + + InputStream is = connection.getInputStream(); + try { + final OutputStream os = response.getOutputStream(); + final byte buffer[] = new byte[DEFAULT_BUFFER_SIZE]; + int bytes; + while ((bytes = is.read(buffer)) >= 0) { + os.write(buffer, 0, bytes); + } + } finally { + if (is != null) { + is.close(); + } } - is.close(); } private URL findResourceURL(String filename, ServletContext sc) -- cgit v1.2.3 From 38c509fec8cd934512f433ea4b7f7781430c8d08 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Fri, 26 Apr 2013 10:25:34 +0300 Subject: Remove duplicate copying of mixin child nodes (#11604) Change-Id: I3a596df4577648ba38588a8a0e74408264e1f9fd --- .../com/vaadin/sass/internal/visitor/MixinNodeHandler.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/theme-compiler/src/com/vaadin/sass/internal/visitor/MixinNodeHandler.java b/theme-compiler/src/com/vaadin/sass/internal/visitor/MixinNodeHandler.java index 5aa90151b9..4e54416522 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/visitor/MixinNodeHandler.java +++ b/theme-compiler/src/com/vaadin/sass/internal/visitor/MixinNodeHandler.java @@ -60,16 +60,10 @@ public class MixinNodeHandler { replacePossibleArguments(mixinNode, defClone); Node previous = mixinNode; - for (final Node child : defClone.getChildren()) { - - Node clone = (Node) DeepCopy.copy(child); - - replaceChildVariables(defClone, clone); - - mixinNode.getParentNode().appendChild(clone, previous); - - previous = clone; - + for (final Node child : new ArrayList(defClone.getChildren())) { + replaceChildVariables(defClone, child); + mixinNode.getParentNode().appendChild(child, previous); + previous = child; } } -- cgit v1.2.3 From edf91cb9ecc9eeb74efa49662bc3bf00a86c3bb2 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Fri, 26 Apr 2013 12:25:51 +0300 Subject: Fixed NPE regression after fix for #11693 Change-Id: I8c9cf686d0746d790a1d55d66a75497fb627714c --- client/src/com/vaadin/client/ui/orderedlayout/Slot.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java index 4fb5acf287..5fab131c65 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java @@ -104,7 +104,10 @@ public final class Slot extends SimplePanel { @Override public void onElementResize(ElementResizeEvent e) { - Util.forceIE8Redraw(getCaptionElement()); + Element caption = getCaptionElement(); + if (caption != null) { + Util.forceIE8Redraw(caption); + } } }; -- cgit v1.2.3 From d214efa39a011002eb88e683676508e438842fe4 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Mon, 29 Apr 2013 13:36:32 +0300 Subject: Ensure actions are handled in a deterministic order (#11735) (merged from #11432 in 6.8 branch) svn changeset:25867/svn branch:6.8 Change-Id: Ie34cc4c4fe6524a23b2e7692b9e73a421443ac4f --- server/src/com/vaadin/event/ActionManager.java | 60 +++++++++++--------------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/server/src/com/vaadin/event/ActionManager.java b/server/src/com/vaadin/event/ActionManager.java index 7a4b39444e..ce3e27d539 100644 --- a/server/src/com/vaadin/event/ActionManager.java +++ b/server/src/com/vaadin/event/ActionManager.java @@ -15,7 +15,7 @@ */ package com.vaadin.event; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.Map; import com.vaadin.event.Action.Container; @@ -44,10 +44,10 @@ public class ActionManager implements Action.Container, Action.Handler, private static final long serialVersionUID = 1641868163608066491L; /** List of action handlers */ - protected HashSet ownActions = null; + protected LinkedHashSet ownActions = null; /** List of action handlers */ - protected HashSet actionHandlers = null; + protected LinkedHashSet actionHandlers = null; /** Action mapper */ protected KeyMapper actionMapper = null; @@ -90,7 +90,7 @@ public class ActionManager implements Action.Container, Action.Handler, @Override public void addAction(T action) { if (ownActions == null) { - ownActions = new HashSet(); + ownActions = new LinkedHashSet(); } if (ownActions.add(action)) { requestRepaint(); @@ -115,7 +115,7 @@ public class ActionManager implements Action.Container, Action.Handler, if (actionHandler != null) { if (actionHandlers == null) { - actionHandlers = new HashSet(); + actionHandlers = new LinkedHashSet(); } if (actionHandlers.add(actionHandler)) { @@ -150,20 +150,7 @@ public class ActionManager implements Action.Container, Action.Handler, actionMapper = null; - HashSet actions = new HashSet(); - if (actionHandlers != null) { - for (Action.Handler handler : actionHandlers) { - Action[] as = handler.getActions(actionTarget, viewer); - if (as != null) { - for (Action action : as) { - actions.add(action); - } - } - } - } - if (ownActions != null) { - actions.addAll(ownActions); - } + LinkedHashSet actions = getActionSet(actionTarget, viewer); /* * Must repaint whenever there are actions OR if all actions have been @@ -225,22 +212,7 @@ public class ActionManager implements Action.Container, Action.Handler, @Override public Action[] getActions(Object target, Object sender) { - HashSet actions = new HashSet(); - if (ownActions != null) { - for (Action a : ownActions) { - actions.add(a); - } - } - if (actionHandlers != null) { - for (Action.Handler h : actionHandlers) { - Action[] as = h.getActions(target, sender); - if (as != null) { - for (Action a : as) { - actions.add(a); - } - } - } - } + LinkedHashSet actions = getActionSet(target, sender); return actions.toArray(new Action[actions.size()]); } @@ -259,4 +231,22 @@ public class ActionManager implements Action.Container, Action.Handler, } } + private LinkedHashSet getActionSet(Object target, Object sender) { + LinkedHashSet actions = new LinkedHashSet(); + if (ownActions != null) { + actions.addAll(ownActions); + + } + if (actionHandlers != null) { + for (Action.Handler h : actionHandlers) { + Action[] as = h.getActions(target, sender); + if (as != null) { + for (Action a : as) { + actions.add(a); + } + } + } + } + return actions; + } } -- cgit v1.2.3