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
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
58
59
60
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 }