コード例 #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;
    }
  }