Пример #1
0
    public void ignorableAtRule(String atRule) throws CSSException {

      // Create the unknown rule and add it to the rule list
      CSSUnknownRuleImpl ir = new CSSUnknownRuleImpl(_parentStyleSheet, null, atRule);
      if (!_nodeStack.empty()) {
        ((CSSRuleListImpl) _nodeStack.peek()).add(ir);
      } else {
        //                _nodeStack.push(ir);
        _root = ir;
      }
    }
Пример #2
0
    public void importStyle(String uri, SACMediaList media, String defaultNamespaceURI)
        throws CSSException {

      // Create the import rule and add it to the rule list
      CSSImportRuleImpl ir =
          new CSSImportRuleImpl(_parentStyleSheet, null, uri, new MediaListImpl(media));
      if (!_nodeStack.empty()) {
        ((CSSRuleListImpl) _nodeStack.peek()).add(ir);
      } else {
        //                _nodeStack.push(ir);
        _root = ir;
      }
    }
Пример #3
0
    public void startSelector(SelectorList selectors) throws CSSException {

      // Create the style rule and add it to the rule list
      CSSStyleRuleImpl sr = new CSSStyleRuleImpl(_parentStyleSheet, null, selectors);
      if (!_nodeStack.empty()) {
        ((CSSRuleListImpl) _nodeStack.peek()).add(sr);
      }

      // Create the style declaration
      CSSStyleDeclarationImpl decl = new CSSStyleDeclarationImpl(sr);
      sr.setStyle(decl);
      _nodeStack.push(sr);
      _nodeStack.push(decl);
    }
Пример #4
0
    public void startFontFace() throws CSSException {

      // Create the font face rule and add it to the rule list
      CSSFontFaceRuleImpl ffr = new CSSFontFaceRuleImpl(_parentStyleSheet, null);
      if (!_nodeStack.empty()) {
        ((CSSRuleListImpl) _nodeStack.peek()).add(ffr);
      }

      // Create the style declaration
      CSSStyleDeclarationImpl decl = new CSSStyleDeclarationImpl(ffr);
      ffr.setStyle(decl);
      _nodeStack.push(ffr);
      _nodeStack.push(decl);
    }
Пример #5
0
    public void startPage(String name, String pseudo_page) throws CSSException {

      // Create the page rule and add it to the rule list
      CSSPageRuleImpl pr = new CSSPageRuleImpl(_parentStyleSheet, null, name, pseudo_page);
      if (!_nodeStack.empty()) {
        ((CSSRuleListImpl) _nodeStack.peek()).add(pr);
      }

      // Create the style declaration
      CSSStyleDeclarationImpl decl = new CSSStyleDeclarationImpl(pr);
      pr.setStyle(decl);
      _nodeStack.push(pr);
      _nodeStack.push(decl);
    }
Пример #6
0
    public void startMedia(SACMediaList media) throws CSSException {

      // Create the media rule and add it to the rule list
      CSSMediaRuleImpl mr = new CSSMediaRuleImpl(_parentStyleSheet, null, new MediaListImpl(media));
      if (!_nodeStack.empty()) {
        ((CSSRuleListImpl) _nodeStack.peek()).add(mr);
      }

      // Create the rule list
      CSSRuleListImpl rules = new CSSRuleListImpl();
      mr.setRuleList(rules);
      _nodeStack.push(mr);
      _nodeStack.push(rules);
    }
Пример #7
0
    public void startDocument(InputSource source) throws CSSException {
      if (_nodeStack.empty()) {
        CSSStyleSheetImpl ss = new CSSStyleSheetImpl();
        _parentStyleSheet = ss;

        // Create the rule list
        CSSRuleListImpl rules = new CSSRuleListImpl();
        ss.setRuleList(rules);
        _nodeStack.push(ss);
        _nodeStack.push(rules);
      } else {
        // Error
      }
    }