1 51 package org.apache.fop.fo; 52 53 import java.util.ArrayList ; 54 55 public class GenericShorthandParser implements ShorthandParser { 56 57 protected ArrayList list; 59 public GenericShorthandParser(ListProperty listprop) { 60 this.list = listprop.getList(); 61 } 62 63 protected Property getElement(int index) { 64 if (list.size() > index) 65 return (Property)list.get(index); 66 else 67 return null; 68 } 69 70 protected int count() { 71 return list.size(); 72 } 73 74 public Property getValueForProperty(String propName, 77 Property.Maker maker, 78 PropertyList propertyList) { 79 Property prop = null; 80 if (count() == 1) { 82 String sval = ((Property)list.get(0)).getString(); 83 if (sval != null && sval.equals("inherit")) { 84 return propertyList.getFromParent(propName); 85 } 86 } 87 return convertValueForProperty(propName, maker, propertyList); 88 } 89 90 91 protected Property convertValueForProperty(String propName, 92 Property.Maker maker, 93 PropertyList propertyList) { 94 for (int i = 0; i < list.size(); i++) { 96 Property p = (Property)list.get(i); 97 Property prop = maker.convertShorthandProperty(propertyList, p, null); 98 if (prop!=null) { 99 return prop; 100 } 101 } 102 return null; 103 } 104 105 } 106 | Popular Tags |