Ejemplo n.º 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);
 }
Ejemplo n.º 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;
      }
    }
Ejemplo n.º 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;
      }
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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
      }
    }
Ejemplo n.º 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));
 }
Ejemplo n.º 10
0
    public void endSelector(SelectorList selectors) throws CSSException {

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

      // Pop both the style declaration and the font face rule nodes
      _nodeStack.pop();
      _root = _nodeStack.pop();
    }
Ejemplo n.º 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();
    }
Ejemplo n.º 13
0
    public void endMedia(SACMediaList media) throws CSSException {

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

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