예제 #1
0
 @Override
 public Set<String> nameSet(Theme.Type type) {
   Set<String> themes = new HashSet<String>();
   for (ThemeProvider p : getProviders()) {
     themes.addAll(p.nameSet(type));
   }
   return themes;
 }
예제 #2
0
 @Override
 public boolean hasTheme(String name, Theme.Type type) {
   for (ThemeProvider p : getProviders()) {
     if (p.hasTheme(name, type)) {
       return true;
     }
   }
   return false;
 }
예제 #3
0
 private Theme findTheme(String name, Theme.Type type) {
   for (ThemeProvider p : getProviders()) {
     if (p.hasTheme(name, type)) {
       try {
         return p.getTheme(name, type);
       } catch (IOException e) {
         log.errorv(e, p.getClass() + " failed to load theme, type={0}, name={1}", type, name);
       }
     }
   }
   return null;
 }
예제 #4
0
  private List<ThemeProvider> getProviders() {
    if (providers == null) {
      providers = new LinkedList();

      for (ThemeProvider p : session.getAllProviders(ThemeProvider.class)) {
        if (!(p instanceof ExtendingThemeManager)) {
          if (!p.getClass().equals(ExtendingThemeManager.class)) {
            providers.add(p);
          }
        }
      }

      Collections.sort(
          providers,
          new Comparator<ThemeProvider>() {
            @Override
            public int compare(ThemeProvider o1, ThemeProvider o2) {
              return o2.getProviderPriority() - o1.getProviderPriority();
            }
          });
    }

    return providers;
  }