1 51 package org.apache.fop.fo.expr; 52 53 54 import org.apache.fop.fo.Property; 55 import org.apache.fop.fo.LengthProperty; 56 import org.apache.fop.datatypes.TableColLength; 57 58 public class PPColWidthFunction extends FunctionBase { 59 60 public int nbArgs() { 61 return 1; 62 } 63 64 public Property eval(Property[] args, 65 PropertyInfo pInfo) throws PropertyException { 66 Number d = args[0].getNumber(); 67 if (d == null) { 68 throw new PropertyException("Non number operand to proportional-column-width function"); 69 } 70 if (!pInfo.getPropertyList().getElement().equals("table-column")) { 71 throw new PropertyException("proportional-column-width function may only be used on table-column FO"); 72 } 73 return new LengthProperty(new TableColLength(d.doubleValue())); 75 } 76 77 } 78 | Popular Tags |