1 17 18 19 20 package org.apache.fop.fo.properties; 21 22 import org.apache.fop.fo.FOPropertyMapping; 23 import org.apache.fop.fo.PropertyList; 24 import org.apache.fop.fo.expr.PropertyException; 25 26 29 public class BoxPropShorthandParser extends GenericShorthandParser { 30 31 34 public BoxPropShorthandParser() { 35 } 36 37 44 protected Property convertValueForProperty(int propId, 45 Property property, 46 PropertyMaker maker, 47 PropertyList propertyList) 48 throws PropertyException { 49 String name = FOPropertyMapping.getPropertyName(propId); 50 Property p = null; 51 int count = property.getList().size(); 52 if (name.indexOf("-top") >= 0) { 53 p = getElement(property, 0); 54 } else if (name.indexOf("-right") >= 0) { 55 p = getElement(property, count > 1 ? 1 : 0); 56 } else if (name.indexOf("-bottom") >= 0) { 57 p = getElement(property, count > 2 ? 2 : 0); 58 } else if (name.indexOf("-left") >= 0) { 59 p = getElement(property, count > 3 ? 3 : (count > 1 ? 1 : 0)); 60 } 61 if (p != null) { 63 return maker.convertShorthandProperty(propertyList, p, null); 64 } 65 return p; 66 } 67 68 } 69 | Popular Tags |