summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>2007-01-29 13:19:19 +0000
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>2007-01-29 13:19:19 +0000
commit60d46d5e7480d6e6796689372f660ededcfa75cf (patch)
tree61367447288e41bf363c774b9f7525216412f812 /src
parent1d174be0621ad451eeca9d5208c151a7a02336cf (diff)
downloadvaadin-framework-60d46d5e7480d6e6796689372f660ededcfa75cf.tar.gz
vaadin-framework-60d46d5e7480d6e6796689372f660ededcfa75cf.zip
Fixed #238
svn changeset:346/svn branch:toolkit
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java56
1 files changed, 43 insertions, 13 deletions
diff --git a/src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java b/src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java
index 136bbe3cd4..41b6e63d38 100644
--- a/src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java
+++ b/src/com/itmill/toolkit/terminal/web/ThemeFunctionLibrary.java
@@ -40,6 +40,7 @@ import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;
+import java.util.Vector;
import javax.servlet.http.HttpSession;
@@ -440,16 +441,30 @@ public class ThemeFunctionLibrary {
static public String getCssLinksForHead() {
ApplicationServlet as = (ApplicationServlet) ((Object[]) state.get())[WEBADAPTERSERVLET];
Theme t = as.getThemeSource().getThemeByName(theme());
- Collection allFiles = t.getFileNames(browser(), Theme.MODE_HTML);
+
+ // Also iterate parent themes
+ Vector themes = new Vector();
+ themes.add(t);
+ while (t.getParent() != null) {
+ String parentName = t.getParent();
+ t = as.getThemeSource().getThemeByName(parentName);
+ themes.add(t);
+ }
+
+ // Generate links
StringBuffer links = new StringBuffer();
- for (Iterator i = allFiles.iterator(); i.hasNext();) {
- String file = (String) i.next();
- if (file.endsWith(".css")) {
- links
- .append("<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\""
- + resource(file) + "\"/>\n");
+ for (int k = themes.size() - 1; k >= 0; k--) {
+ Collection allFiles = ((Theme)themes.get(k)).getFileNames(browser(), Theme.MODE_HTML);
+ for (Iterator i = allFiles.iterator(); i.hasNext();) {
+ String file = (String) i.next();
+ if (file.endsWith(".css")) {
+ links
+ .append("<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\""
+ + resource(file) + "\"/>\n");
+ }
}
}
+
return links.toString();
}
@@ -457,15 +472,30 @@ public class ThemeFunctionLibrary {
static public String getJavaScriptLinksForHead() {
ApplicationServlet as = (ApplicationServlet) ((Object[]) state.get())[WEBADAPTERSERVLET];
Theme t = as.getThemeSource().getThemeByName(theme());
- Collection allFiles = t.getFileNames(browser(), Theme.MODE_HTML);
+
+ // Also iterate parent themes
+ Vector themes = new Vector();
+ themes.add(t);
+ while (t.getParent() != null) {
+ String parentName = t.getParent();
+ t = as.getThemeSource().getThemeByName(parentName);
+ themes.add(t);
+ }
+
+ // Generate links
StringBuffer links = new StringBuffer();
- for (Iterator i = allFiles.iterator(); i.hasNext();) {
- String file = (String) i.next();
- if (file.endsWith(".js")) {
- links.append("<SCRIPT LANGUAGE=\"Javascript\" SRC=\""
- + resource(file) + "\"></SCRIPT>\n");
+ for (int k = themes.size() - 1; k >= 0; k--) {
+ Collection allFiles = ((Theme) themes.get(k)).getFileNames(
+ browser(), Theme.MODE_HTML);
+ for (Iterator i = allFiles.iterator(); i.hasNext();) {
+ String file = (String) i.next();
+ if (file.endsWith(".js")) {
+ links.append("<SCRIPT LANGUAGE=\"Javascript\" SRC=\""
+ + resource(file) + "\"></SCRIPT>\n");
+ }
}
}
+
return links.toString();
}