1 package org
.tianocore
.frameworkwizard
.platform
.ui
;
3 import java
.awt
.BorderLayout
;
4 import java
.awt
.Dimension
;
5 import java
.awt
.Toolkit
;
7 import javax
.swing
.JFrame
;
8 import javax
.swing
.JOptionPane
;
9 import javax
.swing
.JPanel
;
10 import javax
.swing
.JDialog
;
11 import javax
.swing
.JTabbedPane
;
12 import javax
.swing
.JLabel
;
13 import javax
.swing
.JScrollPane
;
14 import javax
.swing
.JTable
;
15 import javax
.swing
.JTextArea
;
16 import javax
.swing
.JSplitPane
;
17 import javax
.swing
.JButton
;
18 import javax
.swing
.ListSelectionModel
;
19 import javax
.swing
.event
.ListSelectionEvent
;
20 import javax
.swing
.event
.ListSelectionListener
;
21 import javax
.swing
.event
.TableModelEvent
;
22 import javax
.swing
.event
.TableModelListener
;
23 import javax
.swing
.table
.DefaultTableModel
;
24 import javax
.swing
.table
.TableModel
;
26 import org
.apache
.xmlbeans
.XmlObject
;
27 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.GlobalData
;
28 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.SurfaceAreaQuery
;
29 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.ModuleIdentification
;
30 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.PackageIdentification
;
32 import java
.awt
.FlowLayout
;
33 import java
.awt
.event
.ActionEvent
;
34 import java
.awt
.event
.ActionListener
;
35 import java
.util
.ArrayList
;
36 import java
.util
.HashMap
;
37 import java
.util
.Iterator
;
38 import java
.util
.ListIterator
;
41 import java
.util
.Vector
;
43 import javax
.swing
.JTextField
;
45 public class FpdModuleSA
extends JDialog
implements ActionListener
{
50 private static final long serialVersionUID
= 1L;
52 private JPanel jContentPane
= null;
53 private JTabbedPane jTabbedPane
= null;
54 private JPanel jPanel
= null;
55 private JPanel jPanel1
= null;
56 private JLabel jLabel
= null;
57 private JScrollPane jScrollPane
= null;
58 private JTable jTable
= null;
59 private JPanel jPanel2
= null;
60 private JScrollPane jScrollPane1
= null;
61 private JTextArea jTextArea
= null;
62 private JPanel jPanel3
= null;
63 private JSplitPane jSplitPane
= null;
64 private JPanel jPanel4
= null;
65 private JPanel jPanel5
= null;
66 private JLabel jLabel1
= null;
67 private JLabel jLabel2
= null;
68 private JScrollPane jScrollPane2
= null;
69 private JTable jTable1
= null;
70 private JScrollPane jScrollPane3
= null;
71 private JTable jTable2
= null;
72 private JScrollPane jScrollPane4
= null;
73 private JTable jTable3
= null;
74 private JPanel jPanel6
= null;
75 private JPanel jPanel7
= null;
76 private JScrollPane jScrollPane5
= null;
77 private JTextArea jTextArea1
= null;
78 private JLabel jLabel3
= null;
79 private JLabel jLabel4
= null;
80 private JButton jButton
= null;
81 private JButton jButton1
= null;
82 private JLabel jLabel5
= null;
83 private JButton jButton2
= null;
84 private JButton jButton3
= null;
85 private PartialEditableTableModel model
= null;
86 private LibraryTableModel model1
= null;
87 private LibraryTableModel model2
= null;
88 private LibraryTableModel model3
= null;
89 private DefaultTableModel optionsTableModel
= null;
90 private FpdFileContents ffc
= null;
91 private String moduleKey
= null;
92 private HashMap
<String
, ArrayList
<String
>> classInstanceMap
= null;
93 private ArrayList
<String
> classProduced
= null;
94 private HashMap
<String
, ArrayList
<String
>> classConsumed
= null;
95 private JPanel jPanel8
= null;
96 private JLabel jLabel6
= null;
97 private JTextField jTextField
= null;
98 private JLabel jLabel7
= null;
99 private JTextField jTextField1
= null;
100 private JLabel jLabel8
= null;
101 private JTextField jTextField2
= null;
102 private JScrollPane jScrollPane6
= null;
103 private JTable jTable4
= null;
104 private JButton jButton4
= null;
105 private JButton jButton5
= null;
107 * This is the default constructor
109 public FpdModuleSA() {
113 public FpdModuleSA(FpdFileContents ffc
) {
118 public void setKey(String k
){
123 init will be called each time FpdModuleSA object is to be shown.
124 @param key Module information.
126 public void init(String key
) {
128 // display pcd for key.
130 model
.setRowCount(0);
131 int pcdCount
= ffc
.getPcdDataCount(key
);
133 String
[][] saa
= new String
[pcdCount
][6];
134 ffc
.getPcdData(key
, saa
);
135 for (int i
= 0; i
< saa
.length
; ++i
) {
136 model
.addRow(saa
[i
]);
141 // display lib instances already selected for key
143 model1
.setRowCount(0);
144 int instanceCount
= ffc
.getLibraryInstancesCount(key
);
145 if (instanceCount
!= 0) {
146 String
[][] saa
= new String
[instanceCount
][5];
147 ffc
.getLibraryInstances(key
, saa
);
148 for (int i
= 0; i
< saa
.length
; ++i
) {
149 if (getModuleId(saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4]) != null) {
150 saa
[i
][0] = getModuleId(saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4]).getName();
153 model1
.addRow(saa
[i
]);
157 // display library classes that need to be resolved. also potential instances for them.
159 resolveLibraryInstances(key
);
161 // display module SA options
163 String fvBinding
= ffc
.getFvBinding(key
);
164 if (fvBinding
!= null) {
165 jTextField
.setText(fvBinding
);
167 String fileGuid
= ffc
.getFfsFileNameGuid(key
);
168 if (fileGuid
!= null) {
169 jTextField1
.setText(fileGuid
);
171 String ffsKey
= ffc
.getFfsFormatKey(key
);
172 if (ffsKey
!= null) {
173 jTextField2
.setText(ffsKey
);
177 private void resolveLibraryInstances(String key
) {
178 ModuleIdentification mi
= getModuleId(key
);
179 PackageIdentification
[] depPkgList
= null;
181 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
182 SurfaceAreaQuery
.setDoc(m
);
184 // Get dependency pkg list into which we will search lib instances.
186 depPkgList
= SurfaceAreaQuery
.getDependencePkg(null);
188 // Get the lib class consumed, produced by this module itself.
190 String
[] classConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED");
192 if (this.classConsumed
== null) {
193 this.classConsumed
= new HashMap
<String
, ArrayList
<String
>>();
196 for(int i
= 0; i
< classConsumed
.length
; ++i
){
197 ArrayList
<String
> consumedBy
= this.classConsumed
.get(classConsumed
[i
]);
198 if (consumedBy
== null) {
199 consumedBy
= new ArrayList
<String
>();
202 this.classConsumed
.put(classConsumed
[i
], consumedBy
);
205 String
[] classProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED");
206 if (this.classProduced
== null) {
207 this.classProduced
= new ArrayList
<String
>();
209 for(int i
= 0; i
< classProduced
.length
; ++i
){
210 if (!this.classProduced
.contains(classProduced
[i
])){
211 this.classProduced
.add(classProduced
[i
]);
215 // Get classes unresolved
217 // Iterator<String> lip = this.classProduced.listIterator();
218 // while(lip.hasNext()){
219 // String clsProduced = lip.next();
220 // this.classConsumed.remove(clsProduced);
224 // find potential instances in all dependency pkgs for classes still in classConsumed.
226 if (classInstanceMap
== null){
227 classInstanceMap
= new HashMap
<String
, ArrayList
<String
>>();
229 Iterator
<String
> lic
= this.classConsumed
.keySet().iterator();
230 while(lic
.hasNext()){
231 String cls
= lic
.next();
232 if (this.classProduced
.contains(cls
) || classInstanceMap
.containsKey(cls
)) {
235 ArrayList
<String
> instances
= getInstancesForClass(cls
, depPkgList
);
236 if (instances
.size() == 0){
237 JOptionPane
.showMessageDialog(frame
, "No Applicable Instance for Library Class " +
238 cls
+ ", Platform Build will Fail.");
240 classInstanceMap
.put(cls
, instances
);
244 showClassToResolved();
251 private ArrayList
<String
> getInstancesForClass(String cls
, PackageIdentification
[] depPkgList
) throws Exception
{
252 ArrayList
<String
> al
= new ArrayList
<String
>();
254 for (int i
= 0; i
< depPkgList
.length
; ++i
) {
255 Set
<ModuleIdentification
> smi
= GlobalData
.getModules(depPkgList
[i
]);
256 Iterator ismi
= smi
.iterator();
257 while(ismi
.hasNext()) {
258 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
260 String
[] clsProduced
= getClassProduced(mi
);
262 boolean isPotential
= false;
263 for (int j
= 0; j
< clsProduced
.length
; ++j
) {
264 if (clsProduced
[j
] == null) {
267 if (clsProduced
[j
].equals(cls
)){
270 if (classProduced
.contains(clsProduced
[j
])) {
276 al
.add(mi
.getGuid() + " " + mi
.getVersion() + " " +
277 depPkgList
[i
].getGuid() + " " + depPkgList
[i
].getVersion());
285 private void removeInstance(String key
) {
286 ModuleIdentification mi
= getModuleId(key
);
288 // remove pcd information of instance from current ModuleSA
290 ffc
.removePcdDataFromLibraryInstance(moduleKey
, key
);
292 // remove class produced by this instance and add back these produced class to be bound.
294 String
[] clsProduced
= getClassProduced(mi
);
295 for (int i
= 0; i
< clsProduced
.length
; ++i
) {
297 classProduced
.remove(clsProduced
[i
]);
300 // remove class consumed by this instance. we do not need to bound it now.
302 String
[] clsConsumed
= getClassConsumed(mi
);
303 for (int i
= 0; i
< clsConsumed
.length
; ++i
) {
304 ArrayList
<String
> al
= classConsumed
.get(clsConsumed
[i
]);
307 classConsumed
.remove(clsConsumed
[i
]);
311 if (al
.size() == 0) {
312 classConsumed
.remove(clsConsumed
[i
]);
317 showClassToResolved();
321 private ModuleIdentification
getModuleId(String key
){
323 // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion into string array.
325 String
[] keyPart
= key
.split(" ");
326 Set
<PackageIdentification
> spi
= GlobalData
.getPackageList();
327 Iterator ispi
= spi
.iterator();
329 while(ispi
.hasNext()) {
330 PackageIdentification pi
= (PackageIdentification
)ispi
.next();
331 if ( !pi
.getGuid().equals(keyPart
[2]) || !pi
.getVersion().equals(keyPart
[3])){
334 Set
<ModuleIdentification
> smi
= GlobalData
.getModules(pi
);
335 Iterator ismi
= smi
.iterator();
336 while(ismi
.hasNext()) {
337 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
338 if (mi
.getGuid().equals(keyPart
[0]) && mi
.getVersion().equals(keyPart
[1])){
346 private String
[] getClassProduced(ModuleIdentification mi
){
349 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
350 SurfaceAreaQuery
.setDoc(m
);
351 String
[] clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED");
354 }catch (Exception e
) {
357 return new String
[0];
361 private String
[] getClassConsumed(ModuleIdentification mi
){
363 String
[] clsConsumed
= null;
365 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
366 SurfaceAreaQuery
.setDoc(m
);
367 clsConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED");
369 }catch (Exception e
) {
375 private void showClassToResolved(){
376 model2
.setRowCount(0);
377 if (classConsumed
.size() == 0) {
380 Iterator
<String
> li
= classConsumed
.keySet().iterator();
383 String
[] s
= {li
.next()};
384 if (classConsumed
.get(s
[0]) == null) {
387 if (classConsumed
.get(s
[0]).size() == 0) {
390 if (!classProduced
.contains(s
[0])){
394 model3
.setRowCount(0);
397 * This method initializes this
401 private void initialize() {
402 this.setSize(664, 515);
405 this.setTitle("Module Settings");
406 this.setContentPane(getJContentPane());
410 * This method initializes jContentPane
412 * @return javax.swing.JPanel
414 private JPanel
getJContentPane() {
415 if (jContentPane
== null) {
416 jContentPane
= new JPanel();
417 jContentPane
.setLayout(new BorderLayout());
418 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
419 jContentPane
.add(getJPanel3(), java
.awt
.BorderLayout
.SOUTH
);
425 * This method initializes jTabbedPane
427 * @return javax.swing.JTabbedPane
429 private JTabbedPane
getJTabbedPane() {
430 if (jTabbedPane
== null) {
431 jTabbedPane
= new JTabbedPane();
432 jTabbedPane
.addTab("PCD Build Definition", null, getJPanel(), null);
433 jTabbedPane
.addTab("Module SA Options", null, getJPanel8(), null);
434 jTabbedPane
.addTab("Libraries", null, getJPanel1(), null);
440 * This method initializes jPanel
442 * @return javax.swing.JPanel
444 private JPanel
getJPanel() {
445 if (jPanel
== null) {
446 jLabel
= new JLabel();
447 jLabel
.setText("PcdData");
448 jPanel
= new JPanel();
449 jPanel
.setLayout(new BorderLayout());
450 jPanel
.add(jLabel
, java
.awt
.BorderLayout
.NORTH
);
451 jPanel
.add(getJScrollPane(), java
.awt
.BorderLayout
.CENTER
);
452 jPanel
.add(getJPanel2(), java
.awt
.BorderLayout
.SOUTH
);
453 jPanel
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
454 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
464 * This method initializes jPanel1
466 * @return javax.swing.JPanel
468 private JPanel
getJPanel1() {
469 if (jPanel1
== null) {
470 jPanel1
= new JPanel();
471 jPanel1
.setLayout(new BorderLayout());
472 jPanel1
.add(getJSplitPane(), java
.awt
.BorderLayout
.NORTH
);
473 jPanel1
.add(getJPanel6(), java
.awt
.BorderLayout
.SOUTH
);
474 jPanel1
.add(getJPanel7(), java
.awt
.BorderLayout
.CENTER
);
475 jPanel1
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
476 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
484 * This method initializes jScrollPane
486 * @return javax.swing.JScrollPane
488 private JScrollPane
getJScrollPane() {
489 if (jScrollPane
== null) {
490 jScrollPane
= new JScrollPane();
491 jScrollPane
.setViewportView(getJTable());
497 * This method initializes jTable
499 * @return javax.swing.JTable
501 private JTable
getJTable() {
502 if (jTable
== null) {
503 model
= new PartialEditableTableModel();
504 jTable
= new JTable(model
);
505 jTable
.setRowHeight(20);
506 model
.addColumn("CName");
507 model
.addColumn("TokenSpaceGUID");
508 model
.addColumn("ItemType");
509 model
.addColumn("Token");
510 model
.addColumn("DataType");
511 model
.addColumn("DefaultValue");
513 jTable
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
514 jTable
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
515 public void valueChanged(ListSelectionEvent e
) {
517 if (e
.getValueIsAdjusting()){
520 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
521 if (lsm
.isSelectionEmpty()) {
525 // int selectedRow = lsm.getMinSelectionIndex();
532 jTable
.getModel().addTableModelListener(new TableModelListener() {
533 public void tableChanged(TableModelEvent arg0
) {
534 // TODO Auto-generated method stub
535 int row
= arg0
.getFirstRow();
536 TableModel m
= (TableModel
)arg0
.getSource();
537 if (arg0
.getType() == TableModelEvent
.INSERT
) {
539 // Set combo box values for item type according to pcd values added.
543 if (arg0
.getType() == TableModelEvent
.UPDATE
){
544 //ToDo Data Validition check.
554 * This method initializes jPanel2
556 * @return javax.swing.JPanel
558 private JPanel
getJPanel2() {
559 if (jPanel2
== null) {
560 jLabel5
= new JLabel();
561 jLabel5
.setText("PCD Description");
562 jPanel2
= new JPanel();
563 jPanel2
.add(jLabel5
, null);
564 jPanel2
.add(getJScrollPane1(), null);
570 * This method initializes jScrollPane1
572 * @return javax.swing.JScrollPane
574 private JScrollPane
getJScrollPane1() {
575 if (jScrollPane1
== null) {
576 jScrollPane1
= new JScrollPane();
577 jScrollPane1
.setPreferredSize(new java
.awt
.Dimension(500,100));
578 jScrollPane1
.setViewportView(getJTextArea());
584 * This method initializes jTextArea
586 * @return javax.swing.JTextArea
588 private JTextArea
getJTextArea() {
589 if (jTextArea
== null) {
590 jTextArea
= new JTextArea();
591 jTextArea
.setEditable(false);
597 * This method initializes jPanel3
599 * @return javax.swing.JPanel
601 private JPanel
getJPanel3() {
602 if (jPanel3
== null) {
603 FlowLayout flowLayout
= new FlowLayout();
604 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
605 jPanel3
= new JPanel();
606 jPanel3
.setLayout(flowLayout
);
607 jPanel3
.add(getJButton2(), null);
608 jPanel3
.add(getJButton3(), null);
614 * This method initializes jSplitPane
616 * @return javax.swing.JSplitPane
618 private JSplitPane
getJSplitPane() {
619 if (jSplitPane
== null) {
620 jSplitPane
= new JSplitPane();
621 jSplitPane
.setDividerLocation(200);
622 jSplitPane
.setLeftComponent(getJPanel4());
623 jSplitPane
.setRightComponent(getJPanel5());
624 jSplitPane
.setPreferredSize(new java
.awt
.Dimension(202,200));
630 * This method initializes jPanel4
632 * @return javax.swing.JPanel
634 private JPanel
getJPanel4() {
635 if (jPanel4
== null) {
636 jLabel1
= new JLabel();
637 jLabel1
.setText("Library Classes Consumed");
638 jPanel4
= new JPanel();
639 jPanel4
.add(jLabel1
, null);
640 jPanel4
.add(getJScrollPane3(), null);
646 * This method initializes jPanel5
648 * @return javax.swing.JPanel
650 private JPanel
getJPanel5() {
651 if (jPanel5
== null) {
652 jLabel2
= new JLabel();
653 jLabel2
.setText("Instances Available");
654 jPanel5
= new JPanel();
655 jPanel5
.add(jLabel2
, null);
656 jPanel5
.add(getJScrollPane4(), null);
662 * This method initializes jScrollPane2
664 * @return javax.swing.JScrollPane
666 private JScrollPane
getJScrollPane2() {
667 if (jScrollPane2
== null) {
668 jScrollPane2
= new JScrollPane();
669 jScrollPane2
.setPreferredSize(new java
.awt
.Dimension(453,150));
670 jScrollPane2
.setViewportView(getJTable1());
676 * This method initializes jTable1
678 * @return javax.swing.JTable
680 private JTable
getJTable1() {
681 if (jTable1
== null) {
682 model1
= new LibraryTableModel();
683 model1
.addColumn("Name");
684 model1
.addColumn("ModuleGUID");
685 model1
.addColumn("ModuleVersion");
686 model1
.addColumn("PackageGUID");
687 model1
.addColumn("PackageVersion");
688 jTable1
= new JTable(model1
);
689 jTable1
.setRowHeight(20);
690 jTable1
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
691 jTable1
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
692 public void valueChanged(ListSelectionEvent e
) {
693 int selectedRow1
= -1;
694 if (e
.getValueIsAdjusting()){
697 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
698 if (lsm
.isSelectionEmpty()) {
702 selectedRow1
= lsm
.getMinSelectionIndex();
715 * This method initializes jScrollPane3
717 * @return javax.swing.JScrollPane
719 private JScrollPane
getJScrollPane3() {
720 if (jScrollPane3
== null) {
721 jScrollPane3
= new JScrollPane();
722 jScrollPane3
.setPreferredSize(new java
.awt
.Dimension(200,170));
723 jScrollPane3
.setViewportView(getJTable2());
729 * This method initializes jTable2
731 * @return javax.swing.JTable
733 private JTable
getJTable2() {
734 if (jTable2
== null) {
735 model2
= new LibraryTableModel();
736 model2
.addColumn("LibraryClass");
737 jTable2
= new JTable(model2
);
738 jTable2
.setRowHeight(20);
739 jTable2
.setShowGrid(false);
740 jTable2
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
741 jTable2
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
742 public void valueChanged(ListSelectionEvent e
) {
743 if (e
.getValueIsAdjusting()){
746 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
747 if (lsm
.isSelectionEmpty()) {
751 int selectedRow2
= lsm
.getMinSelectionIndex();
752 if (selectedRow2
< 0) {
756 // display potential lib instances according to class selection
758 model3
.setRowCount(0);
759 String cls
= model2
.getValueAt(selectedRow2
, 0).toString();
760 ArrayList
<String
> al
= classInstanceMap
.get(cls
);
761 ListIterator
<String
> li
= al
.listIterator();
762 while(li
.hasNext()) {
763 String instance
= li
.next();
764 String
[] s
= {"", "", "", "", ""};
765 if (getModuleId(instance
) != null) {
766 s
[0] = getModuleId(instance
).getName();
769 String
[] instancePart
= instance
.split(" ");
770 for (int i
= 0; i
< instancePart
.length
; ++i
){
771 s
[i
+1] = instancePart
[i
];
784 * This method initializes jScrollPane4
786 * @return javax.swing.JScrollPane
788 private JScrollPane
getJScrollPane4() {
789 if (jScrollPane4
== null) {
790 jScrollPane4
= new JScrollPane();
791 jScrollPane4
.setPreferredSize(new java
.awt
.Dimension(450,170));
792 jScrollPane4
.setViewportView(getJTable3());
798 * This method initializes jTable3
800 * @return javax.swing.JTable
802 private JTable
getJTable3() {
803 if (jTable3
== null) {
804 model3
= new LibraryTableModel();
805 model3
.addColumn("Name");
806 model3
.addColumn("ModuleGUID");
807 model3
.addColumn("ModuleVersion");
808 model3
.addColumn("PackageGUID");
809 model3
.addColumn("PackageVersion");
810 jTable3
= new JTable(model3
);
811 jTable3
.setRowHeight(20);
812 jTable3
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
813 jTable3
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
814 public void valueChanged(ListSelectionEvent e
) {
815 int selectedRow3
= -1;
816 if (e
.getValueIsAdjusting()){
819 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
820 if (lsm
.isSelectionEmpty()) {
824 selectedRow3
= lsm
.getMinSelectionIndex();
835 * This method initializes jPanel6
837 * @return javax.swing.JPanel
839 private JPanel
getJPanel6() {
840 if (jPanel6
== null) {
841 jPanel6
= new JPanel();
847 * This method initializes jPanel7
849 * @return javax.swing.JPanel
851 private JPanel
getJPanel7() {
852 if (jPanel7
== null) {
853 jLabel4
= new JLabel();
854 jLabel4
.setText("Instance Description");
855 jLabel3
= new JLabel();
856 jLabel3
.setText("Selected Instances");
857 jPanel7
= new JPanel();
858 jPanel7
.add(jLabel4
, null);
859 jPanel7
.add(getJScrollPane5(), null);
860 jPanel7
.add(getJButton(), null);
861 jPanel7
.add(getJButton1(), null);
862 jPanel7
.add(jLabel3
, null);
863 jPanel7
.add(getJScrollPane2(), null);
869 * This method initializes jScrollPane5
871 * @return javax.swing.JScrollPane
873 private JScrollPane
getJScrollPane5() {
874 if (jScrollPane5
== null) {
875 jScrollPane5
= new JScrollPane();
876 jScrollPane5
.setPreferredSize(new java
.awt
.Dimension(300,50));
877 jScrollPane5
.setViewportView(getJTextArea1());
883 * This method initializes jTextArea1
885 * @return javax.swing.JTextArea
887 private JTextArea
getJTextArea1() {
888 if (jTextArea1
== null) {
889 jTextArea1
= new JTextArea();
890 jTextArea1
.setEditable(false);
896 * This method initializes jButton
898 * @return javax.swing.JButton
900 private JButton
getJButton() {
901 if (jButton
== null) {
902 jButton
= new JButton();
903 jButton
.setPreferredSize(new java
.awt
.Dimension(80,20));
904 jButton
.setText("Add");
905 jButton
.addActionListener(new java
.awt
.event
.ActionListener() {
906 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
907 int row
= jTable3
.getSelectedRow();
911 Object
[] s
= {model3
.getValueAt(row
, 0), model3
.getValueAt(row
, 1),
912 model3
.getValueAt(row
, 2), model3
.getValueAt(row
, 3),
913 model3
.getValueAt(row
, 4)};
915 String instanceValue
= model3
.getValueAt(row
, 1) + " " +
916 model3
.getValueAt(row
, 2) + " " +
917 model3
.getValueAt(row
, 3) + " " +
918 model3
.getValueAt(row
, 4);
920 // Add pcd information of selected instance to current moduleSA
922 ffc
.addFrameworkModulesPcdBuildDefs(getModuleId(instanceValue
), ffc
.getModuleSA(moduleKey
));
924 resolveLibraryInstances(instanceValue
);
932 * This method initializes jButton1
934 * @return javax.swing.JButton
936 private JButton
getJButton1() {
937 if (jButton1
== null) {
938 jButton1
= new JButton();
939 jButton1
.setPreferredSize(new java
.awt
.Dimension(80,20));
940 jButton1
.setText("Delete");
941 jButton1
.addActionListener(new java
.awt
.event
.ActionListener() {
942 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
943 int row
= jTable1
.getSelectedRow();
947 removeInstance(model1
.getValueAt(row
, 1) + " " +
948 model1
.getValueAt(row
, 2) + " " +
949 model1
.getValueAt(row
, 3) + " " +
950 model1
.getValueAt(row
, 4));
951 model1
.removeRow(row
);
960 * This method initializes jButton2
962 * @return javax.swing.JButton
964 private JButton
getJButton2() {
965 if (jButton2
== null) {
966 jButton2
= new JButton();
967 jButton2
.setPreferredSize(new java
.awt
.Dimension(80,20));
968 jButton2
.setText("Ok");
969 jButton2
.addActionListener(this);
975 * This method initializes jButton3
977 * @return javax.swing.JButton
979 private JButton
getJButton3() {
980 if (jButton3
== null) {
981 jButton3
= new JButton();
982 jButton3
.setPreferredSize(new java
.awt
.Dimension(80,20));
983 jButton3
.setText("Cancel");
984 jButton3
.setVisible(false);
988 public void actionPerformed(ActionEvent arg0
) {
990 if (arg0
.getSource() == jButton2
) {
991 ffc
.removeLibraryInstances(moduleKey
);
992 for (int i
= 0; i
< model1
.getRowCount(); ++i
) {
993 String mg
= model1
.getValueAt(i
, 1)+"";
994 String mv
= model1
.getValueAt(i
, 2)+"";
995 String pg
= model1
.getValueAt(i
, 3)+"";
996 String pv
= model1
.getValueAt(i
, 4)+"";
997 ffc
.genLibraryInstance(mg
, mv
, pg
, pv
, moduleKey
);
999 this.setVisible(false);
1003 * This method initializes jPanel8
1005 * @return javax.swing.JPanel
1007 private JPanel
getJPanel8() {
1008 if (jPanel8
== null) {
1009 jLabel8
= new JLabel();
1010 jLabel8
.setText("FFS Format Key");
1011 jLabel7
= new JLabel();
1012 jLabel7
.setText("FFS File GUID");
1013 jLabel6
= new JLabel();
1014 jLabel6
.setText("FV Binding");
1015 jPanel8
= new JPanel();
1016 jPanel8
.add(jLabel6
, null);
1017 jPanel8
.add(getJTextField(), null);
1018 jPanel8
.add(jLabel7
, null);
1019 jPanel8
.add(getJTextField1(), null);
1020 jPanel8
.add(jLabel8
, null);
1021 jPanel8
.add(getJTextField2(), null);
1022 jPanel8
.add(getJScrollPane6(), null);
1023 jPanel8
.add(getJButton4(), null);
1024 jPanel8
.add(getJButton5(), null);
1029 * This method initializes jTextField
1031 * @return javax.swing.JTextField
1033 private JTextField
getJTextField() {
1034 if (jTextField
== null) {
1035 jTextField
= new JTextField();
1036 jTextField
.setPreferredSize(new java
.awt
.Dimension(100,20));
1037 jTextField
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1038 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1039 ffc
.setFvBinding(moduleKey
, jTextField
.getText());
1046 * This method initializes jTextField1
1048 * @return javax.swing.JTextField
1050 private JTextField
getJTextField1() {
1051 if (jTextField1
== null) {
1052 jTextField1
= new JTextField();
1053 jTextField1
.setPreferredSize(new java
.awt
.Dimension(100,20));
1054 jTextField1
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1055 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1056 ffc
.setFfsFileNameGuid(moduleKey
, jTextField1
.getText());
1063 * This method initializes jTextField2
1065 * @return javax.swing.JTextField
1067 private JTextField
getJTextField2() {
1068 if (jTextField2
== null) {
1069 jTextField2
= new JTextField();
1070 jTextField2
.setPreferredSize(new java
.awt
.Dimension(100,20));
1071 jTextField2
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1072 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1073 ffc
.setFfsFormatKey(moduleKey
, jTextField2
.getText());
1080 * This method initializes jScrollPane6
1082 * @return javax.swing.JScrollPane
1084 private JScrollPane
getJScrollPane6() {
1085 if (jScrollPane6
== null) {
1086 jScrollPane6
= new JScrollPane();
1087 jScrollPane6
.setPreferredSize(new java
.awt
.Dimension(600,200));
1088 jScrollPane6
.setViewportView(getJTable4());
1090 return jScrollPane6
;
1093 * This method initializes jTable4
1095 * @return javax.swing.JTable
1097 private JTable
getJTable4() {
1098 if (jTable4
== null) {
1099 optionsTableModel
= new DefaultTableModel();
1100 optionsTableModel
.addColumn("BuildTargets");
1101 optionsTableModel
.addColumn("ToolChainFamily");
1102 optionsTableModel
.addColumn("TagName");
1103 optionsTableModel
.addColumn("ToolCode");
1104 optionsTableModel
.addColumn("SupportedArchs");
1105 optionsTableModel
.addColumn("Contents");
1106 jTable4
= new JTable(optionsTableModel
);
1107 jTable4
.setRowHeight(20);
1108 Vector
<String
> vArch
= new Vector
<String
>();
1115 jTable4
.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch
));
1116 jTable4
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1117 jTable4
.getModel().addTableModelListener(new TableModelListener() {
1118 public void tableChanged(TableModelEvent arg0
) {
1119 // TODO Auto-generated method stub
1120 int row
= arg0
.getFirstRow();
1121 TableModel m
= (TableModel
)arg0
.getSource();
1123 if (arg0
.getType() == TableModelEvent
.UPDATE
){
1124 //ToDo Data Validition check.
1125 String targets
= m
.getValueAt(row
, 0) + "";
1126 Vector
<Object
> targetName
= null;
1127 if (targets
.length() > 0) {
1128 targetName
= new Vector
<Object
>();
1129 String
[] sArray
= targets
.split(" ");
1130 for (int i
= 0; i
< sArray
.length
; ++i
) {
1131 targetName
.add(sArray
[i
]);
1135 String toolChain
= m
.getValueAt(row
, 1) + "";
1136 String tagName
= m
.getValueAt(row
, 2) + "";
1137 String toolCode
= m
.getValueAt(row
, 3) + "";
1138 String archs
= m
.getValueAt(row
, 4) + "";
1139 Vector
<Object
> supArch
= null;
1140 if (archs
.length() > 0) {
1141 supArch
= new Vector
<Object
>();
1142 String
[] sArray1
= archs
.split(" ");
1143 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1144 supArch
.add(sArray1
[i
]);
1148 String contents
= m
.getValueAt(row
, 5) + "";
1150 ffc
.updateModuleSAOptionsOpt(moduleKey
, row
, targetName
, toolChain
, tagName
, toolCode
, supArch
, contents
);
1158 * This method initializes jButton4
1160 * @return javax.swing.JButton
1162 private JButton
getJButton4() {
1163 if (jButton4
== null) {
1164 jButton4
= new JButton();
1165 jButton4
.setPreferredSize(new java
.awt
.Dimension(80,20));
1166 jButton4
.setText("New");
1167 jButton4
.addActionListener(new java
.awt
.event
.ActionListener() {
1168 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1169 String
[] row
= {"", "", "", "", "IA32", ""};
1170 optionsTableModel
.addRow(row
);
1171 Vector
<Object
> v
= new Vector
<Object
>();
1172 Vector
<Object
> v1
= new Vector
<Object
>();
1174 ffc
.genModuleSAOptionsOpt(moduleKey
, v
, "", "", "", v1
, "");
1181 * This method initializes jButton5
1183 * @return javax.swing.JButton
1185 private JButton
getJButton5() {
1186 if (jButton5
== null) {
1187 jButton5
= new JButton();
1188 jButton5
.setPreferredSize(new java
.awt
.Dimension(80,20));
1189 jButton5
.setText("Delete");
1190 jButton5
.addActionListener(new java
.awt
.event
.ActionListener() {
1191 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1192 if (jTable4
.getSelectedRow() < 0) {
1196 ffc
.removeModuleSAOptionsOpt(moduleKey
, jTable4
.getSelectedRow());
1197 optionsTableModel
.removeRow(jTable4
.getSelectedRow());
1205 Start the window at the center of screen
1208 protected void centerWindow(int intWidth
, int intHeight
) {
1209 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
1210 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
1214 Start the window at the center of screen
1217 protected void centerWindow() {
1218 centerWindow(this.getSize().width
, this.getSize().height
);
1222 } // @jve:decl-index=0:visual-constraint="10,10"
1224 class PartialEditableTableModel
extends DefaultTableModel
{
1228 private static final long serialVersionUID
= 1L;
1230 public boolean isCellEditable(int row
, int col
) {
1241 class LibraryTableModel
extends DefaultTableModel
{
1245 private static final long serialVersionUID
= 1L;
1247 public boolean isCellEditable(int row
, int col
) {