예제 #1
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);
 }
예제 #2
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;
      }
    }
예제 #3
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;
      }
    }
예제 #4
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);
    }
예제 #5
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);
    }
예제 #6
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);
    }
예제 #7
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);
    }
예제 #8
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
      }
    }
예제 #9
0
 public void property(String name, LexicalUnit value, boolean important) throws CSSException {
   CSSStyleDeclarationImpl decl = (CSSStyleDeclarationImpl) _nodeStack.peek();
   decl.addProperty(new Property(name, new CSSValueImpl(value), important));
 }
예제 #10
0
    public void endSelector(SelectorList selectors) throws CSSException {

      // Pop both the style declaration and the style rule nodes
      _nodeStack.pop();
      _root = _nodeStack.pop();
    }
예제 #11
0
    public void endFontFace() throws CSSException {

      // Pop both the style declaration and the font face rule nodes
      _nodeStack.pop();
      _root = _nodeStack.pop();
    }
예제 #12
0
    public void endPage(String name, String pseudo_page) throws CSSException {

      // Pop both the style declaration and the page rule nodes
      _nodeStack.pop();
      _root = _nodeStack.pop();
    }
예제 #13
0
    public void endMedia(SACMediaList media) throws CSSException {

      // Pop the rule list and media rule nodes
      _nodeStack.pop();
      _root = _nodeStack.pop();
    }
예제 #14
0
    public void endDocument(InputSource source) throws CSSException {

      // Pop the rule list and style sheet nodes
      _nodeStack.pop();
      _root = _nodeStack.pop();
    }