diff options
author | Artur Signell <artur@vaadin.com> | 2015-07-14 18:04:09 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-08-24 16:14:33 +0000 |
commit | 79694b4f8017acc33f302e63fd3c5e3679c73ddd (patch) | |
tree | 490f5a0ceae8ed2ab607d5e6c7c17fc223b635e1 /client/src | |
parent | c413b480663e9b3cbda00faf14eb4df224c6a10a (diff) | |
download | vaadin-framework-79694b4f8017acc33f302e63fd3c5e3679c73ddd.tar.gz vaadin-framework-79694b4f8017acc33f302e63fd3c5e3679c73ddd.zip |
Resynchronize everything after theme change (#18478)
Change-Id: Id56d0ff7b2c675780c84efe999cb4b9d655df4cd
Diffstat (limited to 'client/src')
-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 d9e705426b..cb780e7273 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; @@ -804,7 +803,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 bcd90437a4..e0a4608505 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -1040,59 +1040,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() |