KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > olstore > form > CreateTypeForm


1 /**
2  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  *
19  * Component of: Red Hat Application Server
20  *
21  * Initial Developers: Aizaz Ahmed
22  * Vivek Lakshmanan
23  * Andrew Overholt
24  * Matthew Wringe
25  *
26  */

27 package olstore.form;
28
29 //import olstore.dto.TypeValue;
30

31 import java.util.Vector;
32
33 import olstore.dto.PropertyValue;
34
35
36 public class CreateTypeForm extends DemoBaseForm {
37     
38     
39     private String Name = null;
40     
41     private String NumProps = null;
42     private String Submit = null;
43     
44     private Vector Properties = new Vector() ;
45     
46     
47     public String getName () {
48         return this.Name;
49     }
50     public void setName ( String name ) {
51         this.Name = name;
52     }
53     
54     
55     /**
56      * This autoincrements the size of the vector, so will not return null
57      * . This is necessary as the struts auto-populater expects
58      * non-null to be retured, and we don't know how many it will
59      * request.
60      */

61     public PropertyValue getProp (int index) {
62         if ( index >= Properties.size() ) {
63             int size = Properties.size();
64             for ( int i =0; i < (index-size) + 1 ; i++ ) {
65                 Properties.add ( new PropertyValue() );
66             }
67         }
68         return (PropertyValue) Properties.get ( index );
69     }
70     
71     public void setProp ( int index, PropertyValue property ) {
72         Properties.set ( index, property );
73     }
74     
75     /**
76      * Returns a reference to the internal Properties, use wisely
77      */

78     public Vector getProperties( ) {
79         return Properties;
80     }
81     
82     public void setProperties ( Vector props ) {
83         Properties = props;
84     }
85     
86     
87     // Presentation specific fields
88
public String getNumProps () {
89         return this.NumProps;
90     }
91     public void setNumProps ( String numProps) {
92         this.NumProps = numProps;
93     }
94     
95     public String getSubmitType () {
96         return this.Submit;
97     }
98     public void setSubmitType ( String submit ) {
99         this.Submit = submit;
100     }
101     
102 }
103
Popular Tags