Provide UI for generating Apriori file of PEI or DXE phase. The module order informat...
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFlash.java
1 /** @file
2 Java class FpdFlash is GUI for Flash element operation in SPD file.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 **/
13 package org.tianocore.frameworkwizard.platform.ui;
14
15 import java.awt.BorderLayout;
16 import javax.swing.JPanel;
17
18 import javax.swing.AbstractAction;
19 import javax.swing.JFileChooser;
20 import javax.swing.JFrame;
21 import javax.swing.JOptionPane;
22 import javax.swing.JTabbedPane;
23 import javax.swing.JButton;
24 import javax.swing.ListSelectionModel;
25
26 import org.tianocore.PlatformSurfaceAreaDocument;
27 import org.tianocore.frameworkwizard.common.DataValidation;
28 import org.tianocore.frameworkwizard.common.IDefaultTableModel;
29 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
30 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
31 import org.tianocore.frameworkwizard.common.ui.StarLabel;
32 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
33 import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
34
35 import java.awt.FlowLayout;
36 import java.awt.event.ActionEvent;
37 import java.awt.event.ActionListener;
38 import java.awt.event.ComponentAdapter;
39 import java.awt.event.ComponentEvent;
40 import java.awt.event.ItemEvent;
41 import java.awt.event.ItemListener;
42 import java.awt.event.MouseAdapter;
43 import java.awt.event.MouseEvent;
44 import java.io.BufferedReader;
45 import java.io.File;
46 import java.io.FileReader;
47 import java.util.HashMap;
48 import java.util.Iterator;
49 import java.util.LinkedHashMap;
50 import java.util.Map;
51 import java.util.Set;
52 import java.util.Vector;
53
54 import javax.swing.JCheckBox;
55 import javax.swing.JTextField;
56 import java.awt.GridLayout;
57 import javax.swing.JLabel;
58 import javax.swing.JScrollPane;
59 import javax.swing.JTable;
60 import javax.swing.event.InternalFrameAdapter;
61 import javax.swing.event.InternalFrameEvent;
62 import javax.swing.event.ListSelectionEvent;
63 import javax.swing.event.ListSelectionListener;
64 import javax.swing.event.TableModelEvent;
65 import javax.swing.event.TableModelListener;
66 import javax.swing.table.DefaultTableModel;
67 import javax.swing.table.TableModel;
68 import javax.swing.JComboBox;
69 import java.awt.Dimension;
70 import javax.swing.JSplitPane;
71
72 public class FpdFlash extends IInternalFrame {
73
74 /**
75 *
76 */
77 private static final long serialVersionUID = 1L;
78 private final int startIndexOfDynamicTab = 2;
79 static JFrame frame;
80 private JPanel jContentPane = null;
81 private JPanel jPanelContentEast = null;
82 private JPanel jPanelContentSouth = null;
83 private JPanel jPanelContentWest = null;
84 private JPanel jPanelContentNorth = null;
85 private JTabbedPane jTabbedPane = null;
86 private JPanel jPanelFvImages = null;
87 private JPanel jPanelFvImageS = null;
88 private JPanel jPanelFvImageN = null;
89 private JCheckBox jCheckBoxFvProperty = null;
90 private JLabel jLabelFvPropName = null;
91 private JTextField jTextFieldFvPropName = null;
92 private JLabel jLabelFvPropValue = null;
93 private JTextField jTextFieldFvPropValue = null;
94 private JButton jButtonFvPropAdd = null;
95 private JScrollPane jScrollPaneFvProp = null;
96 private JTable jTableFvProp = null;
97 private JPanel jPanelFvPropButtonGroup = null;
98 private JButton jButtonFvPropDel = null;
99 private DefaultTableModel fvPropertyTableModel = null;
100 private DefaultTableModel fvImageNameTableModel = null;
101 private ImageParaTableModel fvImageParaTableModel = null;
102 private DefaultTableModel fvOptionTableModel = null;
103 private JPanel jPanelFvImageC = null;
104 private JLabel jLabelFvParaType = null;
105 private JComboBox jComboBoxFvParaType = null;
106 private JLabel jLabelFvImageNames = null;
107 private JLabel jLabelFvParaName = null;
108 private JTextField jTextFieldFvParaName = null;
109 private JButton jButtonFvNameAdd = null;
110 private JScrollPane jScrollPaneFvImageNames = null;
111 private JTable jTableFvImageNames = null;
112 private JButton jButtonFvNameDel = null;
113 private JPanel jPanelFvImageOpts = null;
114 private JButton jButtonAddFvImage = null;
115 private JScrollPane jScrollPaneFvInfo = null;
116 private JTable jTableFvInfo = null;
117 private JButton jButtonDelFvImage = null;
118 private JPanel jPanelFvImagePara = null;
119 private OpeningPlatformType docConsole = null;
120 private FpdFileContents ffc = null;
121 private JPanel jPanelFdf = null;
122 private JCheckBox jCheckBoxFdf = null;
123 private JTextField jTextFieldFdf = null;
124 private JButton jButtonFdfBrowse = null;
125 private JLabel jLabelFvImageOptName = null;
126 private JTextField jTextFieldFvImageOptName = null;
127 private JLabel jLabelFvImageOptValue = null;
128 private JTextField jTextFieldFvImageOptValue = null;
129 private JPanel jPanelFvImageOptsButtonGroup = null;
130 private JButton jButtonFvImageOptAdd = null;
131 private JButton jButtonFvImageOptDel = null;
132 private JScrollPane jScrollPane = null;
133 private JTable jTableFvImageOpts = null;
134 private JButton jButtonUpdateFvImage = null;
135 private JPanel jPanelFdfN = null;
136 private JPanel jPanelFdfS = null;
137 private JSplitPane jSplitPaneFdfC = null;
138 private JPanel jPanelFdfCTop = null;
139 private JPanel jPanelFdfCBottom = null;
140 private JPanel jPanelFdfCTopN = null;
141 private JPanel jPanelFdfCTopS = null;
142 // private JPanel jPanelFdfCTopC = null;
143 private JPanel jPanelFdfCBottomN = null;
144 // private JPanel jPanelFdfCBottomC = null;
145 private JLabel jLabelFvInFdf = null;
146 private JLabel jLabelFvAdditional = null;
147 private JScrollPane jScrollPaneFvInFdf = null;
148 private JTable jTableFvInFdf = null;
149 private IDefaultTableModel fvInFdfTableModel = null; // @jve:decl-index=0:visual-constraint=""
150 private JButton jButtonFvInFdfOptions = null;
151 private JScrollPane jScrollPaneFvAdditional = null;
152 private JTable jTableFvAdditional = null;
153 private DefaultTableModel fvAdditionalTableModel = null; // @jve:decl-index=0:visual-constraint=""
154 private JButton jButtonAddFv = null;
155 private JButton jButtonDelFv = null;
156 private JButton jButtonAddFvOptions = null;
157 private int tabIndexForFv = -1;
158 private int selectedRowInFvAdditionalTable = -1;
159 private String oldFvName = null;
160 private Vector<String> vBlockSize = new Vector<String>();
161 private String determinedFvBlockSize = null;
162 private final String defaultBlkSize = "0x10000";
163 private String erasePolarity = "";
164 boolean memModified = false;
165 private FvOptsTableModel fvInFdfOptTableModel = null;
166 private FvOptsTableModel fvAdditionalOptTableModel = null;
167 private boolean sizeFromOptionDlg = false;
168 private boolean fileFromOptionDlg = false;
169 private JLabel jLabelOptions = null;
170 private JPanel jPanelBgFvName = null;
171 private JPanel jPanelBgFvImage = null;
172 private JPanel jPanelW = null;
173 private JPanel jPanelFvImageParaN = null;
174 private JPanel jPanelFvImageParaS = null;
175 // private JPanel jPanelFvImageParaC = null;
176 private JPanel jPanelFvImageOptsN = null;
177 private JPanel jPanelFvImageOptsS = null;
178 // private JPanel jPanelFvImageOptsC = null;
179 private JPanel jPanelFvImageParaE = null;
180 private JPanel jPanelFvImageOptsE = null;
181 private JPanel jPanelFvImageSN = null;
182 private JPanel jPanelFvImageSE = null;
183 private JPanel jPanelFvImageSS = null;
184
185 public FpdFlash() {
186 super();
187 // TODO Auto-generated constructor stub
188
189 initialize();
190 this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
191 this.setVisible(true);
192 }
193
194 public FpdFlash(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
195 this();
196 ffc = new FpdFileContents(fpd);
197 init(ffc);
198 }
199
200 public FpdFlash(OpeningPlatformType opt) {
201 this(opt.getXmlFpd());
202 docConsole = opt;
203 if (memModified) {
204 docConsole.setSaved(false);
205 JOptionPane.showMessageDialog(frame, "Platform Synced with FDF file.");
206 memModified = false;
207 }
208 }
209
210 /**
211 * This method initializes jPanel
212 *
213 * @return javax.swing.JPanel
214 */
215 private JPanel getJPanelContentEast() {
216 if (jPanelContentEast == null) {
217 FlowLayout flowLayout7 = new FlowLayout();
218 flowLayout7.setVgap(50);
219 jPanelContentEast = new JPanel();
220 jPanelContentEast.setLayout(flowLayout7);
221 }
222 return jPanelContentEast;
223 }
224
225 /**
226 * This method initializes jPanel1
227 *
228 * @return javax.swing.JPanel
229 */
230 private JPanel getJPanelContentSouth() {
231 if (jPanelContentSouth == null) {
232 FlowLayout flowLayout = new FlowLayout();
233 flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
234 flowLayout.setHgap(15);
235 jPanelContentSouth = new JPanel();
236 jPanelContentSouth.setLayout(flowLayout);
237 jPanelContentSouth.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
238 }
239 return jPanelContentSouth;
240 }
241
242 /**
243 * This method initializes jPanel2
244 *
245 * @return javax.swing.JPanel
246 */
247 private JPanel getJPanelContentWest() {
248 if (jPanelContentWest == null) {
249 jPanelContentWest = new JPanel();
250 }
251 return jPanelContentWest;
252 }
253
254 /**
255 * This method initializes jPanel3
256 *
257 * @return javax.swing.JPanel
258 */
259 private JPanel getJPanelContentNorth() {
260 if (jPanelContentNorth == null) {
261 jPanelContentNorth = new JPanel();
262 }
263 return jPanelContentNorth;
264 }
265
266 /**
267 * This method initializes jTabbedPane
268 *
269 * @return javax.swing.JTabbedPane
270 */
271 private JTabbedPane getJTabbedPane() {
272 if (jTabbedPane == null) {
273 jTabbedPane = new JTabbedPane();
274 jTabbedPane.addTab("General", null, getJPanelFdf(), null);
275 jTabbedPane.addTab("Advanced", null, getJPanelFvImages(), null);
276
277 }
278 return jTabbedPane;
279 }
280
281 /**
282 * This method initializes jPanelFvImages
283 *
284 * @return javax.swing.JPanel
285 */
286 private JPanel getJPanelFvImages() {
287 if (jPanelFvImages == null) {
288 jPanelFvImages = new JPanel();
289 jPanelFvImages.setLayout(new BorderLayout());
290 jPanelFvImages.add(getJPanelFvImageN(), java.awt.BorderLayout.NORTH);
291 jPanelFvImages.add(getJPanelFvImageS(), java.awt.BorderLayout.SOUTH);
292 jPanelFvImages.add(getJPanelFvImageC(), java.awt.BorderLayout.CENTER);
293 jPanelFvImages.add(getJPanelW(), java.awt.BorderLayout.EAST);
294 jPanelFvImages.addComponentListener(new java.awt.event.ComponentAdapter() {
295 public void componentShown(java.awt.event.ComponentEvent e) {
296 // fvImageParaTableModel.setRowCount(0);
297 // fvPropertyTableModel.setRowCount(0);
298
299
300 }
301 });
302
303 }
304 return jPanelFvImages;
305 }
306
307 /**
308 * This method initializes jPanelFvImageN
309 *
310 * @return javax.swing.JPanel
311 */
312 private JPanel getJPanelFvImageS() {
313 if (jPanelFvImageS == null) {
314 jLabelFvPropValue = new JLabel();
315 jLabelFvPropValue.setText("Value");
316 jLabelFvPropValue.setEnabled(false);
317 jLabelFvPropValue.setPreferredSize(new java.awt.Dimension(38,20));
318 jLabelFvPropName = new JLabel();
319 jLabelFvPropName.setText("Name");
320 jLabelFvPropName.setEnabled(false);
321 jLabelFvPropName.setPreferredSize(new java.awt.Dimension(38,20));
322 jPanelFvImageS = new JPanel();
323 jPanelFvImageS.setPreferredSize(new java.awt.Dimension(576,130));
324 jPanelFvImageS.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
325 jPanelFvImageS.setLayout(new BorderLayout());
326 jPanelFvImageS.add(getJPanelFvImageSN(), java.awt.BorderLayout.NORTH);
327 jPanelFvImageS.add(getJPanelFvImageSE(), java.awt.BorderLayout.EAST);
328 jPanelFvImageS.add(getJPanelFvImageSS(), java.awt.BorderLayout.SOUTH);
329 jPanelFvImageS.add(getJScrollPaneFvProp(), java.awt.BorderLayout.CENTER);
330
331 }
332 return jPanelFvImageS;
333 }
334
335 /**
336 * This method initializes jPanelFvImageS
337 *
338 * @return javax.swing.JPanel
339 */
340 private JPanel getJPanelFvImageN() {
341 if (jPanelFvImageN == null) {
342 GridLayout gridLayout2 = new GridLayout();
343 gridLayout2.setRows(1);
344 jPanelFvImageN = new JPanel();
345 jPanelFvImageN.setPreferredSize(new java.awt.Dimension(480,150));
346 jPanelFvImageN.setLayout(gridLayout2);
347 jPanelFvImageN.add(getJScrollPaneFvInfo(), null);
348 }
349 return jPanelFvImageN;
350 }
351
352
353 /**
354 * This method initializes jCheckBox1
355 *
356 * @return javax.swing.JCheckBox
357 */
358 private JCheckBox getJCheckBoxFvProperty() {
359 if (jCheckBoxFvProperty == null) {
360 jCheckBoxFvProperty = new JCheckBox();
361 jCheckBoxFvProperty.setText("Global FV Variables");
362 jCheckBoxFvProperty.addItemListener(new ItemListener(){
363
364 public void itemStateChanged(ItemEvent arg0) {
365 // TODO Auto-generated method stub
366 boolean seleted = jCheckBoxFvProperty.isSelected();
367
368 jLabelFvPropName.setEnabled(seleted);
369 jTextFieldFvPropName.setEnabled(seleted);
370 jLabelFvPropValue.setEnabled(seleted);
371 jTextFieldFvPropValue.setEnabled(seleted);
372 jTableFvProp.setEnabled(seleted);
373 jButtonFvPropAdd.setEnabled(seleted);
374 jButtonFvPropDel.setEnabled(seleted);
375
376
377 }
378
379 });
380 }
381 return jCheckBoxFvProperty;
382 }
383
384
385 /**
386 * This method initializes jTextField
387 *
388 * @return javax.swing.JTextField
389 */
390 private JTextField getJTextFieldFvPropName() {
391 if (jTextFieldFvPropName == null) {
392 jTextFieldFvPropName = new JTextField();
393 jTextFieldFvPropName.setPreferredSize(new java.awt.Dimension(100,20));
394 jTextFieldFvPropName.setEnabled(false);
395 }
396 return jTextFieldFvPropName;
397 }
398
399
400 /**
401 * This method initializes jTextField1
402 *
403 * @return javax.swing.JTextField
404 */
405 private JTextField getJTextFieldFvPropValue() {
406 if (jTextFieldFvPropValue == null) {
407 jTextFieldFvPropValue = new JTextField();
408 jTextFieldFvPropValue.setPreferredSize(new java.awt.Dimension(100,20));
409 jTextFieldFvPropValue.setEnabled(false);
410 }
411 return jTextFieldFvPropValue;
412 }
413
414
415 /**
416 * This method initializes jButton
417 *
418 * @return javax.swing.JButton
419 */
420 private JButton getJButtonFvPropAdd() {
421 if (jButtonFvPropAdd == null) {
422 jButtonFvPropAdd = new JButton();
423 jButtonFvPropAdd.setPreferredSize(new java.awt.Dimension(80,20));
424 jButtonFvPropAdd.setEnabled(false);
425 jButtonFvPropAdd.setText("Add");
426 jButtonFvPropAdd.addActionListener(new AbstractAction() {
427 /**
428 *
429 */
430 private static final long serialVersionUID = 1L;
431
432 public void actionPerformed(ActionEvent e) {
433 if (jTextFieldFvPropName.getText().length() > 0 && jTextFieldFvPropValue.getText().length() > 0){
434 String[] row = {jTextFieldFvPropName.getText(), jTextFieldFvPropValue.getText()};
435 fvPropertyTableModel.addRow(row);
436 docConsole.setSaved(false);
437 ffc.genFvImagesNameValue(row[0], row[1]);
438 }
439 }
440 });
441 }
442 return jButtonFvPropAdd;
443 }
444
445
446 /**
447 * This method initializes jScrollPane1
448 *
449 * @return javax.swing.JScrollPane
450 */
451 private JScrollPane getJScrollPaneFvProp() {
452 if (jScrollPaneFvProp == null) {
453 jScrollPaneFvProp = new JScrollPane();
454 jScrollPaneFvProp.setPreferredSize(new java.awt.Dimension(350,100));
455 jScrollPaneFvProp.setViewportView(getJTableFvProp());
456 }
457 return jScrollPaneFvProp;
458 }
459
460
461 /**
462 * This method initializes jTable
463 *
464 * @return javax.swing.JTable
465 */
466 private JTable getJTableFvProp() {
467 if (jTableFvProp == null) {
468 fvPropertyTableModel = new DefaultTableModel();
469 jTableFvProp = new JTable(fvPropertyTableModel);
470 fvPropertyTableModel.addColumn("Name");
471 fvPropertyTableModel.addColumn("Value");
472 jTableFvProp.setRowHeight(20);
473 jTableFvProp.setEnabled(false);
474
475 jTableFvProp.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
476 jTableFvProp.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
477 public void valueChanged(ListSelectionEvent e) {
478 if (e.getValueIsAdjusting()){
479 return;
480 }
481 ListSelectionModel lsm = (ListSelectionModel)e.getSource();
482 if (lsm.isSelectionEmpty()) {
483 return;
484 }
485 else{
486 // selectedRow = lsm.getMinSelectionIndex();
487 }
488 }
489 });
490
491 jTableFvProp.getModel().addTableModelListener(new TableModelListener(){
492 public void tableChanged(TableModelEvent arg0) {
493 // TODO Auto-generated method stub
494 int row = arg0.getFirstRow();
495 TableModel m = (TableModel)arg0.getSource();
496 if (arg0.getType() == TableModelEvent.UPDATE){
497
498 String name = m.getValueAt(row, 0) + "";
499 String value = m.getValueAt(row, 1) + "";
500 docConsole.setSaved(false);
501 ffc.updateFvImagesNameValue(row, name, value);
502 }
503 }
504 });
505 }
506 return jTableFvProp;
507 }
508
509
510 /**
511 * This method initializes jPanel4
512 *
513 * @return javax.swing.JPanel
514 */
515 private JPanel getJPanelFvPropButtonGroup() {
516 if (jPanelFvPropButtonGroup == null) {
517 jPanelFvPropButtonGroup = new JPanel();
518 jPanelFvPropButtonGroup.setPreferredSize(new java.awt.Dimension(80,55));
519
520 jPanelFvPropButtonGroup.add(getJButtonFvPropAdd(), null);
521 jPanelFvPropButtonGroup.add(getJButtonFvPropDel(), null);
522 }
523 return jPanelFvPropButtonGroup;
524 }
525
526
527 /**
528 * This method initializes jButton1
529 *
530 * @return javax.swing.JButton
531 */
532 private JButton getJButtonFvPropDel() {
533 if (jButtonFvPropDel == null) {
534 jButtonFvPropDel = new JButton();
535 jButtonFvPropDel.setPreferredSize(new java.awt.Dimension(80,20));
536 jButtonFvPropDel.setEnabled(false);
537 jButtonFvPropDel.setText("Delete");
538 jButtonFvPropDel.addActionListener(new AbstractAction() {
539 /**
540 *
541 */
542 private static final long serialVersionUID = 1L;
543
544 public void actionPerformed(ActionEvent e) {
545 if (jTableFvProp.getSelectedRow() >= 0){
546 fvPropertyTableModel.removeRow(jTableFvProp.getSelectedRow());
547 docConsole.setSaved(false);
548 ffc.removeFvImagesNameValue(jTableFvProp.getSelectedRow());
549 }
550 }
551 });
552 }
553 return jButtonFvPropDel;
554 }
555
556
557 /**
558 * This method initializes jPanelFvImageC
559 *
560 * @return javax.swing.JPanel
561 */
562 private JPanel getJPanelFvImageC() {
563 if (jPanelFvImageC == null) {
564 GridLayout gridLayout = new GridLayout();
565 gridLayout.setRows(2);
566 jLabelFvParaName = new JLabel();
567 jLabelFvParaName.setPreferredSize(new Dimension(38, 20));
568 jLabelFvParaName.setText("Name");
569 jLabelFvImageNames = new JLabel();
570 jLabelFvImageNames.setText("FV Image Names");
571 jLabelFvImageNames.setPreferredSize(new java.awt.Dimension(150,20));
572 jLabelFvParaType = new JLabel();
573 jLabelFvParaType.setText("Type");
574 jLabelFvParaType.setPreferredSize(new java.awt.Dimension(70,20));
575 jPanelFvImageC = new JPanel();
576 jPanelFvImageC.setLayout(gridLayout);
577 jPanelFvImageC.add(getJPanelFvImagePara(), null);
578 jPanelFvImageC.add(getJPanelFvImageOpts(), null);
579
580
581 }
582 return jPanelFvImageC;
583 }
584
585
586 /**
587 * This method initializes jComboBox
588 *
589 * @return javax.swing.JComboBox
590 */
591 private JComboBox getJComboBoxFvParaType() {
592 if (jComboBoxFvParaType == null) {
593 jComboBoxFvParaType = new JComboBox();
594 jComboBoxFvParaType.addItem("Attributes");
595 jComboBoxFvParaType.addItem("Components");
596 jComboBoxFvParaType.setSelectedIndex(0);
597 jComboBoxFvParaType.setPreferredSize(new java.awt.Dimension(180,20));
598 jComboBoxFvParaType.addItemListener(new ItemListener() {
599
600 public void itemStateChanged(ItemEvent arg0) {
601 // TODO disable attribute settings when ValidImageNames selected.
602 int selectedRow = jTableFvInfo.getSelectedRow();
603 if (selectedRow < 0) {
604 return;
605 }
606 String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
607 String oldType = jTableFvInfo.getValueAt(selectedRow, 1)+"";
608 int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, oldType);
609 if (fvImagePos < 0) {
610 return;
611 }
612
613 String type = jComboBoxFvParaType.getSelectedItem()+"";
614 ffc.updateFvImagesFvImageType(fvImagePos, type);
615 jTableFvInfo.setValueAt(type, selectedRow, 1);
616 docConsole.setSaved(false);
617 }
618
619 });
620 }
621 return jComboBoxFvParaType;
622 }
623
624
625 /**
626 * This method initializes jTextField2
627 *
628 * @return javax.swing.JTextField
629 */
630 private JTextField getJTextFieldFvParaName() {
631 if (jTextFieldFvParaName == null) {
632 jTextFieldFvParaName = new JTextField();
633 jTextFieldFvParaName.setPreferredSize(new java.awt.Dimension(140,20));
634 }
635 return jTextFieldFvParaName;
636 }
637
638
639 /**
640 * This method initializes jButton2
641 *
642 * @return javax.swing.JButton
643 */
644 private JButton getJButtonFvNameAdd() {
645 if (jButtonFvNameAdd == null) {
646 jButtonFvNameAdd = new JButton();
647 jButtonFvNameAdd.setPreferredSize(new Dimension(80, 20));
648 jButtonFvNameAdd.setEnabled(true);
649 jButtonFvNameAdd.setText("Add");
650 jButtonFvNameAdd.addActionListener(new AbstractAction() {
651 /**
652 *
653 */
654 private static final long serialVersionUID = 1L;
655
656 public void actionPerformed(java.awt.event.ActionEvent e) {
657 if (jTextFieldFvParaName.getText().length() > 0){
658 String[] row = {jTextFieldFvParaName.getText()};
659 int selectedRow = jTableFvInfo.getSelectedRow();
660 if (selectedRow < 0) {
661 return;
662 }
663
664 String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
665 String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
666 int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
667
668 if (fvImagePos < 0) {
669 // new FvImage.
670 ffc.genFvImagesFvImage(row, jComboBoxFvParaType.getSelectedItem()+"", null);
671 }
672 else {
673 //append Fv name.
674 ffc.addFvImageNamesInFvImage(fvImagePos, row);
675 }
676 docConsole.setSaved(false);
677 fvImageNameTableModel.addRow(row);
678 fvNameList += " ";
679 fvNameList += row[0];
680 jTableFvInfo.setValueAt(fvNameList.trim(), selectedRow, 0);
681 jTableFvImageNames.changeSelection(jTableFvImageNames.getRowCount() - 1, 0, false, false);
682 }
683 }
684 });
685 }
686 return jButtonFvNameAdd;
687 }
688
689
690 /**
691 * This method initializes jScrollPane2
692 *
693 * @return javax.swing.JScrollPane
694 */
695 private JScrollPane getJScrollPaneFvImageNames() {
696 if (jScrollPaneFvImageNames == null) {
697 jScrollPaneFvImageNames = new JScrollPane();
698 jScrollPaneFvImageNames.setPreferredSize(new java.awt.Dimension(350,80));
699 jScrollPaneFvImageNames.setViewportView(getJTableFvImageNames());
700 }
701 return jScrollPaneFvImageNames;
702 }
703
704
705 /**
706 * This method initializes jTable1
707 *
708 * @return javax.swing.JTable
709 */
710 private JTable getJTableFvImageNames() {
711 if (jTableFvImageNames == null) {
712 fvImageNameTableModel = new IDefaultTableModel();
713 jTableFvImageNames = new JTable(fvImageNameTableModel);
714 jTableFvImageNames.setRowHeight(20);
715 fvImageNameTableModel.addColumn("FV Image Name");
716
717 }
718 return jTableFvImageNames;
719 }
720
721
722 /**
723 * This method initializes jButton3
724 *
725 * @return javax.swing.JButton
726 */
727 private JButton getJButtonFvNameDel() {
728 if (jButtonFvNameDel == null) {
729 jButtonFvNameDel = new JButton();
730 jButtonFvNameDel.setPreferredSize(new Dimension(80, 20));
731 jButtonFvNameDel.setEnabled(true);
732 jButtonFvNameDel.setText("Delete");
733 jButtonFvNameDel.addActionListener(new AbstractAction() {
734 /**
735 *
736 */
737 private static final long serialVersionUID = 1L;
738
739 public void actionPerformed(java.awt.event.ActionEvent e) {
740 if (jTableFvImageNames.getSelectedRow() >= 0){
741 int selectedRow = jTableFvInfo.getSelectedRow();
742 if (selectedRow < 0) {
743 return;
744 }
745
746 String selectedFvName = jTableFvImageNames.getValueAt(jTableFvImageNames.getSelectedRow(), 0)+"";
747 String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
748 String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
749 int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
750
751 if (fvImagePos < 0) {
752 return;
753 }
754 else {
755 //delete Fv name.
756 ffc.updateFvImageNamesInFvImage(fvImagePos, selectedFvName, null);
757 }
758 docConsole.setSaved(false);
759 String newList = removeFvNameFromList(fvNameList, selectedFvName);
760 jTableFvInfo.setValueAt(newList, selectedRow, 0);
761 fvImageNameTableModel.removeRow(jTableFvImageNames.getSelectedRow());
762 }
763 }
764 });
765 }
766 return jButtonFvNameDel;
767 }
768
769 private String removeFvNameFromList (String list, String name) {
770 String[] nameArray = list.split(" ");
771 int occursAt = -1;
772 for (int i = 0; i < nameArray.length; ++i) {
773 if (nameArray[i].equals(name)) {
774 occursAt = i;
775 break;
776 }
777 }
778
779 if (occursAt == -1) {
780 return list;
781 }
782
783 String newList = " ";
784 for (int j = 0; j < nameArray.length; ++j) {
785 if (j != occursAt) {
786 newList += nameArray[j];
787 newList += " ";
788 }
789 }
790
791 return newList.trim();
792 }
793
794
795 private JPanel getJPanelFvImageOpts() {
796
797
798 if (jPanelFvImageOpts == null) {
799 //ToDo add ButtonGroup for RadioButtons
800 jLabelOptions = new JLabel();
801 jLabelOptions.setText("Attribute");
802 jLabelFvImageOptValue = new JLabel();
803 jLabelFvImageOptValue.setEnabled(true);
804 jLabelFvImageOptValue.setText("Value");
805 jLabelFvImageOptValue.setPreferredSize(new Dimension(38, 20));
806 jLabelFvImageOptName = new JLabel();
807 jLabelFvImageOptName.setEnabled(true);
808 jLabelFvImageOptName.setText("Name");
809 jLabelFvImageOptName.setPreferredSize(new Dimension(38, 20));
810 jPanelFvImageOpts = new JPanel();
811 jPanelFvImageOpts.setLayout(new BorderLayout());
812 jPanelFvImageOpts.setPreferredSize(new java.awt.Dimension(450,130));
813
814
815 jPanelFvImageOpts.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
816
817 jPanelFvImageOpts.add(getJPanelFvImageOptsN(), java.awt.BorderLayout.NORTH);
818 jPanelFvImageOpts.add(getJPanelFvImageOptsS(), java.awt.BorderLayout.SOUTH);
819 jPanelFvImageOpts.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
820
821 jPanelFvImageOpts.add(getJPanelFvImageOptsE(), java.awt.BorderLayout.EAST);
822 }
823 return jPanelFvImageOpts;
824 }
825
826
827 /**
828 * This method initializes jButton4
829 *
830 * @return javax.swing.JButton
831 */
832 private JButton getJButtonAddFvImage() {
833 if (jButtonAddFvImage == null) {
834 jButtonAddFvImage = new JButton();
835 jButtonAddFvImage.setPreferredSize(new java.awt.Dimension(150,20));
836 jButtonAddFvImage.setText("New FV Attributes");
837 jButtonAddFvImage.addActionListener(new AbstractAction() {
838 /**
839 *
840 */
841 private static final long serialVersionUID = 1L;
842
843 public void actionPerformed(java.awt.event.ActionEvent e) {
844
845 // String imageName = " ";
846 // for (int i = 0; i < jTableFvImageNames.getRowCount(); ++i){
847 // imageName += (String)jTableFvImageNames.getValueAt(i, 0);
848 // imageName += " ";
849 // }
850 // imageName = imageName.trim();
851
852 // LinkedHashMap<String, String> m = null;
853 // m = new LinkedHashMap<String, String>();
854 // getOptionNameValue(m);
855 // ffc.genFvImagesFvImage(imageName.split(" "), jComboBoxFvParaType.getSelectedItem()+"", m);
856 // docConsole.setSaved(false);
857 fvImageNameTableModel.setRowCount(0);
858 fvOptionTableModel.setRowCount(0);
859 Object[] row = {"", jComboBoxFvParaType.getSelectedItem()};
860 fvImageParaTableModel.addRow(row);
861 jTableFvInfo.changeSelection(jTableFvInfo.getRowCount() - 1, 0, false, false);
862 }
863 });
864 }
865 return jButtonAddFvImage;
866 }
867
868
869 /**
870 * This method initializes jScrollPane3
871 *
872 * @return javax.swing.JScrollPane
873 */
874 private JScrollPane getJScrollPaneFvInfo() {
875 if (jScrollPaneFvInfo == null) {
876 jScrollPaneFvInfo = new JScrollPane();
877 jScrollPaneFvInfo.setPreferredSize(new java.awt.Dimension(480,150));
878 jScrollPaneFvInfo.setViewportView(getJTableFvInfo());
879 }
880 return jScrollPaneFvInfo;
881 }
882
883
884 /**
885 * This method initializes jTable2
886 *
887 * @return javax.swing.JTable
888 */
889 private JTable getJTableFvInfo() {
890 if (jTableFvInfo == null) {
891 fvImageParaTableModel = new ImageParaTableModel();
892 jTableFvInfo = new JTable(fvImageParaTableModel);
893 fvImageParaTableModel.addColumn("FvImageNames");
894 fvImageParaTableModel.addColumn("Type");
895
896 jTableFvInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
897 jTableFvInfo.setRowHeight(20);
898 jTableFvInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
899 public void valueChanged(ListSelectionEvent e) {
900 if (e.getValueIsAdjusting()){
901 return;
902 }
903 ListSelectionModel lsm = (ListSelectionModel)e.getSource();
904 if (lsm.isSelectionEmpty()) {
905 return;
906 }
907 else{
908 int selectedRow = lsm.getMinSelectionIndex();
909 String fvNameList = fvImageParaTableModel.getValueAt(selectedRow, 0)+"";
910 String type = fvImageParaTableModel.getValueAt(selectedRow, 1)+"";
911 jComboBoxFvParaType.setSelectedItem(type);
912 String[] fvNames = fvNameList.split(" ");
913 fvImageNameTableModel.setRowCount(0);
914 fvOptionTableModel.setRowCount(0);
915 for (int i = 0; i < fvNames.length; ++i) {
916 String[] row = { fvNames[i] };
917 if (row[0].length() > 0) {
918 fvImageNameTableModel.addRow(row);
919 }
920 }
921
922 int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
923 if (fvImagePos < 0) {
924 return;
925 }
926 LinkedHashMap<String, String> optionMap = new LinkedHashMap<String, String>();
927 ffc.getFvImagesFvImageOptions(fvImagePos, optionMap);
928 if (optionMap.size() > 0){
929 Set<String> key = optionMap.keySet();
930 Iterator<String> i = key.iterator();
931 while (i.hasNext()) {
932 String k = (String)i.next();
933 String[] row = {k, optionMap.get(k)};
934 fvOptionTableModel.addRow(row);
935 }
936 }
937 }
938 }
939 });
940
941
942 }
943 return jTableFvInfo;
944 }
945
946
947 /**
948 * This method initializes jButton6
949 *
950 * @return javax.swing.JButton
951 */
952 private JButton getJButtonDelFvImage() {
953 if (jButtonDelFvImage == null) {
954 jButtonDelFvImage = new JButton();
955 jButtonDelFvImage.setPreferredSize(new java.awt.Dimension(150,20));
956 jButtonDelFvImage.setText("Delete FV Attributes");
957 jButtonDelFvImage.addActionListener(new AbstractAction() {
958 /**
959 *
960 */
961 private static final long serialVersionUID = 1L;
962
963 public void actionPerformed(ActionEvent arg0) {
964 // TODO Auto-generated method stub
965 if (jTableFvInfo.getSelectedRow() >= 0 ) {
966 String fvNameList = fvImageParaTableModel.getValueAt(jTableFvInfo.getSelectedRow(), 0)+"";
967 int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, jComboBoxFvParaType.getSelectedItem()+"");
968
969 ffc.removeFvImagesFvImage(fvImagePos);
970 fvImageParaTableModel.removeRow(jTableFvInfo.getSelectedRow());
971 docConsole.setSaved(false);
972
973 fvImageNameTableModel.setRowCount(0);
974 fvOptionTableModel.setRowCount(0);
975 }
976 }
977
978 });
979 }
980 return jButtonDelFvImage;
981 }
982
983
984 /**
985 * This method initializes jPanel6
986 *
987 * @return javax.swing.JPanel
988 */
989 private JPanel getJPanelFvImagePara() {
990 if (jPanelFvImagePara == null) {
991 StarLabel starLabel = new StarLabel();
992 starLabel.setVisible(false);
993 jPanelFvImagePara = new JPanel();
994 jPanelFvImagePara.setLayout(new BorderLayout());
995 jPanelFvImagePara.setPreferredSize(new java.awt.Dimension(450,140));
996 jPanelFvImagePara.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
997
998 jPanelFvImagePara.add(getJPanelFvImageParaN(), java.awt.BorderLayout.NORTH);
999 jPanelFvImagePara.add(getJPanelFvImageParaS(), java.awt.BorderLayout.SOUTH);
1000 jPanelFvImagePara.add(getJScrollPaneFvImageNames(), java.awt.BorderLayout.CENTER);
1001
1002 jPanelFvImagePara.add(getJPanelFvImageParaE(), java.awt.BorderLayout.EAST);
1003 //
1004 //
1005 //
1006 }
1007 return jPanelFvImagePara;
1008 }
1009
1010 /**
1011 * This method initializes jPanel7
1012 *
1013 * @return javax.swing.JPanel
1014 */
1015 private JPanel getJPanelFdf() {
1016 if (jPanelFdf == null) {
1017 jPanelFdf = new JPanel();
1018 jPanelFdf.setLayout(new BorderLayout());
1019
1020 jPanelFdf.add(getJPanelFdfN(), java.awt.BorderLayout.NORTH);
1021 jPanelFdf.add(getJPanelFdfS(), java.awt.BorderLayout.SOUTH);
1022 jPanelFdf.add(getJSplitPaneFdfC(), java.awt.BorderLayout.CENTER);
1023 jPanelFdf.addComponentListener(new ComponentAdapter(){
1024 public void componentShown(ComponentEvent e) {
1025 // if (ffc.getFlashDefinitionFile() != null) {
1026 // jTextFieldFdf.setText(ffc.getFlashDefinitionFile());
1027 // initFvInFdfTable(System.getenv("WORKSPACE") + File.separator + jTextFieldFdf.getText());
1028 //
1029 // }
1030 }
1031 public void componentHidden(ComponentEvent e) {
1032 if (jCheckBoxFdf.isSelected()) {
1033 ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
1034 }
1035 }
1036 });
1037 }
1038 return jPanelFdf;
1039 }
1040
1041 /**
1042 * This method initializes jCheckBox
1043 *
1044 * @return javax.swing.JCheckBox
1045 */
1046 private JCheckBox getJCheckBoxFdf() {
1047 if (jCheckBoxFdf == null) {
1048 jCheckBoxFdf = new JCheckBox();
1049 jCheckBoxFdf.setText("Flash Definition File");
1050 jCheckBoxFdf.addItemListener(new ItemListener() {
1051
1052 public void itemStateChanged(ItemEvent arg0) {
1053 // TODO Auto-generated method stub
1054 if (jCheckBoxFdf.isSelected()){
1055 jTextFieldFdf.setEnabled(true);
1056 jButtonFdfBrowse.setEnabled(true);
1057 }
1058 else {
1059 getFvInFdfTableModel().setRowCount(0);
1060 jTextFieldFdf.setEnabled(false);
1061 jTextFieldFdf.setText("");
1062 jButtonFdfBrowse.setEnabled(false);
1063 ffc.genFlashDefinitionFile("");
1064 docConsole.setSaved(false);
1065 int selectedBackup = selectedRowInFvAdditionalTable;
1066 selectedRowInFvAdditionalTable = -1;
1067 initFvAdditionalTable();
1068 selectedRowInFvAdditionalTable = selectedBackup;
1069 }
1070 }
1071 });
1072 }
1073 return jCheckBoxFdf;
1074 }
1075
1076 /**
1077 * This method initializes jTextField3
1078 *
1079 * @return javax.swing.JTextField
1080 */
1081 private JTextField getJTextFieldFdf() {
1082 if (jTextFieldFdf == null) {
1083 jTextFieldFdf = new JTextField();
1084 jTextFieldFdf.setEnabled(false);
1085 jTextFieldFdf.setEditable(false);
1086 jTextFieldFdf.setPreferredSize(new Dimension(300, 20));
1087 jTextFieldFdf.addFocusListener(new java.awt.event.FocusAdapter() {
1088 public void focusLost(java.awt.event.FocusEvent e) {
1089 ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
1090 }
1091 });
1092 }
1093 return jTextFieldFdf;
1094 }
1095
1096 /**
1097 * This method initializes jButton5
1098 *
1099 * @return javax.swing.JButton
1100 */
1101 private JButton getJButtonFdfBrowse() {
1102 if (jButtonFdfBrowse == null) {
1103 jButtonFdfBrowse = new JButton();
1104 jButtonFdfBrowse.setEnabled(false);
1105 jButtonFdfBrowse.setText("Browse");
1106 jButtonFdfBrowse.setPreferredSize(new Dimension(78, 20));
1107 jButtonFdfBrowse.addActionListener(new AbstractAction(){
1108 /**
1109 *
1110 */
1111 private static final long serialVersionUID = 1L;
1112
1113 public void actionPerformed(ActionEvent e) {
1114 // TODO Auto-generated method stub
1115 String wsDir = System.getenv("WORKSPACE");
1116 JFileChooser chooser = new JFileChooser(wsDir);
1117 chooser.setMultiSelectionEnabled(false);
1118 chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
1119 int retval = chooser.showOpenDialog(frame);
1120 if (retval == JFileChooser.APPROVE_OPTION) {
1121
1122 File theFile = chooser.getSelectedFile();
1123 String filePath = theFile.getPath();
1124 if (!filePath.startsWith(wsDir)) {
1125 JOptionPane.showMessageDialog(frame, "You can only select files in current WORKSPACE.");
1126 return;
1127 }
1128 jTextFieldFdf.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/'));
1129 ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
1130 docConsole.setSaved(false);
1131 initFvInFdfTable(filePath);
1132 }
1133 }
1134
1135 });
1136 }
1137 return jButtonFdfBrowse;
1138 }
1139
1140 private void initFvAttributes () {
1141 if (ffc.getFvImagesFvImageCount("Attributes") == 0 && ffc.getFvImagesFvImageCount("Components") == 0) {
1142 return;
1143 }
1144 String[][] saa = new String[ffc.getFvImagesFvImageCount("Attributes")][2];
1145 ffc.getFvImagesFvImages(saa, "Attributes");
1146
1147 int i = 0;
1148 while (i < saa.length) {
1149 fvImageParaTableModel.addRow(saa[i]);
1150 ++i;
1151 }
1152
1153 saa = new String[ffc.getFvImagesFvImageCount("Components")][2];
1154 ffc.getFvImagesFvImages(saa, "Components");
1155 i = 0;
1156 while (i < saa.length) {
1157 fvImageParaTableModel.addRow(saa[i]);
1158 ++i;
1159 }
1160
1161 saa = new String[ffc.getFvImagesNameValueCount()][2];
1162 ffc.getFvImagesNameValues(saa);
1163 for (int m = 0; m < saa.length; ++m) {
1164 fvPropertyTableModel.addRow(saa[m]);
1165 }
1166 }
1167
1168 private void initFvAdditionalTable() {
1169 Vector<String> vFvNames = new Vector<String>();
1170 ffc.getFvImagesFvImageFvImageNames(vFvNames);
1171 for (int i = 0; i < vFvNames.size(); ++i) {
1172 String fvName = vFvNames.get(i);
1173 if (fvNameExists(fvName)) {
1174 continue;
1175 }
1176 fvAdditionalTableModel.addRow(getBasicFvInfo(fvName));
1177 addTabForFv(new FvInfoFromFdf(fvName, "", ""));
1178 }
1179 }
1180
1181 private void initFvInFdfTable(String fdfPath){
1182 Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();
1183 getFvInfoFromFdf(fdfPath, vFvInfo);
1184 getFlashInfoFromFdf (fdfPath);
1185 if (!erasePolarity.equals("1") && !erasePolarity.equals("0")) {
1186 JOptionPane.showMessageDialog(frame, "FDF file does NOT contain valid Erase Polarity.");
1187 }
1188 else {
1189 ffc.setTypedFvImageNameValue("Attributes", "EFI_ERASE_POLARITY", erasePolarity);
1190 }
1191
1192 // BugBug: assume all blocks have same size;
1193
1194 String blkSize = defaultBlkSize;
1195 if (vBlockSize.size() > 0) {
1196 blkSize = vBlockSize.get(0);
1197 if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {
1198 JOptionPane.showMessageDialog(frame, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used.");
1199 blkSize = defaultBlkSize;
1200 }
1201 }
1202 determinedFvBlockSize = blkSize;
1203
1204 getFvInFdfTableModel().setRowCount(0);
1205 Vector<String> vExistingFvNameInFpd = new Vector<String>();
1206 ffc.getFvImagesFvImageFvImageNames(vExistingFvNameInFpd);
1207 for (int j = 0; j < vFvInfo.size(); ++j) {
1208 FvInfoFromFdf fvInfo = vFvInfo.get(j);
1209 String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};
1210
1211 if (row[0].length() > 0 && !vExistingFvNameInFpd.contains(row[0])) {
1212 ffc.addFvImageFvImageNames(new String[]{row[0]});
1213 }
1214
1215 // if FV addtional table contains the same FV from fdf file, remove that row.
1216 for (int k = 0; k < jTableFvAdditional.getRowCount(); ++k) {
1217 if (fvAdditionalTableModel.getValueAt(k, 0).equals(row[0])) {
1218 fvAdditionalTableModel.removeRow(k);
1219 }
1220 }
1221 getFvInFdfTableModel().addRow(row);
1222 try {
1223 int blockSize = Integer.decode(blkSize);
1224 int fvSize = Integer.decode(row[1]);
1225 int numBlocks = fvSize/blockSize;
1226 HashMap<String, String> mOptions = new HashMap<String, String>();
1227 // if no options for this FV before, generate a new options entry for this FV.
1228 if (ffc.getFvImagesFvImageWithName(row[0], "Options") == null) {
1229
1230 mOptions.put("EFI_BLOCK_SIZE", blkSize);
1231 mOptions.put("EFI_NUM_BLOCKS", numBlocks+"");
1232 mOptions.put("EFI_FILE_NAME", row[2]);
1233 ffc.genFvImagesFvImage(new String[]{row[0]}, "Options", mOptions);
1234 memModified = true;
1235 }
1236 else {
1237 ffc.getFvImagesFvImageOptions(row[0], mOptions);
1238 if (mOptions.get("EFI_BLOCK_SIZE") == null || !mOptions.get("EFI_BLOCK_SIZE").equalsIgnoreCase(blkSize)) {
1239 ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_BLOCK_SIZE", blkSize, null);
1240 memModified = true;
1241 }
1242 if (mOptions.get("EFI_NUM_BLOCKS") == null || Integer.decode(mOptions.get("EFI_NUM_BLOCKS")) != numBlocks) {
1243 ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_NUM_BLOCKS", numBlocks + "", null);
1244 memModified = true;
1245 }
1246 if (mOptions.get("EFI_FILE_NAME") == null || !mOptions.get("EFI_FILE_NAME").equals(row[2])) {
1247 ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_FILE_NAME", row[2], null);
1248 memModified = true;
1249 }
1250
1251 }
1252 }
1253 catch (NumberFormatException e){
1254 JOptionPane.showMessageDialog(frame, e.getMessage());
1255 }
1256 }
1257
1258 for (int k = 0; k < vFvInfo.size(); ++k) {
1259 FvInfoFromFdf fvInfo = vFvInfo.get(k);
1260 addTabForFv(fvInfo);
1261 }
1262
1263 }
1264
1265 private void addTabForFv (FvInfoFromFdf fvInfo) {
1266 String fvName = fvInfo.getFvName();
1267 String outputFile = fvInfo.getEfiFileName();
1268 int index = jTabbedPane.indexOfTab(fvName);
1269 if (index >= startIndexOfDynamicTab) {
1270 return;
1271 }
1272 ModuleOrderPane pane = new ModuleOrderPane(fvName, outputFile, ffc, this);
1273 pane.showModulesInFv(fvName);
1274 pane.showAllModulesInPlatform();
1275 jTabbedPane.addTab(fvName, null, pane, null);
1276 }
1277 /**
1278 * This method initializes jTextField4
1279 *
1280 * @return javax.swing.JTextField
1281 */
1282 private JTextField getJTextFieldFvImageOptName() {
1283 if (jTextFieldFvImageOptName == null) {
1284 jTextFieldFvImageOptName = new JTextField();
1285 jTextFieldFvImageOptName.setEnabled(true);
1286 jTextFieldFvImageOptName.setPreferredSize(new Dimension(100, 20));
1287 }
1288 return jTextFieldFvImageOptName;
1289 }
1290
1291 /**
1292 * This method initializes jTextField5
1293 *
1294 * @return javax.swing.JTextField
1295 */
1296 private JTextField getJTextFieldFvImageOptValue() {
1297 if (jTextFieldFvImageOptValue == null) {
1298 jTextFieldFvImageOptValue = new JTextField();
1299 jTextFieldFvImageOptValue.setEnabled(true);
1300 jTextFieldFvImageOptValue.setPreferredSize(new Dimension(100, 20));
1301 }
1302 return jTextFieldFvImageOptValue;
1303 }
1304
1305 /**
1306 * This method initializes jPanel8
1307 *
1308 * @return javax.swing.JPanel
1309 */
1310 private JPanel getJPanelFvImageOptsButtonGroup() {
1311 if (jPanelFvImageOptsButtonGroup == null) {
1312 jPanelFvImageOptsButtonGroup = new JPanel();
1313 jPanelFvImageOptsButtonGroup.setPreferredSize(new Dimension(80, 55));
1314 jPanelFvImageOptsButtonGroup.add(getJButtonFvImageOptAdd(), null);
1315 jPanelFvImageOptsButtonGroup.add(getJButtonFvImageOptDel(), null);
1316 }
1317 return jPanelFvImageOptsButtonGroup;
1318 }
1319
1320 /**
1321 * This method initializes jButton7
1322 *
1323 * @return javax.swing.JButton
1324 */
1325 private JButton getJButtonFvImageOptAdd() {
1326 if (jButtonFvImageOptAdd == null) {
1327 jButtonFvImageOptAdd = new JButton();
1328 jButtonFvImageOptAdd.setEnabled(true);
1329 jButtonFvImageOptAdd.setText("Add");
1330 jButtonFvImageOptAdd.setPreferredSize(new Dimension(80, 20));
1331 jButtonFvImageOptAdd.addActionListener(new AbstractAction() {
1332 /**
1333 *
1334 */
1335 private static final long serialVersionUID = 1L;
1336
1337 public void actionPerformed(ActionEvent e) {
1338 if (jTextFieldFvImageOptName.getText().length() > 0 && jTextFieldFvImageOptValue.getText().length() > 0){
1339 int selectedRow = jTableFvInfo.getSelectedRow();
1340 if (selectedRow < 0) {
1341 return;
1342 }
1343
1344 String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
1345 String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
1346 int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
1347 String[] row = {jTextFieldFvImageOptName.getText(), jTextFieldFvImageOptValue.getText()};
1348
1349 if (fvImagePos < 0) {
1350 return;
1351 }
1352 else {
1353 //append options to FvImage.
1354 ffc.setFvImagesFvImageNameValue(fvImagePos, row[0], row[1]);
1355 }
1356 docConsole.setSaved(false);
1357 fvOptionTableModel.addRow(row);
1358 jTableFvImageOpts.changeSelection(jTableFvImageOpts.getRowCount() - 1, 0, false, false);
1359 }
1360 }
1361 });
1362 }
1363 return jButtonFvImageOptAdd;
1364 }
1365
1366 /**
1367 * This method initializes jButton8
1368 *
1369 * @return javax.swing.JButton
1370 */
1371 private JButton getJButtonFvImageOptDel() {
1372 if (jButtonFvImageOptDel == null) {
1373 jButtonFvImageOptDel = new JButton();
1374 jButtonFvImageOptDel.setEnabled(true);
1375 jButtonFvImageOptDel.setText("Delete");
1376 jButtonFvImageOptDel.setPreferredSize(new Dimension(80, 20));
1377 jButtonFvImageOptDel.addActionListener(new AbstractAction() {
1378 /**
1379 *
1380 */
1381 private static final long serialVersionUID = 1L;
1382
1383 public void actionPerformed(ActionEvent e) {
1384 if (jTableFvImageOpts.getSelectedRow() >= 0){
1385 int selectedRow = jTableFvInfo.getSelectedRow();
1386 if (selectedRow < 0) {
1387 return;
1388 }
1389
1390 String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
1391 String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
1392 int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
1393 if (fvImagePos < 0) {
1394 return;
1395 }
1396
1397 String optName = fvOptionTableModel.getValueAt(jTableFvImageOpts.getSelectedRow(), 0)+"";
1398 ffc.removeFvImageNameValue(fvImagePos, optName);
1399 docConsole.setSaved(false);
1400 fvOptionTableModel.removeRow(jTableFvImageOpts.getSelectedRow());
1401 }
1402 }
1403 });
1404 }
1405 return jButtonFvImageOptDel;
1406 }
1407
1408 /**
1409 * This method initializes jScrollPane
1410 *
1411 * @return javax.swing.JScrollPane
1412 */
1413 private JScrollPane getJScrollPane() {
1414 if (jScrollPane == null) {
1415 jScrollPane = new JScrollPane();
1416 jScrollPane.setPreferredSize(new java.awt.Dimension(350,100));
1417 jScrollPane.setViewportView(getJTableFvImageOpts());
1418 }
1419 return jScrollPane;
1420 }
1421
1422 /**
1423 * This method initializes jTable3
1424 *
1425 * @return javax.swing.JTable
1426 */
1427 private JTable getJTableFvImageOpts() {
1428 if (jTableFvImageOpts == null) {
1429 fvOptionTableModel = new IDefaultTableModel();
1430 fvOptionTableModel.addColumn("Name");
1431 fvOptionTableModel.addColumn("Value");
1432 jTableFvImageOpts = new JTable(fvOptionTableModel);
1433
1434 jTableFvImageOpts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1435 jTableFvImageOpts.setRowHeight(20);
1436
1437 }
1438 return jTableFvImageOpts;
1439 }
1440
1441 /**
1442 * This method initializes jButton9
1443 *
1444 * @return javax.swing.JButton
1445 */
1446 private JButton getJButtonUpdateFvImage() {
1447 if (jButtonUpdateFvImage == null) {
1448 jButtonUpdateFvImage = new JButton();
1449 jButtonUpdateFvImage.setPreferredSize(new java.awt.Dimension(150,20));
1450 jButtonUpdateFvImage.setActionCommand("Update");
1451 jButtonUpdateFvImage.setText("Update FV Attributes");
1452 jButtonUpdateFvImage.setVisible(false);
1453 jButtonUpdateFvImage.addActionListener(new java.awt.event.ActionListener() {
1454 public void actionPerformed(java.awt.event.ActionEvent e) {
1455 int row = jTableFvInfo.getSelectedRow();
1456 if (jTableFvInfo.isEditing()) {
1457 jTableFvInfo.getCellEditor().stopCellEditing();
1458 }
1459 if (jTableFvImageOpts.isEditing()) {
1460 jTableFvImageOpts.getCellEditor().stopCellEditing();
1461 }
1462
1463 //ToDo Check data validity before update
1464 String name = fvImageParaTableModel.getValueAt(row, 0) + "";
1465 String type = fvImageParaTableModel.getValueAt(row, 1) + "";
1466
1467 LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
1468 getOptionNameValue(lhm);
1469
1470 docConsole.setSaved(false);
1471 ffc.updateFvImagesFvImage(row, name.split(" "), type, lhm);
1472
1473 }
1474 });
1475 }
1476 return jButtonUpdateFvImage;
1477 }
1478
1479 /**
1480 * This method initializes jPanelFdfN
1481 *
1482 * @return javax.swing.JPanel
1483 */
1484 private JPanel getJPanelFdfN() {
1485 if (jPanelFdfN == null) {
1486 jPanelFdfN = new JPanel();
1487 jPanelFdfN.add(getJCheckBoxFdf(), null);
1488 jPanelFdfN.add(getJTextFieldFdf(), null);
1489 jPanelFdfN.add(getJButtonFdfBrowse(), null);
1490 }
1491 return jPanelFdfN;
1492 }
1493
1494 /**
1495 * This method initializes jPanelFdfS
1496 *
1497 * @return javax.swing.JPanel
1498 */
1499 private JPanel getJPanelFdfS() {
1500 if (jPanelFdfS == null) {
1501 FlowLayout flowLayout4 = new FlowLayout();
1502 flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT);
1503 jPanelFdfS = new JPanel();
1504 jPanelFdfS.setLayout(flowLayout4);
1505 jPanelFdfS.add(getJButtonAddFv(), null);
1506 jPanelFdfS.add(getJButtonDelFv(), null);
1507 jPanelFdfS.add(getJButtonAddFvOptions(), null);
1508 }
1509 return jPanelFdfS;
1510 }
1511
1512 /**
1513 * This method initializes jSplitPaneFdfC
1514 *
1515 * @return javax.swing.JSplitPane
1516 */
1517 private JSplitPane getJSplitPaneFdfC() {
1518 if (jSplitPaneFdfC == null) {
1519 jSplitPaneFdfC = new JSplitPane();
1520 jSplitPaneFdfC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
1521 jSplitPaneFdfC.setDividerSize(5);
1522 jSplitPaneFdfC.setTopComponent(getJPanelFdfCTop());
1523 jSplitPaneFdfC.setBottomComponent(getJPanelFdfCBottom());
1524 jSplitPaneFdfC.setDividerLocation(280);
1525 }
1526 return jSplitPaneFdfC;
1527 }
1528
1529 /**
1530 * This method initializes jPanelFdfCTop
1531 *
1532 * @return javax.swing.JPanel
1533 */
1534 private JPanel getJPanelFdfCTop() {
1535 if (jPanelFdfCTop == null) {
1536 jPanelFdfCTop = new JPanel();
1537 jPanelFdfCTop.setLayout(new BorderLayout());
1538 jPanelFdfCTop.add(getJPanelFdfCTopN(), java.awt.BorderLayout.NORTH);
1539 jPanelFdfCTop.add(getJPanelFdfCTopS(), java.awt.BorderLayout.SOUTH);
1540 jPanelFdfCTop.add(getJScrollPaneFvInFdf(), java.awt.BorderLayout.CENTER);
1541 }
1542 return jPanelFdfCTop;
1543 }
1544
1545 /**
1546 * This method initializes jPanelFdfCBottom
1547 *
1548 * @return javax.swing.JPanel
1549 */
1550 private JPanel getJPanelFdfCBottom() {
1551 if (jPanelFdfCBottom == null) {
1552 jPanelFdfCBottom = new JPanel();
1553 jPanelFdfCBottom.setLayout(new BorderLayout());
1554 jPanelFdfCBottom.add(getJPanelFdfCBottomN(), java.awt.BorderLayout.NORTH);
1555 jPanelFdfCBottom.add(getJScrollPaneFvAdditional(), java.awt.BorderLayout.CENTER);
1556 }
1557 return jPanelFdfCBottom;
1558 }
1559
1560 /**
1561 * This method initializes jPanelFdfCTopN
1562 *
1563 * @return javax.swing.JPanel
1564 */
1565 private JPanel getJPanelFdfCTopN() {
1566 if (jPanelFdfCTopN == null) {
1567 jLabelFvInFdf = new JLabel();
1568 jLabelFvInFdf.setText("FVs in Flash Definition File");
1569 jPanelFdfCTopN = new JPanel();
1570 jPanelFdfCTopN.add(jLabelFvInFdf, null);
1571 }
1572 return jPanelFdfCTopN;
1573 }
1574
1575 /**
1576 * This method initializes jPanelFdfCTopS
1577 *
1578 * @return javax.swing.JPanel
1579 */
1580 private JPanel getJPanelFdfCTopS() {
1581 if (jPanelFdfCTopS == null) {
1582 FlowLayout flowLayout1 = new FlowLayout();
1583 flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
1584 jPanelFdfCTopS = new JPanel();
1585 jPanelFdfCTopS.setLayout(flowLayout1);
1586 jPanelFdfCTopS.add(getJButtonFvInFdfOptions(), null);
1587 }
1588 return jPanelFdfCTopS;
1589 }
1590
1591 /**
1592 * This method initializes jPanelFdfCTopC
1593 *
1594 * @return javax.swing.JPanel
1595 */
1596 // private JPanel getJPanelFdfCTopC() {
1597 // if (jPanelFdfCTopC == null) {
1598 // jPanelFdfCTopC = new JPanel();
1599 // jPanelFdfCTopC.add(getJScrollPaneFvInFdf(), null);
1600 // }
1601 // return jPanelFdfCTopC;
1602 // }
1603
1604 /**
1605 * This method initializes jPanelFdfCBottomN
1606 *
1607 * @return javax.swing.JPanel
1608 */
1609 private JPanel getJPanelFdfCBottomN() {
1610 if (jPanelFdfCBottomN == null) {
1611 jLabelFvAdditional = new JLabel();
1612 jLabelFvAdditional.setText("Additional FVs");
1613 jPanelFdfCBottomN = new JPanel();
1614 jPanelFdfCBottomN.add(jLabelFvAdditional, null);
1615 }
1616 return jPanelFdfCBottomN;
1617 }
1618
1619 /**
1620 * This method initializes jPanelFdfCBottomC
1621 *
1622 * @return javax.swing.JPanel
1623 */
1624 // private JPanel getJPanelFdfCBottomC() {
1625 // if (jPanelFdfCBottomC == null) {
1626 // jPanelFdfCBottomC = new JPanel();
1627 // jPanelFdfCBottomC.add(getJScrollPaneFvAdditional(), null);
1628 // }
1629 // return jPanelFdfCBottomC;
1630 // }
1631
1632 /**
1633 * This method initializes jScrollPaneFvInFdf
1634 *
1635 * @return javax.swing.JScrollPane
1636 */
1637 private JScrollPane getJScrollPaneFvInFdf() {
1638 if (jScrollPaneFvInFdf == null) {
1639 jScrollPaneFvInFdf = new JScrollPane();
1640 jScrollPaneFvInFdf.setPreferredSize(new java.awt.Dimension(653,200));
1641 jScrollPaneFvInFdf.setViewportView(getJTableFvInFdf());
1642 }
1643 return jScrollPaneFvInFdf;
1644 }
1645
1646 /**
1647 * This method initializes jTableFvInFdf
1648 *
1649 * @return javax.swing.JTable
1650 */
1651 private JTable getJTableFvInFdf() {
1652 if (jTableFvInFdf == null) {
1653 jTableFvInFdf = new JTable();
1654 jTableFvInFdf.setRowHeight(20);
1655 jTableFvInFdf.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
1656 jTableFvInFdf.setModel(getFvInFdfTableModel());
1657 }
1658 return jTableFvInFdf;
1659 }
1660
1661 /**
1662 * This method initializes fvInFdfTableModel
1663 *
1664 * @return org.tianocore.frameworkwizard.platform.ui.NonEditableTableModel
1665 */
1666 private IDefaultTableModel getFvInFdfTableModel() {
1667 if (fvInFdfTableModel == null) {
1668 fvInFdfTableModel = new IDefaultTableModel();
1669 fvInFdfTableModel.addColumn("FV Name");
1670 fvInFdfTableModel.addColumn("Size");
1671 fvInFdfTableModel.addColumn("Corresponding File Name");
1672 }
1673 return fvInFdfTableModel;
1674 }
1675
1676 /**
1677 * This method initializes jButtonFvInFdfOptions
1678 *
1679 * @return javax.swing.JButton
1680 */
1681 private JButton getJButtonFvInFdfOptions() {
1682 if (jButtonFvInFdfOptions == null) {
1683 jButtonFvInFdfOptions = new JButton();
1684 jButtonFvInFdfOptions.setPreferredSize(new java.awt.Dimension(80,20));
1685 jButtonFvInFdfOptions.setEnabled(true);
1686 jButtonFvInFdfOptions.setText("Options");
1687 jButtonFvInFdfOptions.addActionListener(new java.awt.event.ActionListener() {
1688 public void actionPerformed(java.awt.event.ActionEvent e) {
1689 int selectedRow = jTableFvInFdf.getSelectedRow();
1690 if (selectedRow < 0) {
1691 return;
1692 }
1693 String fvName = jTableFvInFdf.getValueAt(selectedRow, 0)+"";
1694 if (fvName.length() == 0) {
1695 return;
1696 }
1697 DefaultTableModel dtm = getFvInFdfOptTableModel();
1698 new FpdFvOptions(fvName, dtm, ffc, docConsole);
1699 }
1700 });
1701 }
1702 return jButtonFvInFdfOptions;
1703 }
1704
1705 private DefaultTableModel getFvInFdfOptTableModel() {
1706 if (fvInFdfOptTableModel == null) {
1707 fvInFdfOptTableModel = new FvOptsTableModel();
1708 fvInFdfOptTableModel.addColumn("Name");
1709 fvInFdfOptTableModel.addColumn("Value");
1710 Vector<Object> v = new Vector<Object>();
1711 v.add("EFI_BLOCK_SIZE");
1712 v.add("EFI_NUM_BLOCKS");
1713 v.add("EFI_FILE_NAME");
1714 fvInFdfOptTableModel.setVKeyWords(v);
1715 fvInFdfOptTableModel.setVNonEditableName(v);
1716 }
1717 return fvInFdfOptTableModel;
1718 }
1719
1720 private DefaultTableModel getFvAdditionalOptTableModel() {
1721 if (fvAdditionalOptTableModel == null) {
1722 fvAdditionalOptTableModel = new FvOptsTableModel();
1723 fvAdditionalOptTableModel.addColumn("Name");
1724 fvAdditionalOptTableModel.addColumn("Value");
1725 Vector<Object> v = new Vector<Object>();
1726 v.add("EFI_BLOCK_SIZE");
1727 v.add("EFI_NUM_BLOCKS");
1728 v.add("EFI_FILE_NAME");
1729 fvAdditionalOptTableModel.setVNonEditableName(v);
1730 }
1731 return fvAdditionalOptTableModel;
1732 }
1733
1734 /**
1735 * This method initializes jScrollPaneFvAdditional
1736 *
1737 * @return javax.swing.JScrollPane
1738 */
1739 private JScrollPane getJScrollPaneFvAdditional() {
1740 if (jScrollPaneFvAdditional == null) {
1741 jScrollPaneFvAdditional = new JScrollPane();
1742 jScrollPaneFvAdditional.setPreferredSize(new java.awt.Dimension(653,200));
1743 jScrollPaneFvAdditional.setViewportView(getJTableFvAdditional());
1744 }
1745 return jScrollPaneFvAdditional;
1746 }
1747
1748 /**
1749 * This method initializes jTableFvAdditional
1750 *
1751 * @return javax.swing.JTable
1752 */
1753 private JTable getJTableFvAdditional() {
1754 if (jTableFvAdditional == null) {
1755 jTableFvAdditional = new JTable();
1756 jTableFvAdditional.setRowHeight(20);
1757 jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
1758 jTableFvAdditional.setModel(getFvAdditionalTableModel());
1759
1760 jTableFvAdditional.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1761 public void valueChanged(ListSelectionEvent e) {
1762 if (e.getValueIsAdjusting()) {
1763 return;
1764 }
1765 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1766 if (lsm.isSelectionEmpty()) {
1767 return;
1768 } else {
1769 selectedRowInFvAdditionalTable = lsm.getMinSelectionIndex();
1770 oldFvName = jTableFvAdditional.getValueAt(selectedRowInFvAdditionalTable, 0)+"";
1771 }
1772 }
1773 });
1774
1775 jTableFvAdditional.getModel().addTableModelListener(new TableModelListener() {
1776 public void tableChanged(TableModelEvent arg0) {
1777 // TODO Auto-generated method stub
1778 int row = arg0.getFirstRow();
1779 int col = arg0.getColumn();
1780 TableModel m = (TableModel) arg0.getSource();
1781
1782 if (arg0.getType() == TableModelEvent.UPDATE) {
1783 if (col == 0) {
1784 String newFvName = m.getValueAt(row, 0) + "";
1785 if (newFvName.equals(oldFvName)) {
1786 return;
1787 }
1788 if (fvNameExists(newFvName)) {
1789 JOptionPane.showMessageDialog(frame, "This FV already exists. Please choose another FV name.");
1790 m.setValueAt(oldFvName, row, 0);
1791 return;
1792 }
1793
1794 tabIndexForFv = jTabbedPane.indexOfTab(oldFvName);
1795 if (tabIndexForFv >= startIndexOfDynamicTab) {
1796 jTabbedPane.setTitleAt(tabIndexForFv, newFvName);
1797 // change FvName in UserExtensions
1798 ffc.updateBuildOptionsUserExtensions(oldFvName, newFvName);
1799 // change FvBinding in ModuleSA
1800 ffc.appendFvBindingFor(oldFvName, newFvName);
1801 ffc.removeFvBindingAll(oldFvName);
1802 // change FvImageNames in Flash
1803 ffc.updateFvImageNameAll(oldFvName, newFvName);
1804
1805 } else {
1806 ModuleOrderPane pane = new ModuleOrderPane(newFvName, "", ffc, FpdFlash.this);
1807 pane.showModulesInFv(newFvName);
1808 pane.showAllModulesInPlatform();
1809 jTabbedPane.addTab(newFvName, pane);
1810 // Add FvImageNames in Flash
1811 String[] fvNames = {newFvName};
1812 ffc.addFvImageFvImageNames(fvNames);
1813 }
1814 docConsole.setSaved(false);
1815 oldFvName = newFvName;
1816 }
1817
1818 if (col == 1 && !sizeFromOptionDlg) {
1819 String fvSize = m.getValueAt(row, col) + "";
1820 if (!DataValidation.isInt(fvSize) && !DataValidation.isHexDoubleWordDataType(fvSize)) {
1821 JOptionPane.showMessageDialog(frame, "FV size should be Integer or Hex format.");
1822 return;
1823 }
1824 HashMap<String, String> mFvOpts = new HashMap<String, String>();
1825 ffc.getFvImagesFvImageOptions(oldFvName, mFvOpts);
1826 String blkSize = mFvOpts.get("EFI_BLOCK_SIZE");
1827 if (blkSize == null) {
1828 if (determinedFvBlockSize != null) {
1829 blkSize = determinedFvBlockSize;
1830 }
1831 else {
1832 blkSize = defaultBlkSize;
1833 }
1834 ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", blkSize, null);
1835 int fs = Integer.decode(fvSize);
1836 int bs = Integer.decode(blkSize);
1837 ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
1838 docConsole.setSaved(false);
1839 }
1840 else {
1841 if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {
1842 int retVal = JOptionPane.showConfirmDialog(frame, "Confirm", "FPD file contains error block size format. Would you like to replace it with a default value?", JOptionPane.YES_NO_OPTION);
1843 if (retVal == JOptionPane.YES_OPTION) {
1844 ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", defaultBlkSize, null);
1845 int fs = Integer.decode(fvSize);
1846 int bs = Integer.decode(defaultBlkSize);
1847 ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
1848 docConsole.setSaved(false);
1849 return;
1850 }
1851 else {
1852 return;
1853 }
1854
1855 }
1856 int fs = Integer.decode(fvSize);
1857 int bs = Integer.decode(blkSize);
1858 ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
1859 docConsole.setSaved(false);
1860 }
1861 }
1862
1863 if (col == 2 && !fileFromOptionDlg) {
1864 ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_FILE_NAME", m.getValueAt(row, col)+"", null);
1865 docConsole.setSaved(false);
1866 }
1867
1868 }
1869 }
1870 });
1871 }
1872 return jTableFvAdditional;
1873 }
1874
1875 private boolean fvNameExistsInFvInFdfTable (String fvName) {
1876 for (int i = 0; i < jTableFvInFdf.getRowCount(); ++i) {
1877 if (fvInFdfTableModel.getValueAt(i, 0).equals(fvName)) {
1878 return true;
1879 }
1880 }
1881 return false;
1882 }
1883
1884 private boolean fvNameExists (String fvName) {
1885 if (fvNameExistsInFvInFdfTable(fvName)) {
1886 return true;
1887 }
1888
1889 for (int j = 0; j < jTableFvAdditional.getRowCount(); ++j) {
1890 if (fvAdditionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {
1891 return true;
1892 }
1893 }
1894 return false;
1895 }
1896
1897 /**
1898 * This method initializes fvAdditionalTableModel
1899 *
1900 * @return javax.swing.table.DefaultTableModel
1901 */
1902 private DefaultTableModel getFvAdditionalTableModel() {
1903 if (fvAdditionalTableModel == null) {
1904 fvAdditionalTableModel = new DefaultTableModel();
1905 fvAdditionalTableModel.addColumn("FV Name");
1906 fvAdditionalTableModel.addColumn("Size");
1907 fvAdditionalTableModel.addColumn("Corresponding File Name");
1908 }
1909 return fvAdditionalTableModel;
1910 }
1911
1912 /**
1913 * This method initializes jButtonAddFv
1914 *
1915 * @return javax.swing.JButton
1916 */
1917 private JButton getJButtonAddFv() {
1918 if (jButtonAddFv == null) {
1919 jButtonAddFv = new JButton();
1920 jButtonAddFv.setPreferredSize(new java.awt.Dimension(80,20));
1921 jButtonAddFv.setEnabled(true);
1922 jButtonAddFv.setText("New");
1923 jButtonAddFv.addActionListener(new java.awt.event.ActionListener() {
1924 public void actionPerformed(java.awt.event.ActionEvent e) {
1925 if (jTableFvAdditional.isEditing()) {
1926 jTableFvAdditional.getCellEditor().stopCellEditing();
1927 }
1928 String[] row = {"", "", ""};
1929 fvAdditionalTableModel.addRow(row);
1930 }
1931 });
1932 }
1933 return jButtonAddFv;
1934 }
1935
1936 /**
1937 * This method initializes jButtonDelFv
1938 *
1939 * @return javax.swing.JButton
1940 */
1941 private JButton getJButtonDelFv() {
1942 if (jButtonDelFv == null) {
1943 jButtonDelFv = new JButton();
1944 jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));
1945 jButtonDelFv.setEnabled(true);
1946 jButtonDelFv.setText("Delete");
1947 jButtonDelFv.addActionListener(new java.awt.event.ActionListener() {
1948 public void actionPerformed(java.awt.event.ActionEvent e) {
1949 //delete row in FvAdditional table.
1950 int selectedRow = jTableFvAdditional.getSelectedRow();
1951 if (selectedRow < 0) {
1952 return;
1953 }
1954 String fvName = fvAdditionalTableModel.getValueAt(selectedRow, 0) + "";
1955 fvAdditionalTableModel.removeRow(selectedRow);
1956 //
1957 //delete tab with selected FV name.
1958 //
1959 jTabbedPane.removeTabAt(jTabbedPane.indexOfTab(fvName));
1960 //delete FV Name from FvImages element.
1961 ffc.updateFvImageNameAll(fvName, null);
1962 //delete FvBinding from ModuleSA.
1963 ffc.removeFvBindingAll(fvName);
1964 docConsole.setSaved(false);
1965 }
1966 });
1967 }
1968 return jButtonDelFv;
1969 }
1970
1971 /**
1972 * This method initializes jButtonAddFvOptions
1973 *
1974 * @return javax.swing.JButton
1975 */
1976 private JButton getJButtonAddFvOptions() {
1977 if (jButtonAddFvOptions == null) {
1978 jButtonAddFvOptions = new JButton();
1979 jButtonAddFvOptions.setPreferredSize(new java.awt.Dimension(80,20));
1980 jButtonAddFvOptions.setEnabled(true);
1981 jButtonAddFvOptions.setText("Options");
1982 jButtonAddFvOptions.addActionListener(new java.awt.event.ActionListener() {
1983 public void actionPerformed(java.awt.event.ActionEvent e) {
1984 int selectedRow = jTableFvAdditional.getSelectedRow();
1985 if (selectedRow < 0) {
1986 return;
1987 }
1988 String fvName = jTableFvAdditional.getValueAt(selectedRow, 0)+"";
1989 String oldFvSize = jTableFvAdditional.getValueAt(selectedRow, 1)+"";
1990 String oldFileName = jTableFvAdditional.getValueAt(selectedRow, 2)+"";
1991 if (fvName.length() == 0) {
1992 return;
1993 }
1994 DefaultTableModel dtm = getFvAdditionalOptTableModel();
1995 new FpdFvOptions(fvName, dtm, ffc, docConsole);
1996
1997 String[] updatedFvInfo = getBasicFvInfo (fvName);
1998 if (!oldFvSize.equalsIgnoreCase(updatedFvInfo[1])) {
1999 sizeFromOptionDlg = true;
2000 jTableFvAdditional.setValueAt(updatedFvInfo[1], selectedRow, 1);
2001 sizeFromOptionDlg = false;
2002 }
2003 if (!oldFileName.equals(updatedFvInfo[2])) {
2004 fileFromOptionDlg = true;
2005 jTableFvAdditional.setValueAt(updatedFvInfo[2], selectedRow, 2);
2006 fileFromOptionDlg = false;
2007 }
2008 }
2009 });
2010 }
2011 return jButtonAddFvOptions;
2012 }
2013
2014 private String[] getBasicFvInfo (String fvName) {
2015 HashMap<String, String> mFvOpts = new HashMap<String, String>();
2016 ffc.getFvImagesFvImageOptions(fvName, mFvOpts);
2017 String bSize = "";
2018 String numBlks = "";
2019 String fvSize = "";
2020 String fvFile = "";
2021 if (mFvOpts.get("EFI_FILE_NAME") != null) {
2022 fvFile = mFvOpts.get("EFI_FILE_NAME");
2023 }
2024 if (mFvOpts.get("EFI_BLOCK_SIZE") != null && mFvOpts.get("EFI_NUM_BLOCKS") != null) {
2025 bSize = mFvOpts.get("EFI_BLOCK_SIZE");
2026 numBlks = mFvOpts.get("EFI_NUM_BLOCKS");
2027 boolean blockSizeWellFormat = true;
2028 boolean numOfBlockWellFormat = true;
2029 if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) {
2030 blockSizeWellFormat = false;
2031 JOptionPane.showMessageDialog(frame, fvName + " block size bad format.");
2032 }
2033 if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) {
2034 numOfBlockWellFormat = false;
2035 JOptionPane.showMessageDialog(frame, fvName + " number of blocks bad format.");
2036 }
2037 if (blockSizeWellFormat && numOfBlockWellFormat) {
2038 int size = Integer.decode(bSize);
2039 int num = Integer.decode(numBlks);
2040 fvSize = "0x" + Integer.toHexString(size*num);
2041 }
2042 }
2043
2044 return new String[]{fvName, fvSize, fvFile};
2045
2046 }
2047
2048 /**
2049 * This method initializes jPanelBgFvName
2050 *
2051 * @return javax.swing.JPanel
2052 */
2053 private JPanel getJPanelBgFvName() {
2054 if (jPanelBgFvName == null) {
2055 jPanelBgFvName = new JPanel();
2056 jPanelBgFvName.setPreferredSize(new java.awt.Dimension(80,55));
2057 jPanelBgFvName.add(getJButtonFvNameAdd(), null);
2058 jPanelBgFvName.add(getJButtonFvNameDel(), null);
2059 }
2060 return jPanelBgFvName;
2061 }
2062
2063 /**
2064 * This method initializes jPanelBgFvImage
2065 *
2066 * @return javax.swing.JPanel
2067 */
2068 private JPanel getJPanelBgFvImage() {
2069 if (jPanelBgFvImage == null) {
2070 jPanelBgFvImage = new JPanel();
2071 jPanelBgFvImage.setPreferredSize(new java.awt.Dimension(150,100));
2072 jPanelBgFvImage.add(getJButtonAddFvImage(), null);
2073 jPanelBgFvImage.add(getJButtonDelFvImage(), null);
2074 jPanelBgFvImage.add(getJButtonUpdateFvImage(), null);
2075 }
2076 return jPanelBgFvImage;
2077 }
2078
2079 /**
2080 * This method initializes jPanelW
2081 *
2082 * @return javax.swing.JPanel
2083 */
2084 private JPanel getJPanelW() {
2085 if (jPanelW == null) {
2086 jPanelW = new JPanel();
2087 jPanelW.add(getJPanelBgFvImage(), null);
2088 }
2089 return jPanelW;
2090 }
2091
2092 /**
2093 * This method initializes jPanelFvImageParaN
2094 *
2095 * @return javax.swing.JPanel
2096 */
2097 private JPanel getJPanelFvImageParaN() {
2098 if (jPanelFvImageParaN == null) {
2099 FlowLayout flowLayout3 = new FlowLayout();
2100 flowLayout3.setAlignment(java.awt.FlowLayout.CENTER);
2101 jPanelFvImageParaN = new JPanel();
2102 jPanelFvImageParaN.setLayout(flowLayout3);
2103 jPanelFvImageParaN.add(new StarLabel(), null);
2104 jPanelFvImageParaN.add(jLabelFvImageNames, null);
2105 jPanelFvImageParaN.add(jLabelFvParaName, null);
2106 jPanelFvImageParaN.add(getJTextFieldFvParaName(), null);
2107 }
2108 return jPanelFvImageParaN;
2109 }
2110
2111 /**
2112 * This method initializes jPanelFvImageParaS
2113 *
2114 * @return javax.swing.JPanel
2115 */
2116 private JPanel getJPanelFvImageParaS() {
2117 if (jPanelFvImageParaS == null) {
2118 FlowLayout flowLayout6 = new FlowLayout();
2119 flowLayout6.setAlignment(java.awt.FlowLayout.CENTER);
2120 jPanelFvImageParaS = new JPanel();
2121 jPanelFvImageParaS.setLayout(flowLayout6);
2122 jPanelFvImageParaS.add(jLabelFvParaType, null);
2123 jPanelFvImageParaS.add(getJComboBoxFvParaType(), null);
2124 }
2125 return jPanelFvImageParaS;
2126 }
2127
2128 /**
2129 * This method initializes jPanelFvImageParaC
2130 *
2131 * @return javax.swing.JPanel
2132 */
2133 // private JPanel getJPanelFvImageParaC() {
2134 // if (jPanelFvImageParaC == null) {
2135 // jPanelFvImageParaC = new JPanel();
2136 // jPanelFvImageParaC.add(getJScrollPaneFvImageNames(), null);
2137 // }
2138 // return jPanelFvImageParaC;
2139 // }
2140
2141 /**
2142 * This method initializes jPanelFvImageOptsN
2143 *
2144 * @return javax.swing.JPanel
2145 */
2146 private JPanel getJPanelFvImageOptsN() {
2147 if (jPanelFvImageOptsN == null) {
2148 jPanelFvImageOptsN = new JPanel();
2149 jPanelFvImageOptsN.add(jLabelOptions, null);
2150 jPanelFvImageOptsN.add(jLabelFvImageOptName, null);
2151 jPanelFvImageOptsN.add(getJTextFieldFvImageOptName(), null);
2152 jPanelFvImageOptsN.add(jLabelFvImageOptValue, null);
2153 jPanelFvImageOptsN.add(getJTextFieldFvImageOptValue(), null);
2154 }
2155 return jPanelFvImageOptsN;
2156 }
2157
2158 /**
2159 * This method initializes jPanelFvImageOptsS
2160 *
2161 * @return javax.swing.JPanel
2162 */
2163 private JPanel getJPanelFvImageOptsS() {
2164 if (jPanelFvImageOptsS == null) {
2165 jPanelFvImageOptsS = new JPanel();
2166 }
2167 return jPanelFvImageOptsS;
2168 }
2169
2170 /**
2171 * This method initializes jPanelFvImageOptsC
2172 *
2173 * @return javax.swing.JPanel
2174 */
2175 // private JPanel getJPanelFvImageOptsC() {
2176 // if (jPanelFvImageOptsC == null) {
2177 // jPanelFvImageOptsC = new JPanel();
2178 // jPanelFvImageOptsC.add(getJScrollPane(), null);
2179 // }
2180 // return jPanelFvImageOptsC;
2181 // }
2182
2183 /**
2184 * This method initializes jPanelFvImageParaE
2185 *
2186 * @return javax.swing.JPanel
2187 */
2188 private JPanel getJPanelFvImageParaE() {
2189 if (jPanelFvImageParaE == null) {
2190 jPanelFvImageParaE = new JPanel();
2191 jPanelFvImageParaE.add(getJPanelBgFvName(), null);
2192 }
2193 return jPanelFvImageParaE;
2194 }
2195
2196 /**
2197 * This method initializes jPanelFvImageOptsE
2198 *
2199 * @return javax.swing.JPanel
2200 */
2201 private JPanel getJPanelFvImageOptsE() {
2202 if (jPanelFvImageOptsE == null) {
2203 jPanelFvImageOptsE = new JPanel();
2204 jPanelFvImageOptsE.add(getJPanelFvImageOptsButtonGroup(), null);
2205 }
2206 return jPanelFvImageOptsE;
2207 }
2208
2209 /**
2210 * This method initializes jPanelFvImageSN
2211 *
2212 * @return javax.swing.JPanel
2213 */
2214 private JPanel getJPanelFvImageSN() {
2215 if (jPanelFvImageSN == null) {
2216 jPanelFvImageSN = new JPanel();
2217 jPanelFvImageSN.add(getJCheckBoxFvProperty(), null);
2218 jPanelFvImageSN.add(jLabelFvPropName, null);
2219 jPanelFvImageSN.add(getJTextFieldFvPropName(), null);
2220 jPanelFvImageSN.add(jLabelFvPropValue, null);
2221 jPanelFvImageSN.add(getJTextFieldFvPropValue(), null);
2222 }
2223 return jPanelFvImageSN;
2224 }
2225
2226 /**
2227 * This method initializes jPanelFvImageSE
2228 *
2229 * @return javax.swing.JPanel
2230 */
2231 private JPanel getJPanelFvImageSE() {
2232 if (jPanelFvImageSE == null) {
2233 jPanelFvImageSE = new JPanel();
2234 jPanelFvImageSE.add(getJPanelFvPropButtonGroup(), null);
2235 }
2236 return jPanelFvImageSE;
2237 }
2238
2239 /**
2240 * This method initializes jPanelFvImageSS
2241 *
2242 * @return javax.swing.JPanel
2243 */
2244 private JPanel getJPanelFvImageSS() {
2245 if (jPanelFvImageSS == null) {
2246 jPanelFvImageSS = new JPanel();
2247 }
2248 return jPanelFvImageSS;
2249 }
2250
2251 /**
2252 * @param args
2253 */
2254 public static void main(String[] args) {
2255 // TODO Auto-generated method stub
2256 new FpdFlash().setVisible(true);
2257 }
2258
2259 /**
2260 * This method initializes this
2261 *
2262 * @return void
2263 */
2264 private void initialize() {
2265 this.setSize(660, 650);
2266 this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
2267 this.setContentPane(getJContentPane());
2268 this.setTitle("FPD Flash Definitions");
2269 this.addInternalFrameListener(new InternalFrameAdapter(){
2270 public void internalFrameDeactivated(InternalFrameEvent e){
2271 if (jTableFvProp.isEditing()) {
2272 jTableFvProp.getCellEditor().stopCellEditing();
2273 }
2274 if (jTableFvImageNames.isEditing()) {
2275 jTableFvImageNames.getCellEditor().stopCellEditing();
2276 }
2277 if (jTableFvInfo.isEditing()) {
2278 jTableFvInfo.getCellEditor().stopCellEditing();
2279 }
2280 if (jTableFvAdditional.isEditing()) {
2281 jTableFvAdditional.getCellEditor().stopCellEditing();
2282 }
2283 }
2284 });
2285 }
2286
2287 private void init(FpdFileContents ffc) {
2288 initFvAttributes();
2289
2290 jTextFieldFdf.setText("");
2291 String fdfFile = ffc.getFlashDefinitionFile();
2292 if (fdfFile != null && fdfFile.length() > 0) {
2293 jCheckBoxFdf.setSelected(true);
2294 jTextFieldFdf.setText(fdfFile);
2295 String fdfPath = System.getenv("WORKSPACE") + File.separator + fdfFile;
2296 initFvInFdfTable(fdfPath);
2297 }
2298
2299 initFvAdditionalTable();
2300 }
2301
2302 private void getOptionNameValue(Map<String, String> m){
2303 for (int i = 0; i < jTableFvImageOpts.getRowCount(); ++i) {
2304 m.put(fvOptionTableModel.getValueAt(i, 0)+"", fvOptionTableModel.getValueAt(i, 1)+"");
2305 }
2306 }
2307 /**
2308 * This method initializes jContentPane
2309 *
2310 * @return javax.swing.JPanel
2311 */
2312 private JPanel getJContentPane() {
2313 if (jContentPane == null) {
2314 jContentPane = new JPanel();
2315 jContentPane.setLayout(new BorderLayout());
2316 jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
2317 jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
2318 jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
2319 jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
2320 jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
2321 }
2322 return jContentPane;
2323 }
2324
2325 private void getFlashInfoFromFdf (String fdfPath) {
2326 File fdf = new File(fdfPath);
2327 if (!fdf.exists()) {
2328 return;
2329 }
2330 int lines = 0;
2331
2332 try {
2333 FileReader reader = new FileReader(fdf);
2334 BufferedReader in = new BufferedReader(reader);
2335 String str;
2336
2337 while ((str = in.readLine()) != null) {
2338 ++lines;
2339 str = str.trim();
2340 //
2341 // skip empty line, comment (start with //)
2342 //
2343 if (str.length() == 0 || str.startsWith("//")) {
2344 continue;
2345 }
2346 //
2347 // ErasePolarity
2348 //
2349 if (str.startsWith("ErasePolarity")) {
2350 erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(",")).trim();
2351 }
2352 //
2353 // dig into Block section.
2354 //
2355 if (str.startsWith("Block") && str.endsWith("}")) {
2356 String[] blockSec = str.split(",");
2357 String nv = blockSec[1].trim();
2358 String[] sizeSec = nv.split("=");
2359 vBlockSize.add(sizeSec[1].trim());
2360 }
2361
2362 }
2363
2364 reader.close();
2365 in.close();
2366 }
2367 catch (Exception e) {
2368
2369 }
2370 }
2371
2372 private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {
2373 File fdf = new File(fdfPath);
2374 if (!fdf.exists()) {
2375 return;
2376 }
2377 int lines = 0;
2378
2379 try {
2380 FileReader reader = new FileReader(fdf);
2381 BufferedReader in = new BufferedReader(reader);
2382 String str;
2383
2384 while ((str = in.readLine()) != null) {
2385 ++lines;
2386 str = str.trim();
2387 //
2388 // skip empty line, comment (start with //)
2389 //
2390 if (str.length() == 0 || str.startsWith("//")) {
2391 continue;
2392 }
2393 //
2394 // dig into Region {} section, create FvInfoFromFdf object for it.
2395 //
2396 if (str.startsWith("Region") && str.endsWith("{")) {
2397 FvInfoFromFdf fvInfo = new FvInfoFromFdf();
2398 boolean nameFound = false;
2399 boolean sizeFound = false;
2400 while ((str = in.readLine()) != null) {
2401 ++lines;
2402 str = str.trim();
2403 //
2404 // skip empty line, comment (start with //)
2405 //
2406 if (str.length() == 0 || str.startsWith("//")) {
2407 continue;
2408 }
2409
2410 if (str.startsWith("Name")) {
2411 int firstQuote = str.indexOf("\"");
2412 int lastQuote = str.lastIndexOf("\"");
2413 fvInfo.setFvName(str.substring(firstQuote + 1, lastQuote));
2414 nameFound = true;
2415 }
2416
2417 if (str.startsWith("Size")) {
2418 int equalIndex = str.indexOf("=");
2419 int commaIndex = str.indexOf(",");
2420 fvInfo.setSize(str.substring(equalIndex + 1, commaIndex).trim());
2421 sizeFound = true;
2422 }
2423
2424 if (nameFound && sizeFound) {
2425 break;
2426 }
2427 }
2428
2429 vFvInfo.add(fvInfo);
2430 }
2431 //
2432 // dig into File {} section, supply file name information to existing FvInfoFromFdf object.
2433 //
2434 if (str.startsWith("File")) {
2435 boolean fileNameFound = false;
2436 boolean fvFound = false;
2437 String fileName = "";
2438 String fvName = "";
2439 while ((str = in.readLine()) != null) {
2440 ++lines;
2441 str = str.trim();
2442 //
2443 // skip empty line, comment (start with //)
2444 //
2445 if (str.length() == 0 || str.startsWith("//")) {
2446 continue;
2447 }
2448
2449 if (str.startsWith("Name")) {
2450 int firstQuote = str.indexOf("\"");
2451 int lastQuote = str.lastIndexOf("\"");
2452 fileName = str.substring(firstQuote + 1, lastQuote);
2453 fileNameFound = true;
2454 }
2455
2456 if (str.startsWith("Region")) {
2457 int firstQuote = str.indexOf("\"");
2458 int lastQuote = str.lastIndexOf("\"");
2459 fvName = str.substring(firstQuote + 1, lastQuote);
2460 fvFound = true;
2461 }
2462
2463 if (fileNameFound && fvFound) {
2464 break;
2465 }
2466 }
2467
2468 for (int i = 0; i <vFvInfo.size(); ++i) {
2469 if (vFvInfo.get(i).getFvName().equals(fvName)) {
2470 vFvInfo.get(i).setEfiFileName(fileName);
2471 }
2472 }
2473 }
2474
2475 }
2476
2477 reader.close();
2478 in.close();
2479 }
2480 catch (Exception e) {
2481
2482 }
2483
2484 }
2485
2486 /* (non-Javadoc)
2487 * @see org.tianocore.frameworkwizard.common.ui.IInternalFrame#actionPerformed(java.awt.event.ActionEvent)
2488 */
2489 @Override
2490 public void actionPerformed(ActionEvent arg0) {
2491 if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
2492 docConsole.setSaved(false);
2493 jTabbedPane.setSelectedIndex(0);
2494 }
2495 else if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
2496 jTabbedPane.setSelectedIndex(0);
2497 }
2498 else {
2499 return;
2500 }
2501 }
2502
2503 } // @jve:decl-index=0:visual-constraint="10,10"
2504
2505 class ModuleOrderPane extends JPanel implements ActionListener{
2506