1 17 18 19 20 package org.apache.fop.fo.properties; 21 22 import org.apache.fop.datatypes.LengthBase; 23 import org.apache.fop.datatypes.PercentBaseContext; 24 import org.apache.fop.fo.FObj; 25 26 37 public class TableColLength extends LengthProperty { 38 41 private double tcolUnits; 42 43 46 private FObj column; 47 48 53 public TableColLength(double tcolUnits, FObj column) { 54 this.tcolUnits = tcolUnits; 55 this.column = column; 56 } 57 58 62 public double getTableUnits() { 63 return tcolUnits; 64 } 65 66 70 public boolean isAbsolute() { 71 return false; 72 } 73 74 78 public double getNumericValue() { 79 throw new UnsupportedOperationException ( 80 "Must call getNumericValue with PercentBaseContext"); 81 } 82 83 86 public double getNumericValue(PercentBaseContext context) { 87 return tcolUnits * context.getBaseLength(LengthBase.TABLE_UNITS, column); 88 } 89 90 94 public int getValue() { 95 throw new UnsupportedOperationException ( 96 "Must call getValue with PercentBaseContext"); 97 } 98 99 102 public int getValue(PercentBaseContext context) { 103 return (int) (tcolUnits * context.getBaseLength(LengthBase.TABLE_UNITS, column)); 104 } 105 106 110 public String toString() { 111 return (Double.toString(tcolUnits) + " table-column-units"); 112 } 113 114 } 115 | Popular Tags |