1 12 package org.displaytag.model; 13 14 import java.util.Iterator ; 15 import java.util.List ; 16 17 18 23 public class ColumnIterator 24 { 25 26 29 private Row parentRow; 30 31 34 private Iterator headerIterator; 35 36 39 private Iterator cellIterator; 40 41 46 public ColumnIterator(List columns, Row row) 47 { 48 this.headerIterator = columns.iterator(); 49 this.cellIterator = row.getCellList().iterator(); 50 this.parentRow = row; 51 } 52 53 57 public boolean hasNext() 58 { 59 return this.headerIterator.hasNext(); 60 } 61 62 66 public Column nextColumn() 67 { 68 HeaderCell header = (HeaderCell) this.headerIterator.next(); 69 70 Cell cell = Cell.EMPTY_CELL; 71 72 if (this.cellIterator.hasNext()) 75 { 76 cell = (Cell) this.cellIterator.next(); 77 } 78 79 return new Column(header, cell, this.parentRow); 81 } 82 83 } | Popular Tags |