1 | |
package net.sf.jolene.dom; |
2 | |
|
3 | |
import net.sf.jolene.constants.Tags; |
4 | |
|
5 | |
import java.util.ArrayList; |
6 | |
import java.util.Iterator; |
7 | |
import java.util.List; |
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | 0 | final class GridRow extends HTMLElement { |
14 | |
|
15 | |
List<GridCell> cells; |
16 | 42 | boolean header = false; |
17 | |
|
18 | 42 | GridRow() { |
19 | 42 | tag = Tags.tr; |
20 | 42 | cells = new ArrayList<GridCell>(0); |
21 | 42 | } |
22 | |
|
23 | |
GridCell cells(int cell) { |
24 | 6 | return cells.get(cell); |
25 | |
} |
26 | |
|
27 | |
@Override |
28 | |
public String toString() { |
29 | |
|
30 | 47 | StringBuilder sb = new StringBuilder(super.toString()); |
31 | 47 | String lf = System.getProperty("line.separator"); |
32 | |
|
33 | |
Iterator<GridCell> it; |
34 | 47 | it = cells.iterator(); |
35 | |
|
36 | 47 | sb.append(lf); |
37 | 190 | while (it.hasNext()) { |
38 | 143 | GridCell cell = it.next(); |
39 | 143 | cell.setHeader(header); |
40 | 143 | sb.append('\t').append(cell).append(lf); |
41 | 143 | } |
42 | 47 | sb.append("</").append(tag).append('>').append(lf); |
43 | 47 | return sb.toString(); |
44 | |
} |
45 | |
|
46 | |
public boolean isHeader() { |
47 | 0 | return header; |
48 | |
} |
49 | |
|
50 | |
public void setHeader(boolean header) { |
51 | 4 | this.header = header; |
52 | 4 | } |
53 | |
|
54 | |
|
55 | |
@Override |
56 | |
public final GridRow clone() { |
57 | 2 | return (GridRow) super.clone(); |
58 | |
} |
59 | |
} |