Exemple #1
0
 /**
  * Adds a feature to the Condition attribute of the Selector object
  *
  * @param c The feature to be added to the Condition attribute
  */
 private void addCondition(Condition c) {
   if (conditions == null) {
     conditions = new java.util.ArrayList();
   }
   if (_pe != null) {
     conditions.add(Condition.createUnsupportedCondition());
     XRLog.match(Level.WARNING, "Trying to append conditions to pseudoElement " + _pe);
   }
   conditions.add(c);
 }
Exemple #2
0
 /** Check if the given Element matches this selector. Note: the parser should give all class */
 public boolean matches(Object e, AttributeResolver attRes, TreeResolver treeRes) {
   if (siblingSelector != null) {
     Object sib = siblingSelector.getAppropriateSibling(e, treeRes);
     if (sib == null) {
       return false;
     }
     if (!siblingSelector.matches(sib, attRes, treeRes)) {
       return false;
     }
   }
   if (_name == null || treeRes.matchesElement(e, _namespaceURI, _name)) {
     if (conditions != null) {
       // all conditions need to be true
       for (java.util.Iterator i = conditions.iterator(); i.hasNext(); ) {
         Condition c = (Condition) i.next();
         if (!c.matches(e, attRes, treeRes)) {
           return false;
         }
       }
     }
     return true;
   }
   return false;
 }
Exemple #3
0
 /** the CSS condition [attribute|=value] */
 public void addAttributeMatchesFirstPartCondition(
     String namespaceURI, String name, String value) {
   _specificityC++;
   addCondition(Condition.createAttributeMatchesFirstPartCondition(namespaceURI, name, value));
 }
Exemple #4
0
 /** the CSS condition [attribute] */
 public void addAttributeExistsCondition(String namespaceURI, String name) {
   _specificityC++;
   addCondition(Condition.createAttributeExistsCondition(namespaceURI, name));
 }
Exemple #5
0
 /** the CSS condition [attribute*=value] */
 public void addAttributeSubstringCondition(String namespaceURI, String name, String value) {
   _specificityC++;
   addCondition(Condition.createAttributeSubstringCondition(namespaceURI, name, value));
 }
Exemple #6
0
 /** the CSS condition #ID */
 public void addIDCondition(String id) {
   _specificityB++;
   addCondition(Condition.createIDCondition(id));
 }
Exemple #7
0
 /** the CSS condition .class */
 public void addClassCondition(String className) {
   _specificityC++;
   addCondition(Condition.createClassCondition(className));
   _text = _name + Token.TK_PERIOD.getExternalName() + className;
 }
Exemple #8
0
 /** the CSS condition :lang(Xx) */
 public void addLangCondition(String lang) {
   _specificityC++;
   addCondition(Condition.createLangCondition(lang));
 }
Exemple #9
0
 /** the CSS condition that element has pseudo-class :odd */
 public void addOddChildCondition() {
   _specificityC++;
   addCondition(Condition.createOddChildCondition());
 }
Exemple #10
0
 /** the CSS condition that element has pseudo-class :first-child */
 public void addFirstChildCondition() {
   _specificityC++;
   addCondition(Condition.createFirstChildCondition());
 }
Exemple #11
0
 /** the CSS condition that element has pseudo-class :link */
 public void addLinkCondition() {
   _specificityC++;
   addCondition(Condition.createLinkCondition());
 }
Exemple #12
0
 /** for unsupported or invalid CSS */
 public void addUnsupportedCondition() {
   addCondition(Condition.createUnsupportedCondition());
 }