Package com.google.gwt.thirdparty.common.css

Examples of com.google.gwt.thirdparty.common.css.SourceCode


    String cssProperty = propertyBuilder.toString();

    // See if we can parse the rule using the GSS parser and thus verify that the
    // rule is indeed correct CSS.
    try {
      new GssParser(new SourceCode(null, "body{" + cssProperty + "}")).parse();
    } catch (GssParserException e) {
      if (lenient) {
        // print a warning message and don't print the rule.
        treeLogger.log(Type.WARN, "The following rule is not valid and will be skipped: " +
            cssProperty);
View Full Code Here


      ConversionResult result = convertToGss(concatenatedCss, logger);

      String gss = result.gss;
      String name = "[auto-converted gss files from : " + resources + "]";
      sourceCodes.add(new SourceCode(name, gss));

      constantNameMappingBuilder.putAll(result.defNameMapping);
    } else {
      for (URL stylesheet : resources) {
        TreeLogger branchLogger = logger.branch(TreeLogger.DEBUG,
            "Parsing GSS stylesheet " + stylesheet.toExternalForm());
        try {
          // TODO : always use UTF-8 to read the file ?
          String fileContent =
              Resources.asByteSource(stylesheet).asCharSource(Charsets.UTF_8).read();
          sourceCodes.add(new SourceCode(stylesheet.getFile(), fileContent));
          continue;

        } catch (IOException e) {
          branchLogger.log(TreeLogger.ERROR, "Unable to parse CSS", e);
        }
View Full Code Here

    String gss = IOUtils.toString(stream, "UTF-8");
    Assert.assertEquals(gss, convertedGss);

    // assert the convertedGss is compatible with GSS
    try {
      new GssParser(new SourceCode("[conversion of " + inputCssFile + "]", convertedGss)).parse();
    } catch (GssParserException e) {
      e.printStackTrace();
      fail("The conversion produces invalid GSS code.");
    }
  }
View Full Code Here

   * Class wrapping code using GSS in order to keep Java6 compatibility if GSS is not used.
   */
  private static class GssWrapper {
    private static Set<String> getCssClassNames(String fileName, String cssSource,
        Set<JClassType> imports, TreeLogger logger) throws UnableToCompleteException {
      SourceCode sourceCode = new SourceCode(fileName, cssSource);
      CssTree tree;
      try {
        tree = new GssParser(sourceCode).parse();
      } catch (GssParserException e) {
        logger.log(TreeLogger.ERROR, "Unable to parse CSS", e);
View Full Code Here

    return Joiner.on("\n").join(lines);
  }

  private CssTree parse(String source) {
    try {
      return new GssParser(new SourceCode("test", source)).parse();
    } catch (GssParserException e) {
      fail(e.getMessage());
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.thirdparty.common.css.SourceCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.