]> source.dussan.org Git - vaadin-framework.git/commitdiff
Providing informative message on how to configure themes on warning and error cases...
authorJani Laakso <jani.laakso@itmill.com>
Thu, 24 May 2007 12:52:48 +0000 (12:52 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Thu, 24 May 2007 12:52:48 +0000 (12:52 +0000)
svn changeset:1488/svn branch:trunk

src/com/itmill/toolkit/terminal/web/ApplicationServlet.java
src/com/itmill/toolkit/terminal/web/Theme.java

index 5a0da13f986dbbf7c6c9d90a84d7bb5f6ce92a70..9bf94650c30b02ffa452fa20bc35263d44c01e20 100644 (file)
@@ -320,14 +320,16 @@ public class ApplicationServlet extends HttpServlet implements
 
                // Checks that at least one themesource was loaded
                if (this.themeSource.getThemes().size() <= 0) {
+                       throw new ServletException(
+                                       "No themes found in specified themesources. "
+                                                       + Theme.MESSAGE_CONFIGURE_HELP);
+               }
+
+               // Warn if default theme not found
+               if (this.themeSource.getThemeByName(DEFAULT_THEME) == null) {
                        if (!defaultThemeFound)
                                Log.warn("Default theme JAR not found in: "
                                                + Arrays.asList(defaultThemeFiles));
-                       throw new ServletException(
-                                       "No themes found in specified themesources. "
-                                                       + "You can provide themes by e.g. adding "
-                                                       + "itmill-toolkit-x.y.z-themes.jar "
-                                                       + "to WEB-INF/lib directory.");
                }
 
                // Initializes the transformer factory, if not initialized
@@ -605,10 +607,8 @@ public class ApplicationServlet extends HttpServlet implements
                                        Theme theme = themeSource.getThemeByName(themeName);
                                        if (theme == null)
                                                throw new ServletException(
-                                                               "Failed to load theme with name "
-                                                                               + themeName
-                                                                               + ". Check that theme's description.xml "
-                                                                               + "contains correct theme name.");
+                                                               "Failed to load theme with name " + themeName
+                                                                               + ". " + Theme.MESSAGE_CONFIGURE_HELP);
 
                                        String renderingMode = theme.getPreferredMode(wb,
                                                        themeSource);
index 931a85ada3cc7ee7fff0477d0297255a04b3219b..dbc879e7b49ee978076c2186e415a87a33be414c 100644 (file)
@@ -138,6 +138,12 @@ public class Theme extends DefaultHandler {
 
        public static final String MODE_FALLBACK = MODE_HTML;
 
+       public static final String MESSAGE_CONFIGURE_HELP = "You can provide themes by adding "
+                       + "itmill-toolkit-x.y.z-themes.jar "
+                       + "to WEB-INF/lib directory or adding "
+                       + "theme files under WEB-INF/lib/themes directory."
+                       + " Check also theme's description.xml.";
+
        /**
         * Name of the theme.
         */
@@ -282,7 +288,8 @@ public class Theme extends DefaultHandler {
                        Theme parent = themeSource.getThemeByName(parentTheme);
                        if (parent == null)
                                throw new IllegalStateException("Parent theme '" + parentTheme
-                                               + "' is not found for theme '" + getName() + "'.");
+                                               + "' is not found for theme '" + getName() + "'. "
+                                               + MESSAGE_CONFIGURE_HELP);
                        if (!parent.supportsMode(mode, terminal, themeSource))
                                return false;
                }