4e143108d5959c5c89a08849603610dafe83a2c4
[mirror_edk2.git] / Tools / 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.DefaultCellEditor;
20 import javax.swing.JFileChooser;
21 import javax.swing.JFrame;
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.ui.IInternalFrame;
28 import org.tianocore.frameworkwizard.common.ui.StarLabel;
29
30
31 import java.awt.FlowLayout;
32 import java.awt.event.ActionEvent;
33 import java.awt.event.ComponentAdapter;
34 import java.awt.event.ComponentEvent;
35 import java.awt.event.ItemEvent;
36 import java.awt.event.ItemListener;
37 import java.io.File;
38 import java.util.ArrayList;
39 import java.util.Iterator;
40 import java.util.LinkedHashMap;
41 import java.util.Map;
42 import java.util.Set;
43
44 import javax.swing.JCheckBox;
45 import javax.swing.JTextField;
46 import java.awt.GridLayout;
47 import javax.swing.JLabel;
48 import javax.swing.JScrollPane;
49 import javax.swing.JTable;
50 import javax.swing.event.InternalFrameAdapter;
51 import javax.swing.event.InternalFrameEvent;
52 import javax.swing.event.ListSelectionEvent;
53 import javax.swing.event.ListSelectionListener;
54 import javax.swing.event.TableModelEvent;
55 import javax.swing.event.TableModelListener;
56 import javax.swing.table.DefaultTableModel;
57 import javax.swing.table.TableColumn;
58 import javax.swing.table.TableModel;
59 import javax.swing.JComboBox;
60 import java.awt.Dimension;
61
62 public class FpdFlash extends IInternalFrame {
63
64 /**
65 *
66 */
67 private static final long serialVersionUID = 1L;
68 static JFrame frame;
69 private JPanel jContentPane = null;
70 private JPanel jPanel = null;
71 private JPanel jPanel1 = null;
72 private JPanel jPanel2 = null;
73 private JPanel jPanel3 = null;
74 private JTabbedPane jTabbedPane = null;
75 private JPanel jPanelFvImages = null;
76 private JButton jButtonOk = null;
77 private JButton jButtonCancel = null;
78 private JPanel jPanelFvImageN = null;
79 private JPanel jPanelFvImageS = null;
80 private JCheckBox jCheckBox1 = null;
81 private JLabel jLabel = null;
82 private JTextField jTextField = null;
83 private JLabel jLabel1 = null;
84 private JTextField jTextField1 = null;
85 private JButton jButton = null;
86 private JScrollPane jScrollPane1 = null;
87 private JTable jTable = null;
88 private JPanel jPanel4 = null;
89 private JButton jButton1 = null;
90 private DefaultTableModel fvPropertyTableModel = null;
91 private DefaultTableModel fvImageNameTableModel = null;
92 private ImageParaTableModel fvImageParaTableModel = null;
93 private JPanel jPanelFvImageC = null;
94 private JCheckBox jCheckBox2 = null;
95 private JLabel jLabel2 = null;
96 private JComboBox jComboBox = null;
97 private JLabel jLabel3 = null;
98 private JLabel jLabel4 = null;
99 private JTextField jTextField2 = null;
100 private JButton jButton2 = null;
101 private JScrollPane jScrollPane2 = null;
102 private JTable jTable1 = null;
103 private JButton jButton3 = null;
104 private JPanel jPanel5 = null;
105 private JButton jButton4 = null;
106 private JScrollPane jScrollPane3 = null;
107 private JTable jTable2 = null;
108 private JButton jButton6 = null;
109 private JCheckBox jCheckBox3 = null;
110 private JLabel jLabel5 = null;
111 private JComboBox jComboBox1 = null;
112 private JCheckBox jCheckBox4 = null;
113 private JCheckBox jCheckBox5 = null;
114 private JCheckBox jCheckBox6 = null;
115 private JCheckBox jCheckBox7 = null;
116 private JCheckBox jCheckBox8 = null;
117 private JCheckBox jCheckBox9 = null;
118 private JCheckBox jCheckBox10 = null;
119 private JCheckBox jCheckBox11 = null;
120 private JCheckBox jCheckBox12 = null;
121 private JCheckBox jCheckBox13 = null;
122 private JPanel jPanel6 = null;
123
124 private FpdFileContents ffc = null;
125 private JPanel jPanel7 = null;
126 private JCheckBox jCheckBox = null;
127 private JTextField jTextField3 = null;
128 private JButton jButton5 = null;
129 private JLabel jLabel6 = null;
130 private JComboBox jComboBox2 = null;
131 public FpdFlash() {
132 super();
133 // TODO Auto-generated constructor stub
134
135 initialize();
136 this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
137 this.setVisible(true);
138 }
139
140 public FpdFlash(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
141 this();
142 ffc = new FpdFileContents(fpd);
143 init(ffc);
144 }
145
146 /**
147 * This method initializes jPanel
148 *
149 * @return javax.swing.JPanel
150 */
151 private JPanel getJPanel() {
152 if (jPanel == null) {
153 jPanel = new JPanel();
154 }
155 return jPanel;
156 }
157
158 /**
159 * This method initializes jPanel1
160 *
161 * @return javax.swing.JPanel
162 */
163 private JPanel getJPanel1() {
164 if (jPanel1 == null) {
165 FlowLayout flowLayout = new FlowLayout();
166 flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
167 flowLayout.setHgap(15);
168 jPanel1 = new JPanel();
169 jPanel1.setLayout(flowLayout);
170 jPanel1.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
171 jPanel1.add(getJButtonCancel(), null);
172 jPanel1.add(getJButtonOk(), null);
173 }
174 return jPanel1;
175 }
176
177 /**
178 * This method initializes jPanel2
179 *
180 * @return javax.swing.JPanel
181 */
182 private JPanel getJPanel2() {
183 if (jPanel2 == null) {
184 jPanel2 = new JPanel();
185 }
186 return jPanel2;
187 }
188
189 /**
190 * This method initializes jPanel3
191 *
192 * @return javax.swing.JPanel
193 */
194 private JPanel getJPanel3() {
195 if (jPanel3 == null) {
196 jPanel3 = new JPanel();
197 }
198 return jPanel3;
199 }
200
201 /**
202 * This method initializes jTabbedPane
203 *
204 * @return javax.swing.JTabbedPane
205 */
206 private JTabbedPane getJTabbedPane() {
207 if (jTabbedPane == null) {
208 jTabbedPane = new JTabbedPane();
209 jTabbedPane.addTab("FV Images", null, getJPanelFvImages(), null);
210 jTabbedPane.addTab("Flash Definition File", null, getJPanel7(), null);
211
212 }
213 return jTabbedPane;
214 }
215
216 /**
217 * This method initializes jPanelFvImages
218 *
219 * @return javax.swing.JPanel
220 */
221 private JPanel getJPanelFvImages() {
222 if (jPanelFvImages == null) {
223 jPanelFvImages = new JPanel();
224 jPanelFvImages.setLayout(new BorderLayout());
225 jPanelFvImages.add(getJPanelFvImageN(), java.awt.BorderLayout.NORTH);
226 // jPanelFvImages.add(getJPanelFvImageW(), java.awt.BorderLayout.WEST);
227 jPanelFvImages.add(getJPanelFvImageS(), java.awt.BorderLayout.SOUTH);
228 jPanelFvImages.add(getJPanelFvImageC(), java.awt.BorderLayout.CENTER);
229
230 }
231 return jPanelFvImages;
232 }
233
234 /**
235 * This method initializes jButtonOk
236 *
237 * @return javax.swing.JButton
238 */
239 private JButton getJButtonOk() {
240 if (jButtonOk == null) {
241 jButtonOk = new JButton();
242 jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
243 jButtonOk.setText("Cancel");
244 jButtonOk.setVisible(false);
245 }
246 return jButtonOk;
247 }
248
249 /**
250 * This method initializes jButtonCancel
251 *
252 * @return javax.swing.JButton
253 */
254 private JButton getJButtonCancel() {
255 if (jButtonCancel == null) {
256 jButtonCancel = new JButton();
257 jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
258 jButtonCancel.setText("Ok");
259 jButtonCancel.setVisible(false);
260 }
261 return jButtonCancel;
262 }
263
264 /**
265 * This method initializes jPanelFvImageN
266 *
267 * @return javax.swing.JPanel
268 */
269 private JPanel getJPanelFvImageN() {
270 if (jPanelFvImageN == null) {
271 jLabel1 = new JLabel();
272 jLabel1.setText("Value");
273 jLabel1.setEnabled(false);
274 jLabel1.setPreferredSize(new java.awt.Dimension(38,20));
275 jLabel = new JLabel();
276 jLabel.setText("Name");
277 jLabel.setEnabled(false);
278 jLabel.setPreferredSize(new java.awt.Dimension(38,20));
279 FlowLayout flowLayout2 = new FlowLayout();
280 flowLayout2.setAlignment(java.awt.FlowLayout.CENTER);
281 flowLayout2.setHgap(15);
282 jPanelFvImageN = new JPanel();
283 jPanelFvImageN.setPreferredSize(new java.awt.Dimension(576,100));
284 jPanelFvImageN.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
285 jPanelFvImageN.setLayout(flowLayout2);
286 jPanelFvImageN.add(getJCheckBox1(), null);
287 jPanelFvImageN.add(jLabel, null);
288 jPanelFvImageN.add(getJTextField(), null);
289 jPanelFvImageN.add(jLabel1, null);
290 jPanelFvImageN.add(getJTextField1(), null);
291 jPanelFvImageN.add(getJScrollPane1(), null);
292 jPanelFvImageN.add(getJPanel4(), null);
293 }
294 return jPanelFvImageN;
295 }
296
297 /**
298 * This method initializes jPanelFvImageS
299 *
300 * @return javax.swing.JPanel
301 */
302 private JPanel getJPanelFvImageS() {
303 if (jPanelFvImageS == null) {
304 GridLayout gridLayout2 = new GridLayout();
305 gridLayout2.setRows(1);
306 jPanelFvImageS = new JPanel();
307 jPanelFvImageS.setPreferredSize(new java.awt.Dimension(480,190));
308 jPanelFvImageS.setLayout(gridLayout2);
309 jPanelFvImageS.add(getJScrollPane3(), null);
310 }
311 return jPanelFvImageS;
312 }
313
314
315 /**
316 * This method initializes jCheckBox1
317 *
318 * @return javax.swing.JCheckBox
319 */
320 private JCheckBox getJCheckBox1() {
321 if (jCheckBox1 == null) {
322 jCheckBox1 = new JCheckBox();
323 jCheckBox1.setText("FV Properties");
324 jCheckBox1.addItemListener(new ItemListener(){
325
326 public void itemStateChanged(ItemEvent arg0) {
327 // TODO Auto-generated method stub
328 boolean seleted = jCheckBox1.isSelected();
329
330 jLabel.setEnabled(seleted);
331 jTextField.setEnabled(seleted);
332 jLabel1.setEnabled(seleted);
333 jTextField1.setEnabled(seleted);
334 jTable.setEnabled(seleted);
335 jButton.setEnabled(seleted);
336 jButton1.setEnabled(seleted);
337
338
339 }
340
341 });
342 }
343 return jCheckBox1;
344 }
345
346
347 /**
348 * This method initializes jTextField
349 *
350 * @return javax.swing.JTextField
351 */
352 private JTextField getJTextField() {
353 if (jTextField == null) {
354 jTextField = new JTextField();
355 jTextField.setPreferredSize(new java.awt.Dimension(100,20));
356 jTextField.setEnabled(false);
357 }
358 return jTextField;
359 }
360
361
362 /**
363 * This method initializes jTextField1
364 *
365 * @return javax.swing.JTextField
366 */
367 private JTextField getJTextField1() {
368 if (jTextField1 == null) {
369 jTextField1 = new JTextField();
370 jTextField1.setPreferredSize(new java.awt.Dimension(100,20));
371 jTextField1.setEnabled(false);
372 }
373 return jTextField1;
374 }
375
376
377 /**
378 * This method initializes jButton
379 *
380 * @return javax.swing.JButton
381 */
382 private JButton getJButton() {
383 if (jButton == null) {
384 jButton = new JButton();
385 jButton.setPreferredSize(new java.awt.Dimension(80,20));
386 jButton.setEnabled(false);
387 jButton.setText("Add");
388 jButton.addActionListener(new AbstractAction() {
389 /**
390 *
391 */
392 private static final long serialVersionUID = 1L;
393
394 public void actionPerformed(ActionEvent e) {
395 if (jTextField.getText().length() > 0 && jTextField1.getText().length() > 0){
396 String[] row = {jTextField.getText(), jTextField1.getText()};
397 fvPropertyTableModel.addRow(row);
398 ffc.genFvImagesNameValue(row[0], row[1]);
399 }
400 }
401 });
402 }
403 return jButton;
404 }
405
406
407 /**
408 * This method initializes jScrollPane1
409 *
410 * @return javax.swing.JScrollPane
411 */
412 private JScrollPane getJScrollPane1() {
413 if (jScrollPane1 == null) {
414 jScrollPane1 = new JScrollPane();
415 jScrollPane1.setPreferredSize(new java.awt.Dimension(350,55));
416 jScrollPane1.setViewportView(getJTable());
417 }
418 return jScrollPane1;
419 }
420
421
422 /**
423 * This method initializes jTable
424 *
425 * @return javax.swing.JTable
426 */
427 private JTable getJTable() {
428 if (jTable == null) {
429 fvPropertyTableModel = new DefaultTableModel();
430 jTable = new JTable(fvPropertyTableModel);
431 fvPropertyTableModel.addColumn("Name");
432 fvPropertyTableModel.addColumn("Value");
433 jTable.setRowHeight(20);
434 jTable.setEnabled(false);
435
436 jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
437 jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
438 public void valueChanged(ListSelectionEvent e) {
439 if (e.getValueIsAdjusting()){
440 return;
441 }
442 ListSelectionModel lsm = (ListSelectionModel)e.getSource();
443 if (lsm.isSelectionEmpty()) {
444 return;
445 }
446 else{
447 // selectedRow = lsm.getMinSelectionIndex();
448 }
449 }
450 });
451
452 jTable.getModel().addTableModelListener(new TableModelListener(){
453 public void tableChanged(TableModelEvent arg0) {
454 // TODO Auto-generated method stub
455 int row = arg0.getFirstRow();
456 TableModel m = (TableModel)arg0.getSource();
457 if (arg0.getType() == TableModelEvent.UPDATE){
458
459 String name = m.getValueAt(row, 0) + "";
460 String value = m.getValueAt(row, 1) + "";
461
462 ffc.updateFvImagesNameValue(row, name, value);
463 }
464 }
465 });
466 }
467 return jTable;
468 }
469
470
471 /**
472 * This method initializes jPanel4
473 *
474 * @return javax.swing.JPanel
475 */
476 private JPanel getJPanel4() {
477 if (jPanel4 == null) {
478 jPanel4 = new JPanel();
479 jPanel4.setPreferredSize(new java.awt.Dimension(80,55));
480
481 jPanel4.add(getJButton(), null);
482 jPanel4.add(getJButton1(), null);
483 }
484 return jPanel4;
485 }
486
487
488 /**
489 * This method initializes jButton1
490 *
491 * @return javax.swing.JButton
492 */
493 private JButton getJButton1() {
494 if (jButton1 == null) {
495 jButton1 = new JButton();
496 jButton1.setPreferredSize(new java.awt.Dimension(80,20));
497 jButton1.setEnabled(false);
498 jButton1.setText("Delete");
499 jButton1.addActionListener(new AbstractAction() {
500 /**
501 *
502 */
503 private static final long serialVersionUID = 1L;
504
505 public void actionPerformed(ActionEvent e) {
506 if (jTable.getSelectedRow() >= 0){
507 fvPropertyTableModel.removeRow(jTable.getSelectedRow());
508 ffc.removeFvImagesNameValue(jTable.getSelectedRow());
509 }
510 }
511 });
512 }
513 return jButton1;
514 }
515
516
517 /**
518 * This method initializes jPanelFvImageC
519 *
520 * @return javax.swing.JPanel
521 */
522 private JPanel getJPanelFvImageC() {
523 if (jPanelFvImageC == null) {
524 jLabel4 = new JLabel();
525 jLabel4.setPreferredSize(new Dimension(38, 20));
526 jLabel4.setEnabled(false);
527 jLabel4.setText("Name");
528 jLabel3 = new JLabel();
529 jLabel3.setText("FV Image Names");
530 jLabel3.setEnabled(false);
531 jLabel3.setPreferredSize(new java.awt.Dimension(150,20));
532 jLabel2 = new JLabel();
533 jLabel2.setText("Type");
534 jLabel2.setEnabled(false);
535 jLabel2.setPreferredSize(new java.awt.Dimension(70,20));
536 FlowLayout flowLayout3 = new FlowLayout();
537 flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
538 flowLayout3.setHgap(5);
539 jPanelFvImageC = new JPanel();
540 jPanelFvImageC.setLayout(flowLayout3);
541 jPanelFvImageC.add(getJPanel6(), null);
542
543 jPanelFvImageC.add(getJPanel5(), null);
544
545 }
546 return jPanelFvImageC;
547 }
548
549
550 /**
551 * This method initializes jCheckBox2
552 *
553 * @return javax.swing.JCheckBox
554 */
555 private JCheckBox getJCheckBox2() {
556 if (jCheckBox2 == null) {
557 jCheckBox2 = new JCheckBox();
558 jCheckBox2.setText("FV Image Parameters");
559 jCheckBox2.setPreferredSize(new java.awt.Dimension(200,20));
560 jCheckBox2.addItemListener(new ItemListener(){
561
562 public void itemStateChanged(ItemEvent arg0) {
563 // TODO Auto-generated method stub
564 boolean seleted = jCheckBox2.isSelected();
565
566 jLabel2.setEnabled(seleted);
567 jLabel3.setEnabled(seleted);
568 jLabel4.setEnabled(seleted);
569 jComboBox.setEnabled(seleted);
570 jTextField2.setEnabled(seleted);
571
572 jTable1.setEnabled(seleted);
573 jButton2.setEnabled(seleted);
574 jButton3.setEnabled(seleted);
575
576
577 }
578
579 });
580 }
581 return jCheckBox2;
582 }
583
584
585 /**
586 * This method initializes jComboBox
587 *
588 * @return javax.swing.JComboBox
589 */
590 private JComboBox getJComboBox() {
591 if (jComboBox == null) {
592 jComboBox = new JComboBox();
593 jComboBox.addItem("ImageName");
594 jComboBox.addItem("Attributes");
595 jComboBox.addItem("Options");
596 jComboBox.addItem("Components");
597 jComboBox.setPreferredSize(new java.awt.Dimension(180,20));
598 jComboBox.setEnabled(false);
599 jComboBox.addItemListener(new ItemListener() {
600
601 public void itemStateChanged(ItemEvent arg0) {
602 // TODO disable attribute settings when ValidImageNames selected.
603
604 }
605
606 });
607 }
608 return jComboBox;
609 }
610
611
612 /**
613 * This method initializes jTextField2
614 *
615 * @return javax.swing.JTextField
616 */
617 private JTextField getJTextField2() {
618 if (jTextField2 == null) {
619 jTextField2 = new JTextField();
620 jTextField2.setPreferredSize(new java.awt.Dimension(140,20));
621 jTextField2.setEnabled(false);
622 }
623 return jTextField2;
624 }
625
626
627 /**
628 * This method initializes jButton2
629 *
630 * @return javax.swing.JButton
631 */
632 private JButton getJButton2() {
633 if (jButton2 == null) {
634 jButton2 = new JButton();
635 jButton2.setPreferredSize(new Dimension(80, 20));
636 jButton2.setEnabled(false);
637 jButton2.setText("Add");
638 jButton2.addActionListener(new AbstractAction() {
639 /**
640 *
641 */
642 private static final long serialVersionUID = 1L;
643
644 public void actionPerformed(java.awt.event.ActionEvent e) {
645 if (jTextField2.getText().length() > 0){
646 String[] row = {jTextField2.getText()};
647 fvImageNameTableModel.addRow(row);
648 }
649 }
650 });
651 }
652 return jButton2;
653 }
654
655
656 /**
657 * This method initializes jScrollPane2
658 *
659 * @return javax.swing.JScrollPane
660 */
661 private JScrollPane getJScrollPane2() {
662 if (jScrollPane2 == null) {
663 jScrollPane2 = new JScrollPane();
664 jScrollPane2.setPreferredSize(new java.awt.Dimension(350,50));
665 jScrollPane2.setViewportView(getJTable1());
666 }
667 return jScrollPane2;
668 }
669
670
671 /**
672 * This method initializes jTable1
673 *
674 * @return javax.swing.JTable
675 */
676 private JTable getJTable1() {
677 if (jTable1 == null) {
678 fvImageNameTableModel = new DefaultTableModel();
679 jTable1 = new JTable(fvImageNameTableModel);
680 jTable1.setEnabled(false);
681 fvImageNameTableModel.addColumn("FV Image Name");
682 }
683 return jTable1;
684 }
685
686
687 /**
688 * This method initializes jButton3
689 *
690 * @return javax.swing.JButton
691 */
692 private JButton getJButton3() {
693 if (jButton3 == null) {
694 jButton3 = new JButton();
695 jButton3.setPreferredSize(new Dimension(80, 20));
696 jButton3.setEnabled(false);
697 jButton3.setText("Delete");
698 jButton3.addActionListener(new AbstractAction() {
699 /**
700 *
701 */
702 private static final long serialVersionUID = 1L;
703
704 public void actionPerformed(java.awt.event.ActionEvent e) {
705 if (jTable1.getSelectedRow() >= 0){
706
707 fvImageNameTableModel.removeRow(jTable1.getSelectedRow());
708 }
709 }
710 });
711 }
712 return jButton3;
713 }
714
715
716
717
718 private JPanel getJPanel5() {
719
720
721 if (jPanel5 == null) {
722 //ToDo add ButtonGroup for RadioButtons
723 jLabel6 = new JLabel();
724 jLabel6.setText("EFI Alignment CAP");
725 jLabel6.setEnabled(false);
726 jPanel5 = new JPanel();
727 jPanel5.setPreferredSize(new java.awt.Dimension(480,150));
728
729 GridLayout gridLayout = new GridLayout();
730 gridLayout.setRows(6);
731 gridLayout.setColumns(3);
732 jPanel5.setLayout(gridLayout);
733 jPanel5.add(getJCheckBox3(), null);
734
735 jLabel5 = new JLabel();
736 jLabel5.setText("EFI_ERASE_POLARITY");
737 jLabel5.setEnabled(false);
738 jPanel5.add(jLabel5, null);
739 jPanel5.add(getJComboBox1(), null);
740 jPanel5.add(getJCheckBox4(), null);
741 jPanel5.add(getJCheckBox5(), null);
742 jPanel5.add(getJCheckBox6(), null);
743 jPanel5.add(getJCheckBox7(), null);
744 jPanel5.add(getJCheckBox8(), null);
745 jPanel5.add(getJCheckBox9(), null);
746 jPanel5.add(getJCheckBox10(), null);
747 jPanel5.add(getJCheckBox11(), null);
748 jPanel5.add(getJCheckBox12(), null);
749 jPanel5.add(getJCheckBox13(), null);
750 jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
751 jPanel5.add(jLabel6, null);
752 jPanel5.add(getJComboBox2(), null);
753 jPanel5.add(getJButton4(), null);
754 jPanel5.add(getJButton6(), null);
755
756
757
758
759
760 }
761 return jPanel5;
762 }
763
764
765 /**
766 * This method initializes jButton4
767 *
768 * @return javax.swing.JButton
769 */
770 private JButton getJButton4() {
771 if (jButton4 == null) {
772 jButton4 = new JButton();
773 jButton4.setPreferredSize(new java.awt.Dimension(80,20));
774 // jButton4.setEnabled(false);
775 jButton4.setText("Add FV Image");
776 jButton4.addActionListener(new AbstractAction() {
777 /**
778 *
779 */
780 private static final long serialVersionUID = 1L;
781
782 public void actionPerformed(java.awt.event.ActionEvent e) {
783 if (jTable1.getRowCount()== 0){
784 return;
785 }
786 String imageName = " ";
787 for (int i = 0; i < jTable1.getRowCount(); ++i){
788 imageName += (String)jTable1.getValueAt(i, 0);
789 imageName += " ";
790 }
791 imageName = imageName.trim();
792
793 if (!jCheckBox3.isSelected() && jComboBox.getSelectedIndex() != 0){
794 return;
795
796 }
797
798 LinkedHashMap<String, String> m = null;
799 if (jCheckBox3.isSelected()) {
800 m = new LinkedHashMap<String, String>();
801 boolean[] boolArray = {jComboBox1.getSelectedIndex()==0 ? true: false, jCheckBox6.isSelected(), jCheckBox9.isSelected(),
802 jCheckBox11.isSelected(), jCheckBox12.isSelected(),
803 jCheckBox13.isSelected(),jCheckBox4.isSelected(),
804 jCheckBox5.isSelected(), jCheckBox7.isSelected(),
805 jCheckBox8.isSelected(),jCheckBox10.isSelected()};
806 booleanToNameValue(boolArray, m);
807 }
808 ffc.genFvImagesFvImage(imageName.split(" "), jComboBox.getSelectedItem()+"", m);
809
810 Object[] o = {imageName, jComboBox.getSelectedItem(), jComboBox1.getSelectedIndex()==0 ? true: false,
811 jCheckBox6.isSelected(), jCheckBox9.isSelected(),
812 jCheckBox11.isSelected(), jCheckBox12.isSelected(),
813 jCheckBox13.isSelected(),jCheckBox4.isSelected(),
814 jCheckBox5.isSelected(), jCheckBox7.isSelected(),
815 jCheckBox8.isSelected(),jCheckBox10.isSelected()};
816 fvImageParaTableModel.addRow(o);
817 }
818 });
819 }
820 return jButton4;
821 }
822
823
824 /**
825 * This method initializes jScrollPane3
826 *
827 * @return javax.swing.JScrollPane
828 */
829 private JScrollPane getJScrollPane3() {
830 if (jScrollPane3 == null) {
831 jScrollPane3 = new JScrollPane();
832 jScrollPane3.setPreferredSize(new java.awt.Dimension(480,150));
833 jScrollPane3.setViewportView(getJTable2());
834 }
835 return jScrollPane3;
836 }
837
838
839 /**
840 * This method initializes jTable2
841 *
842 * @return javax.swing.JTable
843 */
844 private JTable getJTable2() {
845 if (jTable2 == null) {
846 fvImageParaTableModel = new ImageParaTableModel();
847 jTable2 = new JTable(fvImageParaTableModel);
848 jTable2.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
849 fvImageParaTableModel.addColumn("FvImageNames");
850 fvImageParaTableModel.addColumn("Type");
851 fvImageParaTableModel.addColumn("ErasePolarity");
852 fvImageParaTableModel.addColumn("ReadStatus");
853 fvImageParaTableModel.addColumn("WriteStatus");
854 fvImageParaTableModel.addColumn("LockStatus");
855 fvImageParaTableModel.addColumn("MemoryMapped");
856 fvImageParaTableModel.addColumn("StickyWrite");
857 fvImageParaTableModel.addColumn("ReadDisableCap");
858 fvImageParaTableModel.addColumn("ReadEnableCap");
859 fvImageParaTableModel.addColumn("WriteDisableCap");
860 fvImageParaTableModel.addColumn("WriteEnableCap");
861 fvImageParaTableModel.addColumn("LockCap");
862 fvImageParaTableModel.addColumn("Alignment");
863
864 TableColumn typeCol = jTable2.getColumnModel().getColumn(1);
865 JComboBox cb = new JComboBox();
866 cb.addItem("ValidImageNames");
867 cb.addItem("Attributes");
868 cb.addItem("Options");
869 cb.addItem("Components");
870 typeCol.setCellEditor(new DefaultCellEditor(cb));
871
872 TableColumn alignCol = jTable2.getColumnModel().getColumn(13);
873 JComboBox cb1 = new JComboBox();
874 cb1.addItem("64K");
875 cb1.addItem("32K");
876 cb1.addItem("16K");
877 cb1.addItem("8K");
878 cb1.addItem("4K");
879 cb1.addItem("2K");
880 cb1.addItem("1K");
881 cb1.addItem("512");
882 cb1.addItem("256");
883 cb1.addItem("128");
884 cb1.addItem("64");
885 cb1.addItem("32");
886 cb1.addItem("16");
887 cb1.addItem("8");
888 cb1.addItem("4");
889 cb1.addItem("2");
890 alignCol.setCellEditor(new DefaultCellEditor(cb1));
891
892 jTable2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
893 jTable2.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
894 public void valueChanged(ListSelectionEvent e) {
895 if (e.getValueIsAdjusting()){
896 return;
897 }
898 ListSelectionModel lsm = (ListSelectionModel)e.getSource();
899 if (lsm.isSelectionEmpty()) {
900 return;
901 }
902 else{
903 // selectedRow = lsm.getMinSelectionIndex();
904 }
905 }
906 });
907
908 jTable2.getModel().addTableModelListener(new TableModelListener(){
909 public void tableChanged(TableModelEvent arg0) {
910 // TODO Auto-generated method stub
911 int row = arg0.getFirstRow();
912 TableModel m = (TableModel)arg0.getSource();
913 if (arg0.getType() == TableModelEvent.UPDATE){
914 //ToDo Check data validity before update
915 String name = m.getValueAt(row, 0) + "";
916 String type = m.getValueAt(row, 1) + "";
917 boolean[] boolArray = new boolean[11];
918 for (int i = 2; i < 13; ++i) {
919 boolArray[i-2] = (Boolean)m.getValueAt(row, i);
920 }
921 LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
922 booleanToNameValue(boolArray, lhm);
923 lhm.put("EFI_ALIGNMENT_CAP", m.getValueAt(row, 13)+"");
924
925 ffc.updateFvImagesFvImage(row, name.split(" "), type, lhm);
926 }
927 }
928 });
929 }
930 return jTable2;
931 }
932
933
934 /**
935 * This method initializes jButton6
936 *
937 * @return javax.swing.JButton
938 */
939 private JButton getJButton6() {
940 if (jButton6 == null) {
941 jButton6 = new JButton();
942 jButton6.setPreferredSize(new java.awt.Dimension(150,20));
943 // jButton6.setEnabled(false);
944 jButton6.setText("Delete Row");
945 jButton6.addActionListener(new AbstractAction() {
946 /**
947 *
948 */
949 private static final long serialVersionUID = 1L;
950
951 public void actionPerformed(ActionEvent arg0) {
952 // TODO Auto-generated method stub
953 if (jTable2.getSelectedRow() >= 0 ) {
954 fvImageParaTableModel.removeRow(jTable2.getSelectedRow());
955 ffc.removeFvImagesFvImage(jTable2.getSelectedRow());
956 }
957 }
958
959 });
960 }
961 return jButton6;
962 }
963
964
965 /**
966 * This method initializes jCheckBox3
967 *
968 * @return javax.swing.JCheckBox
969 */
970 private JCheckBox getJCheckBox3() {
971 if (jCheckBox3 == null) {
972 jCheckBox3 = new JCheckBox();
973 jCheckBox3.setText("FV Image Options");
974 jCheckBox3.addItemListener(new ItemListener(){
975
976 public void itemStateChanged(ItemEvent arg0) {
977 // TODO Auto-generated method stub
978 boolean seleted = jCheckBox3.isSelected();
979
980 if (!jCheckBox2.isSelected() || jComboBox.getSelectedIndex() == 0) {
981 return;
982 }
983
984 jLabel5.setEnabled(seleted);
985 jComboBox1.setEnabled(seleted);
986
987 jCheckBox4.setEnabled(seleted);
988 jCheckBox5.setEnabled(seleted);
989 jCheckBox6.setEnabled(seleted);
990 jCheckBox7.setEnabled(seleted);
991 jCheckBox8.setEnabled(seleted);
992 jCheckBox9.setEnabled(seleted);
993 jCheckBox10.setEnabled(seleted);
994 jCheckBox11.setEnabled(seleted);
995 jCheckBox12.setEnabled(seleted);
996 jCheckBox13.setEnabled(seleted);
997 jLabel6.setEnabled(seleted);
998 jComboBox2.setEnabled(seleted);
999 // jButton4.setEnabled(seleted);
1000 // jButton6.setEnabled(seleted);
1001 }
1002
1003 });
1004 }
1005 return jCheckBox3;
1006 }
1007
1008
1009 /**
1010 * This method initializes jComboBox1
1011 *
1012 * @return javax.swing.JComboBox
1013 */
1014 private JComboBox getJComboBox1() {
1015 if (jComboBox1 == null) {
1016 jComboBox1 = new JComboBox();
1017 jComboBox1.setPreferredSize(new java.awt.Dimension(20,20));
1018 jComboBox1.setEnabled(false);
1019 jComboBox1.addItem("1");
1020 jComboBox1.addItem("0");
1021 jComboBox1.setSelectedIndex(0);
1022 }
1023 return jComboBox1;
1024 }
1025
1026
1027 /**
1028 * This method initializes jCheckBox4
1029 *
1030 * @return javax.swing.JCheckBox
1031 */
1032 private JCheckBox getJCheckBox4() {
1033 if (jCheckBox4 == null) {
1034 jCheckBox4 = new JCheckBox();
1035 jCheckBox4.setText("Read Disable CAP");
1036 jCheckBox4.setEnabled(false);
1037 }
1038 return jCheckBox4;
1039 }
1040
1041
1042 /**
1043 * This method initializes jCheckBox5
1044 *
1045 * @return javax.swing.JCheckBox
1046 */
1047 private JCheckBox getJCheckBox5() {
1048 if (jCheckBox5 == null) {
1049 jCheckBox5 = new JCheckBox();
1050 jCheckBox5.setText("Read Enable CAP");
1051 jCheckBox5.setEnabled(false);
1052 }
1053 return jCheckBox5;
1054 }
1055
1056
1057 /**
1058 * This method initializes jCheckBox6
1059 *
1060 * @return javax.swing.JCheckBox
1061 */
1062 private JCheckBox getJCheckBox6() {
1063 if (jCheckBox6 == null) {
1064 jCheckBox6 = new JCheckBox();
1065 jCheckBox6.setText("Read Status");
1066 jCheckBox6.setEnabled(false);
1067 }
1068 return jCheckBox6;
1069 }
1070
1071
1072 /**
1073 * This method initializes jCheckBox7
1074 *
1075 * @return javax.swing.JCheckBox
1076 */
1077 private JCheckBox getJCheckBox7() {
1078 if (jCheckBox7 == null) {
1079 jCheckBox7 = new JCheckBox();
1080 jCheckBox7.setText("Write Disable CAP");
1081 jCheckBox7.setEnabled(false);
1082 }
1083 return jCheckBox7;
1084 }
1085
1086
1087 /**
1088 * This method initializes jCheckBox8
1089 *
1090 * @return javax.swing.JCheckBox
1091 */
1092 private JCheckBox getJCheckBox8() {
1093 if (jCheckBox8 == null) {
1094 jCheckBox8 = new JCheckBox();
1095 jCheckBox8.setText("Write Enable CAP");
1096 jCheckBox8.setEnabled(false);
1097 }
1098 return jCheckBox8;
1099 }
1100
1101
1102 /**
1103 * This method initializes jCheckBox9
1104 *
1105 * @return javax.swing.JCheckBox
1106 */
1107 private JCheckBox getJCheckBox9() {
1108 if (jCheckBox9 == null) {
1109 jCheckBox9 = new JCheckBox();
1110 jCheckBox9.setText("Write Status");
1111 jCheckBox9.setEnabled(false);
1112 }
1113 return jCheckBox9;
1114 }
1115
1116
1117 /**
1118 * This method initializes jCheckBox10
1119 *
1120 * @return javax.swing.JCheckBox
1121 */
1122 private JCheckBox getJCheckBox10() {
1123 if (jCheckBox10 == null) {
1124 jCheckBox10 = new JCheckBox();
1125 jCheckBox10.setText("Lock CAP");
1126 jCheckBox10.setEnabled(false);
1127 }
1128 return jCheckBox10;
1129 }
1130
1131
1132 /**
1133 * This method initializes jCheckBox11
1134 *
1135 * @return javax.swing.JCheckBox
1136 */
1137 private JCheckBox getJCheckBox11() {
1138 if (jCheckBox11 == null) {
1139 jCheckBox11 = new JCheckBox();
1140 jCheckBox11.setText("Lock Status");
1141 jCheckBox11.setEnabled(false);
1142 }
1143 return jCheckBox11;
1144 }
1145
1146
1147 /**
1148 * This method initializes jCheckBox12
1149 *
1150 * @return javax.swing.JCheckBox
1151 */
1152 private JCheckBox getJCheckBox12() {
1153 if (jCheckBox12 == null) {
1154 jCheckBox12 = new JCheckBox();
1155 jCheckBox12.setText("Memory Mapped");
1156 jCheckBox12.setEnabled(false);
1157 }
1158 return jCheckBox12;
1159 }
1160
1161
1162 /**
1163 * This method initializes jCheckBox13
1164 *
1165 * @return javax.swing.JCheckBox
1166 */
1167 private JCheckBox getJCheckBox13() {
1168 if (jCheckBox13 == null) {
1169 jCheckBox13 = new JCheckBox();
1170 jCheckBox13.setText("Sticky Write");
1171 jCheckBox13.setEnabled(false);
1172 }
1173 return jCheckBox13;
1174 }
1175
1176
1177 /**
1178 * This method initializes jPanel6
1179 *
1180 * @return javax.swing.JPanel
1181 */
1182 private JPanel getJPanel6() {
1183 if (jPanel6 == null) {
1184 StarLabel starLabel = new StarLabel();
1185 starLabel.setVisible(false);
1186 jPanel6 = new JPanel();
1187 jPanel6.setPreferredSize(new java.awt.Dimension(480,120));
1188 jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
1189 jPanel6.add(getJCheckBox2(), null);
1190 jPanel6.add(jLabel2, null);
1191 jPanel6.add(getJComboBox(), null);
1192 jPanel6.add(new StarLabel(), null);
1193 jPanel6.add(jLabel3, null);
1194 jPanel6.add(jLabel4, null);
1195 jPanel6.add(getJTextField2(), null);
1196 jPanel6.add(getJButton2(), null);
1197 jPanel6.add(getJScrollPane2(), null);
1198 jPanel6.add(getJButton3(), null);
1199 }
1200 return jPanel6;
1201 }
1202
1203 /**
1204 * This method initializes jPanel7
1205 *
1206 * @return javax.swing.JPanel
1207 */
1208 private JPanel getJPanel7() {
1209 if (jPanel7 == null) {
1210 FlowLayout flowLayout1 = new FlowLayout();
1211 flowLayout1.setAlignment(FlowLayout.LEFT);
1212 jPanel7 = new JPanel();
1213 jPanel7.setLayout(flowLayout1);
1214 jPanel7.add(getJCheckBox(), null);
1215 jPanel7.add(getJTextField3(), null);
1216 jPanel7.add(getJButton5(), null);
1217 jPanel7.addComponentListener(new ComponentAdapter(){
1218 public void componentShown(ComponentEvent e) {
1219 if (ffc.getFlashDefinitionFile() != null) {
1220 jTextField3.setText(ffc.getFlashDefinitionFile());
1221 }
1222 }
1223 public void componentHidden(ComponentEvent e) {
1224 if (jCheckBox.isSelected()) {
1225 ffc.genFlashDefinitionFile(jTextField3.getText());
1226 }
1227 }
1228 });
1229 }
1230 return jPanel7;
1231 }
1232
1233 /**
1234 * This method initializes jCheckBox
1235 *
1236 * @return javax.swing.JCheckBox
1237 */
1238 private JCheckBox getJCheckBox() {
1239 if (jCheckBox == null) {
1240 jCheckBox = new JCheckBox();
1241 jCheckBox.setText("Flash Definition File");
1242 jCheckBox.addItemListener(new ItemListener() {
1243
1244 public void itemStateChanged(ItemEvent arg0) {
1245 // TODO Auto-generated method stub
1246 if (jCheckBox.isSelected()){
1247 jTextField3.setEnabled(true);
1248 jButton5.setEnabled(true);
1249 }
1250 else {
1251
1252 jTextField3.setEnabled(false);
1253 jButton5.setEnabled(false);
1254 }
1255 }
1256 });
1257 }
1258 return jCheckBox;
1259 }
1260
1261 /**
1262 * This method initializes jTextField3
1263 *
1264 * @return javax.swing.JTextField
1265 */
1266 private JTextField getJTextField3() {
1267 if (jTextField3 == null) {
1268 jTextField3 = new JTextField();
1269 jTextField3.setEnabled(false);
1270 jTextField3.setPreferredSize(new Dimension(300, 20));
1271 }
1272 return jTextField3;
1273 }
1274
1275 /**
1276 * This method initializes jButton5
1277 *
1278 * @return javax.swing.JButton
1279 */
1280 private JButton getJButton5() {
1281 if (jButton5 == null) {
1282 jButton5 = new JButton();
1283 jButton5.setEnabled(false);
1284 jButton5.setText("Browse");
1285 jButton5.setPreferredSize(new Dimension(78, 20));
1286 jButton5.addActionListener(new AbstractAction(){
1287 /**
1288 *
1289 */
1290 private static final long serialVersionUID = 1L;
1291
1292 public void actionPerformed(ActionEvent e) {
1293 // TODO Auto-generated method stub
1294 JFileChooser chooser = new JFileChooser();
1295 chooser.setMultiSelectionEnabled(false);
1296 chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
1297 int retval = chooser.showOpenDialog(frame);
1298 if (retval == JFileChooser.APPROVE_OPTION) {
1299
1300 File theFile = chooser.getSelectedFile();
1301 jTextField3.setText(theFile.getPath());
1302 }
1303 }
1304
1305 });
1306 }
1307 return jButton5;
1308 }
1309
1310 /**
1311 * This method initializes jComboBox2
1312 *
1313 * @return javax.swing.JComboBox
1314 */
1315 private JComboBox getJComboBox2() {
1316 if (jComboBox2 == null) {
1317 jComboBox2 = new JComboBox();
1318 jComboBox2.setEnabled(false);
1319 jComboBox2.addItem("64K");
1320 jComboBox2.addItem("32K");
1321 jComboBox2.addItem("16K");
1322 jComboBox2.addItem("8K");
1323 jComboBox2.addItem("4K");
1324 jComboBox2.addItem("2K");
1325 jComboBox2.addItem("1K");
1326 jComboBox2.addItem("512");
1327 jComboBox2.addItem("256");
1328 jComboBox2.addItem("128");
1329 jComboBox2.addItem("64");
1330 jComboBox2.addItem("32");
1331 jComboBox2.addItem("16");
1332 jComboBox2.addItem("8");
1333 jComboBox2.addItem("4");
1334 jComboBox2.addItem("2");
1335 jComboBox2.setSelectedIndex(0);
1336 }
1337 return jComboBox2;
1338 }
1339
1340 /**
1341 * @param args
1342 */
1343 public static void main(String[] args) {
1344 // TODO Auto-generated method stub
1345 new FpdFlash().setVisible(true);
1346 }
1347
1348 /**
1349 * This method initializes this
1350 *
1351 * @return void
1352 */
1353 private void initialize() {
1354 this.setSize(518, 650);
1355 this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
1356 this.setContentPane(getJContentPane());
1357 this.setTitle("FPD Flash Definitions");
1358 this.addInternalFrameListener(new InternalFrameAdapter(){
1359 public void internalFrameDeactivated(InternalFrameEvent e){
1360 if (jTable.isEditing()) {
1361 jTable.getCellEditor().stopCellEditing();
1362 }
1363 if (jTable1.isEditing()) {
1364 jTable1.getCellEditor().stopCellEditing();
1365 }
1366 if (jTable2.isEditing()) {
1367 jTable2.getCellEditor().stopCellEditing();
1368 }
1369 }
1370 });
1371 }
1372
1373 private void init(FpdFileContents ffc) {
1374 if (ffc.getFvImagesFvImageCount() == 0) {
1375 return;
1376 }
1377 String[][] saa = new String[ffc.getFvImagesFvImageCount()][2];
1378 ArrayList<LinkedHashMap<String, String>> options = new ArrayList<LinkedHashMap<String, String>>(ffc.getFvImagesFvImageCount());
1379
1380 for (int j = 0; j < ffc.getFvImagesFvImageCount(); ++j){
1381 options.add(new LinkedHashMap<String, String>());
1382 }
1383 ffc.getFvImagesFvImages(saa, options);
1384
1385 Object[] rowData = new Object[14];
1386 int i = 0;
1387 Boolean f = new Boolean("false");
1388 while (i < saa.length) {
1389 rowData[0] = saa[i][0];
1390 rowData[1] = saa[i][1];
1391
1392
1393 //ToDo: add alignment settings
1394 Boolean[] boolArray = new Boolean[11];
1395 int k = 0;
1396 while (k < 11){
1397 boolArray[k] = f;
1398 ++k;
1399 }
1400 namevalueToBoolean(options.get(i), boolArray);
1401 for (k = 2; k < 13; ++k) {
1402 rowData[k] = boolArray[k-2];
1403 }
1404 rowData[13] = getAlign(options.get(i));
1405 fvImageParaTableModel.addRow(rowData);
1406 ++i;
1407 }
1408 }
1409
1410 private String getAlign(Map<String, String> m){
1411 String s = "64K";
1412 if (m.get("EFI_ALIGNMENT_64K") != null) {
1413 if (m.get("EFI_ALIGNMENT_64K").equals("TRUE")) {
1414 s = "64K";
1415 return s;
1416 }
1417 }
1418 if (m.get("EFI_ALIGNMENT_32K") != null) {
1419 if (m.get("EFI_ALIGNMENT_32K").equals("TRUE")) {
1420 s = "32K";
1421 return s;
1422 }
1423 }
1424 if (m.get("EFI_ALIGNMENT_16K") != null) {
1425 if (m.get("EFI_ALIGNMENT_16K").equals("TRUE")) {
1426 s = "16K";
1427 return s;
1428 }
1429 }
1430 if (m.get("EFI_ALIGNMENT_8K") != null) {
1431 if (m.get("EFI_ALIGNMENT_8K").equals("TRUE")) {
1432 s = "8K";
1433 return s;
1434 }
1435 }
1436 if (m.get("EFI_ALIGNMENT_4K") != null) {
1437 if (m.get("EFI_ALIGNMENT_4K").equals("TRUE")) {
1438 s = "4K";
1439 return s;
1440 }
1441 }
1442 if (m.get("EFI_ALIGNMENT_2K") != null) {
1443 if (m.get("EFI_ALIGNMENT_2K").equals("TRUE")) {
1444 s = "2K";
1445 return s;
1446 }
1447 }
1448 if (m.get("EFI_ALIGNMENT_1K") != null) {
1449 if (m.get("EFI_ALIGNMENT_1K").equals("TRUE")) {
1450 s = "1K";
1451 return s;
1452 }
1453 }
1454 if (m.get("EFI_ALIGNMENT_512") != null) {
1455 if (m.get("EFI_ALIGNMENT_512").equals("TRUE")) {
1456 s = "512";
1457 return s;
1458 }
1459 }
1460 if (m.get("EFI_ALIGNMENT_256") != null) {
1461 if (m.get("EFI_ALIGNMENT_256").equals("TRUE")) {
1462 s = "256";
1463 return s;
1464 }
1465 }
1466 if (m.get("EFI_ALIGNMENT_128") != null) {
1467 if (m.get("EFI_ALIGNMENT_128").equals("TRUE")) {
1468 s = "128";
1469 return s;
1470 }
1471 }
1472 if (m.get("EFI_ALIGNMENT_64") != null) {
1473 if (m.get("EFI_ALIGNMENT_64").equals("TRUE")) {
1474 s = "64";
1475 return s;
1476 }
1477 }
1478 if (m.get("EFI_ALIGNMENT_32") != null) {
1479 if (m.get("EFI_ALIGNMENT_32").equals("TRUE")) {
1480 s = "32";
1481 return s;
1482 }
1483 }
1484 if (m.get("EFI_ALIGNMENT_16") != null) {
1485 if (m.get("EFI_ALIGNMENT_16").equals("TRUE")) {
1486 s = "16";
1487 return s;
1488 }
1489 }
1490 if (m.get("EFI_ALIGNMENT_8") != null) {
1491 if (m.get("EFI_ALIGNMENT_8").equals("TRUE")) {
1492 s = "8";
1493 return s;
1494 }
1495 }
1496 if (m.get("EFI_ALIGNMENT_4") != null) {
1497 if (m.get("EFI_ALIGNMENT_4").equals("TRUE")) {
1498 s = "4";
1499 return s;
1500 }
1501 }
1502 if (m.get("EFI_ALIGNMENT_2") != null) {
1503 if (m.get("EFI_ALIGNMENT_2").equals("TRUE")) {
1504 s = "2";
1505 return s;
1506 }
1507 }
1508 return s;
1509 }
1510
1511 private void namevalueToBoolean(Map<String, String> m, Boolean[] boolArray){
1512 Set<String> key = m.keySet();
1513 Iterator<String> ki= key.iterator();
1514 Boolean t = new Boolean("true");
1515 while(ki.hasNext()) {
1516 String k = ki.next();
1517 if (k.equals("EFI_ERASE_POLARITY") && m.get(k).equals("1")) {
1518 boolArray[0] = t;
1519 }
1520 if (k.equals("EFI_READ_STATUS") && m.get(k).equals("TRUE")) {
1521 boolArray[1] = t;
1522 }
1523 if (k.equals("EFI_WRITE_STATUS") && m.get(k).equals("TRUE")) {
1524 boolArray[2] = t;
1525 }
1526 if (k.equals("EFI_LOCK_STATUS") && m.get(k).equals("TRUE")) {
1527 boolArray[3] = t;
1528 }
1529 if (k.equals("EFI_MEMORY_MAPPED") && m.get(k).equals("TRUE")) {
1530 boolArray[4] = t;
1531 }
1532 if (k.equals("EFI_STICKY_WRITE") && m.get(k).equals("TRUE")) {
1533 boolArray[5] = t;
1534 }
1535 if (k.equals("EFI_READ_DISABLED_CAP") && m.get(k).equals("TRUE")) {
1536 boolArray[6] = t;
1537 }
1538 if (k.equals("EFI_READ_ENABLED_CAP") && m.get(k).equals("TRUE")) {
1539 boolArray[7] = t;
1540 }
1541 if (k.equals("EFI_WRITE_DISABLED_CAP") && m.get(k).equals("TRUE")) {
1542 boolArray[8] = t;
1543 }
1544 if (k.equals("EFI_WRITE_ENABLED_CAP") && m.get(k).equals("TRUE")) {
1545 boolArray[9] = t;
1546 }
1547 if (k.equals("EFI_LOCK_CAP") && m.get(k).equals("TRUE")) {
1548 boolArray[10] = t;
1549 }
1550 }
1551 }
1552
1553 private void booleanToNameValue(boolean[] boolArray, Map<String, String> m){
1554 if (boolArray[0]) {
1555 m.put("EFI_ERASE_POLARITY", "1");
1556 }
1557 else {
1558 m.put("EFI_ERASE_POLARITY", "0");
1559 }
1560 if (boolArray[1]) {
1561 m.put("EFI_READ_STATUS", "TRUE");
1562 }
1563 else {
1564 m.put("EFI_READ_STATUS", "FALSE");
1565 }
1566 if (boolArray[2]) {
1567 m.put("EFI_WRITE_STATUS", "TRUE");
1568 }
1569 else {
1570 m.put("EFI_WRITE_STATUS", "FALSE");
1571 }
1572 if (boolArray[3]) {
1573 m.put("EFI_LOCK_STATUS", "TRUE");
1574 }
1575 else {
1576 m.put("EFI_LOCK_STATUS", "FALSE");
1577 }
1578 if (boolArray[4]) {
1579 m.put("EFI_MEMORY_MAPPED", "TRUE");
1580 }
1581 else {
1582 m.put("EFI_MEMORY_MAPPED", "FALSE");
1583 }
1584 if (boolArray[5]) {
1585 m.put("EFI_STICKY_WRITE", "TRUE");
1586 }
1587 else {
1588 m.put("EFI_STICKY_WRITE", "FALSE");
1589 }
1590 if (boolArray[6]) {
1591 m.put("EFI_READ_DISABLED_CAP", "TRUE");
1592 }
1593 else {
1594 m.put("EFI_READ_DISABLED_CAP", "FALSE");
1595 }
1596 if (boolArray[7]) {
1597 m.put("EFI_READ_ENABLED_CAP", "TRUE");
1598 }
1599 else {
1600 m.put("EFI_READ_ENABLED_CAP", "FALSE");
1601 }
1602 if (boolArray[8]) {
1603 m.put("EFI_WRITE_DISABLED_CAP", "TRUE");
1604 }
1605 else {
1606 m.put("EFI_WRITE_DISABLED_CAP", "FALSE");
1607 }
1608 if (boolArray[9]) {
1609 m.put("EFI_WRITE_ENABLED_CAP", "TRUE");
1610 }
1611 else {
1612 m.put("EFI_WRITE_ENABLED_CAP", "FALSE");
1613 }
1614 if (boolArray[10]) {
1615 m.put("EFI_LOCK_CAP", "TRUE");
1616 }
1617 else {
1618 m.put("EFI_LOCK_CAP", "FALSE");
1619 }
1620 }
1621 /**
1622 * This method initializes jContentPane
1623 *
1624 * @return javax.swing.JPanel
1625 */
1626 private JPanel getJContentPane() {
1627 if (jContentPane == null) {
1628 jContentPane = new JPanel();
1629 jContentPane.setLayout(new BorderLayout());
1630 jContentPane.add(getJPanel(), java.awt.BorderLayout.EAST);
1631 jContentPane.add(getJPanel1(), java.awt.BorderLayout.SOUTH);
1632 jContentPane.add(getJPanel2(), java.awt.BorderLayout.WEST);
1633 jContentPane.add(getJPanel3(), java.awt.BorderLayout.NORTH);
1634 jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
1635 }
1636 return jContentPane;
1637 }
1638
1639 } // @jve:decl-index=0:visual-constraint="10,10"
1640
1641 class ImageParaTableModel extends DefaultTableModel {
1642
1643 /**
1644 *
1645 */
1646 private static final long serialVersionUID = 1L;
1647
1648 public Class<?> getColumnClass (int c) {
1649 if (getValueAt(0, c) != null) {
1650 return getValueAt(0, c).getClass();
1651 }
1652 return String.class;
1653 }
1654
1655 public boolean isCellEditable(int row, int col) {
1656 if (getValueAt(row, 1).equals("ImageName") && col >=1) {
1657 return false;
1658 }
1659 return true;
1660 }
1661 }