1 /**
2 * Copyright 2005-2012 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.uif.element;
17
18 import org.kuali.rice.krad.uif.component.Component;
19 import org.kuali.rice.krad.uif.widget.RichTable;
20
21 import java.util.List;
22 import java.util.Set;
23
24 /**
25 * Content element that renders a table using the {@link RichTable} widget configured with an Ajax (or Javascript)
26 * data source
27 *
28 * <p>
29 * Note this is different from the table layout manager in that it does not render nested components. The data is
30 * provided directly to the rich table widget which will create the table rows (unlike the table layout which creates
31 * the table from components then invokes the table plugin to decorate). Therefore this component just creates a table
32 * element tag and invokes the rich table script
33 * </p>
34 *
35 * <p>
36 * Nested HTML can be given through the rich table data. However generally this will be read-only data with possibly
37 * some inquiry links
38 * </p>
39 *
40 * @author Kuali Rice Team (rice.collab@kuali.org)
41 */
42 public class DataTable extends ContentElementBase {
43 private static final long serialVersionUID = 6201998559169962349L;
44
45 private RichTable richTable;
46
47 public DataTable() {
48 super();
49 }
50
51 /**
52 * @see org.kuali.rice.krad.uif.component.Component#getComponentsForLifecycle()
53 */
54 @Override
55 public List<Component> getComponentsForLifecycle() {
56 List<Component> components = super.getComponentsForLifecycle();
57
58 components.add(richTable);
59
60 return components;
61 }
62
63 /**
64 * Widget that will render the data table client side
65 *
66 * @return RichTable instance
67 */
68 public RichTable getRichTable() {
69 return richTable;
70 }
71
72 /**
73 * Setter for the rich table widget
74 *
75 * @param richTable
76 */
77 public void setRichTable(RichTable richTable) {
78 this.richTable = richTable;
79 }
80
81 /**
82 * @see org.kuali.rice.krad.uif.widget.RichTable#getAjaxSource()
83 */
84 public String getAjaxSource() {
85 if (richTable != null) {
86 return richTable.getAjaxSource();
87 }
88
89 return null;
90 }
91
92 /**
93 * @see org.kuali.rice.krad.uif.widget.RichTable#setAjaxSource(java.lang.String)
94 */
95 public void setAjaxSource(String ajaxSource) {
96 if (richTable != null) {
97 richTable.setAjaxSource(ajaxSource);
98 }
99 }
100
101 /**
102 * @see org.kuali.rice.krad.uif.widget.RichTable#getHiddenColumns()
103 */
104 public Set<String> getHiddenColumns() {
105 if (richTable != null) {
106 return richTable.getHiddenColumns();
107 }
108
109 return null;
110 }
111
112 /**
113 * @see org.kuali.rice.krad.uif.widget.RichTable#setHiddenColumns(java.util.Set<java.lang.String>)
114 */
115 public void setHiddenColumns(Set<String> hiddenColumns) {
116 if (richTable != null) {
117 richTable.setHiddenColumns(hiddenColumns);
118 }
119 }
120
121 /**
122 * @see org.kuali.rice.krad.uif.widget.RichTable#getSortableColumns()
123 */
124 public Set<String> getSortableColumns() {
125 if (richTable != null) {
126 return richTable.getSortableColumns();
127 }
128
129 return null;
130 }
131
132 /**
133 * @see org.kuali.rice.krad.uif.widget.RichTable#setSortableColumns(java.util.Set<java.lang.String>)
134 */
135 public void setSortableColumns(Set<String> sortableColumns) {
136 if (richTable != null) {
137 richTable.setSortableColumns(sortableColumns);
138 }
139 }
140
141 }