1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.document.web;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import javax.servlet.jsp.JspException;
22 import javax.servlet.jsp.PageContext;
23 import javax.servlet.jsp.tagext.Tag;
24
25 import org.kuali.ole.sys.document.web.renderers.TableRowRenderer;
26 import org.kuali.rice.kns.web.ui.Field;
27
28
29
30
31 public class AccountingLineTableRow implements RenderableElement {
32 private List<AccountingLineTableCell> cells;
33 private AccountingLineRenderingContext renderingContext;
34
35
36
37
38 public AccountingLineTableRow() {
39 cells = new ArrayList<AccountingLineTableCell>();
40 }
41
42
43
44
45
46 public List<AccountingLineTableCell> getCells() {
47 return cells;
48 }
49
50
51
52
53
54 public void setCells(List<AccountingLineTableCell> cells) {
55 this.cells = cells;
56 }
57
58
59
60
61
62 public void addCell(AccountingLineTableCell cell) {
63 cells.add(cell);
64 }
65
66
67
68
69 public boolean isHidden() {
70 for (AccountingLineTableCell cell : cells) {
71 if (!cell.isHidden()) {
72 return false;
73 }
74 }
75 return true;
76 }
77
78
79
80
81
82 public boolean isActionBlock() {
83 return false;
84 }
85
86
87
88
89 public boolean isEmpty() {
90 for (AccountingLineTableCell cell : cells) {
91 if (!cell.isEmpty()) {
92 return false;
93 }
94 }
95 return true;
96 }
97
98
99
100
101 public void renderElement(PageContext pageContext, Tag parentTag, AccountingLineRenderingContext renderingContext) throws JspException {
102 TableRowRenderer renderer = new TableRowRenderer();
103 this.renderingContext = renderingContext;
104 renderer.setRow(this);
105 renderer.render(pageContext, parentTag);
106 renderer.clear();
107 this.renderingContext = null;
108 }
109
110
111
112
113
114
115
116
117
118 public void renderChildrenCells(PageContext pageContext, Tag parentTag) throws JspException {
119 for (AccountingLineTableCell cell : cells) {
120 cell.renderElement(pageContext, parentTag, renderingContext);
121 }
122 }
123
124
125
126
127
128 public int getChildCellCount() {
129 return cells.size();
130 }
131
132
133
134
135 public int getChildRenderableCount() {
136 int count = 0;
137 for (AccountingLineTableCell cell : cells) {
138 count += cell.getColSpan();
139 }
140 return count;
141 }
142
143
144
145
146
147
148
149 public void appendFields(List<Field> fields) {
150 for (AccountingLineTableCell cell : cells) {
151 cell.appendFields(fields);
152 }
153 }
154
155
156
157
158 public void populateWithTabIndexIfRequested(int reallyHighIndex) {
159 for (AccountingLineTableCell cell : cells) {
160 cell.populateWithTabIndexIfRequested(reallyHighIndex);
161 }
162 }
163
164
165
166
167
168 public boolean safeToRemove() {
169 for (AccountingLineTableCell cell : cells) {
170 if (!cell.safeToRemove()) return false;
171 }
172 return true;
173 }
174 }