예제 #1
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);
    }
예제 #2
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);
    }
예제 #3
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);
    }
예제 #4
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);
    }
예제 #5
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
      }
    }
예제 #6
0
 public void parseStyleDeclaration(CSSStyleDeclaration sd, InputSource source) throws IOException {
   Stack nodeStack = new Stack();
   nodeStack.push(sd);
   CSSOMHandler handler = new CSSOMHandler(nodeStack);
   _parser.setDocumentHandler(handler);
   _parser.parseStyleDeclaration(source);
 }