1 17 18 19 20 package org.apache.fop.fo.properties; 21 22 import java.util.Iterator ; 23 24 import org.apache.fop.fo.PropertyList; 25 import org.apache.fop.fo.expr.PropertyException; 26 27 30 public class GenericShorthandParser implements ShorthandParser { 31 32 35 public GenericShorthandParser() { 36 } 37 38 43 protected Property getElement(Property list, int index) { 44 if (list.getList().size() > index) { 45 return (Property) list.getList().get(index); 46 } else { 47 return null; 48 } 49 } 50 51 54 public Property getValueForProperty(int propId, 55 Property property, 56 PropertyMaker maker, 57 PropertyList propertyList) 58 throws PropertyException { 59 if (property.getList().size() == 1) { 61 String sval = getElement(property, 0).getString(); 62 if (sval != null && sval.equals("inherit")) { 63 return propertyList.getFromParent(propId); 64 } 65 } 66 return convertValueForProperty(propId, property, maker, propertyList); 67 } 68 69 70 80 protected Property convertValueForProperty(int propId, 81 Property property, 82 PropertyMaker maker, 83 PropertyList propertyList) 84 throws PropertyException { 85 Property prop = null; 86 Iterator iprop = property.getList().iterator(); 88 while (iprop.hasNext() && prop == null) { 89 Property p = (Property)iprop.next(); 90 prop = maker.convertShorthandProperty(propertyList, p, null); 91 } 92 return prop; 93 } 94 95 } 96 97 | Popular Tags |