]>
Commit | Line | Data |
---|---|---|
06a19cee | 1 | /** @file\r |
2 | \r | |
3f62225f | 3 | The file is used to create, update Events section of the MSA file\r |
06a19cee | 4 | \r |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | package org.tianocore.frameworkwizard.module.ui.dialog;\r | |
16 | \r | |
17 | import java.awt.event.ActionEvent;\r | |
18 | import java.util.Vector;\r | |
19 | \r | |
20 | import javax.swing.JButton;\r | |
21 | import javax.swing.JComboBox;\r | |
22 | import javax.swing.JLabel;\r | |
23 | import javax.swing.JPanel;\r | |
24 | import javax.swing.JScrollPane;\r | |
25 | import javax.swing.JTextField;\r | |
7ab6baa9 | 26 | import javax.swing.JTextArea;\r |
06a19cee | 27 | \r |
28 | import org.tianocore.frameworkwizard.common.DataType;\r | |
29 | import org.tianocore.frameworkwizard.common.DataValidation;\r | |
30 | import org.tianocore.frameworkwizard.common.EnumerationData;\r | |
31 | import org.tianocore.frameworkwizard.common.Log;\r | |
32 | import org.tianocore.frameworkwizard.common.Tools;\r | |
33 | import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r | |
55683eab | 34 | import org.tianocore.frameworkwizard.common.ui.IComboBox;\r |
06a19cee | 35 | import org.tianocore.frameworkwizard.common.ui.IDialog;\r |
36 | import org.tianocore.frameworkwizard.common.ui.IFrame;\r | |
37 | import org.tianocore.frameworkwizard.common.ui.StarLabel;\r | |
e08433ef | 38 | import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r |
06a19cee | 39 | import org.tianocore.frameworkwizard.module.Identifications.Events.EventsIdentification;\r |
d48c170d | 40 | import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r |
06a19cee | 41 | import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r |
42 | \r | |
43 | /**\r | |
3f62225f | 44 | * The class is used to create, update Events section of the MSA file \r |
45 | * It extends IDialog\r | |
7ab6baa9 | 46 | * \r |
47 | * @since ModuleEditor 1.0\r | |
48 | * \r | |
49 | */\r | |
06a19cee | 50 | public class EventsDlg extends IDialog {\r |
51 | \r | |
a929458e | 52 | // /\r |
53 | // / Define class Serial Version UID\r | |
54 | // /\r | |
55 | private static final long serialVersionUID = -4396143706422842331L;\r | |
06a19cee | 56 | \r |
a929458e | 57 | //\r |
58 | // Define class members\r | |
59 | //\r | |
60 | private JPanel jContentPane = null;\r | |
06a19cee | 61 | \r |
a929458e | 62 | private JLabel jLabelEventType = null;\r |
06a19cee | 63 | \r |
a929458e | 64 | private JLabel jLabelC_Name = null;\r |
06a19cee | 65 | \r |
55683eab | 66 | private IComboBox iComboBoxGuidC_Name = null;\r |
06a19cee | 67 | \r |
a929458e | 68 | private JLabel jLabelUsage = null;\r |
06a19cee | 69 | \r |
a929458e | 70 | private JLabel jLabelGroup = null;\r |
06a19cee | 71 | \r |
a929458e | 72 | private JComboBox jComboBoxUsage = null;\r |
06a19cee | 73 | \r |
a929458e | 74 | private JComboBox jComboBoxEventGroup = null;\r |
06a19cee | 75 | \r |
a929458e | 76 | private StarLabel jStarLabel1 = null;\r |
06a19cee | 77 | \r |
a929458e | 78 | private StarLabel jStarLabel2 = null;\r |
06a19cee | 79 | \r |
a929458e | 80 | private StarLabel jStarLabel3 = null;\r |
06a19cee | 81 | \r |
a929458e | 82 | private StarLabel jStarLabel4 = null;\r |
06a19cee | 83 | \r |
a929458e | 84 | private JComboBox jComboBoxEventsType = null;\r |
06a19cee | 85 | \r |
a929458e | 86 | private JScrollPane jScrollPane = null;\r |
06a19cee | 87 | \r |
a929458e | 88 | private JLabel jLabelArch = null;\r |
06a19cee | 89 | \r |
a929458e | 90 | private JLabel jLabelHelpText = null;\r |
06a19cee | 91 | \r |
a929458e | 92 | private JTextArea jTextAreaHelpText = null;\r |
06a19cee | 93 | \r |
a929458e | 94 | private JScrollPane jScrollPaneHelpText = null;\r |
06a19cee | 95 | \r |
a929458e | 96 | private JLabel jLabelFeatureFlag = null;\r |
06a19cee | 97 | \r |
a929458e | 98 | private JTextField jTextFieldFeatureFlag = null;\r |
06a19cee | 99 | \r |
a929458e | 100 | private ArchCheckBox jArchCheckBox = null;\r |
06a19cee | 101 | \r |
a929458e | 102 | private JButton jButtonOk = null;\r |
06a19cee | 103 | \r |
a929458e | 104 | private JButton jButtonCancel = null;\r |
06a19cee | 105 | \r |
a929458e | 106 | //\r |
107 | // Not used by UI\r | |
108 | //\r | |
109 | private EventsIdentification id = null;\r | |
110 | \r | |
111 | private EnumerationData ed = new EnumerationData();\r | |
112 | \r | |
113 | private WorkspaceTools wt = new WorkspaceTools();\r | |
114 | \r | |
115 | /**\r | |
116 | * This method initializes jComboBoxType\r | |
117 | * \r | |
118 | * @return javax.swing.JComboBox jComboBoxType\r | |
119 | * \r | |
120 | */\r | |
121 | private JComboBox getJComboBoxEventsType() {\r | |
122 | if (jComboBoxEventsType == null) {\r | |
123 | jComboBoxEventsType = new JComboBox();\r | |
3f62225f | 124 | jComboBoxEventsType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));\r |
a929458e | 125 | jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20));\r |
126 | jComboBoxEventsType\r | |
9e857952 | 127 | .setToolTipText("<html>Select CreateEvents if the Module has an event that is waiting to be signaled.<br>"\r |
128 | + "Select SignalEvents if the Module will signal all events in an event group.<br>"\r | |
129 | + "NOTE: Signal events are named by GUID.</html>");\r | |
a929458e | 130 | }\r |
131 | return jComboBoxEventsType;\r | |
132 | }\r | |
06a19cee | 133 | \r |
a929458e | 134 | /**\r |
135 | * This method initializes jTextFieldC_Name\r | |
136 | * \r | |
137 | * @return javax.swing.JTextField jTextFieldC_Name\r | |
138 | * \r | |
139 | */\r | |
55683eab | 140 | private IComboBox getIComboBoxGuidC_Name() {\r |
141 | if (iComboBoxGuidC_Name == null) {\r | |
142 | iComboBoxGuidC_Name = new IComboBox();\r | |
143 | iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 37, 320, 20));\r | |
144 | iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));\r | |
145 | iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Event");\r | |
a929458e | 146 | }\r |
55683eab | 147 | return iComboBoxGuidC_Name;\r |
a929458e | 148 | }\r |
06a19cee | 149 | \r |
a929458e | 150 | /**\r |
151 | * This method initializes jComboBoxEventsType\r | |
152 | * \r | |
153 | * @return javax.swing.JComboBox\r | |
154 | */\r | |
155 | private JComboBox getJComboBoxEventGroup() {\r | |
156 | if (jComboBoxEventGroup == null) {\r | |
157 | jComboBoxEventGroup = new JComboBox();\r | |
3f62225f | 158 | jComboBoxEventGroup.setBounds(new java.awt.Rectangle(168, 62, 320, 20));\r |
a929458e | 159 | jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20));\r |
160 | jComboBoxEventGroup.setToolTipText("Select Type of Event: Guid or Timer.");\r | |
161 | \r | |
162 | }\r | |
163 | return jComboBoxEventGroup;\r | |
164 | }\r | |
06a19cee | 165 | \r |
a929458e | 166 | /**\r |
167 | * This method initializes jComboBoxUsage\r | |
168 | * \r | |
169 | * @return javax.swing.JComboBox jComboBoxUsage\r | |
170 | * \r | |
171 | */\r | |
172 | private JComboBox getJComboBoxUsage() {\r | |
173 | if (jComboBoxUsage == null) {\r | |
174 | jComboBoxUsage = new JComboBox();\r | |
3f62225f | 175 | jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 87, 320, 20));\r |
a929458e | 176 | jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r |
177 | jComboBoxUsage\r | |
9e857952 | 178 | .setToolTipText("<html><table>"\r |
179 | + "<tr><td colspan=2 align=center><b>Create Events</b></td></tr>"\r | |
180 | + "<tr><td>ALWAYS_CONSUMED</td><td>Module registers a notification function and REQUIRES that it be<br>"\r | |
181 | + "executed for the module to fully function.</td></tr>"\r | |
182 | + "<tr><td>SOMETIMES_CONSUMED</td><td>Module registers a notification function and calls the function<br>"\r | |
183 | + "when it is signaled</td></tr><tr><td colspan=2 align=center><b>Signal Events</b></td></tr>"\r | |
184 | + "<tr><td>ALWAYS_PRODUCED</td><td>Module will Always signal the event</td></tr>"\r | |
185 | + "<tr><td>SOMETIMES_PRODUCED</td><td>Module will sometimes signal the event</td></tr>"\r | |
186 | + "</table></html>");\r | |
a929458e | 187 | }\r |
188 | return jComboBoxUsage;\r | |
06a19cee | 189 | }\r |
a929458e | 190 | \r |
191 | /**\r | |
192 | * This method initializes jScrollPane\r | |
193 | * \r | |
194 | * @return javax.swing.JScrollPane\r | |
195 | */\r | |
196 | private JScrollPane getJScrollPane() {\r | |
197 | if (jScrollPane == null) {\r | |
198 | jScrollPane = new JScrollPane();\r | |
199 | jScrollPane.setViewportView(getJContentPane());\r | |
200 | }\r | |
201 | return jScrollPane;\r | |
06a19cee | 202 | }\r |
203 | \r | |
a929458e | 204 | /**\r |
205 | * This method initializes jTextFieldFeatureFlag\r | |
206 | * \r | |
207 | * @return javax.swing.JTextField\r | |
208 | */\r | |
209 | private JTextField getJTextFieldFeatureFlag() {\r | |
210 | if (jTextFieldFeatureFlag == null) {\r | |
211 | jTextFieldFeatureFlag = new JTextField();\r | |
21b42c66 | 212 | jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 182, 320, 20));\r |
a929458e | 213 | jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r |
214 | jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");\r | |
21b42c66 | 215 | jTextFieldFeatureFlag.setEnabled(false);\r |
a929458e | 216 | }\r |
217 | return jTextFieldFeatureFlag;\r | |
06a19cee | 218 | }\r |
a929458e | 219 | \r |
220 | /**\r | |
221 | * This method initializes jTextAreaHelpText\r | |
222 | * \r | |
223 | * @return javax.swing.JTextArea\r | |
224 | * \r | |
225 | */\r | |
226 | private JTextArea getJTextAreaHelpText() {\r | |
227 | if (jTextAreaHelpText == null) {\r | |
228 | jTextAreaHelpText = new JTextArea();\r | |
229 | jTextAreaHelpText.setLineWrap(true);\r | |
230 | jTextAreaHelpText.setWrapStyleWord(true);\r | |
231 | }\r | |
232 | return jTextAreaHelpText;\r | |
06a19cee | 233 | }\r |
a929458e | 234 | \r |
235 | /**\r | |
236 | * This method initializes jScrollPaneHelpText\r | |
237 | * \r | |
238 | * @return javax.swing.JScrollPane\r | |
239 | * \r | |
240 | */\r | |
241 | private JScrollPane getJScrollPaneHelpText() {\r | |
242 | if (jScrollPaneHelpText == null) {\r | |
243 | jScrollPaneHelpText = new JScrollPane();\r | |
244 | jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r | |
245 | jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));\r | |
246 | jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));\r | |
3f62225f | 247 | jScrollPaneHelpText.setLocation(new java.awt.Point(168, 112));\r |
a929458e | 248 | jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());\r |
249 | }\r | |
250 | return jScrollPaneHelpText;\r | |
06a19cee | 251 | }\r |
a929458e | 252 | \r |
253 | /**\r | |
254 | * This method initializes jButtonOk\r | |
255 | * \r | |
256 | * @return javax.swing.JButton\r | |
257 | * \r | |
258 | */\r | |
259 | private JButton getJButtonOk() {\r | |
260 | if (jButtonOk == null) {\r | |
261 | jButtonOk = new JButton();\r | |
3f62225f | 262 | jButtonOk.setBounds(new java.awt.Rectangle(290, 212, 90, 20));\r |
a929458e | 263 | jButtonOk.setText("Ok");\r |
264 | jButtonOk.addActionListener(this);\r | |
265 | }\r | |
266 | return jButtonOk;\r | |
06a19cee | 267 | }\r |
a929458e | 268 | \r |
269 | /**\r | |
270 | * This method initializes jButtonCancel\r | |
271 | * \r | |
272 | * @return javax.swing.JButton\r | |
273 | * \r | |
274 | */\r | |
275 | private JButton getJButtonCancel() {\r | |
276 | if (jButtonCancel == null) {\r | |
277 | jButtonCancel = new JButton();\r | |
3f62225f | 278 | jButtonCancel.setBounds(new java.awt.Rectangle(390, 212, 90, 20));\r |
a929458e | 279 | jButtonCancel.setText("Cancel");\r |
280 | jButtonCancel.addActionListener(this);\r | |
281 | }\r | |
282 | return jButtonCancel;\r | |
7ab6baa9 | 283 | }\r |
a929458e | 284 | \r |
285 | public static void main(String[] args) {\r | |
286 | \r | |
7ab6baa9 | 287 | }\r |
a929458e | 288 | \r |
289 | /**\r | |
290 | * This method initializes this\r | |
291 | * \r | |
292 | */\r | |
293 | private void init() {\r | |
3f62225f | 294 | this.setSize(505, 280);\r |
a929458e | 295 | this.setContentPane(getJScrollPane());\r |
296 | this.setTitle("Events");\r | |
297 | initFrame();\r | |
298 | this.setViewMode(false);\r | |
299 | this.centerWindow();\r | |
7ab6baa9 | 300 | }\r |
a929458e | 301 | \r |
302 | /**\r | |
303 | * This method initializes this Fill values to all fields if these values are\r | |
304 | * not empty\r | |
305 | * \r | |
306 | * @param inEventsId\r | |
307 | * \r | |
308 | */\r | |
e08433ef | 309 | private void init(EventsIdentification inEventsId, ModuleIdentification mid) {\r |
a929458e | 310 | init();\r |
311 | this.id = inEventsId;\r | |
d48c170d | 312 | \r |
e08433ef | 313 | //\r |
314 | // Init arch with module's arch\r | |
315 | //\r | |
316 | this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));\r | |
d48c170d | 317 | \r |
318 | //\r | |
319 | // Get defined guids from dependent packages\r | |
320 | //\r | |
321 | Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);\r | |
322 | if (vpid.size() <= 0) {\r | |
323 | Log\r | |
324 | .wrn("Init Guid",\r | |
325 | "This module hasn't defined any package dependency, so there is no guid value can be added for event");\r | |
326 | }\r | |
327 | //\r | |
328 | // Init guids drop down list\r | |
329 | //\r | |
330 | Tools\r | |
55683eab | 331 | .generateComboBoxByVector(iComboBoxGuidC_Name,\r |
d48c170d | 332 | wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_EFI_EVENT));\r |
5b396948 | 333 | \r |
334 | this.iComboBoxGuidC_Name.insertItemAt(DataType.EMPTY_SELECT_ITEM, 0);\r | |
335 | this.iComboBoxGuidC_Name.setSelectedIndex(0);\r | |
d48c170d | 336 | \r |
a929458e | 337 | if (this.id != null) {\r |
5b396948 | 338 | String tmpName = id.getName();\r |
339 | if (isEmpty(tmpName)) {\r | |
340 | tmpName = DataType.EMPTY_SELECT_ITEM;\r | |
341 | }\r | |
342 | \r | |
343 | this.iComboBoxGuidC_Name.setSelectedItem(tmpName);\r | |
a929458e | 344 | this.jComboBoxEventsType.setSelectedItem(id.getType());\r |
345 | this.jComboBoxUsage.setSelectedItem(id.getUsage());\r | |
346 | this.jTextAreaHelpText.setText(id.getHelp());\r | |
347 | \r | |
348 | jTextFieldFeatureFlag.setText(id.getFeatureFlag());\r | |
349 | this.jArchCheckBox.setSelectedItems(id.getSupArchList());\r | |
350 | this.jComboBoxEventGroup.setSelectedItem(id.getGroup());\r | |
351 | }\r | |
7ab6baa9 | 352 | }\r |
a929458e | 353 | \r |
354 | /**\r | |
355 | * This is the override edit constructor\r | |
356 | * \r | |
357 | * @param inEventsIdentification\r | |
358 | * @param iFrame\r | |
359 | * \r | |
360 | */\r | |
e08433ef | 361 | public EventsDlg(EventsIdentification inEventsIdentification, IFrame iFrame, ModuleIdentification mid) {\r |
a929458e | 362 | super(iFrame, true);\r |
e08433ef | 363 | init(inEventsIdentification, mid);\r |
7ab6baa9 | 364 | }\r |
a929458e | 365 | \r |
366 | /**\r | |
367 | * Disable all components when the mode is view\r | |
368 | * \r | |
369 | * @param isView\r | |
370 | * true - The view mode; false - The non-view mode\r | |
371 | * \r | |
372 | */\r | |
373 | public void setViewMode(boolean isView) {\r | |
374 | if (isView) {\r | |
55683eab | 375 | this.iComboBoxGuidC_Name.setEnabled(!isView);\r |
a929458e | 376 | this.jComboBoxUsage.setEnabled(!isView);\r |
377 | }\r | |
06a19cee | 378 | }\r |
379 | \r | |
a929458e | 380 | /**\r |
381 | * This method initializes jContentPane\r | |
382 | * \r | |
383 | * @return javax.swing.JPanel jContentPane\r | |
384 | * \r | |
385 | */\r | |
386 | private JPanel getJContentPane() {\r | |
387 | if (jContentPane == null) {\r | |
388 | jStarLabel1 = new StarLabel();\r | |
3f62225f | 389 | jStarLabel1.setLocation(new java.awt.Point(2, 12));\r |
a929458e | 390 | jLabelEventType = new JLabel();\r |
391 | jLabelEventType.setText("Select Event Type");\r | |
3f62225f | 392 | jLabelEventType.setBounds(new java.awt.Rectangle(12, 12, 168, 20));\r |
a929458e | 393 | \r |
394 | jStarLabel2 = new StarLabel();\r | |
3f62225f | 395 | jStarLabel2.setLocation(new java.awt.Point(2, 37));\r |
a929458e | 396 | jLabelC_Name = new JLabel();\r |
397 | jLabelC_Name.setText("Guid C Name");\r | |
3f62225f | 398 | jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 168, 20));\r |
a929458e | 399 | \r |
400 | jStarLabel3 = new StarLabel();\r | |
3f62225f | 401 | jStarLabel3.setLocation(new java.awt.Point(2, 62));\r |
a929458e | 402 | jLabelGroup = new JLabel();\r |
403 | jLabelGroup.setText("Event Group Type");\r | |
3f62225f | 404 | jLabelGroup.setBounds(new java.awt.Rectangle(12, 62, 168, 20));\r |
a929458e | 405 | \r |
406 | jStarLabel4 = new StarLabel();\r | |
3f62225f | 407 | jStarLabel4.setLocation(new java.awt.Point(2, 87));\r |
a929458e | 408 | jLabelUsage = new JLabel();\r |
409 | jLabelUsage.setText("Usage");\r | |
3f62225f | 410 | jLabelUsage.setBounds(new java.awt.Rectangle(12, 87, 168, 20));\r |
a929458e | 411 | \r |
412 | jLabelHelpText = new JLabel();\r | |
3f62225f | 413 | jLabelHelpText.setBounds(new java.awt.Rectangle(12, 112, 168, 20));\r |
a929458e | 414 | jLabelHelpText.setText("Help Text");\r |
415 | \r | |
416 | jLabelFeatureFlag = new JLabel();\r | |
21b42c66 | 417 | jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 182, 168, 20));\r |
a929458e | 418 | jLabelFeatureFlag.setText("Feature Flag Expression");\r |
21b42c66 | 419 | jLabelFeatureFlag.setEnabled(false);\r |
a929458e | 420 | \r |
421 | jLabelArch = new JLabel();\r | |
21b42c66 | 422 | jLabelArch.setBounds(new java.awt.Rectangle(12, 157, 168, 20));\r |
a929458e | 423 | jLabelArch.setText("Supported Architectures");\r |
424 | jArchCheckBox = new ArchCheckBox();\r | |
21b42c66 | 425 | jArchCheckBox.setBounds(new java.awt.Rectangle(168, 157, 320, 20));\r |
a929458e | 426 | jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));\r |
427 | \r | |
428 | jContentPane = new JPanel();\r | |
429 | jContentPane.setLayout(null);\r | |
3f62225f | 430 | jContentPane.setPreferredSize(new java.awt.Dimension(485, 235));\r |
a929458e | 431 | \r |
432 | jContentPane.add(jStarLabel1, null);\r | |
433 | jContentPane.add(jLabelEventType, null);\r | |
434 | jContentPane.add(getJComboBoxEventsType(), null);\r | |
5b396948 | 435 | //jContentPane.add(jStarLabel2, null);\r |
a929458e | 436 | jContentPane.add(jLabelC_Name, null);\r |
55683eab | 437 | jContentPane.add(getIComboBoxGuidC_Name(), null);\r |
a929458e | 438 | jContentPane.add(jStarLabel3, null);\r |
439 | jContentPane.add(jLabelGroup, null);\r | |
440 | jContentPane.add(getJComboBoxEventGroup(), null);\r | |
441 | jContentPane.add(jStarLabel4, null);\r | |
442 | jContentPane.add(jLabelUsage, null);\r | |
443 | jContentPane.add(getJComboBoxUsage(), null);\r | |
444 | jContentPane.add(jLabelHelpText, null);\r | |
445 | jContentPane.add(getJScrollPaneHelpText(), null);\r | |
446 | jContentPane.add(jLabelFeatureFlag, null);\r | |
447 | jContentPane.add(getJTextFieldFeatureFlag(), null);\r | |
448 | jContentPane.add(jLabelArch, null);\r | |
449 | jContentPane.add(jArchCheckBox, null);\r | |
450 | jContentPane.add(getJButtonOk(), null);\r | |
451 | jContentPane.add(getJButtonCancel(), null);\r | |
452 | \r | |
453 | }\r | |
454 | return jContentPane;\r | |
7ab6baa9 | 455 | }\r |
a929458e | 456 | \r |
457 | /**\r | |
458 | * This method initializes events groups and usage type\r | |
459 | * \r | |
460 | */\r | |
461 | private void initFrame() {\r | |
462 | Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType());\r | |
463 | Tools.generateComboBoxByVector(jComboBoxEventGroup, ed.getVEventGroup());\r | |
464 | Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage());\r | |
06a19cee | 465 | }\r |
466 | \r | |
a929458e | 467 | /*\r |
468 | * (non-Javadoc)\r | |
469 | * \r | |
470 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
471 | * \r | |
472 | * Override actionPerformed to listen all actions\r | |
473 | * \r | |
474 | */\r | |
475 | public void actionPerformed(ActionEvent arg0) {\r | |
476 | if (arg0.getSource() == jButtonOk) {\r | |
477 | if (checkAdd()) {\r | |
478 | getCurrentEvents();\r | |
479 | this.returnType = DataType.RETURN_TYPE_OK;\r | |
480 | this.setVisible(false);\r | |
481 | }\r | |
482 | }\r | |
483 | \r | |
484 | if (arg0.getSource() == jButtonCancel) {\r | |
485 | this.returnType = DataType.RETURN_TYPE_CANCEL;\r | |
486 | this.setVisible(false);\r | |
487 | }\r | |
06a19cee | 488 | }\r |
489 | \r | |
a929458e | 490 | /**\r |
491 | * Data validation for all fields\r | |
492 | * \r | |
493 | * @retval true - All datas are valid\r | |
494 | * @retval false - At least one data is invalid\r | |
495 | * \r | |
496 | */\r | |
497 | public boolean checkAdd() {\r | |
498 | //\r | |
499 | // Check if all fields have correct data types\r | |
500 | //\r | |
d48c170d | 501 | \r |
502 | //\r | |
503 | // Check Name\r | |
504 | //\r | |
5b396948 | 505 | String tmpName = this.iComboBoxGuidC_Name.getSelectedItem().toString();\r |
506 | if (!tmpName.equals(DataType.EMPTY_SELECT_ITEM) && isEmpty(tmpName)) {\r | |
55683eab | 507 | if (!DataValidation.isC_NameType(this.iComboBoxGuidC_Name.getSelectedItem().toString())) {\r |
a929458e | 508 | Log.wrn("Update Events", "Incorrect data type for Event Name");\r |
509 | return false;\r | |
510 | }\r | |
511 | }\r | |
512 | \r | |
513 | //\r | |
514 | // Check FeatureFlag\r | |
515 | //\r | |
516 | if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r | |
517 | if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r | |
518 | Log.wrn("Update Events", "Incorrect data type for Feature Flag");\r | |
519 | return false;\r | |
520 | }\r | |
521 | }\r | |
522 | \r | |
523 | return true;\r | |
06a19cee | 524 | }\r |
525 | \r | |
a929458e | 526 | private EventsIdentification getCurrentEvents() {\r |
55683eab | 527 | String arg0 = this.iComboBoxGuidC_Name.getSelectedItem().toString();\r |
a929458e | 528 | String arg1 = this.jComboBoxEventsType.getSelectedItem().toString();\r |
529 | String arg2 = this.jComboBoxUsage.getSelectedItem().toString();\r | |
530 | \r | |
531 | String arg3 = this.jTextFieldFeatureFlag.getText();\r | |
532 | Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();\r | |
533 | String arg5 = this.jTextAreaHelpText.getText();\r | |
534 | String arg6 = this.jComboBoxEventGroup.getSelectedItem().toString();\r | |
535 | id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);\r | |
536 | return id;\r | |
06a19cee | 537 | }\r |
538 | \r | |
a929458e | 539 | public EventsIdentification getId() {\r |
540 | return id;\r | |
06a19cee | 541 | }\r |
7ab6baa9 | 542 | \r |
a929458e | 543 | public void setId(EventsIdentification id) {\r |
544 | this.id = id;\r | |
545 | }\r | |
06a19cee | 546 | }\r |