1 51 package org.apache.fop.fo; 52 53 import org.apache.fop.datatypes.Length; 54 import org.apache.fop.datatypes.AutoLength; 55 import org.apache.fop.fo.expr.Numeric; 56 import org.apache.fop.apps.FOPException; 57 58 public class LengthProperty extends Property { 59 60 public static class Maker extends Property.Maker { 61 62 public Maker(String name) { 63 super(name); 64 } 65 66 74 75 protected boolean isAutoLengthAllowed() { 76 return false; 77 } 78 79 public Property convertProperty(Property p, 80 PropertyList propertyList, 81 FObj fo) throws FOPException { 82 if (isAutoLengthAllowed()) { 83 String pval = p.getString(); 84 if (pval != null && pval.equals("auto")) 85 return new LengthProperty(new AutoLength()); 86 } 87 if (p instanceof LengthProperty) 88 return p; 89 Length val = p.getLength(); 90 if (val != null) 91 return new LengthProperty(val); 92 return convertPropertyDatatype(p, propertyList, fo); 93 } 94 95 } 96 97 102 103 107 private Length length; 108 109 public LengthProperty(Length length) { 110 this.length = length; 111 } 113 114 public Numeric getNumeric() { 115 return length.asNumeric() ; 116 } 117 118 public Length getLength() { 119 return this.length; 120 } 121 122 public Object getObject() { 123 return this.length; 124 } 125 126 } 127 | Popular Tags |