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.TableRenderer;
26 import org.kuali.rice.kns.web.ui.Field;
27
28
29
30
31 public class AccountingLineTable implements RenderableElement {
32 private List<AccountingLineTableRow> rows;
33 private AccountingLineRenderingContext renderingContext;
34
35
36
37
38
39 public List<AccountingLineTableRow> getRows() {
40 return rows;
41 }
42
43
44
45
46
47 public void setRows(List<AccountingLineTableRow> rows) {
48 this.rows = rows;
49 }
50
51
52
53
54 public boolean isHidden() {
55 for(AccountingLineTableRow row : rows) {
56 if (!row.isHidden()) {
57 return false;
58 }
59 }
60 return true;
61 }
62
63
64
65
66
67 public boolean isActionBlock() {
68 return false;
69 }
70
71
72
73
74
75 public boolean isEmpty() {
76 for (AccountingLineTableRow row : rows) {
77 if (!row.isEmpty()) {
78 return false;
79 }
80 }
81 return true;
82 }
83
84
85
86
87 public void renderElement(PageContext pageContext, Tag parentTag, AccountingLineRenderingContext renderingContext) throws JspException {
88 TableRenderer renderer = new TableRenderer();
89 this.renderingContext = renderingContext;
90 renderer.setTable(this);
91 renderer.render(pageContext, parentTag);
92 renderer.clear();
93 this.renderingContext = null;
94 }
95
96
97
98
99
100
101
102
103
104 public void renderChildrenRows(PageContext pageContext, Tag parentTag) throws JspException {
105 for (AccountingLineTableRow row : rows) {
106 row.renderElement(pageContext, parentTag, renderingContext);
107 }
108 }
109
110
111
112
113
114
115 public void appendFields(List<Field> fields) {
116 for (AccountingLineTableRow row : rows) {
117 row.appendFields(fields);
118 }
119 }
120
121
122
123
124 public void populateWithTabIndexIfRequested(int reallyHighIndex) {
125 for (AccountingLineTableRow row : rows) {
126 row.populateWithTabIndexIfRequested(reallyHighIndex);
127 }
128 }
129
130
131
132
133
134 public void addRow(AccountingLineTableRow row) {
135 if (rows == null) {
136 rows = new ArrayList<AccountingLineTableRow>();
137 }
138 rows.add(row);
139 }
140 }