1 /**
2 * Copyright 2005-2014 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.datadictionary.parse.BeanTag;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.widget.RichTable;
22
23 import java.util.List;
24 import java.util.Set;
25
26 /**
27 * Content element that renders a table using the {@link RichTable} widget configured with an Ajax (or Javascript)
28 * data source
29 *
30 * <p>
31 * Note this is different from the table layout manager in that it does not render nested components. The data is
32 * provided directly to the rich table widget which will create the table rows (unlike the table layout which creates
33 * the table from components then invokes the table plugin to decorate). Therefore this component just creates a table
34 * element tag and invokes the rich table script
35 * </p>
36 *
37 * <p>
38 * Nested HTML can be given through the rich table data. However generally this will be read-only data with possibly
39 * some inquiry links
40 * </p>
41 *
42 * @author Kuali Rice Team (rice.collab@kuali.org)
43 */
44 @BeanTag(name = "dataTable-bean", parent = "Uif-DataTable")
45 public class DataTable extends ContentElementBase {
46 private static final long serialVersionUID = 6201998559169962349L;
47
48 private RichTable richTable;
49
50 public DataTable() {
51 super();
52 }
53
54 /**
55 * Widget that will render the data table client side
56 *
57 * @return RichTable instance
58 */
59 @BeanTagAttribute(name = "richTable", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
60 public RichTable getRichTable() {
61 return richTable;
62 }
63
64 /**
65 * Setter for the rich table widget
66 *
67 * @param richTable
68 */
69 public void setRichTable(RichTable richTable) {
70 this.richTable = richTable;
71 }
72
73 /**
74 * @see org.kuali.rice.krad.uif.widget.RichTable#getAjaxSource()
75 */
76 @BeanTagAttribute(name = "ajaxSource")
77 public String getAjaxSource() {
78 if (richTable != null) {
79 return richTable.getAjaxSource();
80 }
81
82 return null;
83 }
84
85 /**
86 * @see org.kuali.rice.krad.uif.widget.RichTable#setAjaxSource(java.lang.String)
87 */
88 public void setAjaxSource(String ajaxSource) {
89 if (richTable != null) {
90 richTable.setAjaxSource(ajaxSource);
91 }
92 }
93
94 /**
95 * @see org.kuali.rice.krad.uif.widget.RichTable#getHiddenColumns()
96 */
97 @BeanTagAttribute(name = "hiddenColumns", type = BeanTagAttribute.AttributeType.SETVALUE)
98 public Set<String> getHiddenColumns() {
99 if (richTable != null) {
100 return richTable.getHiddenColumns();
101 }
102
103 return null;
104 }
105
106 /**
107 * @see org.kuali.rice.krad.uif.widget.RichTable#setHiddenColumns(Set)
108 */
109 public void setHiddenColumns(Set<String> hiddenColumns) {
110 if (richTable != null) {
111 richTable.setHiddenColumns(hiddenColumns);
112 }
113 }
114
115 /**
116 * @see org.kuali.rice.krad.uif.widget.RichTable#getSortableColumns()
117 */
118 @BeanTagAttribute(name = "sortableColumns", type = BeanTagAttribute.AttributeType.SETVALUE)
119 public Set<String> getSortableColumns() {
120 if (richTable != null) {
121 return richTable.getSortableColumns();
122 }
123
124 return null;
125 }
126
127 /**
128 * @see org.kuali.rice.krad.uif.widget.RichTable#setSortableColumns(Set)
129 */
130 public void setSortableColumns(Set<String> sortableColumns) {
131 if (richTable != null) {
132 richTable.setSortableColumns(sortableColumns);
133 }
134 }
135 }