Package org.w3c.dom.css

Examples of org.w3c.dom.css.CSSRuleList


*/
public abstract class AbstractCSSVisitor {
    public void visitStyleSheet(CSSStyleSheet styleSheet) {
        startStyleSheet(styleSheet);

        CSSRuleList rules = styleSheet.getCssRules();
        int length = rules.getLength();
        for (int i = 0; i < length; i++) {
            CSSRule rule = rules.item(i);
            visitRule(rule);
        }

        endStyleSheet(styleSheet);
    }
View Full Code Here


    public abstract void visitImportRule(CSSImportRule rule);

    public void visitMediaRule(CSSMediaRule rule) {
        startMediaRule(rule);

        CSSRuleList rules = rule.getCssRules();
        int length = rules.getLength();
        for (int i = 0; i < length; i++) {
            CSSRule childRule = rules.item(i);
            visitRule(childRule);
        }

        endMediaRule(rule);
    }
View Full Code Here

  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++){
View Full Code Here

  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++) {
View Full Code Here

    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) {
          CSSStyleRule styleRule = (CSSStyleRule) rule;
          String selector = styleRule.getSelectorText();
          this.selectors.add(selector);
        }
View Full Code Here

     *            The {@code CSSStyleSheet} containing the rules.
     * @return The CSS rules.
     */
    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

 
  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

     * @param element the element to which style rules must apply in order for them to be added to
     *        the specified style
     */
    void modifyIfNecessary(final ComputedCSSStyleDeclaration style, final HTMLElement element) {
        final HtmlElement e = element.getDomNodeOrDie();
        final CSSRuleList rules = getWrappedSheet().getCssRules();
        if (rules == null) {
            return;
        }
        for (int i = 0; i < rules.getLength(); i++) {
            final CSSRule rule = rules.item(i);
            if (rule.getType() == CSSRule.STYLE_RULE) {
                final CSSStyleRuleImpl styleRule = (CSSStyleRuleImpl) rule;
                final SelectorList selectors = styleRule.getSelectors();
                for (int j = 0; j < selectors.getLength(); j++) {
                    final Selector selector = selectors.item(j);
View Full Code Here

         
          CSSOMParser parser = new CSSOMParser();
            InputSource is = new InputSource(r);

            CSSStyleSheet stylesheet = parser.parseStyleSheet(is);
            CSSRuleList rules = stylesheet.getCssRules();

            for (int i = 0; i < rules.getLength(); i++) {
                CSSRule rule = rules.item(i);
                list.add(rule);
            }


      }
View Full Code Here

   *
   * @return DOCUMENT ME!
   */
  public String toString() {
    CStringBuilder buffer = new CStringBuilder();
    CSSRuleList    list = getCssRules();

    for (int i = 0; i < list.getLength(); i++) {
      buffer.append(list.item(i));
    } // end for

    return buffer.toString();
  } // end toString()
View Full Code Here

TOP

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

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.