예제 #1
0
  private Theme loadTheme(String name, Theme.Type type) throws IOException {
    Theme theme = findTheme(name, type);
    if (theme != null && (theme.getParentName() != null || theme.getImportName() != null)) {
      List<Theme> themes = new LinkedList<>();
      themes.add(theme);

      if (theme.getImportName() != null) {
        String[] s = theme.getImportName().split("/");
        themes.add(findTheme(s[1], Theme.Type.valueOf(s[0].toUpperCase())));
      }

      if (theme.getParentName() != null) {
        for (String parentName = theme.getParentName();
            parentName != null;
            parentName = theme.getParentName()) {
          theme = findTheme(parentName, type);
          themes.add(theme);

          if (theme.getImportName() != null) {
            String[] s = theme.getImportName().split("/");
            themes.add(findTheme(s[1], Theme.Type.valueOf(s[0].toUpperCase())));
          }
        }
      }

      return new ExtendingTheme(themes);
    } else {
      return theme;
    }
  }
예제 #2
0
 public static Theme getTheme(long uid) {
   for (Theme selectedTheme : themeList) {
     if (selectedTheme.getUid() == uid) {
       return selectedTheme;
     }
   }
   return null;
 }
예제 #3
0
 public static boolean removeTheme(Long uid) {
   for (Theme accessTheme : themeList) {
     if (accessTheme.getUid().equals(uid)) {
       themeList.remove(accessTheme);
       return true;
     }
   }
   return false;
 }
예제 #4
0
 @Override
 public InputStream getResourceAsStream(String path) throws IOException {
   for (Theme t : themes) {
     InputStream resource = t.getResourceAsStream(path);
     if (resource != null) {
       return resource;
     }
   }
   return null;
 }
예제 #5
0
 @Override
 public URL getResource(String path) throws IOException {
   for (Theme t : themes) {
     URL resource = t.getResource(path);
     if (resource != null) {
       return resource;
     }
   }
   return null;
 }
예제 #6
0
 @Override
 public InputStream getTemplateAsStream(String name) throws IOException {
   for (Theme t : themes) {
     InputStream template = t.getTemplateAsStream(name);
     if (template != null) {
       return template;
     }
   }
   return null;
 }
예제 #7
0
 @Override
 public URL getTemplate(String name) throws IOException {
   for (Theme t : themes) {
     URL template = t.getTemplate(name);
     if (template != null) {
       return template;
     }
   }
   return null;
 }