/**
 * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Component of: Red Hat Application Server
 * 
 * Initial Developers: Aizaz Ahmed
 *                     Vivek Lakshmanan
 *                     Andrew Overholt
 *                     Matthew Wringe
 *
 */
package olstore.form;

//import olstore.dto.TypeValue;

import java.util.Vector;

import olstore.dto.PropertyValue;


public class CreateTypeForm extends DemoBaseForm {
    
    
    private String Name = null;
    
    private String NumProps = null;
    private String Submit = null;
    
    private Vector Properties = new Vector() ;
    
    
    public String getName () {
        return this.Name;
    }
    public void setName ( String name ) {
        this.Name = name;
    }
    
    
    /**
     * This autoincrements the size of the vector, so will not return null
     * . This is necessary as the struts auto-populater expects
     * non-null to be retured, and we don't know how many it will
     * request.
     */
    public PropertyValue getProp (int index) {
        if ( index >= Properties.size() ) {
            int size = Properties.size();
            for ( int i =0; i < (index-size) + 1 ; i++ ) {
                Properties.add ( new PropertyValue() );
            }
        }
        return (PropertyValue) Properties.get ( index );
    }
    
    public void setProp ( int index, PropertyValue property ) {
        Properties.set ( index, property );
    }
    
    /**
     * Returns a reference to the internal Properties, use wisely
     */
    public Vector getProperties( ) {
        return Properties;
    }
    
    public void setProperties ( Vector props ) {
        Properties = props;
    }
    
    
    // Presentation specific fields 
    public String getNumProps () {
        return this.NumProps;
    }
    public void setNumProps ( String numProps) {
        this.NumProps = numProps;
    }
    
    public String getSubmitType () {
        return this.Submit;
    }
    public void setSubmitType ( String submit ) {
        this.Submit = submit;
    }
    
}
