예제 #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);
 }
예제 #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;
 }
예제 #3
0
 /** the CSS condition [attribute|=value] */
 public void addAttributeMatchesFirstPartCondition(
     String namespaceURI, String name, String value) {
   _specificityC++;
   addCondition(Condition.createAttributeMatchesFirstPartCondition(namespaceURI, name, value));
 }
예제 #4
0
 /** the CSS condition [attribute] */
 public void addAttributeExistsCondition(String namespaceURI, String name) {
   _specificityC++;
   addCondition(Condition.createAttributeExistsCondition(namespaceURI, name));
 }
예제 #5
0
 /** the CSS condition [attribute*=value] */
 public void addAttributeSubstringCondition(String namespaceURI, String name, String value) {
   _specificityC++;
   addCondition(Condition.createAttributeSubstringCondition(namespaceURI, name, value));
 }
예제 #6
0
 /** the CSS condition #ID */
 public void addIDCondition(String id) {
   _specificityB++;
   addCondition(Condition.createIDCondition(id));
 }
예제 #7
0
 /** the CSS condition .class */
 public void addClassCondition(String className) {
   _specificityC++;
   addCondition(Condition.createClassCondition(className));
   _text = _name + Token.TK_PERIOD.getExternalName() + className;
 }
예제 #8
0
 /** the CSS condition :lang(Xx) */
 public void addLangCondition(String lang) {
   _specificityC++;
   addCondition(Condition.createLangCondition(lang));
 }
예제 #9
0
 /** the CSS condition that element has pseudo-class :odd */
 public void addOddChildCondition() {
   _specificityC++;
   addCondition(Condition.createOddChildCondition());
 }
예제 #10
0
 /** the CSS condition that element has pseudo-class :first-child */
 public void addFirstChildCondition() {
   _specificityC++;
   addCondition(Condition.createFirstChildCondition());
 }
예제 #11
0
 /** the CSS condition that element has pseudo-class :link */
 public void addLinkCondition() {
   _specificityC++;
   addCondition(Condition.createLinkCondition());
 }
예제 #12
0
 /** for unsupported or invalid CSS */
 public void addUnsupportedCondition() {
   addCondition(Condition.createUnsupportedCondition());
 }