1   package org.wcb.gui.forms.wizard;
2   
3   import org.wcb.gui.component.JXTitlePanel;
4   import org.wcb.model.vo.hibernate.FAA8710ApplicationBO;
5   import org.jdesktop.swingx.border.DropShadowBorder;
6   
7   import javax.swing.border.Border;
8   import javax.swing.border.CompoundBorder;
9   import javax.swing.*;
10  import java.awt.*;
11  import java.util.Date;
12  
13  import com.toedter.calendar.JDateChooser;
14  
15  /**
16   * <small>
17   * <p/>
18   * Copyright (C)  2006  wbogaardt.
19   * This library is free software; you can redistribute it and/or
20   * modify it under the terms of the GNU Lesser General Public
21   * License as published by the Free Software Foundation; either
22   * version 2.1 of the License, or (at your option) any later version.
23   * <p/>
24   * This library is distributed in the hope that it will be useful,
25   * but WITHOUT ANY WARRANTY; without even the implied warranty of
26   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27   * Lesser General Public License for more details.
28   * <p/>
29   * You should have received a copy of the GNU Lesser General Public
30   * License along with this library; if not, write to the Free Software
31   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
32   * <p/>
33   * $File:  $ <br>
34   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Oct 26, 2006 2:43:12 PM $ <br>
35   * </small>
36   *
37   * @author wbogaardt
38   *        Step 2 is personal airman information.
39   */
40  
41  public class Step2of8710Wizard extends JXTitlePanel {
42  
43      public Step2of8710Wizard() {
44          super("Step 2 of 6 - Airman Information", new Color(0x3779ff));
45          Border shadow = new DropShadowBorder(Color.BLACK, 1, 5, .3f, 15, true, true, true, true);
46          setBorder(new CompoundBorder(shadow, getBorder()));
47          initComponents();
48      }
49  
50      /** This method is called from within the constructor to
51       * initialize the form.
52       * WARNING: Do NOT modify this code. The content of this method is
53       * always regenerated by the Form Editor.
54       */
55      private void initComponents() {
56  
57          JPanel personalPanel = new JPanel();
58          personalPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Personal Information"));
59          java.awt.GridBagConstraints gridBagConstraints;
60          lastName = new JTextField(30);
61          firstName = new JTextField(30);
62          middleName = new JTextField(30);
63          ssn1 = new JTextField(5);
64          ssn2 = new JTextField(3);
65          ssn3 = new JTextField(5);
66          placeOfBirth = new JTextField(20);
67          birthDate = new JDateChooser();
68          cityTf = new JTextField(20);
69          stateCombo = new JComboBox();
70          streetAddressTf = new JTextField(20);
71          zipCodeTf = new JTextField(10);
72  
73          personalPanel.setLayout(new java.awt.GridBagLayout());
74  
75          gridBagConstraints = new java.awt.GridBagConstraints();
76          gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
77          personalPanel.add(new JLabel("Last Name"), gridBagConstraints);
78  
79          gridBagConstraints = new java.awt.GridBagConstraints();
80          gridBagConstraints.gridwidth = 6;
81          gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
82          gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
83          personalPanel.add(lastName, gridBagConstraints);
84  
85          gridBagConstraints = new java.awt.GridBagConstraints();
86          gridBagConstraints.gridx = 0;
87          gridBagConstraints.gridy = 1;
88          gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
89          personalPanel.add(new JLabel("First Name"), gridBagConstraints);
90  
91          gridBagConstraints = new java.awt.GridBagConstraints();
92          gridBagConstraints.gridx = 1;
93          gridBagConstraints.gridy = 1;
94          gridBagConstraints.gridwidth = 6;
95          gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
96          gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
97          personalPanel.add(firstName, gridBagConstraints);
98  
99          gridBagConstraints = new java.awt.GridBagConstraints();
100         gridBagConstraints.gridx = 0;
101         gridBagConstraints.gridy = 2;
102         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
103         personalPanel.add(new JLabel("Middle Name"), gridBagConstraints);
104 
105         gridBagConstraints = new java.awt.GridBagConstraints();
106         gridBagConstraints.gridx = 1;
107         gridBagConstraints.gridy = 2;
108         gridBagConstraints.gridwidth = 6;
109         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
110         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
111         personalPanel.add(middleName, gridBagConstraints);
112 
113         //SSN
114         gridBagConstraints = new java.awt.GridBagConstraints();
115         gridBagConstraints.gridx = 0;
116         gridBagConstraints.gridy = 3;
117         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
118         personalPanel.add(new JLabel("SSN"), gridBagConstraints);
119 
120         gridBagConstraints = new java.awt.GridBagConstraints();
121         gridBagConstraints.gridx = 1;
122         gridBagConstraints.gridy = 3;
123         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
124         personalPanel.add(ssn1, gridBagConstraints);
125 
126         gridBagConstraints = new java.awt.GridBagConstraints();
127         gridBagConstraints.gridx = 2;
128         gridBagConstraints.gridy = 3;
129         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
130         personalPanel.add(new JLabel("-"), gridBagConstraints);
131 
132         gridBagConstraints = new java.awt.GridBagConstraints();
133         gridBagConstraints.gridx = 3;
134         gridBagConstraints.gridy = 3;
135         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
136         personalPanel.add(ssn2, gridBagConstraints);
137 
138         gridBagConstraints = new java.awt.GridBagConstraints();
139         gridBagConstraints.gridx = 4;
140         gridBagConstraints.gridy = 3;
141         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
142         personalPanel.add(new JLabel("-"), gridBagConstraints);
143 
144         gridBagConstraints = new java.awt.GridBagConstraints();
145         gridBagConstraints.gridx = 5;
146         gridBagConstraints.gridy = 3;
147         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
148         personalPanel.add(ssn3, gridBagConstraints);
149 
150         gridBagConstraints = new java.awt.GridBagConstraints();
151         gridBagConstraints.gridx = 6;
152         gridBagConstraints.gridy = 3;
153         gridBagConstraints.insets = new Insets(0,5,0,0);
154         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
155         personalPanel.add(new JLabel("(US Applicants Only)"), gridBagConstraints);
156 
157         // Date of birth
158         gridBagConstraints = new java.awt.GridBagConstraints();
159         gridBagConstraints.gridx = 0;
160         gridBagConstraints.gridy = 4;
161         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
162         personalPanel.add(new JLabel("Date of Birth"), gridBagConstraints);
163 
164         gridBagConstraints = new java.awt.GridBagConstraints();
165         gridBagConstraints.gridx = 1;
166         gridBagConstraints.gridy = 4;
167          gridBagConstraints.gridwidth = 6;
168         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
169         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
170         personalPanel.add(birthDate, gridBagConstraints);
171 
172         //Place of Birth
173         gridBagConstraints = new java.awt.GridBagConstraints();
174         gridBagConstraints.gridx = 0;
175         gridBagConstraints.gridy = 5;
176         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
177         personalPanel.add(new JLabel("Place of Birth"), gridBagConstraints);
178 
179         gridBagConstraints = new java.awt.GridBagConstraints();
180         gridBagConstraints.gridx = 1;
181         gridBagConstraints.gridy = 5;
182         gridBagConstraints.gridwidth = 6;
183         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
184         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
185         personalPanel.add(placeOfBirth, gridBagConstraints);
186         add(personalPanel, BorderLayout.NORTH);
187         add(getAddressPanel(), BorderLayout.CENTER);
188 
189 
190     }
191 
192     private JPanel getAddressPanel() {
193         JPanel addressPanel = new JPanel(new GridBagLayout());
194 
195         addressPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Address"));
196 
197         addressPanel.add(new JLabel("Address"), new java.awt.GridBagConstraints());
198         addressPanel.add(streetAddressTf, new java.awt.GridBagConstraints());
199 
200         GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
201         gridBagConstraints.gridx = 0;
202         gridBagConstraints.gridy = 1;
203         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
204         addressPanel.add(new JLabel("City"), gridBagConstraints);
205 
206         gridBagConstraints = new java.awt.GridBagConstraints();
207         gridBagConstraints.gridx = 1;
208         gridBagConstraints.gridy = 1;
209         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
210         addressPanel.add(cityTf, gridBagConstraints);
211 
212         gridBagConstraints = new java.awt.GridBagConstraints();
213         gridBagConstraints.gridx = 0;
214         gridBagConstraints.gridy = 2;
215         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
216         addressPanel.add(new JLabel("State"), gridBagConstraints);
217 
218         stateCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID",
219                                          "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO",
220                                          "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA",
221                                          "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"}));
222         gridBagConstraints = new java.awt.GridBagConstraints();
223         gridBagConstraints.gridx = 1;
224         gridBagConstraints.gridy = 2;
225         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
226         addressPanel.add(stateCombo, gridBagConstraints);
227 
228         gridBagConstraints = new java.awt.GridBagConstraints();
229         gridBagConstraints.gridx = 2;
230         gridBagConstraints.gridy = 2;
231         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
232         addressPanel.add(new JLabel("Zip code"), gridBagConstraints);
233 
234         gridBagConstraints = new java.awt.GridBagConstraints();
235         gridBagConstraints.gridx = 3;
236         gridBagConstraints.gridy = 2;
237         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
238         addressPanel.add(zipCodeTf, gridBagConstraints);
239         return addressPanel;
240     }
241 
242     public void loadApplicant(FAA8710ApplicationBO app) {
243         this.firstName.setText(app.getFirstName());
244         this.lastName.setText(app.getLastName());
245         this.middleName.setText(app.getMiddleName());
246         this.birthDate.setDate(app.getBirthDate());
247         this.placeOfBirth.setText(app.getPlaceOfBirth());
248         this.streetAddressTf.setText(app.getAddress());
249         this.cityTf.setText(app.getCity());
250         this.stateCombo.setSelectedItem(app.getState());
251         this.zipCodeTf.setText(app.getZip());
252     }
253 
254     /**
255      * User's last name
256      * @return A. last name
257      */
258     public String getLastName() {
259         return lastName.getText();
260     }
261 
262     /**
263      * User's First name
264      * @return A. first name of applicant
265      */
266     public String getFirstName() {
267         return firstName.getText();
268     }
269 
270     /**
271      * User's middle name
272      * @return A. middle name of applicant
273      */
274     public String getMiddleName() {
275         return middleName.getText();
276     }
277 
278     /**
279      * User's social security number
280      * @return B. applicant's ssn number in proper xxx-xx-xxxx format
281      */
282     public String getSSN() {
283         return ssn1.getText() + "-" + ssn2.getText() + "-" + ssn3.getText();
284     }
285 
286     /**
287      * Get user's date of birth
288      * @return C. applicant's date of birth
289      */
290     public Date getBirthDate() {
291         return birthDate.getDate();
292     }
293 
294     /**
295      * User's place of birth
296      * @return D. place of birth
297      */
298     public String getPlaceOfBirth() {
299         return placeOfBirth.getText();
300     }
301 
302     /**
303      * Applicant's address
304      * @return E. Address
305      */
306     public String getAddress() {
307         return streetAddressTf.getText();
308     }
309 
310     /**
311      * Applicant's city
312      * @return City
313      */
314     public String getCity() {
315         return cityTf.getText();
316     }
317 
318     /**
319      * Applicants state.
320      * @return State in two letter format.
321      */
322     public String getState() {
323         return (String) stateCombo.getSelectedItem();
324     }
325 
326     /**
327      * Applicant's zip code
328      * @return  zip code of address
329      */
330     public String getZipcode() {
331         return zipCodeTf.getText();
332     }
333 
334     // Variables declaration - do not modify
335     private JTextField lastName;
336     private JTextField firstName;
337     private JTextField middleName;
338     private JTextField ssn1, ssn2, ssn3;
339     private JDateChooser birthDate;
340     private JTextField placeOfBirth;
341     private JTextField cityTf;
342     private JComboBox stateCombo;
343     private JTextField streetAddressTf;
344     private JTextField zipCodeTf;
345     // End of variables declaration
346 
347 }