]>
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 |
5b396948 | 313 | this.iComboBoxGuidC_Name.insertItemAt(DataType.EMPTY_SELECT_ITEM, 0);\r |
314 | this.iComboBoxGuidC_Name.setSelectedIndex(0);\r | |
d48c170d | 315 | \r |
316 | \r | |
a929458e | 317 | if (this.id != null) {\r |
5b396948 | 318 | String tmpName = id.getName();\r |
319 | if (isEmpty(tmpName)) {\r | |
320 | tmpName = DataType.EMPTY_SELECT_ITEM;\r | |
321 | }\r | |
322 | this.iComboBoxGuidC_Name.setSelectedItem(tmpName); \r | |
a929458e | 323 | this.jComboBoxHobType.setSelectedItem(id.getType());\r |
324 | this.jComboBoxUsage.setSelectedItem(id.getUsage());\r | |
325 | this.jTextAreaHelpText.setText(id.getHelp());\r | |
326 | this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());\r | |
327 | this.jArchCheckBox.setSelectedItems(id.getSupArchList());\r | |
328 | }\r | |
06a19cee | 329 | }\r |
a929458e | 330 | \r |
331 | /**\r | |
332 | * This is the override edit constructor\r | |
333 | * \r | |
334 | * @param inHobsIdentification\r | |
335 | * @param iFrame\r | |
336 | * \r | |
337 | */\r | |
e08433ef | 338 | public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame, ModuleIdentification mid) {\r |
a929458e | 339 | super(iFrame, true);\r |
e08433ef | 340 | init(inHobsIdentification, mid);\r |
06a19cee | 341 | }\r |
a929458e | 342 | \r |
343 | /**\r | |
344 | * Disable all components when the mode is view\r | |
345 | * \r | |
346 | * @param isView\r | |
347 | * true - The view mode; false - The non-view mode\r | |
348 | * \r | |
349 | */\r | |
350 | public void setViewMode(boolean isView) {\r | |
351 | if (isView) {\r | |
55683eab | 352 | this.iComboBoxGuidC_Name.setEnabled(!isView);\r |
a929458e | 353 | this.jComboBoxUsage.setEnabled(!isView);\r |
354 | this.jComboBoxHobType.setEnabled(!isView);\r | |
355 | }\r | |
5101eff9 | 356 | }\r |
a929458e | 357 | \r |
358 | /**\r | |
359 | * This method initializes jContentPane\r | |
360 | * \r | |
361 | * @return javax.swing.JPanel jContentPane\r | |
362 | * \r | |
363 | */\r | |
364 | public JPanel getJContentPane() {\r | |
365 | if (jContentPane == null) {\r | |
366 | jStarLabel1 = new StarLabel();\r | |
3f62225f | 367 | jStarLabel1.setLocation(new java.awt.Point(2, 12));\r |
a929458e | 368 | jLabelC_Name = new JLabel();\r |
369 | jLabelC_Name.setText("Hob's Guid C Name");\r | |
3f62225f | 370 | jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 155, 20));\r |
a929458e | 371 | \r |
372 | jStarLabel2 = new StarLabel();\r | |
3f62225f | 373 | jStarLabel2.setLocation(new java.awt.Point(2, 37));\r |
a929458e | 374 | jLabelHobType = new JLabel();\r |
375 | jLabelHobType.setText("Hob Type");\r | |
3f62225f | 376 | jLabelHobType.setBounds(new java.awt.Rectangle(12, 37, 155, 20));\r |
a929458e | 377 | \r |
378 | jStarLabel3 = new StarLabel();\r | |
3f62225f | 379 | jStarLabel3.setLocation(new java.awt.Point(2, 62));\r |
a929458e | 380 | jLabelUsage = new JLabel();\r |
381 | jLabelUsage.setText("Usage");\r | |
3f62225f | 382 | jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 155, 20));\r |
a929458e | 383 | \r |
384 | jLabelHelpText = new JLabel();\r | |
3f62225f | 385 | jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 155, 20));\r |
a929458e | 386 | jLabelHelpText.setText("Help Text");\r |
387 | \r | |
388 | jLabelFeatureFlag = new JLabel();\r | |
21b42c66 | 389 | jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 155, 20));\r |
a929458e | 390 | jLabelFeatureFlag.setText("Feature Flag Expression");\r |
21b42c66 | 391 | jLabelFeatureFlag.setEnabled(false);\r |
a929458e | 392 | \r |
393 | jLabelArch = new JLabel();\r | |
21b42c66 | 394 | jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 155, 20));\r |
a929458e | 395 | jLabelArch.setText("Supported Architectures");\r |
396 | jArchCheckBox = new ArchCheckBox();\r | |
21b42c66 | 397 | jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));\r |
a929458e | 398 | jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));\r |
399 | \r | |
400 | jContentPane = new JPanel();\r | |
401 | jContentPane.setLayout(null);\r | |
3f62225f | 402 | jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));\r |
a929458e | 403 | \r |
a929458e | 404 | jContentPane.add(jLabelC_Name, null);\r |
55683eab | 405 | jContentPane.add(getIComboBoxGuidC_Name(), null);\r |
a929458e | 406 | jContentPane.add(jStarLabel2, null);\r |
407 | jContentPane.add(jLabelHobType, null);\r | |
408 | jContentPane.add(getJComboBoxHobType(), null);\r | |
409 | jContentPane.add(jStarLabel3, null);\r | |
410 | jContentPane.add(jLabelUsage, null);\r | |
411 | jContentPane.add(getJComboBoxUsage(), null);\r | |
412 | jContentPane.add(jLabelHelpText, null);\r | |
413 | jContentPane.add(getJScrollPaneHelpText(), null);\r | |
414 | jContentPane.add(jLabelFeatureFlag, null);\r | |
415 | jContentPane.add(getJTextFieldFeatureFlag(), null);\r | |
416 | jContentPane.add(jLabelArch, null);\r | |
417 | jContentPane.add(jArchCheckBox, null);\r | |
418 | jContentPane.add(getJButtonOk(), null);\r | |
419 | jContentPane.add(getJButtonCancel(), null);\r | |
420 | }\r | |
421 | return jContentPane;\r | |
5101eff9 | 422 | }\r |
a929458e | 423 | \r |
424 | /**\r | |
425 | * This method initializes Usage type and Hob type\r | |
426 | * \r | |
427 | */\r | |
428 | private void initFrame() {\r | |
429 | Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());\r | |
430 | Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());\r | |
06a19cee | 431 | }\r |
432 | \r | |
a929458e | 433 | /*\r |
434 | * (non-Javadoc)\r | |
435 | * \r | |
436 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
437 | * \r | |
438 | * Override actionPerformed to listen all actions\r | |
439 | * \r | |
440 | */\r | |
441 | public void actionPerformed(ActionEvent arg0) {\r | |
442 | if (arg0.getSource() == jButtonOk) {\r | |
443 | if (checkAdd()) {\r | |
444 | getCurrentHobs();\r | |
445 | this.returnType = DataType.RETURN_TYPE_OK;\r | |
446 | this.setVisible(false);\r | |
447 | }\r | |
448 | }\r | |
449 | \r | |
450 | if (arg0.getSource() == jButtonCancel) {\r | |
451 | this.returnType = DataType.RETURN_TYPE_CANCEL;\r | |
452 | this.setVisible(false);\r | |
453 | }\r | |
5101eff9 | 454 | }\r |
06a19cee | 455 | \r |
a929458e | 456 | /**\r |
457 | * Data validation for all fields\r | |
458 | * \r | |
459 | * @retval true - All datas are valid\r | |
460 | * @retval false - At least one data is invalid\r | |
461 | * \r | |
462 | */\r | |
463 | public boolean checkAdd() {\r | |
464 | //\r | |
465 | // Check if all fields have correct data types\r | |
466 | //\r | |
d48c170d | 467 | \r |
468 | //\r | |
469 | // Check Name\r | |
470 | //\r | |
5b396948 | 471 | String tmpName = this.iComboBoxGuidC_Name.getSelectedItem().toString();\r |
472 | if (!tmpName.equals(DataType.EMPTY_SELECT_ITEM) && isEmpty(tmpName)) {\r | |
55683eab | 473 | if (!DataValidation.isC_NameType(this.iComboBoxGuidC_Name.getSelectedItem().toString())) {\r |
a929458e | 474 | Log.wrn("Update Hobs", "Incorrect data type for Hob Name");\r |
475 | return false;\r | |
476 | }\r | |
477 | }\r | |
478 | \r | |
479 | //\r | |
480 | // Check FeatureFlag\r | |
481 | //\r | |
482 | if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r | |
483 | if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r | |
484 | Log.wrn("Update Hobs", "Incorrect data type for Feature Flag");\r | |
485 | return false;\r | |
486 | }\r | |
487 | }\r | |
488 | \r | |
489 | return true;\r | |
06a19cee | 490 | }\r |
491 | \r | |
a929458e | 492 | private HobsIdentification getCurrentHobs() {\r |
55683eab | 493 | String arg0 = this.iComboBoxGuidC_Name.getSelectedItem().toString();\r |
a929458e | 494 | String arg1 = this.jComboBoxHobType.getSelectedItem().toString();\r |
495 | String arg2 = this.jComboBoxUsage.getSelectedItem().toString();\r | |
496 | \r | |
497 | String arg3 = this.jTextFieldFeatureFlag.getText();\r | |
498 | Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();\r | |
499 | String arg5 = this.jTextAreaHelpText.getText();\r | |
500 | id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r | |
501 | return id;\r | |
06a19cee | 502 | }\r |
503 | \r | |
a929458e | 504 | public HobsIdentification getId() {\r |
505 | return id;\r | |
06a19cee | 506 | }\r |
5101eff9 | 507 | \r |
a929458e | 508 | public void setId(HobsIdentification id) {\r |
509 | this.id = id;\r | |
510 | }\r | |
06a19cee | 511 | }\r |