2 Java class SpdLibClassDecls is GUI for create library definition elements of spd file.
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
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.
13 package org
.tianocore
.frameworkwizard
.packaging
.ui
;
15 import java
.awt
.Dimension
;
16 import java
.awt
.event
.ActionEvent
;
17 import java
.awt
.event
.ComponentEvent
;
19 import java
.util
.HashMap
;
20 import java
.util
.Iterator
;
23 import java
.util
.Vector
;
25 import javax
.swing
.AbstractAction
;
26 import javax
.swing
.JFileChooser
;
27 import javax
.swing
.JOptionPane
;
28 import javax
.swing
.JPanel
;
29 import javax
.swing
.JTable
;
30 import javax
.swing
.JTextField
;
31 import javax
.swing
.JComboBox
;
32 import javax
.swing
.JLabel
;
33 import javax
.swing
.JScrollPane
;
34 import javax
.swing
.JButton
;
35 import javax
.swing
.JFrame
;
36 import javax
.swing
.ListSelectionModel
;
37 import javax
.swing
.event
.InternalFrameAdapter
;
38 import javax
.swing
.event
.InternalFrameEvent
;
39 import javax
.swing
.event
.ListSelectionEvent
;
40 import javax
.swing
.event
.ListSelectionListener
;
41 import javax
.swing
.event
.TableModelEvent
;
42 import javax
.swing
.event
.TableModelListener
;
43 import javax
.swing
.table
.DefaultTableModel
;
44 import javax
.swing
.table
.TableModel
;
46 import org
.apache
.xmlbeans
.XmlObject
;
47 import org
.tianocore
.PackageSurfaceAreaDocument
;
48 import org
.tianocore
.frameworkwizard
.common
.DataValidation
;
49 import org
.tianocore
.frameworkwizard
.common
.Tools
;
50 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
51 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
52 import org
.tianocore
.frameworkwizard
.common
.ui
.StarLabel
;
53 import org
.tianocore
.frameworkwizard
.common
.ui
.iCheckBoxList
.ICheckBoxList
;
54 import org
.tianocore
.frameworkwizard
.platform
.ui
.ListEditor
;
55 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.GlobalData
;
56 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.SurfaceAreaQuery
;
57 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.ModuleIdentification
;
58 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.PackageIdentification
;
62 GUI for create library definition elements of spd file.
64 @since PackageEditor 1.0
66 public class SpdLibClassDecls
extends IInternalFrame
implements TableModelListener
{
70 private static final long serialVersionUID
= 1L;
74 private JTable jTable
= null;
76 private DefaultTableModel model
= null;
78 private JPanel jContentPane
= null;
80 private JTextField jTextFieldAdd
= null;
82 private JComboBox jComboBoxSelect
= null;
84 private JScrollPane jScrollPane
= null;
86 private JButton jButtonAdd
= null;
88 private JButton jButtonRemove
= null;
90 private JButton jButtonClearAll
= null;
92 private JLabel jLabel
= null;
94 private JTextField jTextField
= null;
96 private JButton jButtonBrowse
= null;
98 private StarLabel jStarLabel1
= null;
100 private StarLabel jStarLabel2
= null;
102 private SpdFileContents sfc
= null;
104 private OpeningPackageType docConsole
= null;
106 private JLabel jLabel1ClassName
= null;
108 private JScrollPane topScrollPane
= null; // @jve:decl-index=0:visual-constraint="10,53"
110 private int selectedRow
= -1;
112 private StarLabel starLabel
= null;
114 private JLabel jLabel2HelpText
= null;
116 private JTextField jTextFieldHelp
= null;
118 private JLabel jLabel3RecInstName
= null;
120 private JTextField jTextField1RecInstName
= null;
122 private JLabel jLabel4RecInstVer
= null;
124 private JTextField jTextField2RecInstVer
= null;
126 private JLabel jLabel5SupArchList
= null;
128 private JLabel jLabel6SupModList
= null;
130 private JScrollPane jScrollPaneArch
= null;
132 private JScrollPane jScrollPane1
= null;
134 private ICheckBoxList iCheckBoxListArch
= null;
136 private ICheckBoxList iCheckBoxList
= null;
138 private JComboBox jComboBox
= null;
140 HashMap
<String
, String
> libNameGuidMap
= new HashMap
<String
, String
>();
144 This method initializes this
147 private void initialize() {
149 this.setDefaultCloseOperation(javax
.swing
.WindowConstants
.DISPOSE_ON_CLOSE
);
154 This method initializes jTextFieldAdd
156 @return javax.swing.JTextField
158 private JTextField
getJTextFieldAdd() {
159 if (jTextFieldAdd
== null) {
160 jTextFieldAdd
= new JTextField();
161 jTextFieldAdd
.setBounds(new java
.awt
.Rectangle(122,6,390,20));
162 jTextFieldAdd
.setPreferredSize(new java
.awt
.Dimension(260,20));
163 jTextFieldAdd
.setEnabled(true);
165 return jTextFieldAdd
;
169 This method initializes jComboBoxSelect
171 @return javax.swing.JComboBox
173 private JComboBox
getJComboBoxSelect() {
174 if (jComboBoxSelect
== null) {
175 jComboBoxSelect
= new JComboBox();
176 jComboBoxSelect
.setBounds(new java
.awt
.Rectangle(220, 10, 260, 20));
177 jComboBoxSelect
.setPreferredSize(new java
.awt
.Dimension(260,22));
178 jComboBoxSelect
.setEnabled(true);
179 jComboBoxSelect
.setVisible(false);
181 return jComboBoxSelect
;
185 This method initializes jScrollPane
187 @return javax.swing.JScrollPane
189 private JScrollPane
getJScrollPane() {
190 if (jScrollPane
== null) {
191 jScrollPane
= new JScrollPane();
192 jScrollPane
.setBounds(new java
.awt
.Rectangle(12,351,608,253));
193 jScrollPane
.setPreferredSize(new java
.awt
.Dimension(330,150));
194 jScrollPane
.setViewportView(getJTable());
200 This method initializes jTable
202 @return javax.swing.JTable
204 private JTable
getJTable() {
205 if (jTable
== null) {
206 model
= new DefaultTableModel();
207 jTable
= new JTable(model
);
208 jTable
.setRowHeight(20);
209 jTable
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
210 model
.addColumn("Library Class");
211 model
.addColumn("Include Header");
212 model
.addColumn("HelpText");
213 model
.addColumn("Recommended Instance");
214 model
.addColumn("Version");
215 model
.addColumn("Supported Arch");
216 model
.addColumn("Supported Module");
218 Vector
<String
> vArch
= new Vector
<String
>();
225 jTable
.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vArch
));
227 Vector
<String
> vModule
= new Vector
<String
>();
230 vModule
.add("PEI_CORE");
232 vModule
.add("DXE_CORE");
233 vModule
.add("DXE_DRIVER");
234 vModule
.add("DXE_RUNTIME_DRIVER");
235 vModule
.add("DXE_SAL_DRIVER");
236 vModule
.add("DXE_SMM_DRIVER");
237 vModule
.add("UEFI_DRIVER");
238 vModule
.add("UEFI_APPLICATION");
239 vModule
.add("TOOLS");
240 vModule
.add("USER_DEFINED");
241 jTable
.getColumnModel().getColumn(6).setCellEditor(new ListEditor(vModule
));
243 jTable
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
244 jTable
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
245 public void valueChanged(ListSelectionEvent e
) {
246 if (e
.getValueIsAdjusting()){
249 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
250 if (lsm
.isSelectionEmpty()) {
254 selectedRow
= lsm
.getMinSelectionIndex();
259 jTable
.getModel().addTableModelListener(this);
266 public void tableChanged(TableModelEvent arg0
) {
267 // TODO Auto-generated method stub
268 int row
= arg0
.getFirstRow();
269 TableModel m
= (TableModel
)arg0
.getSource();
270 if (arg0
.getType() == TableModelEvent
.UPDATE
){
271 String lib
= m
.getValueAt(row
, 0) + "";
272 String hdr
= m
.getValueAt(row
, 1) + "";
273 String hlp
= m
.getValueAt(row
, 2) + "";
274 String name
= m
.getValueAt(row
, 3) + "";
275 String ver
= m
.getValueAt(row
, 4) + "";
277 if (m
.getValueAt(row
, 5) != null) {
278 arch
= m
.getValueAt(row
, 5).toString();
280 String module
= null;
281 if (m
.getValueAt(row
, 6) != null) {
282 module
= m
.getValueAt(row
, 6).toString();
284 String
[] rowData
= {lib
, hdr
, hlp
};
285 if (!dataValidation(rowData
)) {
288 docConsole
.setSaved(false);
290 getLibInstances(lib
);
291 String guid
= nameToGuid(name
);
293 sfc
.updateSpdLibClass(row
, lib
, hdr
, hlp
, guid
, ver
, arch
, module
);
298 This method initializes jButtonAdd
300 @return javax.swing.JButton
302 private JButton
getJButtonAdd() {
303 if (jButtonAdd
== null) {
304 jButtonAdd
= new JButton();
305 jButtonAdd
.setText("Add");
306 jButtonAdd
.setSize(new java
.awt
.Dimension(80,20));
307 jButtonAdd
.setLocation(new java
.awt
.Point(359,326));
308 jButtonAdd
.addActionListener(this);
314 This method initializes jButtonRemove
316 @return javax.swing.JButton
318 private JButton
getJButtonRemove() {
319 if (jButtonRemove
== null) {
320 jButtonRemove
= new JButton();
321 jButtonRemove
.setText("Remove");
322 jButtonRemove
.setSize(new java
.awt
.Dimension(80,20));
323 jButtonRemove
.setLocation(new java
.awt
.Point(443,326));
324 jButtonRemove
.addActionListener(this);
326 return jButtonRemove
;
330 This method initializes jButtonRemoveAll
332 @return javax.swing.JButton
334 private JButton
getJButtonClearAll() {
335 if (jButtonClearAll
== null) {
336 jButtonClearAll
= new JButton();
337 jButtonClearAll
.setText("Clear All");
338 jButtonClearAll
.setSize(new java
.awt
.Dimension(86,20));
339 jButtonClearAll
.setLocation(new java
.awt
.Point(530,326));
340 jButtonClearAll
.addActionListener(this);
342 return jButtonClearAll
;
346 This is the default constructor
348 public SpdLibClassDecls() {
355 public SpdLibClassDecls(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
){
357 sfc
= new SpdFileContents(inPsa
);
361 public SpdLibClassDecls(OpeningPackageType opt
) {
362 this(opt
.getXmlSpd());
366 This method initializes this
370 private void init() {
372 this.setContentPane(getJContentPane());
373 this.setTitle("Library Class Declarations");
374 this.setBounds(new java
.awt
.Rectangle(0, 0, 500, 370));
375 this.setVisible(true);
376 this.addInternalFrameListener(new InternalFrameAdapter(){
377 public void internalFrameDeactivated(InternalFrameEvent e
){
378 if (jTable
.isEditing()) {
379 jTable
.getCellEditor().stopCellEditing();
386 private void init(SpdFileContents sfc
) {
387 if (sfc
.getSpdLibClassDeclarationCount() == 0) {
391 // initialize table using SpdFileContents object
393 String
[][] saa
= new String
[sfc
.getSpdLibClassDeclarationCount()][7];
394 sfc
.getSpdLibClassDeclarations(saa
);
396 while (i
< saa
.length
) {
397 if (saa
[i
][3] != null && saa
[i
][3].length() > 0) {
398 getLibInstances(saa
[i
][0]);
399 saa
[i
][3] = guidToName(saa
[i
][3]);
402 model
.addRow(saa
[i
]);
406 private JScrollPane
getJContentPane(){
407 if (topScrollPane
== null){
408 topScrollPane
= new JScrollPane();
409 topScrollPane
.setSize(new java
.awt
.Dimension(634,500));
410 topScrollPane
.setViewportView(getJContentPane1());
412 return topScrollPane
;
415 This method initializes jContentPane
417 @return javax.swing.JPanel
419 private JPanel
getJContentPane1() {
420 if (jContentPane
== null) {
421 jLabel6SupModList
= new JLabel();
422 jLabel6SupModList
.setBounds(new java
.awt
.Rectangle(16,252,108,16));
423 jLabel6SupModList
.setText("Supported Module");
424 jLabel6SupModList
.setEnabled(true);
425 jLabel5SupArchList
= new JLabel();
426 jLabel5SupArchList
.setBounds(new java
.awt
.Rectangle(15,169,93,16));
427 jLabel5SupArchList
.setText("Supported Arch");
428 jLabel5SupArchList
.setEnabled(true);
429 jLabel4RecInstVer
= new JLabel();
430 jLabel4RecInstVer
.setBounds(new java
.awt
.Rectangle(16,138,196,16));
431 jLabel4RecInstVer
.setEnabled(true);
432 jLabel4RecInstVer
.setText("Recommended Instance Version");
433 jLabel3RecInstName
= new JLabel();
434 jLabel3RecInstName
.setBounds(new java
.awt
.Rectangle(17,112,195,16));
435 jLabel3RecInstName
.setEnabled(true);
436 jLabel3RecInstName
.setText("Recommended Instance Name");
437 jLabel2HelpText
= new JLabel();
438 jLabel2HelpText
.setBounds(new java
.awt
.Rectangle(16,33,82,20));
439 jLabel2HelpText
.setText("Help Text");
440 starLabel
= new StarLabel();
441 starLabel
.setBounds(new java
.awt
.Rectangle(1,33,10,20));
442 jLabel1ClassName
= new JLabel();
443 jLabel1ClassName
.setBounds(new java
.awt
.Rectangle(16,6,82,20));
444 jLabel1ClassName
.setText("Library Class");
445 jStarLabel1
= new StarLabel();
446 jStarLabel1
.setLocation(new java
.awt
.Point(1,7));
447 jStarLabel2
= new StarLabel();
448 jStarLabel2
.setLocation(new java
.awt
.Point(-1,74));
449 jLabel
= new JLabel();
450 jLabel
.setBounds(new java
.awt
.Rectangle(14,74,199,22));
451 jLabel
.setText("Include Header for Specified Class");
453 jContentPane
= new JPanel();
454 jContentPane
.setPreferredSize(new Dimension(480, 400));
455 jContentPane
.setLayout(null);
456 jContentPane
.add(jLabel
, null);
457 jContentPane
.add(jStarLabel1
, null);
458 jContentPane
.add(jStarLabel2
, null);
459 jContentPane
.add(getJTextFieldAdd(), null);
460 jContentPane
.add(getJComboBoxSelect(), null);
461 jContentPane
.add(getJScrollPane(), null);
462 jContentPane
.add(getJButtonAdd(), null);
463 jContentPane
.add(getJButtonRemove(), null);
464 jContentPane
.add(getJButtonClearAll(), null);
466 jContentPane
.add(getJTextField(), null);
467 jContentPane
.add(getJButtonBrowse(), null);
468 jContentPane
.add(jLabel1ClassName
, null);
469 jContentPane
.add(starLabel
, null);
470 jContentPane
.add(jLabel2HelpText
, null);
471 jContentPane
.add(getJTextFieldHelp(), null);
472 // LAH Removed until we can fix permanently
473 // jContentPane.add(jLabel3RecInstName, null);
474 // jContentPane.add(getJTextField1RecInstName(), null);
475 // jContentPane.add(jLabel4RecInstVer, null);
476 // jContentPane.add(getJTextField2RecInstVer(), null);
477 jContentPane
.add(jLabel5SupArchList
, null);
478 jContentPane
.add(jLabel6SupModList
, null);
480 jContentPane
.add(getJScrollPaneArch(), null);
481 jContentPane
.add(getJScrollPane1(), null);
482 // LAH jContentPane.add(getJComboBox(), null);
490 fill ComboBoxes with pre-defined contents
492 private void initFrame() {
493 jComboBoxSelect
.addItem("BaseCpuICacheFlush");
494 jComboBoxSelect
.addItem("BaseDebugLibNull");
495 jComboBoxSelect
.addItem("BaseDebugLibReportStatusCode");
496 jComboBoxSelect
.addItem("BaseIoLibIntrinsic");
497 jComboBoxSelect
.addItem("BaseLib");
498 jComboBoxSelect
.addItem("BaseMemoryLib");
499 jComboBoxSelect
.addItem("BaseMemoryLibMmx");
500 jComboBoxSelect
.addItem("BaseMemoryLibSse2");
501 jComboBoxSelect
.addItem("BasePeCoffGetEntryPointLib");
502 jComboBoxSelect
.addItem("BasePeCoffLib");
503 jComboBoxSelect
.addItem("BasePrintLib");
504 jComboBoxSelect
.addItem("BaseReportStatusCodeLibNull");
505 jComboBoxSelect
.addItem("CommonPciCf8Lib");
506 jComboBoxSelect
.addItem("CommonPciExpressLib");
507 jComboBoxSelect
.addItem("CommonPciLibCf8");
508 jComboBoxSelect
.addItem("CommonPciLibPciExpress");
509 jComboBoxSelect
.addItem("DxeCoreEntryPoint");
510 jComboBoxSelect
.addItem("DxeHobLib");
511 jComboBoxSelect
.addItem("DxeIoLibCpuIo");
512 jComboBoxSelect
.addItem("DxeLib");
513 jComboBoxSelect
.addItem("DxePcdLib");
514 jComboBoxSelect
.addItem("DxeReportStatusCodeLib");
515 jComboBoxSelect
.addItem("DxeServicesTableLib");
516 jComboBoxSelect
.addItem("PeiCoreEntryPoint");
517 jComboBoxSelect
.addItem("PeiMemoryLib");
518 jComboBoxSelect
.addItem("PeimEntryPoint");
519 jComboBoxSelect
.addItem("PeiReportStatusCodeLib");
520 jComboBoxSelect
.addItem("PeiServicesTablePointerLib");
521 jComboBoxSelect
.addItem("PeiServicesTablePointerLibMm7");
522 jComboBoxSelect
.addItem("UefiDebugLibConOut");
523 jComboBoxSelect
.addItem("UefiDebugLibStdErr");
524 jComboBoxSelect
.addItem("UefiDriverEntryPointMultiple");
525 jComboBoxSelect
.addItem("UefiDriverEntryPointSingle");
526 jComboBoxSelect
.addItem("UefiDriverEntryPointSingleUnload");
527 jComboBoxSelect
.addItem("UefiDriverModelLib");
528 jComboBoxSelect
.addItem("UefiDriverModelLibNoConfigNoDiag");
529 jComboBoxSelect
.addItem("UefiLib");
530 jComboBoxSelect
.addItem("UefiMemoryLib");
535 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
537 public void actionPerformed(ActionEvent arg0
) {
539 if (arg0
.getSource() == jButtonAdd
) {
541 //ToDo: check before add
542 // LAH WAS String[] row = {null, null, null, jComboBox.getSelectedItem()+"", jTextField2RecInstVer.getText(), null, null};
543 String
[] row
= {null, null, null, null, null, null, null};
544 row
[0] = jTextFieldAdd
.getText();
545 row
[1] = jTextField
.getText().replace('\\', '/');
546 row
[2] = jTextFieldHelp
.getText();
547 row
[5] = vectorToString(iCheckBoxList
.getAllCheckedItemsString());
548 if (row
[5].length() == 0){
551 row
[6] = vectorToString(iCheckBoxListArch
.getAllCheckedItemsString());
552 if (row
[6].length() == 0){
555 if (!dataValidation(row
)) {
559 jTable
.changeSelection(model
.getRowCount()-1, 0, false, false);
560 docConsole
.setSaved(false);
562 //convert to GUID before storing recommended lib instance.
564 getLibInstances(row
[0]);
566 // LAH recommendGuid = nameToGuid(row[3]);
568 // LAH WAS sfc.genSpdLibClassDeclarations(row[0], recommendGuid, row[1], row[2], row[5], null, null, row[4], null, row[6]);
569 sfc
.genSpdLibClassDeclarations(row
[0], null, row
[1], row
[2], row
[5], null, null, row
[4], null, row
[6]);
573 // remove selected line
575 if (arg0
.getSource() == jButtonRemove
) {
576 if (jTable
.isEditing()){
577 jTable
.getCellEditor().stopCellEditing();
579 int rowSelected
= selectedRow
;
580 if (rowSelected
>= 0) {
581 model
.removeRow(rowSelected
);
582 sfc
.removeSpdLibClass(rowSelected
);
586 if (arg0
.getSource() == jButtonClearAll
) {
587 if (model
.getRowCount() == 0) {
591 model
.setRowCount(0);
592 sfc
.removeSpdLibClass();
596 private boolean dataValidation(String
[] row
) {
597 if (!DataValidation
.isKeywordType(row
[0])) {
598 JOptionPane
.showMessageDialog(frame
, "Library Class is NOT KeyWord Type.");
601 if (!DataValidation
.isPathAndFilename(row
[1])) {
602 JOptionPane
.showMessageDialog(frame
, "Include Header is NOT PathAndFilename Type.");
604 if (row
[2].length() == 0) {
605 JOptionPane
.showMessageDialog(frame
, "HelpText could NOT be empty.");
610 Add contents in list to sfc
612 protected void save() {
617 This method initializes jTextField
619 @return javax.swing.JTextField
621 private JTextField
getJTextField() {
622 if (jTextField
== null) {
623 jTextField
= new JTextField();
624 jTextField
.setBounds(new java
.awt
.Rectangle(218,75,290,21));
625 jTextField
.setPreferredSize(new java
.awt
.Dimension(260,20));
631 This method initializes jButtonBrowse
633 @return javax.swing.JButton
635 private JButton
getJButtonBrowse() {
636 if (jButtonBrowse
== null) {
637 jButtonBrowse
= new JButton();
638 jButtonBrowse
.setBounds(new java
.awt
.Rectangle(528,75,90,20));
639 jButtonBrowse
.setText("Browse");
640 jButtonBrowse
.setPreferredSize(new java
.awt
.Dimension(80,20));
641 jButtonBrowse
.addActionListener(new AbstractAction() {
646 private static final long serialVersionUID
= 1L;
648 public void actionPerformed(ActionEvent arg0
) {
650 // Select files from current pkg
652 String dirPrefix
= Tools
.dirForNewSpd
.substring(0, Tools
.dirForNewSpd
.lastIndexOf(File
.separator
));
653 JFileChooser chooser
= new JFileChooser(dirPrefix
);
655 String headerDest
= null;
657 chooser
.setMultiSelectionEnabled(false);
658 chooser
.setFileSelectionMode(JFileChooser
.FILES_AND_DIRECTORIES
);
659 int retval
= chooser
.showOpenDialog(frame
);
660 if (retval
== JFileChooser
.APPROVE_OPTION
) {
662 theFile
= chooser
.getSelectedFile();
663 String file
= theFile
.getPath();
664 if (!file
.startsWith(dirPrefix
)) {
665 JOptionPane
.showMessageDialog(frame
, "You can only select files in current package!");
675 headerDest
= theFile
.getPath();
676 int fileIndex
= headerDest
.indexOf(System
.getProperty("file.separator"), dirPrefix
.length());
677 jTextField
.setText(headerDest
.substring(fileIndex
+ 1).replace('\\', '/'));
683 return jButtonBrowse
;
686 public void componentResized(ComponentEvent arg0
) {
687 int intPreferredWidth
= 500;
689 resizeComponentWidth(this.jTextFieldAdd
, this.getWidth(), intPreferredWidth
);
690 resizeComponentWidth(this.jTextFieldHelp
, this.getWidth(), intPreferredWidth
);
691 resizeComponentWidth(this.jScrollPane
, this.getWidth(), intPreferredWidth
);
695 * This method initializes jTextFieldHelp
697 * @return javax.swing.JTextField
699 private JTextField
getJTextFieldHelp() {
700 if (jTextFieldHelp
== null) {
701 jTextFieldHelp
= new JTextField();
702 jTextFieldHelp
.setBounds(new java
.awt
.Rectangle(122,33,390,20));
703 jTextFieldHelp
.setPreferredSize(new java
.awt
.Dimension(260,20));
705 return jTextFieldHelp
;
709 * This method initializes jTextField1RecInstName
711 * @return javax.swing.JTextField
713 private JTextField
getJTextField1RecInstName() {
714 if (jTextField1RecInstName
== null) {
715 jTextField1RecInstName
= new JTextField();
716 jTextField1RecInstName
.setBounds(new java
.awt
.Rectangle(218,110,291,20));
717 jTextField1RecInstName
.setEnabled(true);
718 jTextField1RecInstName
.setVisible(false);
720 return jTextField1RecInstName
;
724 * This method initializes jTextField2RecInstVer
726 * @return javax.swing.JTextField
728 private JTextField
getJTextField2RecInstVer() {
729 if (jTextField2RecInstVer
== null) {
730 jTextField2RecInstVer
= new JTextField();
731 jTextField2RecInstVer
.setBounds(new java
.awt
.Rectangle(218,135,292,20));
732 jTextField2RecInstVer
.setEnabled(true);
734 return jTextField2RecInstVer
;
737 private JScrollPane
getJScrollPaneArch() {
738 if (jScrollPaneArch
== null) {
739 jScrollPaneArch
= new JScrollPane();
740 jScrollPaneArch
.setBounds(new java
.awt
.Rectangle(218,245,293,73));
741 jScrollPaneArch
.setPreferredSize(new java
.awt
.Dimension(320, 80));
742 jScrollPaneArch
.setViewportView(getICheckBoxListSupportedArchitectures());
744 return jScrollPaneArch
;
747 private ICheckBoxList
getICheckBoxListSupportedArchitectures() {
748 if (iCheckBoxListArch
== null) {
749 iCheckBoxListArch
= new ICheckBoxList();
750 iCheckBoxListArch
.setBounds(new java
.awt
.Rectangle(218,246,292,73));
751 Vector
<String
> v
= new Vector
<String
>();
758 v
.add("DXE_RUNTIME_DRIVER");
759 v
.add("DXE_SAL_DRIVER");
760 v
.add("DXE_SMM_DRIVER");
761 v
.add("UEFI_DRIVER");
762 v
.add("UEFI_APPLICATION");
763 v
.add("USER_DEFINED");
764 iCheckBoxListArch
.setAllItems(v
);
766 return iCheckBoxListArch
;
769 private String
vectorToString(Vector
<String
> v
) {
771 for (int i
= 0; i
< v
.size(); ++i
) {
778 private JScrollPane
getJScrollPane1() {
779 if (jScrollPane1
== null) {
780 jScrollPane1
= new JScrollPane();
781 jScrollPane1
.setBounds(new java
.awt
.Rectangle(218,170,293,73));
782 jScrollPane1
.setPreferredSize(new java
.awt
.Dimension(320, 80));
783 jScrollPane1
.setViewportView(getICheckBoxList());
788 * This method initializes iCheckBoxList
790 * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
792 private ICheckBoxList
getICheckBoxList() {
793 if (iCheckBoxList
== null) {
794 iCheckBoxList
= new ICheckBoxList();
795 iCheckBoxList
.setBounds(new java
.awt
.Rectangle(218,171,292,66));
796 Vector
<String
> v
= new Vector
<String
>();
803 iCheckBoxList
.setAllItems(v
);
805 return iCheckBoxList
;
809 * This method initializes jComboBox
811 * @return javax.swing.JComboBox
813 private JComboBox
getJComboBox() {
814 if (jComboBox
== null) {
815 jComboBox
= new JComboBox();
816 jComboBox
.setPreferredSize(new java
.awt
.Dimension(31,20));
817 jComboBox
.setSize(new java
.awt
.Dimension(290,20));
818 jComboBox
.setLocation(new java
.awt
.Point(218,111));
819 jComboBox
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
820 public void focusGained(java
.awt
.event
.FocusEvent e
) {
821 if (jTextFieldAdd
.getText().length() == 0) {
824 jComboBox
.removeAllItems();
825 getLibInstances(jTextFieldAdd
.getText());
826 Set
<String
> libNames
= libNameGuidMap
.keySet();
827 Iterator
<String
> si
= libNames
.iterator();
828 while(si
.hasNext()) {
829 jComboBox
.addItem(si
.next());
838 private void getLibInstances(String libClass
){
839 libNameGuidMap
.clear();
841 GlobalData
.initInfo("Tools" + File
.separator
+ "Conf" + File
.separator
+ "FrameworkDatabase.db", System
.getenv("WORKSPACE"));
843 Set
<PackageIdentification
> spi
= GlobalData
.getPackageList();
844 Iterator ispi
= spi
.iterator();
846 while (ispi
.hasNext()) {
847 PackageIdentification pi
= (PackageIdentification
) ispi
.next();
849 Set
<ModuleIdentification
> smi
= GlobalData
.getModules(pi
);
850 Iterator ismi
= smi
.iterator();
851 while (ismi
.hasNext()) {
852 ModuleIdentification mi
= (ModuleIdentification
) ismi
.next();
853 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
854 SurfaceAreaQuery
.setDoc(m
);
855 String
[] classProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED");
856 for (int i
= 0; i
< classProduced
.length
; ++i
) {
857 if (classProduced
[i
].equals(libClass
)) {
858 libNameGuidMap
.put(mi
.getName(), mi
.getGuid());
865 JOptionPane
.showMessageDialog(frame
, "Search Instances Fail.");
870 private String
nameToGuid(String name
) {
872 if (!libNameGuidMap
.containsKey(name
)) {
876 s
= libNameGuidMap
.get(name
);
880 private String
guidToName(String guid
){
882 if (!libNameGuidMap
.containsValue(guid
)) {
885 Set
<String
> key
= libNameGuidMap
.keySet();
886 Iterator
<String
> is
= key
.iterator();
887 while(is
.hasNext()) {
889 if (libNameGuidMap
.get(s
).equals(guid
)) {