List of usage examples for com.google.gwt.resources.css GenerateCssAst exec
public static CssStylesheet exec(TreeLogger logger, URL... stylesheets) throws UnableToCompleteException
From source file:com.googlecode.mgwt.theme.server.CssCollector.java
License:Apache License
private static Map<File, Set<String>> collectorClassPerOutFile(Set<File> allCssFiles, File outputDir) throws MalformedURLException, UnableToCompleteException { Map<File, Set<String>> map = new HashMap<File, Set<String>>(); for (File file : allCssFiles) { CssStylesheet sheet = GenerateCssAst.exec(new PrintWriterTreeLogger(new PrintWriter(System.err)), file.toURI().toURL());/*from w w w.j av a2 s .c o m*/ ClassesCollectorVisitor classesCollectorVisitor = new ClassesCollectorVisitor(); classesCollectorVisitor.accept(sheet); Set<String> allClasses = classesCollectorVisitor.getAllClasses(); File outfile = new File(outputDir, file.getName()); map.put(outfile, allClasses); } return map; }
From source file:fr.onevu.gwt.uibinder.rebind.model.ImplicitCssResource.java
License:Apache License
/** * Returns the set of CSS classnames in the underlying .css files. * * @throws UnableToCompleteException if the user has called for a .css file we * can't find.//from w w w . ja v a 2 s. c om */ public Set<String> getCssClassNames() throws UnableToCompleteException { List<URL> urls = getExternalCss(); if (cssClassNames == null) { final File bodyFile = getGeneratedFile(); if (bodyFile != null) { try { urls.add(bodyFile.toURI().toURL()); } catch (MalformedURLException e) { throw new RuntimeException(e); } } assert urls.size() > 0; CssStylesheet sheet = GenerateCssAst.exec(logger.getTreeLogger(), urls.toArray(new URL[urls.size()])); cssClassNames = ExtractClassNamesVisitor.exec(sheet, imports.toArray(new JClassType[imports.size()])); } return cssClassNames; }
From source file:org.tessell.generators.css.AbstractCssGenerator.java
License:Apache License
private CssStylesheet parseFile() { try {/*w w w . j av a 2 s . c o m*/ // Create AST PrintWriterTreeLogger logger = new PrintWriterTreeLogger(logWriter); return GenerateCssAst.exec(logger, inputFile.toURI().toURL()); } catch (final MalformedURLException e) { throw new RuntimeException(e); } catch (final UnableToCompleteException e) { throw new RuntimeException(e); } finally { logWriter.flush(); } }