Package org.w3c.dom.css

Examples of org.w3c.dom.css.CSSRule


     */
    private static List<CSSStyleRule> getRules(final CSSStyleSheet styleSheet) {
        final List<CSSStyleRule> rules = new ArrayList<>();
        final CSSRuleList ruleList = styleSheet.getCssRules();
        for (int i = 0; i < ruleList.getLength(); i++) {
            final CSSRule rule = ruleList.item(i);
            if (rule instanceof CSSStyleRule) {
                final CSSStyleRule styleRule = (CSSStyleRule) rule;
                rules.add(styleRule);
            }
        }
View Full Code Here


 
  public AttributeRuleList(CSSRuleList ruleList) {
    super(ruleList.getLength());
   
    for (int i = 0; i < ruleList.getLength(); i++) {
      CSSRule rule = ruleList.item(i);
      if(rule instanceof CSSStyleRule) {
        this.add((CSSStyleRule)rule);
      }
    }
View Full Code Here

            Element e,
            String pe,
            CSSOMRuleList rl) {
  int llen = l.getLength();
  for (int i = 0; i < llen; i++) {
      CSSRule rule = l.item(i);
      switch (rule.getType()) {
      case CSSRule.STYLE_RULE:
    CSSOMStyleRule sr = (CSSOMStyleRule)rule;
    SelectorList sl = sr.getSelectors();
    int slen = sl.getLength();
    for (int j = 0; j < slen; j++) {
View Full Code Here

    public String getCssText() {
        StringBuffer sb = new StringBuffer("@media ");
        sb.append(getMedia().toString()).append(" {");
        for (int i = 0; i < getCssRules().getLength(); i++) {
            CSSRule rule = getCssRules().item(i);
            sb.append(rule.getCssText()).append(" ");
        }
        sb.append("}");
        return sb.toString();
    }
View Full Code Here

        }

        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;
            } else {
                throw new DOMExceptionImpl(
                    DOMException.INVALID_MODIFICATION_ERR,
View Full Code Here

            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

        }

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

            // The rule must be a page rule
            if (r.getType() == CSSRule.PAGE_RULE) {
                this.ident = ((CSSPageRuleImpl)r).ident;
                this.pseudoPage = ((CSSPageRuleImpl)r).pseudoPage;
                this.style = ((CSSPageRuleImpl)r).style;
            } else {
                throw new DOMExceptionImpl(
View Full Code Here

        }

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

            // The rule must be a charset rule
            if (r.getType() == CSSRule.CHARSET_RULE) {
                this.encoding = ((CSSCharsetRuleImpl)r).encoding;
            } else {
                throw new DOMExceptionImpl(
                    DOMException.INVALID_MODIFICATION_ERR,
                    DOMExceptionImpl.EXPECTING_CHARSET_RULE);
View Full Code Here

        }

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

            // The rule must be a style rule
            if (r.getType() == CSSRule.STYLE_RULE) {
                this.selectors = ((CSSStyleRuleImpl)r).selectors;
                this.style = ((CSSStyleRuleImpl)r).style;
            } else {
                throw new DOMExceptionImpl(
                    DOMException.INVALID_MODIFICATION_ERR,
View Full Code Here

        }

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

            // The rule must be an import rule
            if (r.getType() == CSSRule.IMPORT_RULE) {
                this.href = ((CSSImportRuleImpl)r).href;
                this.media = ((CSSImportRuleImpl)r).media;
            } else {
                throw new DOMExceptionImpl(
                    DOMException.INVALID_MODIFICATION_ERR,
View Full Code Here

TOP

Related Classes of org.w3c.dom.css.CSSRule

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.