1 17 18 19 20 package org.apache.fop.area; 21 22 import java.util.Collections ; 23 import java.util.Iterator ; 24 import java.util.Map ; 25 26 import org.apache.fop.util.QName; 27 28 31 public abstract class AreaTreeObject { 32 33 34 protected Map foreignAttributes = null; 35 36 41 public void setForeignAttribute(QName name, String value) { 42 if (this.foreignAttributes == null) { 43 this.foreignAttributes = new java.util.HashMap (); 44 } 45 this.foreignAttributes.put(name, value); 46 } 47 48 52 public void setForeignAttributes(Map atts) { 53 if (atts.size() == 0) { 54 return; 55 } 56 Iterator iter = atts.keySet().iterator(); 57 while (iter.hasNext()) { 58 QName qName = (QName)iter.next(); 59 String value = (String )atts.get(qName); 60 setForeignAttribute(qName, value); 62 } 63 } 64 65 70 public String getForeignAttributeValue(QName name) { 71 if (this.foreignAttributes != null) { 72 return (String )this.foreignAttributes.get(name); 73 } else { 74 return null; 75 } 76 } 77 78 79 public Map getForeignAttributes() { 80 if (this.foreignAttributes != null) { 81 return Collections.unmodifiableMap(this.foreignAttributes); 82 } else { 83 return Collections.EMPTY_MAP; 84 } 85 } 86 87 88 } 89 | Popular Tags |