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