]>
Commit | Line | Data |
---|---|---|
06a19cee | 1 | /** @file\r |
2 | \r | |
9e857952 | 3 | The file is used to create, update Hob 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 | |
5101eff9 | 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.Hobs.HobsIdentification;\r |
d48c170d | 40 | import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r |
06a19cee | 41 | import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r |
42 | \r | |
43 | /**\r | |
9e857952 | 44 | * The class is used to create, update Hob of the MSA file \r |
45 | * \r | |
46 | * It extends IDialog\r | |
5101eff9 | 47 | * \r |
48 | */\r | |
06a19cee | 49 | public class HobsDlg extends IDialog {\r |
50 | \r | |
a929458e | 51 | // /\r |
52 | // / Define class Serial Version UID\r | |
53 | // /\r | |
54 | private static final long serialVersionUID = -553473437579358325L;\r | |
06a19cee | 55 | \r |
a929458e | 56 | //\r |
57 | // Define class members\r | |
58 | //\r | |
59 | private JPanel jContentPane = null;\r | |
06a19cee | 60 | \r |
a929458e | 61 | private JLabel jLabelC_Name = null;\r |
06a19cee | 62 | \r |
55683eab | 63 | private IComboBox iComboBoxGuidC_Name = null;\r |
06a19cee | 64 | \r |
a929458e | 65 | private JLabel jLabelUsage = null;\r |
06a19cee | 66 | \r |
a929458e | 67 | private JLabel jLabelHobType = null;\r |
06a19cee | 68 | \r |
a929458e | 69 | private JComboBox jComboBoxUsage = null;\r |
06a19cee | 70 | \r |
a929458e | 71 | private JComboBox jComboBoxHobType = 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 JLabel jLabelArch = null;\r |
06a19cee | 80 | \r |
a929458e | 81 | private JScrollPane jScrollPane = null;\r |
06a19cee | 82 | \r |
a929458e | 83 | private JLabel jLabelFeatureFlag = null;\r |
06a19cee | 84 | \r |
a929458e | 85 | private JTextField jTextFieldFeatureFlag = 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 ArchCheckBox jArchCheckBox = null;\r |
06a19cee | 94 | \r |
a929458e | 95 | private JButton jButtonOk = null;\r |
06a19cee | 96 | \r |
a929458e | 97 | private JButton jButtonCancel = null;\r |
06a19cee | 98 | \r |
a929458e | 99 | //\r |
100 | // Not used by UI\r | |
101 | //\r | |
102 | private HobsIdentification id = null;\r | |
103 | \r | |
104 | private EnumerationData ed = new EnumerationData();\r | |
105 | \r | |
106 | private WorkspaceTools wt = new WorkspaceTools();\r | |
107 | \r | |
108 | /**\r | |
109 | * This method initializes jTextField\r | |
110 | * \r | |
111 | * @return javax.swing.JTextField jTextFieldC_Name\r | |
112 | * \r | |
113 | */\r | |
55683eab | 114 | private IComboBox getIComboBoxGuidC_Name() {\r |
115 | if (iComboBoxGuidC_Name == null) {\r | |
116 | iComboBoxGuidC_Name = new IComboBox();\r | |
117 | iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 12, 320, 20));\r | |
118 | iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));\r | |
119 | iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob");\r | |
a929458e | 120 | }\r |
55683eab | 121 | return iComboBoxGuidC_Name;\r |
a929458e | 122 | }\r |
06a19cee | 123 | \r |
a929458e | 124 | /**\r |
125 | * This method initializes jComboBoxHobType\r | |
126 | * \r | |
127 | * @return javax.swing.JComboBox jComboBoxHobType\r | |
128 | * \r | |
129 | */\r | |
130 | private JComboBox getJComboBoxHobType() {\r | |
131 | if (jComboBoxHobType == null) {\r | |
132 | jComboBoxHobType = new JComboBox();\r | |
3f62225f | 133 | jComboBoxHobType.setBounds(new java.awt.Rectangle(168, 37, 320, 20));\r |
a929458e | 134 | jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20));\r |
135 | jComboBoxHobType\r | |
136 | .setToolTipText("<html><table>"\r | |
137 | + "<tr><td>PHIT</td><td>EFI_HOB_TYPE_HANDOFF</td></tr>"\r | |
138 | + "<tr><td>MEMORY_ALLOCATION</td><td>EFI_HOB_TYPE_MEMORY_ALLOCATION and $BaseName</td></tr>"\r | |
139 | + "<tr><td>RESOURCE_DESCRIPTOR</td><td>EFI_HOB_TYPE_RESOURCE_DESCRIPTOR</td></tr>"\r | |
140 | + "<tr><td>GUID_EXTENTION</td><td>EFI_HOB_TYPE_GUID_EXTENSION and BaseName of GUID</td></tr>"\r | |
141 | + "<tr><td>FIRMWARE_VOLUME</td><td>EFI_HOB_TYPE_FV</td></tr>"\r | |
142 | + "<tr><td>CPU</td><td>EFI_HOB_TYPE_CPU</td></tr>"\r | |
143 | + "<tr><td>POOL</td><td>EFI_HOB_TYPE_PEI_MEMORY_POOL</td></tr>"\r | |
144 | + "<tr><td>CAPSULE_VOLUME</td><td>EFI_HOB_TYPE_CV</td></tr>"\r | |
145 | + "</table></html>");\r | |
146 | }\r | |
147 | return jComboBoxHobType;\r | |
148 | }\r | |
06a19cee | 149 | \r |
a929458e | 150 | /**\r |
151 | * This method initializes jComboBoxUsage\r | |
152 | * \r | |
153 | * @return javax.swing.JComboBox jComboBoxUsage\r | |
154 | * \r | |
155 | */\r | |
156 | private JComboBox getJComboBoxUsage() {\r | |
157 | if (jComboBoxUsage == null) {\r | |
158 | jComboBoxUsage = new JComboBox();\r | |
3f62225f | 159 | jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));\r |
a929458e | 160 | jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r |
161 | jComboBoxUsage\r | |
162 | .setToolTipText("<html><table>"\r | |
163 | + "<tr><td>ALWAYS_CONSUMED</td><td>HOB must be present in the system</td></tr>"\r | |
164 | + "<tr><td>SOMETIMES_CONSUMED</td><td>HOB will be used if it's present</td></tr>"\r | |
165 | + "<tr><td>ALWAYS_PRODUCED</td><td>HOB is always produced</td></tr>"\r | |
166 | + "<tr><td>SOMETIMES_PRODUCED</td><td>HOB will sometimes be produced by the module</td></tr>"\r | |
167 | + "</table></html>");\r | |
168 | }\r | |
169 | return jComboBoxUsage;\r | |
170 | }\r | |
06a19cee | 171 | \r |
a929458e | 172 | /**\r |
173 | * This method initializes jScrollPane\r | |
174 | * \r | |
175 | * @return javax.swing.JScrollPane\r | |
176 | */\r | |
177 | private JScrollPane getJScrollPane() {\r | |
178 | if (jScrollPane == null) {\r | |
179 | jScrollPane = new JScrollPane();\r | |
180 | jScrollPane.setViewportView(getJContentPane());\r | |
181 | }\r | |
182 | return jScrollPane;\r | |
06a19cee | 183 | }\r |
a929458e | 184 | \r |
185 | /**\r | |
186 | * This method initializes jTextFieldFeatureFlag\r | |
187 | * \r | |
188 | * @return javax.swing.JTextField\r | |
189 | */\r | |
190 | private JTextField getJTextFieldFeatureFlag() {\r | |
191 | if (jTextFieldFeatureFlag == null) {\r | |
192 | jTextFieldFeatureFlag = new JTextField();\r | |
21b42c66 | 193 | jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 157, 320, 20));\r |
a929458e | 194 | jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r |
195 | jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");\r | |
21b42c66 | 196 | jTextFieldFeatureFlag.setEnabled(false);\r |
a929458e | 197 | }\r |
198 | return jTextFieldFeatureFlag;\r | |
06a19cee | 199 | }\r |
a929458e | 200 | \r |
201 | /**\r | |
202 | * This method initializes jTextFieldHelpText\r | |
203 | * \r | |
204 | * @return javax.swing.JTextField\r | |
205 | * \r | |
206 | */\r | |
207 | private JTextArea getJTextAreaHelpText() {\r | |
208 | if (jTextAreaHelpText == null) {\r | |
209 | jTextAreaHelpText = new JTextArea();\r | |
210 | jTextAreaHelpText.setLineWrap(true);\r | |
211 | jTextAreaHelpText.setWrapStyleWord(true);\r | |
212 | }\r | |
213 | return jTextAreaHelpText;\r | |
06a19cee | 214 | }\r |
a929458e | 215 | \r |
216 | /**\r | |
217 | * This method initializes jScrollPaneHelpText\r | |
218 | * \r | |
219 | * @return javax.swing.JScrollPane\r | |
220 | */\r | |
221 | private JScrollPane getJScrollPaneHelpText() {\r | |
222 | if (jScrollPaneHelpText == null) {\r | |
223 | jScrollPaneHelpText = new JScrollPane();\r | |
224 | jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r | |
225 | jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));\r | |
226 | jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));\r | |
3f62225f | 227 | jScrollPaneHelpText.setLocation(new java.awt.Point(168, 87));\r |
a929458e | 228 | jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());\r |
229 | }\r | |
230 | return jScrollPaneHelpText;\r | |
06a19cee | 231 | }\r |
a929458e | 232 | \r |
233 | /**\r | |
234 | * This method initializes jButtonOk\r | |
235 | * \r | |
236 | * @return javax.swing.JButton\r | |
237 | * \r | |
238 | */\r | |
239 | private JButton getJButtonOk() {\r | |
240 | if (jButtonOk == null) {\r | |
241 | jButtonOk = new JButton();\r | |
3f62225f | 242 | jButtonOk.setBounds(new java.awt.Rectangle(290, 187, 90, 20));\r |
a929458e | 243 | jButtonOk.setText("Ok");\r |
244 | jButtonOk.addActionListener(this);\r | |
245 | }\r | |
246 | return jButtonOk;\r | |
06a19cee | 247 | }\r |
a929458e | 248 | \r |
249 | /**\r | |
250 | * This method initializes jButtonCancel\r | |
251 | * \r | |
252 | * @return javax.swing.JButton\r | |
253 | * \r | |
254 | */\r | |
255 | private JButton getJButtonCancel() {\r | |
256 | if (jButtonCancel == null) {\r | |
257 | jButtonCancel = new JButton();\r | |
3f62225f | 258 | jButtonCancel.setBounds(new java.awt.Rectangle(390, 187, 90, 20));\r |
a929458e | 259 | jButtonCancel.setText("Cancel");\r |
260 | jButtonCancel.addActionListener(this);\r | |
261 | }\r | |
262 | return jButtonCancel;\r | |
06a19cee | 263 | }\r |
a929458e | 264 | \r |
265 | public static void main(String[] args) {\r | |
266 | \r | |
06a19cee | 267 | }\r |
a929458e | 268 | \r |
269 | /**\r | |
270 | * This method initializes this\r | |
271 | * \r | |
272 | */\r | |
273 | private void init() {\r | |
3f62225f | 274 | this.setSize(505, 260);\r |
a929458e | 275 | this.setContentPane(getJScrollPane());\r |
276 | this.setTitle("Hobs");\r | |
277 | initFrame();\r | |
278 | this.setViewMode(false);\r | |
279 | this.centerWindow();\r | |
06a19cee | 280 | }\r |
a929458e | 281 | \r |
282 | /**\r | |
283 | * This method initializes this Fill values to all fields if these values are\r | |
284 | * not empty\r | |
285 | * \r | |
286 | * @param inHobsId\r | |
287 | * \r | |
288 | */\r | |
e08433ef | 289 | private void init(HobsIdentification inHobsId, ModuleIdentification mid) {\r |
a929458e | 290 | init();\r |
291 | this.id = inHobsId;\r | |
e08433ef | 292 | \r |
293 | //\r | |
294 | // Init arch with module's arch\r | |
295 | //\r | |
296 | this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));\r | |
297 | \r | |
d48c170d | 298 | //\r |
299 | // Get defined guids from dependent packages\r | |
300 | //\r | |
301 | Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);\r | |
302 | if (vpid.size() <= 0) {\r | |
303 | Log\r | |
304 | .wrn("Init Guid",\r | |
305 | "This module hasn't defined any package dependency, so there is no guid value can be added for hob");\r | |
306 | }\r | |
307 | //\r | |
308 | // Init guids drop down list\r | |
309 | //\r | |
310 | Tools\r | |
55683eab | 311 | .generateComboBoxByVector(iComboBoxGuidC_Name,\r |
d48c170d | 312 | wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_HOB));\r |
313 | \r | |
314 | \r | |
a929458e | 315 | if (this.id != null) {\r |
55683eab | 316 | this.iComboBoxGuidC_Name.setSelectedItem(id.getName());\r |
a929458e | 317 | this.jComboBoxHobType.setSelectedItem(id.getType());\r |
318 | this.jComboBoxUsage.setSelectedItem(id.getUsage());\r | |
319 | this.jTextAreaHelpText.setText(id.getHelp());\r | |
320 | this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());\r | |
321 | this.jArchCheckBox.setSelectedItems(id.getSupArchList());\r | |
322 | }\r | |
06a19cee | 323 | }\r |
a929458e | 324 | \r |
325 | /**\r | |
326 | * This is the override edit constructor\r | |
327 | * \r | |
328 | * @param inHobsIdentification\r | |
329 | * @param iFrame\r | |
330 | * \r | |
331 | */\r | |
e08433ef | 332 | public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame, ModuleIdentification mid) {\r |
a929458e | 333 | super(iFrame, true);\r |
e08433ef | 334 | init(inHobsIdentification, mid);\r |
06a19cee | 335 | }\r |
a929458e | 336 | \r |
337 | /**\r | |
338 | * Disable all components when the mode is view\r | |
339 | * \r | |
340 | * @param isView\r | |
341 | * true - The view mode; false - The non-view mode\r | |
342 | * \r | |
343 | */\r | |
344 | public void setViewMode(boolean isView) {\r | |
345 | if (isView) {\r | |
55683eab | 346 | this.iComboBoxGuidC_Name.setEnabled(!isView);\r |
a929458e | 347 | this.jComboBoxUsage.setEnabled(!isView);\r |
348 | this.jComboBoxHobType.setEnabled(!isView);\r | |
349 | }\r | |
5101eff9 | 350 | }\r |
a929458e | 351 | \r |
352 | /**\r | |
353 | * This method initializes jContentPane\r | |
354 | * \r | |
355 | * @return javax.swing.JPanel jContentPane\r | |
356 | * \r | |
357 | */\r | |
358 | public JPanel getJContentPane() {\r | |
359 | if (jContentPane == null) {\r | |
360 | jStarLabel1 = new StarLabel();\r | |
3f62225f | 361 | jStarLabel1.setLocation(new java.awt.Point(2, 12));\r |
a929458e | 362 | jLabelC_Name = new JLabel();\r |
363 | jLabelC_Name.setText("Hob's Guid C Name");\r | |
3f62225f | 364 | jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 155, 20));\r |
a929458e | 365 | \r |
366 | jStarLabel2 = new StarLabel();\r | |
3f62225f | 367 | jStarLabel2.setLocation(new java.awt.Point(2, 37));\r |
a929458e | 368 | jLabelHobType = new JLabel();\r |
369 | jLabelHobType.setText("Hob Type");\r | |
3f62225f | 370 | jLabelHobType.setBounds(new java.awt.Rectangle(12, 37, 155, 20));\r |
a929458e | 371 | \r |
372 | jStarLabel3 = new StarLabel();\r | |
3f62225f | 373 | jStarLabel3.setLocation(new java.awt.Point(2, 62));\r |
a929458e | 374 | jLabelUsage = new JLabel();\r |
375 | jLabelUsage.setText("Usage");\r | |
3f62225f | 376 | jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 155, 20));\r |
a929458e | 377 | \r |
378 | jLabelHelpText = new JLabel();\r | |
3f62225f | 379 | jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 155, 20));\r |
a929458e | 380 | jLabelHelpText.setText("Help Text");\r |
381 | \r | |
382 | jLabelFeatureFlag = new JLabel();\r | |
21b42c66 | 383 | jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 155, 20));\r |
a929458e | 384 | jLabelFeatureFlag.setText("Feature Flag Expression");\r |
21b42c66 | 385 | jLabelFeatureFlag.setEnabled(false);\r |
a929458e | 386 | \r |
387 | jLabelArch = new JLabel();\r | |
21b42c66 | 388 | jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 155, 20));\r |
a929458e | 389 | jLabelArch.setText("Supported Architectures");\r |
390 | jArchCheckBox = new ArchCheckBox();\r | |
21b42c66 | 391 | jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 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, 215));\r |
a929458e | 397 | \r |
398 | jContentPane.add(jStarLabel1, null);\r | |
399 | jContentPane.add(jLabelC_Name, null);\r | |
55683eab | 400 | jContentPane.add(getIComboBoxGuidC_Name(), null);\r |
a929458e | 401 | jContentPane.add(jStarLabel2, null);\r |
402 | jContentPane.add(jLabelHobType, null);\r | |
403 | jContentPane.add(getJComboBoxHobType(), null);\r | |
404 | jContentPane.add(jStarLabel3, null);\r | |
405 | jContentPane.add(jLabelUsage, null);\r | |
406 | jContentPane.add(getJComboBoxUsage(), null);\r | |
407 | jContentPane.add(jLabelHelpText, null);\r | |
408 | jContentPane.add(getJScrollPaneHelpText(), null);\r | |
409 | jContentPane.add(jLabelFeatureFlag, null);\r | |
410 | jContentPane.add(getJTextFieldFeatureFlag(), null);\r | |
411 | jContentPane.add(jLabelArch, null);\r | |
412 | jContentPane.add(jArchCheckBox, null);\r | |
413 | jContentPane.add(getJButtonOk(), null);\r | |
414 | jContentPane.add(getJButtonCancel(), null);\r | |
415 | }\r | |
416 | return jContentPane;\r | |
5101eff9 | 417 | }\r |
a929458e | 418 | \r |
419 | /**\r | |
420 | * This method initializes Usage type and Hob type\r | |
421 | * \r | |
422 | */\r | |
423 | private void initFrame() {\r | |
424 | Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());\r | |
425 | Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());\r | |
06a19cee | 426 | }\r |
427 | \r | |
a929458e | 428 | /*\r |
429 | * (non-Javadoc)\r | |
430 | * \r | |
431 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
432 | * \r | |
433 | * Override actionPerformed to listen all actions\r | |
434 | * \r | |
435 | */\r | |
436 | public void actionPerformed(ActionEvent arg0) {\r | |
437 | if (arg0.getSource() == jButtonOk) {\r | |
438 | if (checkAdd()) {\r | |
439 | getCurrentHobs();\r | |
440 | this.returnType = DataType.RETURN_TYPE_OK;\r | |
441 | this.setVisible(false);\r | |
442 | }\r | |
443 | }\r | |
444 | \r | |
445 | if (arg0.getSource() == jButtonCancel) {\r | |
446 | this.returnType = DataType.RETURN_TYPE_CANCEL;\r | |
447 | this.setVisible(false);\r | |
448 | }\r | |
5101eff9 | 449 | }\r |
06a19cee | 450 | \r |
a929458e | 451 | /**\r |
452 | * Data validation for all fields\r | |
453 | * \r | |
454 | * @retval true - All datas are valid\r | |
455 | * @retval false - At least one data is invalid\r | |
456 | * \r | |
457 | */\r | |
458 | public boolean checkAdd() {\r | |
459 | //\r | |
460 | // Check if all fields have correct data types\r | |
461 | //\r | |
d48c170d | 462 | \r |
463 | //\r | |
464 | // Check Name\r | |
465 | //\r | |
55683eab | 466 | if (this.iComboBoxGuidC_Name.getSelectedItem() == null) {\r |
d48c170d | 467 | Log.wrn("Update Guids", "Please select one Hob Name");\r |
468 | return false;\r | |
469 | }\r | |
a929458e | 470 | //\r |
471 | // Check Name\r | |
472 | //\r | |
55683eab | 473 | if (isEmpty(this.iComboBoxGuidC_Name.getSelectedItem().toString())) {\r |
623db5ca | 474 | Log.wrn("Update Hobs", "Hob Guid C Name must be entered!");\r |
a929458e | 475 | return false;\r |
476 | }\r | |
477 | \r | |
55683eab | 478 | if (!isEmpty(this.iComboBoxGuidC_Name.getSelectedItem().toString())) {\r |
479 | if (!DataValidation.isC_NameType(this.iComboBoxGuidC_Name.getSelectedItem().toString())) {\r | |
a929458e | 480 | Log.wrn("Update Hobs", "Incorrect data type for Hob Name");\r |
481 | return false;\r | |
482 | }\r | |
483 | }\r | |
484 | \r | |
485 | //\r | |
486 | // Check FeatureFlag\r | |
487 | //\r | |
488 | if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r | |
489 | if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r | |
490 | Log.wrn("Update Hobs", "Incorrect data type for Feature Flag");\r | |
491 | return false;\r | |
492 | }\r | |
493 | }\r | |
494 | \r | |
495 | return true;\r | |
06a19cee | 496 | }\r |
497 | \r | |
a929458e | 498 | private HobsIdentification getCurrentHobs() {\r |
55683eab | 499 | String arg0 = this.iComboBoxGuidC_Name.getSelectedItem().toString();\r |
a929458e | 500 | String arg1 = this.jComboBoxHobType.getSelectedItem().toString();\r |
501 | String arg2 = this.jComboBoxUsage.getSelectedItem().toString();\r | |
502 | \r | |
503 | String arg3 = this.jTextFieldFeatureFlag.getText();\r | |
504 | Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();\r | |
505 | String arg5 = this.jTextAreaHelpText.getText();\r | |
506 | id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r | |
507 | return id;\r | |
06a19cee | 508 | }\r |
509 | \r | |
a929458e | 510 | public HobsIdentification getId() {\r |
511 | return id;\r | |
06a19cee | 512 | }\r |
5101eff9 | 513 | \r |
a929458e | 514 | public void setId(HobsIdentification id) {\r |
515 | this.id = id;\r | |
516 | }\r | |
06a19cee | 517 | }\r |