KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > olstore > form > CreateItemForm


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
28 package olstore.form;
29
30
31 import java.util.Vector;
32
33 import olstore.dto.PictureValue;
34 import olstore.dto.PropertyValue;
35
36
37 public class CreateItemForm extends DemoBaseForm {
38     
39     
40     private String ItemId = null;
41     private String Name = null;
42     private String Price = null;
43     private String ShortDesc = null;
44     private String LongDesc = null;
45     private String TypeId = null;
46     private Boolean MainPage = new Boolean ( false );
47     private Boolean SpecialOffer= new Boolean ( false );
48     
49     private String NumPics = null;
50     private String NumProps = null;
51     private String Submit = null;
52     
53     private Vector Properties = new Vector() ;
54     private Vector Pictures = new Vector();
55     
56     
57     public String getItemId () {
58         return this.ItemId;
59     }
60     public void setItemId ( String itemId ) {
61         this.ItemId = itemId;
62     }
63     
64     public String getName () {
65         return this.Name;
66     }
67     public void setName ( String name ) {
68         this.Name = name;
69     }
70     
71     public String getPrice () {
72         return this.Price;
73     }
74     public void setPrice ( String price ) {
75         this.Price= price;
76     }
77     
78     public String getShortDesc () {
79         return this.ShortDesc;
80     }
81     public void setShortDesc ( String shortDesc ) {
82         this.ShortDesc= shortDesc;
83     }
84     
85     public String getLongDesc () {
86         return this.LongDesc;
87     }
88     public void setLongDesc ( String longDesc) {
89         this.LongDesc = longDesc;
90     }
91     
92     public String getTypeId () {
93         return this.TypeId ;
94     }
95     public void setTypeId ( String typeId ) {
96         this.TypeId = typeId ;
97     }
98     
99     public Boolean getMainPage() {
100         return this.MainPage;
101     }
102     public void setMainPage ( Boolean mainPage) {
103         this.MainPage= mainPage;
104     }
105     
106     public Boolean getSpecialOffer () {
107         return this.SpecialOffer;
108     }
109     public void setSpecialOffer ( Boolean specialOffer ) {
110         this.SpecialOffer = specialOffer ;
111     }
112     
113     
114     /**
115      * This autoincrements the size of the vector, so will not return null
116      * . This is necessary as the struts auto-populater expects
117      * non-null to be retured, and we don't know how many it will
118      * request.
119      * TODO: CAN LIKELY NOW CHANGE THIS TO NOT HAVE TO RETURN
120      * A CUMBERSOME ARRAY
121      */

122     public PropertyValue getProp (int index) {
123         if ( index >= Properties.size() ) {
124             int size = Properties.size();
125             for ( int i =0; i < (index-size) + 1 ; i++ ) {
126                 Properties.add ( new PropertyValue() );
127             }
128         }
129         return (PropertyValue) Properties.get ( index );
130     }
131     
132     public void setProp ( int index, PropertyValue property ) {
133         Properties.set ( index, property );
134     }
135     
136     /**
137      * Returns a reference to the internal Properties, use wisely
138      */

139     public Vector getProperties( ) {
140         return Properties;
141     }
142     
143     public void setProperties ( Vector props ) {
144         Properties = props;
145     }
146     
147     /**
148      * This autoincrements the size of the vector, so will not return null
149      * . This is necessary as the struts auto-populater expects
150      * non-null to be retured, and we don't know how many it will
151      * request.
152      * TODO: CAN LIKELY NOW CHANGE THIS TO NOT HAVE TO RETURN
153      * A CUMBERSOME ARRAY
154      */

155     public PictureValue getPic (int index) {
156         if ( index >= Pictures.size() ) {
157             int size = Pictures.size();
158             for ( int i =0; i < (index-size) + 1 ; i++ ) {
159                 Pictures.add ( new PictureValue() );
160             }
161         }
162         return (PictureValue) Pictures.get ( index );
163     }
164     
165     public void setPic ( int index, PictureValue picture ) {
166         Pictures.set ( index, picture );
167     }
168     
169     /**
170      * Returns a reference to the internal Pictures, use wisely
171      */

172     public Vector getPictures( ) {
173         return Pictures;
174     }
175     
176     public void setPictures ( Vector pics ) {
177         Pictures = pics ;
178     }
179     
180     // Presentation specific fields
181
public String getNumPics () {
182         return this.NumPics;
183     }
184     public void setNumPics ( String numPics ) {
185         this.NumPics = numPics ;
186     }
187     
188     public String getNumProps () {
189         return this.NumProps;
190     }
191     public void setNumProps ( String numProps) {
192         this.NumProps = numProps;
193     }
194     
195     public String getSubmitType () {
196         return this.Submit;
197     }
198     public void setSubmitType ( String submit ) {
199         this.Submit = submit;
200     }
201     
202 }
203
Popular Tags