1 18 package org.apache.batik.css.engine.sac; 19 20 import java.util.Set ; 21 22 import org.apache.batik.css.engine.CSSStylableElement; 23 import org.w3c.dom.Element ; 24 25 32 33 public class CSSIdCondition extends AbstractAttributeCondition { 34 35 38 protected String namespaceURI; 39 40 43 protected String localName; 44 45 48 public CSSIdCondition(String ns, String ln, String value) { 49 super(value); 50 namespaceURI = ns; 51 localName = ln; 52 } 53 54 58 public short getConditionType() { 59 return SAC_ID_CONDITION; 60 } 61 62 66 public String getNamespaceURI() { 67 return namespaceURI; 68 } 69 70 74 public String getLocalName() { 75 return localName; 76 } 77 78 82 public boolean getSpecified() { 83 return true; 84 } 85 86 89 public boolean match(Element e, String pseudoE) { 90 return (e instanceof CSSStylableElement) 91 ? ((CSSStylableElement)e).getXMLId().equals(getValue()) 92 : false; 93 } 94 95 98 public void fillAttributeSet(Set attrSet) { 99 attrSet.add(localName); 100 } 101 102 105 public int getSpecificity() { 106 return 1 << 16; 107 } 108 109 112 public String toString() { 113 return "#" + getValue(); 114 } 115 } 116 | Popular Tags |