001/**
002 * Copyright 2005-2015 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.kns.web.ui;
017
018import java.util.ArrayList;
019import java.util.List;
020
021/**
022 * This class represents a row of fields on the ui.
023 *
024 * @deprecated KNS Struts deprecated, use KRAD and the Spring MVC framework.
025 */
026@Deprecated
027public class Row implements java.io.Serializable {
028
029    private static final long serialVersionUID = 5920833652172097098L;
030    private List<Field> fields;
031    private boolean hidden;
032
033    public Row() {
034        fields = new ArrayList<Field>();
035        hidden = false;
036    }
037
038    public Row(List<Field> fields) {
039        this.fields = fields;
040        hidden = false;
041    }
042
043    public Row(Field field) {
044        this.fields = new ArrayList<Field>();
045        fields.add(field);
046        hidden = false;
047    }
048
049    /**
050     * @return the fields contained in the row
051     */
052    public List<Field> getFields() {
053        return fields;
054    }
055
056    /**
057     * @param fields the fields to be displayed in the row.
058     */
059    public void setFields(List<Field> fields) {
060        this.fields = fields;
061    }
062
063    /**
064     * @return the hidden
065     */
066    public boolean isHidden() {
067        return hidden;
068    }
069
070    /**
071     * @param hidden the hidden to set
072     */
073    public void setHidden(boolean hidden) {
074        this.hidden = hidden;
075    }
076
077    public Field getField(int index) {
078        while (fields.size() <= index) {
079            Field field = new Field();
080            fields.add(field);
081        }
082        return (Field) fields.get(index);
083    }
084
085    public String toString(){
086        StringBuffer sRet = new StringBuffer();
087        sRet.append("[");
088
089        if(fields != null){
090                for(Field f: fields){
091                        sRet.append(f.getPropertyName() + ", ");
092                }
093
094                sRet.delete(sRet.length()-2, sRet.length());
095        }
096        sRet.append("]");
097
098        return sRet.toString();
099
100    }
101}