1   package org.wcb.gui.forms.wizard;
2   
3   import org.wcb.gui.component.JXTitlePanel;
4   import org.wcb.gui.component.WaveButton;
5   import org.wcb.gui.forms.CSVDataExportSelectForm;
6   import org.wcb.resources.MessageKey;
7   import org.wcb.resources.MessageResourceRegister;
8   import org.jdesktop.swingx.border.DropShadowBorder;
9   
10  import javax.swing.border.Border;
11  import javax.swing.border.CompoundBorder;
12  import javax.swing.*;
13  import java.awt.*;
14  import java.awt.event.ActionListener;
15  import java.awt.event.ActionEvent;
16  
17  /**
18   * <small>
19   * <p/>
20   * Copyright (C)  2006  wbogaardt.
21   * This library is free software; you can redistribute it and/or
22   * modify it under the terms of the GNU Lesser General Public
23   * License as published by the Free Software Foundation; either
24   * version 2.1 of the License, or (at your option) any later version.
25   * <p/>
26   * This library is distributed in the hope that it will be useful,
27   * but WITHOUT ANY WARRANTY; without even the implied warranty of
28   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29   * Lesser General Public License for more details.
30   * <p/>
31   * You should have received a copy of the GNU Lesser General Public
32   * License along with this library; if not, write to the Free Software
33   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
34   * <p/>
35   * $File:  $ <br>
36   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Oct 26, 2006 2:43:12 PM $ <br>
37   * </small>
38   *
39   * @author wbogaardt
40   *         Wizard step 1 type of application the applicant is applying for.
41   */
42  
43  public class Step1ofExportWizard extends JXTitlePanel implements ActionListener {
44  
45      private CSVDataExportSelectForm form;
46      private JButton selectAllButton;
47      private JButton clearAllButton;
48  
49  
50      public Step1ofExportWizard() {
51          super("Step 1 - Select Fields", new Color(0x3779ff));
52          Border shadow = new DropShadowBorder(Color.BLACK, 1, 5, .3f, 15, true, true, true, true);
53          setBorder(new CompoundBorder(shadow, getBorder()));
54          initComponents();
55      }
56  
57      /** This method is called from within the constructor to
58       * initialize the form.
59       * WARNING: Do NOT modify this code. The content of this method is
60       * always regenerated by the Form Editor.
61       */
62      private void initComponents() {
63          form = new CSVDataExportSelectForm();
64          setLayout(new BorderLayout());
65  
66          selectAllButton = new WaveButton(MessageResourceRegister.getInstance().getValue(MessageKey.BUTTON_SELECT_ALL));
67          clearAllButton = new WaveButton(MessageResourceRegister.getInstance().getValue(MessageKey.BUTTON_CLEAR));
68          selectAllButton.addActionListener(this);
69          clearAllButton.addActionListener(this);
70          
71          JPanel buttonPanel = new JPanel();
72          buttonPanel.setLayout(new GridBagLayout());
73          GridBagConstraints gridBagConstraints = new GridBagConstraints();
74          gridBagConstraints.gridx = 0;
75          gridBagConstraints.gridy = 1;
76          gridBagConstraints.anchor = GridBagConstraints.WEST;
77          buttonPanel.add(selectAllButton, gridBagConstraints);
78  
79          gridBagConstraints = new GridBagConstraints();
80          gridBagConstraints.gridx = 1;
81          gridBagConstraints.gridy = 1;
82          gridBagConstraints.anchor = GridBagConstraints.WEST;
83          buttonPanel.add(clearAllButton, gridBagConstraints);
84  
85          add(form, BorderLayout.NORTH);
86          add(buttonPanel, BorderLayout.SOUTH);
87      }
88  
89       public void actionPerformed(ActionEvent evt) {
90          Object src = evt.getSource();
91          if (src.equals(selectAllButton))
92          {
93              form.setjCheckBoxEntryDate(true);
94              form.setjCheckBoxRegistration(true);
95              form.setjCheckBoxFAAFrom(true);
96              form.setjCheckBoxVIA(true);
97              form.setjCheckBoxFAATo(true);
98              form.setjCheckBoxFlightDuration(true);
99              form.setjCheckBoxPIC(true);
100             form.setjCheckBoxSIC(true);
101             form.setjCheckBoxDualReceived(true);
102             form.setjCheckBoxSafetyPilot(true);
103             form.setjCheckBoxCrossCountry(true);
104             form.setjCheckBoxFlightInstructing(true);
105             form.setjCheckBoxSolo(true);
106             form.setjCheckBoxDayTakeoff(true);
107             form.setjCheckBoxDayLanding(true);
108             form.setjCheckBoxNightTakeoff(true);
109             form.setjCheckBoxNightLanding(true);
110             form.setjCheckBoxConditionNight(true);
111             form.setjCheckBoxInstrumentApproaches(true);
112             form.setjCheckBoxSimulatedIMC(true);
113             form.setjCheckBoxActualIMC(true);
114             form.setjCheckBoxFlightSim(true);
115         }
116         if (src.equals(clearAllButton))
117         {
118             form.setjCheckBoxEntryDate(false);
119             form.setjCheckBoxRegistration(false);
120             form.setjCheckBoxFAAFrom(false);
121             form.setjCheckBoxVIA(false);
122             form.setjCheckBoxFAATo(false);
123             form.setjCheckBoxFlightDuration(false);
124             form.setjCheckBoxPIC(false);
125             form.setjCheckBoxSIC(false);
126             form.setjCheckBoxDualReceived(false);
127             form.setjCheckBoxSafetyPilot(false);
128             form.setjCheckBoxCrossCountry(false);
129             form.setjCheckBoxFlightInstructing(false);
130             form.setjCheckBoxSolo(false);
131             form.setjCheckBoxDayTakeoff(false);
132             form.setjCheckBoxDayLanding(false);
133             form.setjCheckBoxNightTakeoff(false);
134             form.setjCheckBoxNightLanding(false);
135             form.setjCheckBoxConditionNight(false);
136             form.setjCheckBoxInstrumentApproaches(false);
137             form.setjCheckBoxSimulatedIMC(false);
138             form.setjCheckBoxActualIMC(false);
139             form.setjCheckBoxFlightSim(false);
140         }
141     }
142 
143     public CSVDataExportSelectForm getForm() {
144         return form;
145     }
146 }