Fix EDKT337,Double click on modules in "Framework Modules" of Platforms should be...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdDynamicPcdBuildDefinitions.java
CommitLineData
a13899c5 1package org.tianocore.frameworkwizard.platform.ui;\r
2\r
3import java.awt.BorderLayout;\r
4\r
5import javax.swing.ButtonGroup;\r
2a23019d 6import javax.swing.JOptionPane;\r
a13899c5 7import javax.swing.JPanel;\r
a13899c5 8import javax.swing.JScrollPane;\r
9import javax.swing.JTable;\r
10import javax.swing.ListSelectionModel;\r
11import javax.swing.event.ListSelectionEvent;\r
12import javax.swing.event.ListSelectionListener;\r
13import javax.swing.table.DefaultTableModel;\r
14\r
15import org.tianocore.PlatformSurfaceAreaDocument;\r
2a23019d 16import org.tianocore.frameworkwizard.common.DataValidation;\r
17import org.tianocore.frameworkwizard.common.Tools;\r
d6d24759 18import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
a13899c5 19import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
20import javax.swing.JCheckBox;\r
21import java.awt.FlowLayout;\r
22import javax.swing.JRadioButton;\r
23import javax.swing.JButton;\r
24import javax.swing.JLabel;\r
25import javax.swing.JTextField;\r
a0783edc 26import java.awt.GridLayout;\r
a13899c5 27\r
28public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {\r
29\r
44053733 30 /**\r
31 * \r
32 */\r
33 private static final long serialVersionUID = 1L;\r
a13899c5 34 private JPanel jContentPane = null;\r
4da2e625 35 private JScrollPane jScrollPaneDynPcd = null;\r
36 private JTable jTableDynPcd = null;\r
37 private DynPcdTableModel modelPcd = null; \r
38 private DynPcdTableModel modelSku = null;\r
a13899c5 39 private FpdFileContents ffc = null;\r
d6d24759 40 private OpeningPlatformType docConsole = null;\r
4da2e625 41 private JPanel jPanelSkuInfo = null;\r
42 private JCheckBox jCheckBoxSkuEnable = null;\r
43 private JPanel jPanelDynPcdValue = null;\r
44 private JRadioButton jRadioButtonHii = null;\r
45 private JRadioButton jRadioButtonVpd = null;\r
46 private JScrollPane jScrollPaneSkuInfo = null;\r
47 private JTable jTableSkuInfo = null;\r
48 private JButton jButtonSkuInfoUpdate = null;\r
49 private JLabel jLabelVarName = null;\r
50 private JTextField jTextFieldVarName = null;\r
51 private JLabel jLabelVarGuid = null;\r
52 private JTextField jTextFieldVarGuid = null;\r
53 private JLabel jLabelPad = null;\r
54 private JLabel jLabelVarOffset = null;\r
55 private JTextField jTextFieldVarOffset = null;\r
56 private JLabel jLabelHiiDefaultValue = null;\r
57 private JTextField jTextFieldHiiDefaultValue = null;\r
58 private JTextField jTextFieldVpdOffset = null;\r
59 private JLabel jLabelVpdOffset = null;\r
60 private JTextField jTextFieldDefaultValue = null;\r
61 private JRadioButton jRadioButtonDefaultValue = null;\r
a13899c5 62 private ButtonGroup bg = new ButtonGroup();\r
4da2e625 63 private JLabel jLabelPadd = null;\r
a0783edc 64 private JLabel jLabelPad1 = null;\r
a13899c5 65 /**\r
66 * This is the default constructor\r
67 */\r
68 public FpdDynamicPcdBuildDefinitions() {\r
69 super();\r
70 initialize();\r
71 }\r
72\r
73 public FpdDynamicPcdBuildDefinitions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){\r
74 this();\r
75 init(fpd);\r
76 }\r
77 \r
d6d24759 78 public FpdDynamicPcdBuildDefinitions(OpeningPlatformType opt) {\r
79 this(opt.getXmlFpd());\r
80 docConsole = opt;\r
81 }\r
82 \r
a13899c5 83 public void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
84 if (ffc == null) {\r
85 ffc = new FpdFileContents(fpd);\r
86 }\r
87 String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];\r
88 ffc.getDynamicPcdBuildData(saa);\r
89 for (int i = 0; i < saa.length; ++i) {\r
4da2e625 90 modelPcd.addRow(saa[i]);\r
a13899c5 91 }\r
92 \r
93 saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];\r
94 ffc.getPlatformDefsSkuInfos(saa);\r
95 for (int i = 0; i < saa.length; ++i) {\r
4da2e625 96 modelSku.addRow(saa[i]);\r
a13899c5 97 }\r
98 \r
99 }\r
100 /**\r
101 * This method initializes this\r
102 * \r
103 * @return void\r
104 */\r
105 private void initialize() {\r
106 this.setSize(661, 558);\r
107 this.setTitle("Dynamic PCD Build Definitions");\r
108 this.setContentPane(getJContentPane());\r
109 this.setVisible(true);\r
110 }\r
111\r
112 /**\r
113 * This method initializes jContentPane\r
114 * \r
115 * @return javax.swing.JPanel\r
116 */\r
117 private JPanel getJContentPane() {\r
118 if (jContentPane == null) {\r
119 jContentPane = new JPanel();\r
120 jContentPane.setLayout(new BorderLayout());\r
a0783edc 121 jContentPane.add(getJScrollPaneDynPcd(), java.awt.BorderLayout.NORTH);\r
122 jContentPane.add(getJPanelSkuInfo(), java.awt.BorderLayout.CENTER);\r
123 jContentPane.add(getJPanelDynPcdValue(), java.awt.BorderLayout.SOUTH);\r
a13899c5 124 }\r
125 return jContentPane;\r
126 }\r
127\r
a13899c5 128 /**\r
129 * This method initializes jScrollPane \r
130 * \r
131 * @return javax.swing.JScrollPane \r
132 */\r
4da2e625 133 private JScrollPane getJScrollPaneDynPcd() {\r
134 if (jScrollPaneDynPcd == null) {\r
135 jScrollPaneDynPcd = new JScrollPane();\r
a0783edc 136 jScrollPaneDynPcd.setPreferredSize(new java.awt.Dimension(100,300));\r
4da2e625 137 jScrollPaneDynPcd.setViewportView(getJTableDynPcd());\r
a13899c5 138 }\r
4da2e625 139 return jScrollPaneDynPcd;\r
a13899c5 140 }\r
141\r
142 /**\r
143 * This method initializes jTable \r
144 * \r
145 * @return javax.swing.JTable \r
146 */\r
4da2e625 147 private JTable getJTableDynPcd() {\r
148 if (jTableDynPcd == null) {\r
149 modelPcd = new DynPcdTableModel();\r
150 modelPcd.addColumn("CName");\r
151 modelPcd.addColumn("Token");\r
152 modelPcd.addColumn("TokenSpaceGuid");\r
153 modelPcd.addColumn("MaxDatumSize");\r
154 modelPcd.addColumn("DatumType");\r
155 jTableDynPcd = new JTable(modelPcd);\r
156 jTableDynPcd.setRowHeight(20);\r
157 jTableDynPcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
158 jTableDynPcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r
a13899c5 159 public void valueChanged(ListSelectionEvent e) {\r
160 if (e.getValueIsAdjusting()){\r
161 return;\r
162 }\r
163 ListSelectionModel lsm = (ListSelectionModel)e.getSource();\r
164 if (lsm.isSelectionEmpty()) {\r
165 return;\r
166 }\r
167 else{\r
168 int selectedRow = lsm.getMinSelectionIndex();\r
fb464577 169 jTextFieldDefaultValue.setText("");\r
170 jTextFieldVpdOffset.setText("");\r
171 jTextFieldVarName.setText("");\r
172 jTextFieldVarGuid.setText("");\r
173 jTextFieldVarOffset.setText("");\r
174 jTextFieldHiiDefaultValue.setText("");\r
a13899c5 175 displayDetails(selectedRow);\r
176 }\r
177 }\r
178 });\r
179 }\r
4da2e625 180 return jTableDynPcd;\r
a13899c5 181 }\r
182 //\r
183 // should display default sku info here, as no selection event of table1 will be triggered when change selection of rows in table. \r
184 //\r
185 private void displayDetails(int i) {\r
4da2e625 186 jTableSkuInfo.changeSelection(0, 1, false, false);\r
a13899c5 187 int skuCount = ffc.getDynamicPcdSkuInfoCount(i);\r
188 String defaultVal = ffc.getDynamicPcdBuildDataValue(i);\r
189 if (defaultVal != null) {\r
4da2e625 190 jRadioButtonDefaultValue.setSelected(true);\r
191 jTextFieldDefaultValue.setText(defaultVal);\r
a13899c5 192 if ( skuCount == 1) {\r
4da2e625 193 jCheckBoxSkuEnable.setSelected(false);\r
a13899c5 194 }\r
195 else{\r
4da2e625 196 jCheckBoxSkuEnable.setSelected(true);\r
a13899c5 197 }\r
198 }\r
199 \r
200 else if (ffc.getDynamicPcdBuildDataVpdOffset(i) != null) {\r
4da2e625 201 jRadioButtonVpd.setSelected(true);\r
202 jTextFieldVpdOffset.setText(ffc.getDynamicPcdBuildDataVpdOffset(i));\r
a13899c5 203 if (skuCount ==1) {\r
4da2e625 204 jCheckBoxSkuEnable.setSelected(false);\r
a13899c5 205 \r
206 }\r
207 else{\r
4da2e625 208 jCheckBoxSkuEnable.setSelected(true);\r
a13899c5 209 }\r
210 }\r
211 else {\r
4da2e625 212 jRadioButtonHii.setSelected(true);\r
a13899c5 213 String[][] saa = new String[ffc.getDynamicPcdSkuInfoCount(i)][7];\r
214 ffc.getDynamicPcdSkuInfos(i, saa);\r
2a23019d 215 \r
216 String varDisplayName = Tools.convertUnicodeHexStringToString(saa[0][1]);\r
217 jTextFieldVarName.setText(varDisplayName);\r
218 \r
4da2e625 219 jTextFieldVarGuid.setText(saa[0][2]);\r
220 jTextFieldVarOffset.setText(saa[0][3]);\r
221 jTextFieldHiiDefaultValue.setText(saa[0][4]);\r
a13899c5 222 if (skuCount ==1) {\r
4da2e625 223 jCheckBoxSkuEnable.setSelected(false);\r
a13899c5 224 }\r
225 else{\r
4da2e625 226 jCheckBoxSkuEnable.setSelected(true);\r
a13899c5 227 }\r
228 }\r
229 \r
230 }\r
231 \r
232 private void displaySkuInfoDetails(int i) {\r
4da2e625 233 int pcdSelected = jTableDynPcd.getSelectedRow();\r
a13899c5 234 if (pcdSelected < 0) {\r
235 return;\r
236 }\r
237 \r
238 String[][] saa = new String[ffc.getDynamicPcdSkuInfoCount(pcdSelected)][7];\r
239 ffc.getDynamicPcdSkuInfos(pcdSelected, saa);\r
240 \r
241 if (saa[i][5] != null){\r
4da2e625 242 jRadioButtonVpd.setSelected(true);\r
243 jTextFieldVpdOffset.setText(saa[i][5]);\r
a13899c5 244 } \r
245 \r
246 else if (saa[i][1] != null) {\r
4da2e625 247 jRadioButtonHii.setSelected(true);\r
2a23019d 248 String varDisplayName = Tools.convertUnicodeHexStringToString(saa[i][1]);\r
249 jTextFieldVarName.setText(varDisplayName);\r
4da2e625 250 jTextFieldVarGuid.setText(saa[i][2]);\r
251 jTextFieldVarOffset.setText(saa[i][3]);\r
252 jTextFieldHiiDefaultValue.setText(saa[i][4]);\r
a13899c5 253 }\r
254 \r
255 else{\r
4da2e625 256 jRadioButtonDefaultValue.setSelected(true);\r
257 jTextFieldDefaultValue.setText(saa[i][6]);\r
a13899c5 258 }\r
259 \r
260 }\r
261\r
262 /**\r
263 * This method initializes jPanel3 \r
264 * \r
265 * @return javax.swing.JPanel \r
266 */\r
4da2e625 267 private JPanel getJPanelSkuInfo() {\r
268 if (jPanelSkuInfo == null) {\r
a13899c5 269 FlowLayout flowLayout = new FlowLayout();\r
270 flowLayout.setAlignment(java.awt.FlowLayout.LEFT);\r
4da2e625 271 jPanelSkuInfo = new JPanel();\r
272 jPanelSkuInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));\r
273 jPanelSkuInfo.setLayout(flowLayout);\r
274 jPanelSkuInfo.setPreferredSize(new java.awt.Dimension(600,100));\r
275 jPanelSkuInfo.add(getJCheckBoxSkuEnable(), null);\r
276 jPanelSkuInfo.add(getJScrollPaneSkuInfo(), null);\r
277 jPanelSkuInfo.add(getJButtonSkuInfoUpdate(), null);\r
278 }\r
279 return jPanelSkuInfo;\r
a13899c5 280 }\r
281\r
282 /**\r
283 * This method initializes jCheckBox \r
284 * \r
285 * @return javax.swing.JCheckBox \r
286 */\r
4da2e625 287 private JCheckBox getJCheckBoxSkuEnable() {\r
288 if (jCheckBoxSkuEnable == null) {\r
289 jCheckBoxSkuEnable = new JCheckBox();\r
290 jCheckBoxSkuEnable.setText("SKU Enable");\r
291 jCheckBoxSkuEnable.addItemListener(new java.awt.event.ItemListener() {\r
a13899c5 292 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
4da2e625 293 jTableSkuInfo.setEnabled(jCheckBoxSkuEnable.isSelected());\r
a13899c5 294 }\r
295 });\r
296 }\r
4da2e625 297 return jCheckBoxSkuEnable;\r
a13899c5 298 }\r
299\r
300 \r
301 /**\r
302 * This method initializes jPanel4 \r
303 * \r
304 * @return javax.swing.JPanel \r
305 */\r
4da2e625 306 private JPanel getJPanelDynPcdValue() {\r
307 if (jPanelDynPcdValue == null) {\r
a0783edc 308 jLabelPad1 = new JLabel();\r
309 jLabelPad1.setText(" ");\r
310 GridLayout gridLayout = new GridLayout();\r
311 gridLayout.setColumns(5);\r
312 gridLayout.setRows(4);\r
313 gridLayout.setHgap(5);\r
314 gridLayout.setVgap(5);\r
315 \r
4da2e625 316 jLabelVpdOffset = new JLabel();\r
317 jLabelVpdOffset.setPreferredSize(new java.awt.Dimension(80,20));\r
318 jLabelVpdOffset.setText("VPD Offset");\r
319 jLabelHiiDefaultValue = new JLabel();\r
320 jLabelHiiDefaultValue.setPreferredSize(new java.awt.Dimension(100,20));\r
321 jLabelHiiDefaultValue.setText("HII Default Value");\r
322 jLabelVarOffset = new JLabel();\r
323 jLabelVarOffset.setText("Variable Offset");\r
324 jLabelVarOffset.setPreferredSize(new java.awt.Dimension(90,20));\r
325 jLabelPad = new JLabel();\r
326 jLabelPad.setText(" ");\r
327 jLabelVarGuid = new JLabel();\r
328 jLabelVarGuid.setText("Variable GUID");\r
329 jLabelVarGuid.setPreferredSize(new java.awt.Dimension(100,20));\r
330 jLabelVarName = new JLabel();\r
331 jLabelVarName.setText("Variable Name");\r
332 jLabelVarName.setToolTipText("");\r
333 jLabelVarName.setPreferredSize(new java.awt.Dimension(90,20));\r
4da2e625 334 jPanelDynPcdValue = new JPanel();\r
335 jPanelDynPcdValue.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));\r
a0783edc 336 jPanelDynPcdValue.setLayout(gridLayout);\r
4da2e625 337 jPanelDynPcdValue.setPreferredSize(new java.awt.Dimension(600,120));\r
338 jPanelDynPcdValue.add(getJRadioButtonHii(), null);\r
339 jPanelDynPcdValue.add(jLabelVarName, null);\r
340 jPanelDynPcdValue.add(getJTextFieldVarName(), null);\r
341 jPanelDynPcdValue.add(jLabelVarGuid, null);\r
342 jPanelDynPcdValue.add(getJTextFieldVarGuid(), null);\r
343 jPanelDynPcdValue.add(jLabelPad, null);\r
344 jPanelDynPcdValue.add(jLabelVarOffset, null);\r
345 jPanelDynPcdValue.add(getJTextFieldVarOffset(), null);\r
346 jPanelDynPcdValue.add(jLabelHiiDefaultValue, null);\r
347 jPanelDynPcdValue.add(getJTextFieldHiiDefaultValue(), null);\r
348 jPanelDynPcdValue.add(getJRadioButtonVpd(), null);\r
349 jPanelDynPcdValue.add(jLabelVpdOffset, null);\r
4da2e625 350 jLabelPadd = new JLabel();\r
351 jLabelPadd.setText(" ");\r
a0783edc 352 jPanelDynPcdValue.add(getJTextFieldVpdOffset(), null);\r
4da2e625 353 jLabelVarName.setEnabled(false);\r
354 jLabelVarGuid.setEnabled(false);\r
355 jLabelHiiDefaultValue.setEnabled(false);\r
356 jLabelVarOffset.setEnabled(false);\r
357 jLabelVpdOffset.setEnabled(false);\r
a0783edc 358 jPanelDynPcdValue.add(jLabelPadd, null);\r
359 jPanelDynPcdValue.add(jLabelPad1, null);\r
4da2e625 360 jPanelDynPcdValue.add(getJRadioButtonDefaultValue(), null);\r
361 jPanelDynPcdValue.add(getJTextFieldDefaultValue(), null);\r
362 bg.add(jRadioButtonHii);\r
363 bg.add(jRadioButtonVpd);\r
a13899c5 364 } \r
365\r
4da2e625 366 return jPanelDynPcdValue;\r
a13899c5 367 }\r
368\r
369 /**\r
370 * This method initializes jRadioButton \r
371 * \r
372 * @return javax.swing.JRadioButton \r
373 */\r
4da2e625 374 private JRadioButton getJRadioButtonHii() {\r
375 if (jRadioButtonHii == null) {\r
376 jRadioButtonHii = new JRadioButton();\r
377 jRadioButtonHii.setText("HII Enable");\r
378 jRadioButtonHii.addItemListener(new java.awt.event.ItemListener() {\r
a13899c5 379 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
4da2e625 380 boolean selected = jRadioButtonHii.isSelected();\r
381 jLabelVarName.setEnabled(selected);\r
382 jLabelVarGuid.setEnabled(selected);\r
383 jLabelPad.setEnabled(selected);\r
384 jLabelVarOffset.setEnabled(selected);\r
385 jLabelHiiDefaultValue.setEnabled(selected);\r
386 jTextFieldVarName.setEnabled(selected);\r
387 jTextFieldVarGuid.setEnabled(selected);\r
388 jTextFieldVarOffset.setEnabled(selected);\r
389 jTextFieldHiiDefaultValue.setEnabled(selected);\r
a13899c5 390 }\r
391 });\r
392 }\r
4da2e625 393 return jRadioButtonHii;\r
a13899c5 394 }\r
395\r
396 /**\r
397 * This method initializes jRadioButton1 \r
398 * \r
399 * @return javax.swing.JRadioButton \r
400 */\r
4da2e625 401 private JRadioButton getJRadioButtonVpd() {\r
402 if (jRadioButtonVpd == null) {\r
403 jRadioButtonVpd = new JRadioButton();\r
404 jRadioButtonVpd.setText("VPD Enable");\r
405 jRadioButtonVpd.addItemListener(new java.awt.event.ItemListener() {\r
a13899c5 406 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
4da2e625 407 boolean selected = jRadioButtonVpd.isSelected();\r
408 jTextFieldVpdOffset.setEnabled(selected);\r
409 jLabelVpdOffset.setEnabled(selected);\r
a13899c5 410 }\r
411 });\r
412 }\r
4da2e625 413 return jRadioButtonVpd;\r
a13899c5 414 }\r
415\r
416 /**\r
417 * This method initializes jScrollPane1 \r
418 * \r
419 * @return javax.swing.JScrollPane \r
420 */\r
4da2e625 421 private JScrollPane getJScrollPaneSkuInfo() {\r
422 if (jScrollPaneSkuInfo == null) {\r
423 jScrollPaneSkuInfo = new JScrollPane();\r
424 jScrollPaneSkuInfo.setPreferredSize(new java.awt.Dimension(300,80));\r
425 jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());\r
a13899c5 426 }\r
4da2e625 427 return jScrollPaneSkuInfo;\r
a13899c5 428 }\r
429\r
430 /**\r
431 * This method initializes jTable1 \r
432 * \r
433 * @return javax.swing.JTable \r
434 */\r
4da2e625 435 private JTable getJTableSkuInfo() {\r
436 if (jTableSkuInfo == null) {\r
437 modelSku = new DynPcdTableModel();\r
438 jTableSkuInfo = new JTable(modelSku);\r
439 modelSku.addColumn("SKU ID");\r
440 modelSku.addColumn("SKU Name");\r
a13899c5 441 \r
4da2e625 442 jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
443 jTableSkuInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r
a13899c5 444 public void valueChanged(ListSelectionEvent e) {\r
4da2e625 445 if (jTableDynPcd.getSelectedRow() < 0) {\r
a13899c5 446 return;\r
447 }\r
448 if (e.getValueIsAdjusting()){\r
449 return;\r
450 }\r
451 ListSelectionModel lsm = (ListSelectionModel)e.getSource();\r
452 if (lsm.isSelectionEmpty()) {\r
453 return;\r
454 }\r
455 else{\r
1bf9fa5a 456 jTextFieldDefaultValue.setText("");\r
457 jTextFieldVpdOffset.setText("");\r
458 jTextFieldVarName.setText("");\r
459 jTextFieldVarGuid.setText("");\r
460 jTextFieldVarOffset.setText("");\r
461 jTextFieldHiiDefaultValue.setText("");\r
a13899c5 462 int selected = lsm.getMinSelectionIndex();\r
44053733 463 displaySkuInfoDetails(selected);\r
a13899c5 464 }\r
465 }\r
466 });\r
467 }\r
4da2e625 468 return jTableSkuInfo;\r
a13899c5 469 }\r
470\r
471 /**\r
472 * This method initializes jButton \r
473 * \r
474 * @return javax.swing.JButton \r
475 */\r
4da2e625 476 private JButton getJButtonSkuInfoUpdate() {\r
477 if (jButtonSkuInfoUpdate == null) {\r
478 jButtonSkuInfoUpdate = new JButton();\r
479 jButtonSkuInfoUpdate.setPreferredSize(new java.awt.Dimension(180,20));\r
480 jButtonSkuInfoUpdate.setText(" Update SKU Information");\r
481 jButtonSkuInfoUpdate.addActionListener(new java.awt.event.ActionListener() {\r
a13899c5 482 public void actionPerformed(java.awt.event.ActionEvent e) {\r
4da2e625 483 int pcdSelected = jTableDynPcd.getSelectedRow();\r
a13899c5 484 if (pcdSelected < 0) {\r
485 return;\r
486 }\r
d6d24759 487 docConsole.setSaved(false);\r
a13899c5 488 updateSkuInfo(pcdSelected);\r
489 \r
490 }\r
491 });\r
492 }\r
4da2e625 493 return jButtonSkuInfoUpdate;\r
a13899c5 494 }\r
2a23019d 495 \r
a13899c5 496 private void updateSkuInfo (int pcdSelected) {\r
497 int skuCount = ffc.getDynamicPcdSkuInfoCount(pcdSelected);\r
498 \r
499 String varName = null;\r
500 String varGuid = null;\r
501 String varOffset = null;\r
502 String hiiDefault = null;\r
503 String value = null;\r
504 String vpdOffset = null;\r
4da2e625 505 if (jRadioButtonHii.isSelected()) {\r
2a23019d 506 varName = Tools.convertStringToUnicodeHexString(jTextFieldVarName.getText());\r
507 if (varName.length() == 0) {\r
508 JOptionPane.showMessageDialog(this, "Variable Name is Empty.");\r
509 return;\r
510 }\r
4da2e625 511 varGuid = jTextFieldVarGuid.getText();\r
2a23019d 512 if (varGuid.length() == 0) {\r
513 JOptionPane.showMessageDialog(this, "Variable GUID is Empty.");\r
514 return;\r
515 }\r
4da2e625 516 varOffset = jTextFieldVarOffset.getText();\r
2a23019d 517 if (!DataValidation.isHex64BitDataType(varOffset)) {\r
518 JOptionPane.showMessageDialog(this, "Variable Offset is NOT Hex64BitDataType.");\r
519 return;\r
520 }\r
4da2e625 521 hiiDefault = jTextFieldHiiDefaultValue.getText();\r
2a23019d 522 if (!DataValidation.isDefaultValueType(hiiDefault)) {\r
523 JOptionPane.showMessageDialog(this, "Default Value is NOT DefaultValueType.");\r
524 return;\r
525 }\r
a13899c5 526 }\r
4da2e625 527 if (jRadioButtonVpd.isSelected()) {\r
528 vpdOffset = jTextFieldVpdOffset.getText();\r
2a23019d 529 if (!DataValidation.isHex64BitDataType(vpdOffset)) {\r
530 JOptionPane.showMessageDialog(this, "VPD Offset is NOT Hex64BitDataType.");\r
531 return;\r
532 }\r
a13899c5 533 }\r
4da2e625 534 if (jRadioButtonDefaultValue.isSelected()) {\r
535 value = jTextFieldDefaultValue.getText();\r
2a23019d 536 if (!DataValidation.isDefaultValueType(value)) {\r
537 JOptionPane.showMessageDialog(this, "Value is NOT DefaultValueType.");\r
538 return;\r
539 }\r
a13899c5 540 }\r
541 //\r
542 // SKU disabled. only modify data for default SKU.\r
543 //\r
4da2e625 544 if (!jCheckBoxSkuEnable.isSelected()) {\r
a13899c5 545 if (true) {\r
546 ffc.removeDynamicPcdBuildDataSkuInfo(pcdSelected);\r
4da2e625 547 if (jRadioButtonHii.isSelected()) {\r
a13899c5 548 ffc.genDynamicPcdBuildDataSkuInfo("0", varName, varGuid, varOffset, hiiDefault, null, null, pcdSelected);\r
549 }\r
4da2e625 550 else if (jRadioButtonVpd.isSelected()){\r
a13899c5 551 ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, vpdOffset, null, pcdSelected);\r
552 }\r
553 else{\r
554 ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, null, value, pcdSelected);\r
555 }\r
556 }\r
557 }\r
558 //\r
559 // SKU Enabled, need add data to all SKUs.\r
560 //\r
4da2e625 561 if (jCheckBoxSkuEnable.isSelected()) {\r
a13899c5 562 if (skuCount == 1) {\r
563 \r
4da2e625 564 for (int i = 1; i < jTableSkuInfo.getRowCount(); ++i) {\r
565 ffc.genDynamicPcdBuildDataSkuInfo(jTableSkuInfo.getValueAt(i, 0)+"", varName, varGuid, varOffset, hiiDefault, vpdOffset, value, pcdSelected);\r
a13899c5 566 }\r
567 }\r
568 else {\r
4da2e625 569 int row = jTableSkuInfo.getSelectedRow();\r
a13899c5 570 if (row < 0) {\r
571 return;\r
572 }\r
4da2e625 573 ffc.updateDynamicPcdBuildDataSkuInfo(jTableSkuInfo.getValueAt(row, 0)+"", varName, varGuid, varOffset, hiiDefault, vpdOffset, value, pcdSelected);\r
a13899c5 574 }\r
575 }\r
576 }\r
577 /**\r
578 * This method initializes jTextField \r
579 * \r
580 * @return javax.swing.JTextField \r
581 */\r
4da2e625 582 private JTextField getJTextFieldVarName() {\r
583 if (jTextFieldVarName == null) {\r
584 jTextFieldVarName = new JTextField();\r
585 jTextFieldVarName.setPreferredSize(new java.awt.Dimension(150,20));\r
586 jTextFieldVarName.setEnabled(false);\r
a13899c5 587 }\r
4da2e625 588 return jTextFieldVarName;\r
a13899c5 589 }\r
590\r
591 /**\r
592 * This method initializes jTextField1 \r
593 * \r
594 * @return javax.swing.JTextField \r
595 */\r
4da2e625 596 private JTextField getJTextFieldVarGuid() {\r
597 if (jTextFieldVarGuid == null) {\r
598 jTextFieldVarGuid = new JTextField();\r
599 jTextFieldVarGuid.setPreferredSize(new java.awt.Dimension(150,20));\r
600 jTextFieldVarGuid.setEnabled(false);\r
a13899c5 601 }\r
4da2e625 602 return jTextFieldVarGuid;\r
a13899c5 603 }\r
604\r
605 /**\r
606 * This method initializes jTextField2 \r
607 * \r
608 * @return javax.swing.JTextField \r
609 */\r
4da2e625 610 private JTextField getJTextFieldVarOffset() {\r
611 if (jTextFieldVarOffset == null) {\r
612 jTextFieldVarOffset = new JTextField();\r
613 jTextFieldVarOffset.setPreferredSize(new java.awt.Dimension(150,20));\r
614 jTextFieldVarOffset.setEnabled(false);\r
a13899c5 615 }\r
4da2e625 616 return jTextFieldVarOffset;\r
a13899c5 617 }\r
618\r
619 /**\r
620 * This method initializes jTextField3 \r
621 * \r
622 * @return javax.swing.JTextField \r
623 */\r
4da2e625 624 private JTextField getJTextFieldHiiDefaultValue() {\r
625 if (jTextFieldHiiDefaultValue == null) {\r
626 jTextFieldHiiDefaultValue = new JTextField();\r
627 jTextFieldHiiDefaultValue.setPreferredSize(new java.awt.Dimension(150,20));\r
628 jTextFieldHiiDefaultValue.setEnabled(false);\r
a13899c5 629 }\r
4da2e625 630 return jTextFieldHiiDefaultValue;\r
a13899c5 631 }\r
632\r
633 /**\r
634 * This method initializes jTextField4 \r
635 * \r
636 * @return javax.swing.JTextField \r
637 */\r
4da2e625 638 private JTextField getJTextFieldVpdOffset() {\r
639 if (jTextFieldVpdOffset == null) {\r
640 jTextFieldVpdOffset = new JTextField();\r
641 jTextFieldVpdOffset.setPreferredSize(new java.awt.Dimension(150,20));\r
642 jTextFieldVpdOffset.setEnabled(false);\r
a13899c5 643 }\r
4da2e625 644 return jTextFieldVpdOffset;\r
a13899c5 645 }\r
646\r
647 /**\r
648 * This method initializes jTextField5 \r
649 * \r
650 * @return javax.swing.JTextField \r
651 */\r
4da2e625 652 private JTextField getJTextFieldDefaultValue() {\r
653 if (jTextFieldDefaultValue == null) {\r
654 jTextFieldDefaultValue = new JTextField();\r
655 jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(150,20));\r
a13899c5 656 }\r
4da2e625 657 return jTextFieldDefaultValue;\r
a13899c5 658 }\r
659\r
660 /**\r
661 * This method initializes jRadioButton2 \r
662 * \r
663 * @return javax.swing.JRadioButton \r
664 */\r
4da2e625 665 private JRadioButton getJRadioButtonDefaultValue() {\r
666 if (jRadioButtonDefaultValue == null) {\r
667 jRadioButtonDefaultValue = new JRadioButton();\r
668 jRadioButtonDefaultValue.setText("Default PCD Value");\r
669 jRadioButtonDefaultValue.setSelected(true);\r
670 jRadioButtonDefaultValue.setPreferredSize(new java.awt.Dimension(175,20));\r
671 jRadioButtonDefaultValue.addItemListener(new java.awt.event.ItemListener() {\r
a13899c5 672 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
4da2e625 673 jTextFieldDefaultValue.setEnabled(jRadioButtonDefaultValue.isSelected());\r
a13899c5 674 }\r
675 });\r
4da2e625 676 bg.add(jRadioButtonDefaultValue);\r
a13899c5 677 }\r
4da2e625 678 return jRadioButtonDefaultValue;\r
a13899c5 679 }\r
680\r
681} // @jve:decl-index=0:visual-constraint="10,10"\r
682\r
683class DynPcdTableModel extends DefaultTableModel {\r
44053733 684 /**\r
685 * \r
686 */\r
687 private static final long serialVersionUID = 1L;\r
688\r
a13899c5 689 public boolean isCellEditable(int row, int col) {\r
690 \r
691 return false;\r
692 }\r
693}\r