1 package org
.tianocore
.frameworkwizard
.platform
.ui
;
3 import java
.awt
.BorderLayout
;
5 import javax
.swing
.JFrame
;
6 import javax
.swing
.JOptionPane
;
7 import javax
.swing
.JPanel
;
8 import javax
.swing
.JDialog
;
9 import javax
.swing
.JTabbedPane
;
10 import javax
.swing
.JLabel
;
11 import javax
.swing
.JScrollPane
;
12 import javax
.swing
.JTable
;
13 import javax
.swing
.JTextArea
;
14 import javax
.swing
.JSplitPane
;
15 import javax
.swing
.JButton
;
16 import javax
.swing
.ListSelectionModel
;
17 import javax
.swing
.event
.ListSelectionEvent
;
18 import javax
.swing
.event
.ListSelectionListener
;
19 import javax
.swing
.event
.TableModelEvent
;
20 import javax
.swing
.event
.TableModelListener
;
21 import javax
.swing
.table
.DefaultTableModel
;
22 import javax
.swing
.table
.TableModel
;
24 import org
.apache
.xmlbeans
.XmlObject
;
25 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.GlobalData
;
26 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.SurfaceAreaQuery
;
27 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.ModuleIdentification
;
28 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.PackageIdentification
;
30 import java
.awt
.FlowLayout
;
31 import java
.awt
.event
.ActionEvent
;
32 import java
.awt
.event
.ActionListener
;
33 import java
.util
.ArrayList
;
34 import java
.util
.HashMap
;
35 import java
.util
.Iterator
;
36 import java
.util
.ListIterator
;
39 import java
.util
.Vector
;
41 import javax
.swing
.JTextField
;
43 public class FpdModuleSA
extends JDialog
implements ActionListener
{
48 private static final long serialVersionUID
= 1L;
50 private JPanel jContentPane
= null;
51 private JTabbedPane jTabbedPane
= null;
52 private JPanel jPanel
= null;
53 private JPanel jPanel1
= null;
54 private JLabel jLabel
= null;
55 private JScrollPane jScrollPane
= null;
56 private JTable jTable
= null;
57 private JPanel jPanel2
= null;
58 private JScrollPane jScrollPane1
= null;
59 private JTextArea jTextArea
= null;
60 private JPanel jPanel3
= null;
61 private JSplitPane jSplitPane
= null;
62 private JPanel jPanel4
= null;
63 private JPanel jPanel5
= null;
64 private JLabel jLabel1
= null;
65 private JLabel jLabel2
= null;
66 private JScrollPane jScrollPane2
= null;
67 private JTable jTable1
= null;
68 private JScrollPane jScrollPane3
= null;
69 private JTable jTable2
= null;
70 private JScrollPane jScrollPane4
= null;
71 private JTable jTable3
= null;
72 private JPanel jPanel6
= null;
73 private JPanel jPanel7
= null;
74 private JScrollPane jScrollPane5
= null;
75 private JTextArea jTextArea1
= null;
76 private JLabel jLabel3
= null;
77 private JLabel jLabel4
= null;
78 private JButton jButton
= null;
79 private JButton jButton1
= null;
80 private JLabel jLabel5
= null;
81 private JButton jButton2
= null;
82 private JButton jButton3
= null;
83 private PartialEditableTableModel model
= null;
84 private LibraryTableModel model1
= null;
85 private LibraryTableModel model2
= null;
86 private LibraryTableModel model3
= null;
87 private DefaultTableModel optionsTableModel
= null;
88 private FpdFileContents ffc
= null;
89 private String moduleKey
= null;
90 private HashMap
<String
, ArrayList
<String
>> classInstanceMap
= null;
91 private ArrayList
<String
> classProduced
= null;
92 private HashMap
<String
, ArrayList
<String
>> classConsumed
= null;
93 private JPanel jPanel8
= null;
94 private JLabel jLabel6
= null;
95 private JTextField jTextField
= null;
96 private JLabel jLabel7
= null;
97 private JTextField jTextField1
= null;
98 private JLabel jLabel8
= null;
99 private JTextField jTextField2
= null;
100 private JScrollPane jScrollPane6
= null;
101 private JTable jTable4
= null;
102 private JButton jButton4
= null;
103 private JButton jButton5
= null;
105 * This is the default constructor
107 public FpdModuleSA() {
111 public FpdModuleSA(FpdFileContents ffc
) {
116 public void setKey(String k
){
121 init will be called each time FpdModuleSA object is to be shown.
122 @param key Module information.
124 public void init(String key
) {
126 // display pcd for key.
128 model
.setRowCount(0);
129 int pcdCount
= ffc
.getPcdDataCount(key
);
131 String
[][] saa
= new String
[pcdCount
][6];
132 ffc
.getPcdData(key
, saa
);
133 for (int i
= 0; i
< saa
.length
; ++i
) {
134 model
.addRow(saa
[i
]);
139 // display lib instances already selected for key
141 model1
.setRowCount(0);
142 int instanceCount
= ffc
.getLibraryInstancesCount(key
);
143 if (instanceCount
!= 0) {
144 String
[][] saa
= new String
[instanceCount
][5];
145 ffc
.getLibraryInstances(key
, saa
);
146 for (int i
= 0; i
< saa
.length
; ++i
) {
147 if (getModuleId(saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4]) != null) {
148 saa
[i
][0] = getModuleId(saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4]).getName();
151 model1
.addRow(saa
[i
]);
155 // display library classes that need to be resolved. also potential instances for them.
157 resolveLibraryInstances(key
);
159 // display module SA options
161 String fvBinding
= ffc
.getFvBinding(key
);
162 if (fvBinding
!= null) {
163 jTextField
.setText(fvBinding
);
165 String fileGuid
= ffc
.getFfsFileNameGuid(key
);
166 if (fileGuid
!= null) {
167 jTextField1
.setText(fileGuid
);
169 String ffsKey
= ffc
.getFfsFormatKey(key
);
170 if (ffsKey
!= null) {
171 jTextField2
.setText(ffsKey
);
175 private void resolveLibraryInstances(String key
) {
176 ModuleIdentification mi
= getModuleId(key
);
177 PackageIdentification
[] depPkgList
= null;
179 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
180 SurfaceAreaQuery
.setDoc(m
);
182 // Get dependency pkg list into which we will search lib instances.
184 depPkgList
= SurfaceAreaQuery
.getDependencePkg(null);
186 // Get the lib class consumed, produced by this module itself.
188 String
[] classConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED");
190 if (this.classConsumed
== null) {
191 this.classConsumed
= new HashMap
<String
, ArrayList
<String
>>();
194 for(int i
= 0; i
< classConsumed
.length
; ++i
){
195 ArrayList
<String
> consumedBy
= this.classConsumed
.get(classConsumed
[i
]);
196 if (consumedBy
== null) {
197 consumedBy
= new ArrayList
<String
>();
200 this.classConsumed
.put(classConsumed
[i
], consumedBy
);
203 String
[] classProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED");
204 if (this.classProduced
== null) {
205 this.classProduced
= new ArrayList
<String
>();
207 for(int i
= 0; i
< classProduced
.length
; ++i
){
208 if (!this.classProduced
.contains(classProduced
[i
])){
209 this.classProduced
.add(classProduced
[i
]);
213 // Get classes unresolved
215 // Iterator<String> lip = this.classProduced.listIterator();
216 // while(lip.hasNext()){
217 // String clsProduced = lip.next();
218 // this.classConsumed.remove(clsProduced);
222 // find potential instances in all dependency pkgs for classes still in classConsumed.
224 if (classInstanceMap
== null){
225 classInstanceMap
= new HashMap
<String
, ArrayList
<String
>>();
227 Iterator
<String
> lic
= this.classConsumed
.keySet().iterator();
228 while(lic
.hasNext()){
229 String cls
= lic
.next();
230 if (this.classProduced
.contains(cls
) || classInstanceMap
.containsKey(cls
)) {
233 ArrayList
<String
> instances
= getInstancesForClass(cls
, depPkgList
);
234 if (instances
.size() == 0){
235 JOptionPane
.showMessageDialog(frame
, "No Applicable Instance for Library Class " +
236 cls
+ ", Platform Build will Fail.");
238 classInstanceMap
.put(cls
, instances
);
242 showClassToResolved();
249 private ArrayList
<String
> getInstancesForClass(String cls
, PackageIdentification
[] depPkgList
) throws Exception
{
250 ArrayList
<String
> al
= new ArrayList
<String
>();
252 for (int i
= 0; i
< depPkgList
.length
; ++i
) {
253 Set
<ModuleIdentification
> smi
= GlobalData
.getModules(depPkgList
[i
]);
254 Iterator ismi
= smi
.iterator();
255 while(ismi
.hasNext()) {
256 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
258 String
[] clsProduced
= getClassProduced(mi
);
260 boolean isPotential
= false;
261 for (int j
= 0; j
< clsProduced
.length
; ++j
) {
262 if (clsProduced
[j
] == null) {
265 if (clsProduced
[j
].equals(cls
)){
268 if (classProduced
.contains(clsProduced
[j
])) {
274 al
.add(mi
.getGuid() + " " + mi
.getVersion() + " " +
275 depPkgList
[i
].getGuid() + " " + depPkgList
[i
].getVersion());
283 private void removeInstance(String key
) {
284 ModuleIdentification mi
= getModuleId(key
);
286 // remove pcd information of instance from current ModuleSA
288 ffc
.removePcdDataFromLibraryInstance(moduleKey
, key
);
290 // remove class produced by this instance and add back these produced class to be bound.
292 String
[] clsProduced
= getClassProduced(mi
);
293 for (int i
= 0; i
< clsProduced
.length
; ++i
) {
295 classProduced
.remove(clsProduced
[i
]);
298 // remove class consumed by this instance. we do not need to bound it now.
300 String
[] clsConsumed
= getClassConsumed(mi
);
301 for (int i
= 0; i
< clsConsumed
.length
; ++i
) {
302 ArrayList
<String
> al
= classConsumed
.get(clsConsumed
[i
]);
305 classConsumed
.remove(clsConsumed
[i
]);
309 if (al
.size() == 0) {
310 classConsumed
.remove(clsConsumed
[i
]);
315 showClassToResolved();
319 private ModuleIdentification
getModuleId(String key
){
321 // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion into string array.
323 String
[] keyPart
= key
.split(" ");
324 Set
<PackageIdentification
> spi
= GlobalData
.getPackageList();
325 Iterator ispi
= spi
.iterator();
327 while(ispi
.hasNext()) {
328 PackageIdentification pi
= (PackageIdentification
)ispi
.next();
329 if ( !pi
.getGuid().equals(keyPart
[2]) || !pi
.getVersion().equals(keyPart
[3])){
332 Set
<ModuleIdentification
> smi
= GlobalData
.getModules(pi
);
333 Iterator ismi
= smi
.iterator();
334 while(ismi
.hasNext()) {
335 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
336 if (mi
.getGuid().equals(keyPart
[0]) && mi
.getVersion().equals(keyPart
[1])){
344 private String
[] getClassProduced(ModuleIdentification mi
){
347 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
348 SurfaceAreaQuery
.setDoc(m
);
349 String
[] clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED");
352 }catch (Exception e
) {
355 return new String
[0];
359 private String
[] getClassConsumed(ModuleIdentification mi
){
361 String
[] clsConsumed
= null;
363 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
364 SurfaceAreaQuery
.setDoc(m
);
365 clsConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED");
367 }catch (Exception e
) {
373 private void showClassToResolved(){
374 model2
.setRowCount(0);
375 if (classConsumed
.size() == 0) {
378 Iterator
<String
> li
= classConsumed
.keySet().iterator();
381 String
[] s
= {li
.next()};
382 if (classConsumed
.get(s
[0]) == null) {
385 if (classConsumed
.get(s
[0]).size() == 0) {
388 if (!classProduced
.contains(s
[0])){
392 model3
.setRowCount(0);
395 * This method initializes this
399 private void initialize() {
400 this.setSize(664, 515);
402 this.setTitle("Module Settings");
403 this.setContentPane(getJContentPane());
407 * This method initializes jContentPane
409 * @return javax.swing.JPanel
411 private JPanel
getJContentPane() {
412 if (jContentPane
== null) {
413 jContentPane
= new JPanel();
414 jContentPane
.setLayout(new BorderLayout());
415 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
416 jContentPane
.add(getJPanel3(), java
.awt
.BorderLayout
.SOUTH
);
422 * This method initializes jTabbedPane
424 * @return javax.swing.JTabbedPane
426 private JTabbedPane
getJTabbedPane() {
427 if (jTabbedPane
== null) {
428 jTabbedPane
= new JTabbedPane();
429 jTabbedPane
.addTab("PCD Build Definition", null, getJPanel(), null);
430 jTabbedPane
.addTab("Module SA Options", null, getJPanel8(), null);
431 jTabbedPane
.addTab("Libraries", null, getJPanel1(), null);
437 * This method initializes jPanel
439 * @return javax.swing.JPanel
441 private JPanel
getJPanel() {
442 if (jPanel
== null) {
443 jLabel
= new JLabel();
444 jLabel
.setText("PcdData");
445 jPanel
= new JPanel();
446 jPanel
.setLayout(new BorderLayout());
447 jPanel
.add(jLabel
, java
.awt
.BorderLayout
.NORTH
);
448 jPanel
.add(getJScrollPane(), java
.awt
.BorderLayout
.CENTER
);
449 jPanel
.add(getJPanel2(), java
.awt
.BorderLayout
.SOUTH
);
450 jPanel
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
451 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
461 * This method initializes jPanel1
463 * @return javax.swing.JPanel
465 private JPanel
getJPanel1() {
466 if (jPanel1
== null) {
467 jPanel1
= new JPanel();
468 jPanel1
.setLayout(new BorderLayout());
469 jPanel1
.add(getJSplitPane(), java
.awt
.BorderLayout
.NORTH
);
470 jPanel1
.add(getJPanel6(), java
.awt
.BorderLayout
.SOUTH
);
471 jPanel1
.add(getJPanel7(), java
.awt
.BorderLayout
.CENTER
);
472 jPanel1
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
473 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
481 * This method initializes jScrollPane
483 * @return javax.swing.JScrollPane
485 private JScrollPane
getJScrollPane() {
486 if (jScrollPane
== null) {
487 jScrollPane
= new JScrollPane();
488 jScrollPane
.setViewportView(getJTable());
494 * This method initializes jTable
496 * @return javax.swing.JTable
498 private JTable
getJTable() {
499 if (jTable
== null) {
500 model
= new PartialEditableTableModel();
501 jTable
= new JTable(model
);
502 model
.addColumn("CName");
503 model
.addColumn("TokenSpaceGUID");
504 model
.addColumn("ItemType");
505 model
.addColumn("Token");
506 model
.addColumn("DataType");
507 model
.addColumn("DefaultValue");
509 jTable
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
510 jTable
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
511 public void valueChanged(ListSelectionEvent e
) {
513 if (e
.getValueIsAdjusting()){
516 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
517 if (lsm
.isSelectionEmpty()) {
521 // int selectedRow = lsm.getMinSelectionIndex();
528 jTable
.getModel().addTableModelListener(new TableModelListener() {
529 public void tableChanged(TableModelEvent arg0
) {
530 // TODO Auto-generated method stub
531 int row
= arg0
.getFirstRow();
532 TableModel m
= (TableModel
)arg0
.getSource();
533 if (arg0
.getType() == TableModelEvent
.INSERT
) {
535 // Set combo box values for item type according to pcd values added.
539 if (arg0
.getType() == TableModelEvent
.UPDATE
){
540 //ToDo Data Validition check.
550 * This method initializes jPanel2
552 * @return javax.swing.JPanel
554 private JPanel
getJPanel2() {
555 if (jPanel2
== null) {
556 jLabel5
= new JLabel();
557 jLabel5
.setText("PCD Description");
558 jPanel2
= new JPanel();
559 jPanel2
.add(jLabel5
, null);
560 jPanel2
.add(getJScrollPane1(), null);
566 * This method initializes jScrollPane1
568 * @return javax.swing.JScrollPane
570 private JScrollPane
getJScrollPane1() {
571 if (jScrollPane1
== null) {
572 jScrollPane1
= new JScrollPane();
573 jScrollPane1
.setPreferredSize(new java
.awt
.Dimension(500,100));
574 jScrollPane1
.setViewportView(getJTextArea());
580 * This method initializes jTextArea
582 * @return javax.swing.JTextArea
584 private JTextArea
getJTextArea() {
585 if (jTextArea
== null) {
586 jTextArea
= new JTextArea();
587 jTextArea
.setEditable(false);
593 * This method initializes jPanel3
595 * @return javax.swing.JPanel
597 private JPanel
getJPanel3() {
598 if (jPanel3
== null) {
599 FlowLayout flowLayout
= new FlowLayout();
600 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
601 jPanel3
= new JPanel();
602 jPanel3
.setLayout(flowLayout
);
603 jPanel3
.add(getJButton2(), null);
604 jPanel3
.add(getJButton3(), null);
610 * This method initializes jSplitPane
612 * @return javax.swing.JSplitPane
614 private JSplitPane
getJSplitPane() {
615 if (jSplitPane
== null) {
616 jSplitPane
= new JSplitPane();
617 jSplitPane
.setDividerLocation(200);
618 jSplitPane
.setLeftComponent(getJPanel4());
619 jSplitPane
.setRightComponent(getJPanel5());
620 jSplitPane
.setPreferredSize(new java
.awt
.Dimension(202,200));
626 * This method initializes jPanel4
628 * @return javax.swing.JPanel
630 private JPanel
getJPanel4() {
631 if (jPanel4
== null) {
632 jLabel1
= new JLabel();
633 jLabel1
.setText("Library Classes Consumed");
634 jPanel4
= new JPanel();
635 jPanel4
.add(jLabel1
, null);
636 jPanel4
.add(getJScrollPane3(), null);
642 * This method initializes jPanel5
644 * @return javax.swing.JPanel
646 private JPanel
getJPanel5() {
647 if (jPanel5
== null) {
648 jLabel2
= new JLabel();
649 jLabel2
.setText("Instances Available");
650 jPanel5
= new JPanel();
651 jPanel5
.add(jLabel2
, null);
652 jPanel5
.add(getJScrollPane4(), null);
658 * This method initializes jScrollPane2
660 * @return javax.swing.JScrollPane
662 private JScrollPane
getJScrollPane2() {
663 if (jScrollPane2
== null) {
664 jScrollPane2
= new JScrollPane();
665 jScrollPane2
.setPreferredSize(new java
.awt
.Dimension(453,150));
666 jScrollPane2
.setViewportView(getJTable1());
672 * This method initializes jTable1
674 * @return javax.swing.JTable
676 private JTable
getJTable1() {
677 if (jTable1
== null) {
678 model1
= new LibraryTableModel();
679 model1
.addColumn("Name");
680 model1
.addColumn("ModuleGUID");
681 model1
.addColumn("ModuleVersion");
682 model1
.addColumn("PackageGUID");
683 model1
.addColumn("PackageVersion");
684 jTable1
= new JTable(model1
);
686 jTable1
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
687 jTable1
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
688 public void valueChanged(ListSelectionEvent e
) {
689 int selectedRow1
= -1;
690 if (e
.getValueIsAdjusting()){
693 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
694 if (lsm
.isSelectionEmpty()) {
698 selectedRow1
= lsm
.getMinSelectionIndex();
711 * This method initializes jScrollPane3
713 * @return javax.swing.JScrollPane
715 private JScrollPane
getJScrollPane3() {
716 if (jScrollPane3
== null) {
717 jScrollPane3
= new JScrollPane();
718 jScrollPane3
.setPreferredSize(new java
.awt
.Dimension(200,170));
719 jScrollPane3
.setViewportView(getJTable2());
725 * This method initializes jTable2
727 * @return javax.swing.JTable
729 private JTable
getJTable2() {
730 if (jTable2
== null) {
731 model2
= new LibraryTableModel();
732 model2
.addColumn("LibraryClass");
733 jTable2
= new JTable(model2
);
735 jTable2
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
736 jTable2
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
737 public void valueChanged(ListSelectionEvent e
) {
738 if (e
.getValueIsAdjusting()){
741 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
742 if (lsm
.isSelectionEmpty()) {
746 int selectedRow2
= lsm
.getMinSelectionIndex();
747 if (selectedRow2
< 0) {
751 // display potential lib instances according to class selection
753 model3
.setRowCount(0);
754 String cls
= model2
.getValueAt(selectedRow2
, 0).toString();
755 ArrayList
<String
> al
= classInstanceMap
.get(cls
);
756 ListIterator
<String
> li
= al
.listIterator();
757 while(li
.hasNext()) {
758 String instance
= li
.next();
759 String
[] s
= {"", "", "", "", ""};
760 if (getModuleId(instance
) != null) {
761 s
[0] = getModuleId(instance
).getName();
764 String
[] instancePart
= instance
.split(" ");
765 for (int i
= 0; i
< instancePart
.length
; ++i
){
766 s
[i
+1] = instancePart
[i
];
779 * This method initializes jScrollPane4
781 * @return javax.swing.JScrollPane
783 private JScrollPane
getJScrollPane4() {
784 if (jScrollPane4
== null) {
785 jScrollPane4
= new JScrollPane();
786 jScrollPane4
.setPreferredSize(new java
.awt
.Dimension(450,170));
787 jScrollPane4
.setViewportView(getJTable3());
793 * This method initializes jTable3
795 * @return javax.swing.JTable
797 private JTable
getJTable3() {
798 if (jTable3
== null) {
799 model3
= new LibraryTableModel();
800 model3
.addColumn("Name");
801 model3
.addColumn("ModuleGUID");
802 model3
.addColumn("ModuleVersion");
803 model3
.addColumn("PackageGUID");
804 model3
.addColumn("PackageVersion");
805 jTable3
= new JTable(model3
);
807 jTable3
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
808 jTable3
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
809 public void valueChanged(ListSelectionEvent e
) {
810 int selectedRow3
= -1;
811 if (e
.getValueIsAdjusting()){
814 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
815 if (lsm
.isSelectionEmpty()) {
819 selectedRow3
= lsm
.getMinSelectionIndex();
830 * This method initializes jPanel6
832 * @return javax.swing.JPanel
834 private JPanel
getJPanel6() {
835 if (jPanel6
== null) {
836 jPanel6
= new JPanel();
842 * This method initializes jPanel7
844 * @return javax.swing.JPanel
846 private JPanel
getJPanel7() {
847 if (jPanel7
== null) {
848 jLabel4
= new JLabel();
849 jLabel4
.setText("Instance Description");
850 jLabel3
= new JLabel();
851 jLabel3
.setText("Selected Instances");
852 jPanel7
= new JPanel();
853 jPanel7
.add(jLabel4
, null);
854 jPanel7
.add(getJScrollPane5(), null);
855 jPanel7
.add(getJButton(), null);
856 jPanel7
.add(getJButton1(), null);
857 jPanel7
.add(jLabel3
, null);
858 jPanel7
.add(getJScrollPane2(), null);
864 * This method initializes jScrollPane5
866 * @return javax.swing.JScrollPane
868 private JScrollPane
getJScrollPane5() {
869 if (jScrollPane5
== null) {
870 jScrollPane5
= new JScrollPane();
871 jScrollPane5
.setPreferredSize(new java
.awt
.Dimension(300,50));
872 jScrollPane5
.setViewportView(getJTextArea1());
878 * This method initializes jTextArea1
880 * @return javax.swing.JTextArea
882 private JTextArea
getJTextArea1() {
883 if (jTextArea1
== null) {
884 jTextArea1
= new JTextArea();
885 jTextArea1
.setEditable(false);
891 * This method initializes jButton
893 * @return javax.swing.JButton
895 private JButton
getJButton() {
896 if (jButton
== null) {
897 jButton
= new JButton();
898 jButton
.setPreferredSize(new java
.awt
.Dimension(80,20));
899 jButton
.setText("Add");
900 jButton
.addActionListener(new java
.awt
.event
.ActionListener() {
901 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
902 int row
= jTable3
.getSelectedRow();
906 Object
[] s
= {model3
.getValueAt(row
, 0), model3
.getValueAt(row
, 1),
907 model3
.getValueAt(row
, 2), model3
.getValueAt(row
, 3),
908 model3
.getValueAt(row
, 4)};
910 String instanceValue
= model3
.getValueAt(row
, 1) + " " +
911 model3
.getValueAt(row
, 2) + " " +
912 model3
.getValueAt(row
, 3) + " " +
913 model3
.getValueAt(row
, 4);
915 // Add pcd information of selected instance to current moduleSA
917 ffc
.addFrameworkModulesPcdBuildDefs(getModuleId(instanceValue
), ffc
.getModuleSA(moduleKey
));
919 resolveLibraryInstances(instanceValue
);
927 * This method initializes jButton1
929 * @return javax.swing.JButton
931 private JButton
getJButton1() {
932 if (jButton1
== null) {
933 jButton1
= new JButton();
934 jButton1
.setPreferredSize(new java
.awt
.Dimension(80,20));
935 jButton1
.setText("Delete");
936 jButton1
.addActionListener(new java
.awt
.event
.ActionListener() {
937 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
938 int row
= jTable1
.getSelectedRow();
942 removeInstance(model1
.getValueAt(row
, 1) + " " +
943 model1
.getValueAt(row
, 2) + " " +
944 model1
.getValueAt(row
, 3) + " " +
945 model1
.getValueAt(row
, 4));
946 model1
.removeRow(row
);
955 * This method initializes jButton2
957 * @return javax.swing.JButton
959 private JButton
getJButton2() {
960 if (jButton2
== null) {
961 jButton2
= new JButton();
962 jButton2
.setPreferredSize(new java
.awt
.Dimension(80,20));
963 jButton2
.setText("Ok");
964 jButton2
.addActionListener(this);
970 * This method initializes jButton3
972 * @return javax.swing.JButton
974 private JButton
getJButton3() {
975 if (jButton3
== null) {
976 jButton3
= new JButton();
977 jButton3
.setPreferredSize(new java
.awt
.Dimension(80,20));
978 jButton3
.setText("Cancel");
979 jButton3
.setVisible(false);
983 public void actionPerformed(ActionEvent arg0
) {
985 if (arg0
.getSource() == jButton2
) {
986 ffc
.removeLibraryInstances(moduleKey
);
987 for (int i
= 0; i
< model1
.getRowCount(); ++i
) {
988 String mg
= model1
.getValueAt(i
, 1)+"";
989 String mv
= model1
.getValueAt(i
, 2)+"";
990 String pg
= model1
.getValueAt(i
, 3)+"";
991 String pv
= model1
.getValueAt(i
, 4)+"";
992 ffc
.genLibraryInstance(mg
, mv
, pg
, pv
, moduleKey
);
994 this.setVisible(false);
998 * This method initializes jPanel8
1000 * @return javax.swing.JPanel
1002 private JPanel
getJPanel8() {
1003 if (jPanel8
== null) {
1004 jLabel8
= new JLabel();
1005 jLabel8
.setText("FFS Format Key");
1006 jLabel7
= new JLabel();
1007 jLabel7
.setText("FFS File GUID");
1008 jLabel6
= new JLabel();
1009 jLabel6
.setText("FV Binding");
1010 jPanel8
= new JPanel();
1011 jPanel8
.add(jLabel6
, null);
1012 jPanel8
.add(getJTextField(), null);
1013 jPanel8
.add(jLabel7
, null);
1014 jPanel8
.add(getJTextField1(), null);
1015 jPanel8
.add(jLabel8
, null);
1016 jPanel8
.add(getJTextField2(), null);
1017 jPanel8
.add(getJScrollPane6(), null);
1018 jPanel8
.add(getJButton4(), null);
1019 jPanel8
.add(getJButton5(), null);
1024 * This method initializes jTextField
1026 * @return javax.swing.JTextField
1028 private JTextField
getJTextField() {
1029 if (jTextField
== null) {
1030 jTextField
= new JTextField();
1031 jTextField
.setPreferredSize(new java
.awt
.Dimension(100,20));
1032 jTextField
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1033 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1034 ffc
.setFvBinding(moduleKey
, jTextField
.getText());
1041 * This method initializes jTextField1
1043 * @return javax.swing.JTextField
1045 private JTextField
getJTextField1() {
1046 if (jTextField1
== null) {
1047 jTextField1
= new JTextField();
1048 jTextField1
.setPreferredSize(new java
.awt
.Dimension(100,20));
1049 jTextField1
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1050 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1051 ffc
.setFfsFileNameGuid(moduleKey
, jTextField1
.getText());
1058 * This method initializes jTextField2
1060 * @return javax.swing.JTextField
1062 private JTextField
getJTextField2() {
1063 if (jTextField2
== null) {
1064 jTextField2
= new JTextField();
1065 jTextField2
.setPreferredSize(new java
.awt
.Dimension(100,20));
1066 jTextField2
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1067 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1068 ffc
.setFfsFormatKey(moduleKey
, jTextField2
.getText());
1075 * This method initializes jScrollPane6
1077 * @return javax.swing.JScrollPane
1079 private JScrollPane
getJScrollPane6() {
1080 if (jScrollPane6
== null) {
1081 jScrollPane6
= new JScrollPane();
1082 jScrollPane6
.setPreferredSize(new java
.awt
.Dimension(600,200));
1083 jScrollPane6
.setViewportView(getJTable4());
1085 return jScrollPane6
;
1088 * This method initializes jTable4
1090 * @return javax.swing.JTable
1092 private JTable
getJTable4() {
1093 if (jTable4
== null) {
1094 optionsTableModel
= new DefaultTableModel();
1095 optionsTableModel
.addColumn("BuildTargets");
1096 optionsTableModel
.addColumn("ToolChainFamily");
1097 optionsTableModel
.addColumn("TagName");
1098 optionsTableModel
.addColumn("ToolCode");
1099 optionsTableModel
.addColumn("SupportedArchs");
1100 optionsTableModel
.addColumn("Contents");
1101 jTable4
= new JTable(optionsTableModel
);
1102 jTable4
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1103 jTable4
.getModel().addTableModelListener(new TableModelListener() {
1104 public void tableChanged(TableModelEvent arg0
) {
1105 // TODO Auto-generated method stub
1106 int row
= arg0
.getFirstRow();
1107 TableModel m
= (TableModel
)arg0
.getSource();
1109 if (arg0
.getType() == TableModelEvent
.UPDATE
){
1110 //ToDo Data Validition check.
1111 String targets
= m
.getValueAt(row
, 0) + "";
1112 Vector
<Object
> targetName
= new Vector
<Object
>();
1113 String
[] sArray
= targets
.split(" ");
1114 for (int i
= 0; i
< sArray
.length
; ++i
) {
1115 targetName
.add(sArray
[i
]);
1117 String toolChain
= m
.getValueAt(row
, 1) + "";
1118 String tagName
= m
.getValueAt(row
, 2) + "";
1119 String toolCode
= m
.getValueAt(row
, 3) + "";
1120 String archs
= m
.getValueAt(row
, 4) + "";
1121 Vector
<Object
> supArch
= new Vector
<Object
>();
1122 String
[] sArray1
= archs
.split(" ");
1123 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1124 supArch
.add(sArray1
[i
]);
1126 if (supArch
.size() == 0) {
1127 supArch
.add("IA32");
1129 String contents
= m
.getValueAt(row
, 5) + "";
1131 ffc
.updateModuleSAOptionsOpt(moduleKey
, row
, targetName
, toolChain
, tagName
, toolCode
, supArch
, contents
);
1139 * This method initializes jButton4
1141 * @return javax.swing.JButton
1143 private JButton
getJButton4() {
1144 if (jButton4
== null) {
1145 jButton4
= new JButton();
1146 jButton4
.setPreferredSize(new java
.awt
.Dimension(80,20));
1147 jButton4
.setText("New");
1148 jButton4
.addActionListener(new java
.awt
.event
.ActionListener() {
1149 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1150 String
[] row
= {"", "", "", "", "IA32", ""};
1151 optionsTableModel
.addRow(row
);
1152 Vector
<Object
> v
= new Vector
<Object
>();
1153 Vector
<Object
> v1
= new Vector
<Object
>();
1155 ffc
.genModuleSAOptionsOpt(moduleKey
, v
, "", "", "", v1
, "");
1162 * This method initializes jButton5
1164 * @return javax.swing.JButton
1166 private JButton
getJButton5() {
1167 if (jButton5
== null) {
1168 jButton5
= new JButton();
1169 jButton5
.setPreferredSize(new java
.awt
.Dimension(80,20));
1170 jButton5
.setText("Delete");
1171 jButton5
.addActionListener(new java
.awt
.event
.ActionListener() {
1172 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1173 if (jTable4
.getSelectedRow() < 0) {
1177 ffc
.removeModuleSAOptionsOpt(moduleKey
, jTable4
.getSelectedRow());
1178 optionsTableModel
.removeRow(jTable4
.getSelectedRow());
1185 } // @jve:decl-index=0:visual-constraint="10,10"
1187 class PartialEditableTableModel
extends DefaultTableModel
{
1191 private static final long serialVersionUID
= 1L;
1193 public boolean isCellEditable(int row
, int col
) {
1204 class LibraryTableModel
extends DefaultTableModel
{
1208 private static final long serialVersionUID
= 1L;
1210 public boolean isCellEditable(int row
, int col
) {