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.layout.collections; 17 18 import org.kuali.rice.krad.uif.field.Field; 19 20 import java.io.Serializable; 21 import java.util.List; 22 23 /** 24 * Holds the components that make up a row within the table layout. 25 * 26 * @author Kuali Rice Team (rice.collab@kuali.org) 27 * @see org.kuali.rice.krad.uif.layout.TableLayoutManager 28 */ 29 public class TableRow implements Serializable { 30 private static final long serialVersionUID = -3566983879980459225L; 31 32 private List<Field> columns; 33 34 /** 35 * Empty Constructor. 36 */ 37 public TableRow() { 38 39 } 40 41 /** 42 * Constructor with columns for the row. 43 * 44 * @param columns list of fields that make up the row's columns 45 */ 46 public TableRow(List<Field> columns) { 47 this.columns = columns; 48 } 49 50 /** 51 * List of field components that make up the row's columns. 52 * 53 * @return list of field components 54 */ 55 public List<Field> getColumns() { 56 return columns; 57 } 58 59 /** 60 * @see TableRow#getColumns() 61 */ 62 public void setColumns(List<Field> columns) { 63 this.columns = columns; 64 } 65 66 /** 67 * Returns the field instance that makes up the column with the given index. 68 * 69 * @param columnIndex index for the column to return 70 * @return field instance at that column, or null if column does not exist 71 */ 72 public Field getColumn(int columnIndex) { 73 Field column = null; 74 75 if ((this.columns != null) && (this.columns.size() > columnIndex)) { 76 column = this.columns.get(columnIndex); 77 } 78 79 return column; 80 } 81 82 /** 83 * Returns the number of columns within the row. 84 * 85 * @return number of columns 86 */ 87 public int getNumberOfColumns() { 88 if (this.columns != null) { 89 return this.columns.size(); 90 } 91 92 return 0; 93 } 94 }