diff options
author | Artur Signell <artur@vaadin.com> | 2015-07-14 18:04:09 +0300 |
---|---|---|
committer | Mika Murtojarvi <mika@vaadin.com> | 2015-08-25 16:41:57 +0300 |
commit | dc6d4953ed09fdd91a814072d947f9feb5e9b99e (patch) | |
tree | 1d0486ddc6705f5926d43858f44852e00a938c8c /client | |
parent | f6ac86984881ab56eba09f5604bea9aaf0a6aafb (diff) | |
download | vaadin-framework-dc6d4953ed09fdd91a814072d947f9feb5e9b99e.tar.gz vaadin-framework-dc6d4953ed09fdd91a814072d947f9feb5e9b99e.zip |
Resynchronize everything after theme change (#18478)
Change-Id: Id56d0ff7b2c675780c84efe999cb4b9d655df4cd
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ApplicationConnection.java | 3 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/ui/UIConnector.java | 53 |
2 files changed, 6 insertions, 50 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 628559dd2a..45a5b32a40 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -63,7 +63,6 @@ import com.google.gwt.user.client.Window.ClosingHandler; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConfiguration.ErrorMessage; -import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent; import com.vaadin.client.ResourceLoader.ResourceLoadEvent; import com.vaadin.client.ResourceLoader.ResourceLoadListener; import com.vaadin.client.communication.HasJavaScriptConnectorHelper; @@ -805,7 +804,7 @@ public class ApplicationConnection implements HasHandlers { return parameters; } - protected void repaintAll() { + public void repaintAll() { makeUidlRequest(Json.createArray(), getRepaintAllParameters()); } diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index 6d98e2108a..46956d95d1 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -1032,59 +1032,16 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } - forceStateChangeRecursively(UIConnector.this); - // UIDL has no stored URL which we can repaint so we do some find and - // replace magic... - String newThemeBase = getConnection().translateVaadinUri("theme://"); - replaceThemeAttribute(oldThemeBase, newThemeBase); + // Request a full resynchronization from the server to deal with legacy + // components + getConnection().repaintAll(); + // Immediately update state and do layout while waiting for the resync + forceStateChangeRecursively(UIConnector.this); getLayoutManager().forceLayout(); } /** - * Finds all attributes where theme:// urls have possibly been used and - * replaces any old theme url with a new one - * - * @param oldPrefix - * The start of the old theme URL - * @param newPrefix - * The start of the new theme URL - */ - private void replaceThemeAttribute(String oldPrefix, String newPrefix) { - // Images - replaceThemeAttribute("src", oldPrefix, newPrefix); - // Embedded flash - replaceThemeAttribute("value", oldPrefix, newPrefix); - replaceThemeAttribute("movie", oldPrefix, newPrefix); - } - - /** - * Finds any attribute of the given type where theme:// urls have possibly - * been used and replaces any old theme url with a new one - * - * @param attributeName - * The name of the attribute, e.g. "src" - * @param oldPrefix - * The start of the old theme URL - * @param newPrefix - * The start of the new theme URL - */ - private void replaceThemeAttribute(String attributeName, String oldPrefix, - String newPrefix) { - // Find all "attributeName=" which start with "oldPrefix" using e.g. - // [^src='http://oldpath'] - NodeList<Element> elements = querySelectorAll("[" + attributeName - + "^='" + oldPrefix + "']"); - for (int i = 0; i < elements.getLength(); i++) { - Element element = elements.getItem(i); - element.setAttribute( - attributeName, - element.getAttribute(attributeName).replace(oldPrefix, - newPrefix)); - } - } - - /** * Force a full recursive recheck of every connector's state variables. * * @see #forceStateChange() |