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