001/** 002 * Copyright 2005-2018 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.uif.element; 017 018import org.kuali.rice.krad.datadictionary.parse.BeanTag; 019import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute; 020import org.kuali.rice.krad.uif.component.Component; 021import org.kuali.rice.krad.uif.widget.RichTable; 022 023import java.util.List; 024import java.util.Set; 025 026/** 027 * Content element that renders a table using the {@link RichTable} widget configured with an Ajax (or Javascript) 028 * data source 029 * 030 * <p> 031 * Note this is different from the table layout manager in that it does not render nested components. The data is 032 * provided directly to the rich table widget which will create the table rows (unlike the table layout which creates 033 * the table from components then invokes the table plugin to decorate). Therefore this component just creates a table 034 * element tag and invokes the rich table script 035 * </p> 036 * 037 * <p> 038 * Nested HTML can be given through the rich table data. However generally this will be read-only data with possibly 039 * some inquiry links 040 * </p> 041 * 042 * @author Kuali Rice Team (rice.collab@kuali.org) 043 */ 044@BeanTag(name = "dataTable", parent = "Uif-DataTable") 045public class DataTable extends ContentElementBase { 046 private static final long serialVersionUID = 6201998559169962349L; 047 048 private RichTable richTable; 049 050 public DataTable() { 051 super(); 052 } 053 054 /** 055 * Widget that will render the data table client side 056 * 057 * @return RichTable instance 058 */ 059 @BeanTagAttribute 060 public RichTable getRichTable() { 061 return richTable; 062 } 063 064 /** 065 * Setter for the rich table widget 066 * 067 * @param richTable 068 */ 069 public void setRichTable(RichTable richTable) { 070 this.richTable = richTable; 071 } 072 073 /** 074 * @see org.kuali.rice.krad.uif.widget.RichTable#getAjaxSource() 075 */ 076 @BeanTagAttribute 077 public String getAjaxSource() { 078 if (richTable != null) { 079 return richTable.getAjaxSource(); 080 } 081 082 return null; 083 } 084 085 /** 086 * @see org.kuali.rice.krad.uif.widget.RichTable#setAjaxSource(java.lang.String) 087 */ 088 public void setAjaxSource(String ajaxSource) { 089 if (richTable != null) { 090 richTable.setAjaxSource(ajaxSource); 091 } 092 } 093 094 /** 095 * @see org.kuali.rice.krad.uif.widget.RichTable#getHiddenColumns() 096 */ 097 @BeanTagAttribute(type = BeanTagAttribute.AttributeType.SETVALUE) 098 public Set<String> getHiddenColumns() { 099 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(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}