Examples of CSSOMParser


Examples of com.steadystate.css.parser.CSSOMParser

            stream = getResourceInputStream();
            if (null == stream) {
                return null;
            }
            InputSource source = new InputSource(new InputStreamReader(stream));
            CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
            ErrorHandlerImpl errorHandler = new ErrorHandlerImpl(this, ctx.isProjectStage(ProjectStage.Production));

            parser.setErrorHandler(errorHandler);

            // parse and create a stylesheet composition
            styleSheet = parser.parseStyleSheet(source, null, null);
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        } finally {
            if (stream != null) {
                try {
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

   *
   * @param css CSS
   */
  private void processStylesheet(String css){
    try {
      CSSOMParser parser = new CSSOMParser();
      InputSource is = new InputSource(new StringReader(css));
      CSSStyleSheet stylesheet = parser.parseStyleSheet(is);
      CSSRuleList list = stylesheet.getCssRules();
//      ArrayList assists = new ArrayList();
      for(int i=0;i<list.getLength();i++){
        CSSRule rule = list.item(i);
        if(rule instanceof CSSStyleRule){
          CSSStyleRule styleRule = (CSSStyleRule)rule;
          String selector = styleRule.getSelectorText();
          SelectorList selectors = parser.parseSelectors(new InputSource(new StringReader(selector)));
          for(int j=0;j<selectors.getLength();j++){
            Selector sel = selectors.item(j);
            if(sel instanceof ConditionalSelector){
              Condition cond = ((ConditionalSelector)sel).getCondition();
              SimpleSelector simple = ((ConditionalSelector)sel).getSimpleSelector();
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

    update();
  }
 
  public void update(){
    try {
      CSSOMParser parser = new CSSOMParser();
      InputSource is = new InputSource(new StringReader(
          editor.getDocumentProvider().getDocument(editor.getEditorInput()).get()));
      CSSStyleSheet stylesheet = parser.parseStyleSheet(is);
      this.selectors.clear();
      CSSRuleList list = stylesheet.getCssRules();
      for(int i=0;i<list.getLength();i++){
        CSSRule rule = list.item(i);
        if(rule instanceof CSSStyleRule){
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

   *
   * @param css CSS
   */
  private void processStylesheet(String css) {
    try {
      CSSOMParser parser = new CSSOMParser();
      InputSource is = new InputSource(new StringReader(css));
      CSSStyleSheet stylesheet = parser.parseStyleSheet(is);
      CSSRuleList list = stylesheet.getCssRules();
      //      ArrayList assists = new ArrayList();
      for (int i = 0; i < list.getLength(); i++) {
        CSSRule rule = list.item(i);
        if (rule instanceof CSSStyleRule) {
          CSSStyleRule styleRule = (CSSStyleRule) rule;
          String selector = styleRule.getSelectorText();
          SelectorList selectors = parser.parseSelectors(new InputSource(new StringReader(selector)));
          for (int j = 0; j < selectors.getLength(); j++) {
            Selector sel = selectors.item(j);
            if (sel instanceof ConditionalSelector) {
              Condition cond = ((ConditionalSelector) sel).getCondition();
              SimpleSelector simple = ((ConditionalSelector) sel).getSimpleSelector();
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

    update();
  }

  public void update() {
    try {
      CSSOMParser parser = new CSSOMParser();
      InputSource is = new InputSource(new StringReader(editor.getDocumentProvider().getDocument(editor.getEditorInput()).get()));
      CSSStyleSheet stylesheet = parser.parseStyleSheet(is);
      this.selectors.clear();
      CSSRuleList list = stylesheet.getCssRules();
      for (int i = 0; i < list.getLength(); i++) {
        CSSRule rule = list.item(i);
        if (rule instanceof CSSStyleRule) {
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

    private static CSSStyleSheet getStyleSheet(final File cssFile) {

        CSSStyleSheet sheet = null;
        final InputSource source = new InputSource(cssFile.toURI().toString());
        try {
            sheet = new CSSOMParser().parseStyleSheet(source, null, null);
        } catch (final IOException e) {
            LOG.error("IOException while reading {}", cssFile, e);
        }
        if (sheet == null) {
            sheet = new CSSStyleSheetImpl();
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

    return null;
  }
 
  AttributeRuleList getRuleList(InputStream stream) throws IOException {
    InputSource source = new InputSource(new InputStreamReader(stream));
        CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
        CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null, null);
        CSSRuleList ruleList = stylesheet.getCssRules();
       
        return new AttributeRuleList(ruleList);
  }
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

            cssString = startBlock + hint + ": " + endBlock;
        }
        StyleObjectModel model = null;

        Reader reader = new StringReader(cssString);
        CSSOMParser parser2 = new CSSOMParser();
        CSSStyleDeclaration n;

        try {
            n = parser2.parseStyleDeclaration(new InputSource(reader));
            model = new StyleObjectModel();
            model.setBorder(new StyleBorderModel());

            boolean isItalic = false;
            boolean isBold = false;
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

                DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
        }

        try {
            InputSource is = new InputSource(new StringReader(cssText));
            CSSOMParser parser = new CSSOMParser();
            CSSRule r = parser.parseRule(is);

            // The rule must be a media rule
            if (r.getType() == CSSRule.MEDIA_RULE) {
                this.media = ((CSSMediaRuleImpl)r).media;
                this.cssRules = ((CSSMediaRuleImpl)r).cssRules;
View Full Code Here

Examples of com.steadystate.css.parser.CSSOMParser

                DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
        }

        try {
            InputSource is = new InputSource(new StringReader(rule));
            CSSOMParser parser = new CSSOMParser();
            parser.setParentStyleSheet(this.parentStyleSheet);
            // parser._parentRule is never read
            //parser.setParentRule(_parentRule);
            CSSRule r = parser.parseRule(is);

            // Insert the rule into the list of rules
            ((CSSRuleListImpl)getCssRules()).insert(r, index);

        } catch (ArrayIndexOutOfBoundsException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.