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.layout.collections; 017 018import org.kuali.rice.krad.uif.field.Field; 019 020import java.io.Serializable; 021import java.util.List; 022 023/** 024 * Holds the components that make up a row within the table layout. 025 * 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 * @see org.kuali.rice.krad.uif.layout.TableLayoutManager 028 */ 029public class TableRow implements Serializable { 030 private static final long serialVersionUID = -3566983879980459225L; 031 032 private List<Field> columns; 033 034 /** 035 * Empty Constructor. 036 */ 037 public TableRow() { 038 039 } 040 041 /** 042 * Constructor with columns for the row. 043 * 044 * @param columns list of fields that make up the row's columns 045 */ 046 public TableRow(List<Field> columns) { 047 this.columns = columns; 048 } 049 050 /** 051 * List of field components that make up the row's columns. 052 * 053 * @return list of field components 054 */ 055 public List<Field> getColumns() { 056 return columns; 057 } 058 059 /** 060 * @see TableRow#getColumns() 061 */ 062 public void setColumns(List<Field> columns) { 063 this.columns = columns; 064 } 065 066 /** 067 * Returns the field instance that makes up the column with the given index. 068 * 069 * @param columnIndex index for the column to return 070 * @return field instance at that column, or null if column does not exist 071 */ 072 public Field getColumn(int columnIndex) { 073 Field column = null; 074 075 if ((this.columns != null) && (this.columns.size() > columnIndex)) { 076 column = this.columns.get(columnIndex); 077 } 078 079 return column; 080 } 081 082 /** 083 * Returns the number of columns within the row. 084 * 085 * @return number of columns 086 */ 087 public int getNumberOfColumns() { 088 if (this.columns != null) { 089 return this.columns.size(); 090 } 091 092 return 0; 093 } 094}