1 17 18 19 20 package org.apache.fop.fo.properties; 21 22 import org.apache.fop.datatypes.Length; 23 import org.apache.fop.datatypes.Numeric; 24 import org.apache.fop.fo.FObj; 25 import org.apache.fop.fo.PropertyList; 26 import org.apache.fop.fo.expr.PropertyException; 27 28 31 public abstract class LengthProperty extends Property 32 implements Length, Numeric { 33 34 37 public static class Maker extends PropertyMaker { 38 39 42 public Maker(int propId) { 43 super(propId); 44 } 45 46 51 public Property convertProperty(Property p, 52 PropertyList propertyList, 53 FObj fo) throws PropertyException { 54 if (p instanceof EnumProperty) { 55 return new EnumLength(p); 56 } 57 if (p instanceof LengthProperty) { 58 return p; 59 } 60 if (p instanceof NumberProperty) { 61 return new FixedLength(p.getNumeric().getNumericValue(), "px"); 63 } 64 Length val = p.getLength(); 65 if (val != null) { 66 return (Property) val; 67 } 68 69 return convertPropertyDatatype(p, propertyList, fo); 70 } 71 72 } 73 74 86 public double getTableUnits() { 87 return 0.0; 88 } 89 90 93 public int getDimension() { 94 return 1; 95 } 96 97 100 public Numeric getNumeric() { 101 return this; 102 } 103 104 107 public Length getLength() { 108 return this; 109 } 110 111 114 public Object getObject() { 115 return this; 116 } 117 118 } 119 120 | Popular Tags |