1 17 18 19 20 package org.apache.fop.layoutmgr.table; 21 22 import java.util.Iterator ; 23 import java.util.List ; 24 25 import org.apache.fop.fo.flow.TableRow; 26 import org.apache.fop.traits.MinOptMax; 27 28 32 class EffRow { 33 34 35 public static final int FIRST_IN_PART = GridUnit.FIRST_IN_PART; 36 37 public static final int LAST_IN_PART = GridUnit.LAST_IN_PART; 38 39 private List gridUnits = new java.util.ArrayList (); 40 private int index; 41 42 private int bodyType; 43 private MinOptMax height; 44 private MinOptMax explicitHeight; 45 46 51 public EffRow(int index, int bodyType) { 52 this.index = index; 53 this.bodyType = bodyType; 54 } 55 56 57 public int getIndex() { 58 return this.index; 59 } 60 61 65 public int getBodyType() { 66 return this.bodyType; 67 } 68 69 70 public TableRow getTableRow() { 71 return getGridUnit(0).getRow(); 72 } 73 74 75 public MinOptMax getHeight() { 76 return this.height; 77 } 78 79 83 public void setHeight(MinOptMax mom) { 84 this.height = mom; 85 } 86 87 88 public MinOptMax getExplicitHeight() { 89 return this.explicitHeight; 90 } 91 92 97 public void setExplicitHeight(MinOptMax mom) { 98 this.explicitHeight = mom; 99 } 100 101 102 public List getGridUnits() { 103 return gridUnits; 104 } 105 106 111 public GridUnit getGridUnit(int column) { 112 return (GridUnit)gridUnits.get(column); 113 } 114 115 122 public GridUnit safelyGetGridUnit(int column) { 123 if (column < gridUnits.size()) { 124 return (GridUnit)gridUnits.get(column); 125 } else { 126 return null; 127 } 128 } 129 130 135 public void setFlagForAllGridUnits(int flag, boolean value) { 136 Iterator iter = gridUnits.iterator(); 137 while (iter.hasNext()) { 138 GridUnit gu = (GridUnit)iter.next(); 139 gu.setFlag(flag, value); 140 } 141 } 142 143 150 public boolean getFlag(int which) { 151 if (which == FIRST_IN_PART) { 152 return getGridUnit(0).getFlag(GridUnit.FIRST_IN_PART); 153 } else if (which == LAST_IN_PART) { 154 return getGridUnit(0).getFlag(GridUnit.LAST_IN_PART); 155 } else { 156 throw new IllegalArgumentException ("Illegal flag queried: " + which); 157 } 158 } 159 160 161 public String toString() { 162 StringBuffer sb = new StringBuffer ("EffRow {"); 163 sb.append(index); 164 if (getBodyType() == TableRowIterator.BODY) { 165 sb.append(" in body"); 166 } else if (getBodyType() == TableRowIterator.HEADER) { 167 sb.append(" in header"); 168 } else { 169 sb.append(" in footer"); 170 } 171 sb.append(", ").append(height); 172 sb.append(", ").append(explicitHeight); 173 sb.append(", ").append(gridUnits.size()).append(" gu"); 174 sb.append("}"); 175 return sb.toString(); 176 } 177 } 178 | Popular Tags |