summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Laakso <jani.laakso@itmill.com>2007-05-24 12:52:48 +0000
committerJani Laakso <jani.laakso@itmill.com>2007-05-24 12:52:48 +0000
commite89b20ab51f508cc7e0e773d457733c40958c9d3 (patch)
tree8b6344d4174987483163b0c5cd682289e9d488ac
parent7f8d95b59d3cf7b3b75e78d412b82f750d6f4fbf (diff)
downloadvaadin-framework-e89b20ab51f508cc7e0e773d457733c40958c9d3.tar.gz
vaadin-framework-e89b20ab51f508cc7e0e773d457733c40958c9d3.zip
Providing informative message on how to configure themes on warning and error cases that are theme related.
svn changeset:1488/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/terminal/web/ApplicationServlet.java18
-rw-r--r--src/com/itmill/toolkit/terminal/web/Theme.java9
2 files changed, 17 insertions, 10 deletions
diff --git a/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java
index 5a0da13f98..9bf94650c3 100644
--- a/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java
+++ b/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java
@@ -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);
diff --git a/src/com/itmill/toolkit/terminal/web/Theme.java b/src/com/itmill/toolkit/terminal/web/Theme.java
index 931a85ada3..dbc879e7b4 100644
--- a/src/com/itmill/toolkit/terminal/web/Theme.java
+++ b/src/com/itmill/toolkit/terminal/web/Theme.java
@@ -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;
}