diff options
author | Teemu Pöntelin <teemu@vaadin.com> | 2014-12-04 20:09:42 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-12-10 17:55:25 +0000 |
commit | 9107b8d8c520bd297ed7685d7a8482d1078604e9 (patch) | |
tree | 9914f3a45044e6dacb6f5b343a53f69082f7caa8 /client/src | |
parent | 60f0bdaa6ef00f14664ead0d0b4aefb18343c8a7 (diff) | |
download | vaadin-framework-9107b8d8c520bd297ed7685d7a8482d1078604e9.tar.gz vaadin-framework-9107b8d8c520bd297ed7685d7a8482d1078604e9.zip |
Fix CustomLayout child rendering when template is missing (#8696)
Change-Id: I8ce4fbc566f030bf22c555f68b97beb781b19805
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java index a37ce9af38..80979587b9 100644 --- a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java @@ -34,6 +34,8 @@ import com.vaadin.ui.CustomLayout; public class CustomLayoutConnector extends AbstractLayoutConnector implements SimpleManagedLayout, Paintable { + private boolean templateUpdated; + @Override public CustomLayoutState getState() { return (CustomLayoutState) super.getState(); @@ -62,7 +64,7 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements } private void updateHtmlTemplate() { - if (getWidget().hasTemplate()) { + if (templateUpdated) { // We (currently) only do this once. You can't change the template // later on. return; @@ -76,14 +78,23 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements templateContents = getConnection().getResource( "layouts/" + templateName + ".html"); if (templateContents == null) { - templateContents = "<em>Layout file layouts/" - + templateName - + ".html is missing. Components will be drawn for debug purposes.</em>"; + // Template missing -> show debug notice and render components + // in order. + getWidget() + .getElement() + .setInnerHTML( + "<em>Layout file layouts/" + + templateName + + ".html is missing. Components will be drawn for debug purposes.</em>"); } } - getWidget().initializeHTML(templateContents, - getConnection().getThemeUri()); + if (templateContents != null) { + // Template ok -> initialize. + getWidget().initializeHTML(templateContents, + getConnection().getThemeUri()); + } + templateUpdated = true; } @Override |