1 17 18 19 20 package org.apache.fop.fo.properties; 21 22 import org.apache.fop.datatypes.CompoundDatatype; 23 import org.apache.fop.fo.FObj; 24 import org.apache.fop.fo.PropertyList; 25 import org.apache.fop.fo.expr.PropertyException; 26 27 30 public class LengthPairProperty extends Property implements CompoundDatatype { 31 private Property ipd; 32 private Property bpd; 33 34 37 public static class Maker extends CompoundPropertyMaker { 38 39 42 public Maker(int propId) { 43 super(propId); 44 } 45 46 50 public Property makeNewProperty() { 51 return new LengthPairProperty(); 52 } 53 54 57 public Property convertProperty(Property p, PropertyList propertyList, FObj fo) 58 throws PropertyException { 59 if (p instanceof LengthPairProperty) { 60 return p; 61 } 62 return super.convertProperty(p, propertyList, fo); 63 } 64 } 65 66 69 public LengthPairProperty() { 70 super(); 71 } 72 73 78 public LengthPairProperty(Property ipd, Property bpd) { 79 this(); 80 this.ipd = ipd; 81 this.bpd = bpd; 82 } 83 84 89 public LengthPairProperty(Property len) { 90 this(len, len); 91 } 92 93 96 public void setComponent(int cmpId, Property cmpnValue, 97 boolean bIsDefault) { 98 if (cmpId == CP_BLOCK_PROGRESSION_DIRECTION) { 99 bpd = cmpnValue; 100 } else if (cmpId == CP_INLINE_PROGRESSION_DIRECTION) { 101 ipd = cmpnValue; 102 } 103 } 104 105 108 public Property getComponent(int cmpId) { 109 if (cmpId == CP_BLOCK_PROGRESSION_DIRECTION) { 110 return getBPD(); 111 } else if (cmpId == CP_INLINE_PROGRESSION_DIRECTION) { 112 return getIPD(); 113 } else { 114 return null; } 116 } 117 118 121 public Property getIPD() { 122 return this.ipd; 123 } 124 125 128 public Property getBPD() { 129 return this.bpd; 130 } 131 132 133 public String toString() { 134 return "LengthPair[" 135 + "ipd:" + getIPD().getObject() 136 + ", bpd:" + getBPD().getObject() + "]"; 137 } 138 139 142 public LengthPairProperty getLengthPair() { 143 return this; 144 } 145 146 149 public Object getObject() { 150 return this; 151 } 152 153 } 154 | Popular Tags |