From 2a671f2810dfb409cc4d30a1606868282d0925d3 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Mon, 23 Mar 2015 12:10:07 +0200 Subject: Fix declarative support for CustomLayout (#17210) CustomLayout now has a public default constructor. If a template is not set using one of the setters, a warning message is displayed like in the case where the template file is specified but not found. Change-Id: I5d56f24fafc5c82e6ab76dec393a0c25bd78aae5 --- .../ui/customlayout/CustomLayoutConnector.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java index 80979587b9..cde1f1af0f 100644 --- a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java @@ -77,22 +77,24 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements // (even though both can never be given at the same time) templateContents = getConnection().getResource( "layouts/" + templateName + ".html"); - if (templateContents == null) { - // Template missing -> show debug notice and render components - // in order. - getWidget() - .getElement() - .setInnerHTML( - "Layout file layouts/" - + templateName - + ".html is missing. Components will be drawn for debug purposes."); - } } if (templateContents != null) { // Template ok -> initialize. getWidget().initializeHTML(templateContents, getConnection().getThemeUri()); + } else { + // Template missing -> show debug notice and render components in + // order. + String warning = templateName != null ? "Layout file layouts/" + + templateName + ".html is missing." + : "Layout file not specified."; + getWidget() + .getElement() + .setInnerHTML( + "" + + warning + + " Components will be drawn for debug purposes."); } templateUpdated = true; } -- cgit v1.2.3