diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-11-16 11:01:32 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-11-16 11:01:32 +0200 |
commit | 9f9ccd8d002b65db3e3e0430b4d5788a90b04c5c (patch) | |
tree | 10b47915eddcd2b99c36fc240f7cfe3ed0ba8ff8 /src/com/vaadin/Application.java | |
parent | 35b913559f66b5b9244eda388224e299fc3e05ff (diff) | |
download | vaadin-framework-9f9ccd8d002b65db3e3e0430b4d5788a90b04c5c.tar.gz vaadin-framework-9f9ccd8d002b65db3e3e0430b4d5788a90b04c5c.zip |
Allow configuring the root class to use, remove RootLayout
Diffstat (limited to 'src/com/vaadin/Application.java')
-rw-r--r-- | src/com/vaadin/Application.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/com/vaadin/Application.java b/src/com/vaadin/Application.java index 21e642f0e1..de68bff9bc 100644 --- a/src/com/vaadin/Application.java +++ b/src/com/vaadin/Application.java @@ -38,7 +38,6 @@ import com.vaadin.terminal.gwt.server.ChangeVariablesErrorEvent; import com.vaadin.terminal.gwt.server.WebApplicationContext; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Root; -import com.vaadin.ui.RootLayout; import com.vaadin.ui.Window; /** @@ -97,6 +96,8 @@ import com.vaadin.ui.Window; @SuppressWarnings("serial") public class Application implements Terminal.ErrorListener, Serializable { + public static final String ROOT_PARAMETER = "root"; + private final static Logger logger = Logger.getLogger(Application.class .getName()); @@ -1481,26 +1482,27 @@ public class Application implements Terminal.ErrorListener, Serializable { } protected Root createRoot(WrappedRequest request) { - Object rootLayoutClassNameObj = properties.get("rootLayout"); - if (rootLayoutClassNameObj instanceof String) { - String rootLayoutClassName = (String) rootLayoutClassNameObj; + Object rootClassNameObj = properties.get(ROOT_PARAMETER); + if (rootClassNameObj instanceof String) { + String rootClassName = (String) rootClassNameObj; try { - Class<? extends RootLayout> rootLayoutClass = Class.forName( - rootLayoutClassName).asSubclass(RootLayout.class); + Class<? extends Root> rootClass = Class.forName(rootClassName) + .asSubclass(Root.class); try { - RootLayout rootLayout = rootLayoutClass.newInstance(); - return new Root(rootLayout); + Root root = rootClass.newInstance(); + return root; } catch (Exception e) { throw new RuntimeException( - "Could instantiate rootLayout class " - + rootLayoutClassName, e); + "Could not instantiate root class " + rootClassName, + e); } } catch (ClassNotFoundException e) { - throw new RuntimeException("Could not load rootLayout class " - + rootLayoutClassName, e); + throw new RuntimeException("Could not load root class " + + rootClassName, e); } } - throw new RuntimeException("No rootLayout defined in web.xml"); + throw new RuntimeException("No " + ROOT_PARAMETER + + " defined in web.xml"); } public boolean handleRequest(WrappedRequest request, |