From: Joonas Lehtinen Date: Mon, 29 Jan 2007 13:19:19 +0000 (+0000) Subject: Fixed #238 X-Git-Tag: 6.7.0.beta1~6733 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=60d46d5e7480d6e6796689372f660ededcfa75cf;p=vaadin-framework.git Fixed #238 svn changeset:346/svn branch:toolkit --- 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("\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("\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("\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("\n"); + } } } + return links.toString(); }