Exemplo n.º 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;
    }
  }
Exemplo n.º 2
0
 public static Theme getTheme(long uid) {
   for (Theme selectedTheme : themeList) {
     if (selectedTheme.getUid() == uid) {
       return selectedTheme;
     }
   }
   return null;
 }
Exemplo n.º 3
0
 public static boolean removeTheme(Long uid) {
   for (Theme accessTheme : themeList) {
     if (accessTheme.getUid().equals(uid)) {
       themeList.remove(accessTheme);
       return true;
     }
   }
   return false;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }