예제 #1
0
  private void loadDefaultStyles() {
    VirtualFile defaultsCSSFile = resolveDefaultsCssFile();

    // Load the per SWC default styles first
    for (Iterator it = configuration.getDefaultsCssFiles().iterator(); it.hasNext(); ) {
      VirtualFile swcDefaultsCssFile = (VirtualFile) it.next();

      // Make sure that we resolve things relative to the SWC.
      ThreadLocalToolkit.getPathResolver().addSinglePathResolver(0, swcDefaultsCssFile);
      processStyleSheet(swcDefaultsCssFile);
      ThreadLocalToolkit.getPathResolver().removeSinglePathResolver(swcDefaultsCssFile);
    }

    // Load the default styles next, so they can override the SWC defaults
    if (defaultsCSSFile != null) {
      // Only load the defaults if it's not a SwcFile.  If it's
      // a SwcFile, it should have already been loaded.
      if (!(defaultsCSSFile instanceof SwcFile)) {
        processStyleSheet(defaultsCSSFile);
      }
    } else {
      ThreadLocalToolkit.log(new DefaultCSSFileNotFound());
    }

    // Load the theme styles next, so they can override the defaults
    for (Iterator it = configuration.getThemeCssFiles().iterator(); it.hasNext(); ) {
      VirtualFile themeCssFile = (VirtualFile) it.next();

      // Make sure that we resolve things in the theme relative
      // to the theme SWC first.
      ThreadLocalToolkit.getPathResolver().addSinglePathResolver(0, themeCssFile);
      processStyleSheet(themeCssFile);
      ThreadLocalToolkit.getPathResolver().removeSinglePathResolver(themeCssFile);
    }
  }