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
;
40 public class FpdModuleSA
extends JDialog
implements ActionListener
{
45 private static final long serialVersionUID
= 1L;
47 private JPanel jContentPane
= null;
48 private JTabbedPane jTabbedPane
= null;
49 private JPanel jPanel
= null;
50 private JPanel jPanel1
= null;
51 private JLabel jLabel
= null;
52 private JScrollPane jScrollPane
= null;
53 private JTable jTable
= null;
54 private JPanel jPanel2
= null;
55 private JScrollPane jScrollPane1
= null;
56 private JTextArea jTextArea
= null;
57 private JPanel jPanel3
= null;
58 private JSplitPane jSplitPane
= null;
59 private JPanel jPanel4
= null;
60 private JPanel jPanel5
= null;
61 private JLabel jLabel1
= null;
62 private JLabel jLabel2
= null;
63 private JScrollPane jScrollPane2
= null;
64 private JTable jTable1
= null;
65 private JScrollPane jScrollPane3
= null;
66 private JTable jTable2
= null;
67 private JScrollPane jScrollPane4
= null;
68 private JTable jTable3
= null;
69 private JPanel jPanel6
= null;
70 private JPanel jPanel7
= null;
71 private JScrollPane jScrollPane5
= null;
72 private JTextArea jTextArea1
= null;
73 private JLabel jLabel3
= null;
74 private JLabel jLabel4
= null;
75 private JButton jButton
= null;
76 private JButton jButton1
= null;
77 private JLabel jLabel5
= null;
78 private JButton jButton2
= null;
79 private JButton jButton3
= null;
80 private PartialEditableTableModel model
= null;
81 private LibraryTableModel model1
= null;
82 private LibraryTableModel model2
= null;
83 private LibraryTableModel model3
= null;
84 private FpdFileContents ffc
= null;
85 private String moduleKey
= null;
86 private HashMap
<String
, ArrayList
<String
>> classInstanceMap
= null;
87 private ArrayList
<String
> classProduced
= null;
88 private HashMap
<String
, ArrayList
<String
>> classConsumed
= null;
90 * This is the default constructor
92 public FpdModuleSA() {
96 public FpdModuleSA(FpdFileContents ffc
) {
101 public void setKey(String k
){
106 init will be called each time FpdModuleSA object is to be shown.
107 @param key Module information.
109 public void init(String key
) {
111 // display pcd for key.
113 model
.setRowCount(0);
114 int pcdCount
= ffc
.getPcdDataCount(key
);
116 String
[][] saa
= new String
[pcdCount
][6];
117 ffc
.getPcdData(key
, saa
);
118 for (int i
= 0; i
< saa
.length
; ++i
) {
119 model
.addRow(saa
[i
]);
124 // display lib instances already selected for key
126 model1
.setRowCount(0);
127 int instanceCount
= ffc
.getLibraryInstancesCount(key
);
128 if (instanceCount
!= 0) {
129 String
[][] saa
= new String
[instanceCount
][5];
130 ffc
.getLibraryInstances(key
, saa
);
131 for (int i
= 0; i
< saa
.length
; ++i
) {
132 if (getModuleId(saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4]) != null) {
133 saa
[i
][0] = getModuleId(saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4]).getName();
136 model1
.addRow(saa
[i
]);
140 // display library classes that need to be resolved. also potential instances for them.
142 resolveLibraryInstances(key
);
145 private void resolveLibraryInstances(String key
) {
146 ModuleIdentification mi
= getModuleId(key
);
147 PackageIdentification
[] depPkgList
= null;
149 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
150 SurfaceAreaQuery
.setDoc(m
);
152 // Get dependency pkg list into which we will search lib instances.
154 depPkgList
= SurfaceAreaQuery
.getDependencePkg(null);
156 // Get the lib class consumed, produced by this module itself.
158 String
[] classConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED");
160 if (this.classConsumed
== null) {
161 this.classConsumed
= new HashMap
<String
, ArrayList
<String
>>();
164 for(int i
= 0; i
< classConsumed
.length
; ++i
){
165 ArrayList
<String
> consumedBy
= this.classConsumed
.get(classConsumed
[i
]);
166 if (consumedBy
== null) {
167 consumedBy
= new ArrayList
<String
>();
170 this.classConsumed
.put(classConsumed
[i
], consumedBy
);
173 String
[] classProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED");
174 if (this.classProduced
== null) {
175 this.classProduced
= new ArrayList
<String
>();
177 for(int i
= 0; i
< classProduced
.length
; ++i
){
178 if (!this.classProduced
.contains(classProduced
[i
])){
179 this.classProduced
.add(classProduced
[i
]);
183 // Get classes unresolved
185 // Iterator<String> lip = this.classProduced.listIterator();
186 // while(lip.hasNext()){
187 // String clsProduced = lip.next();
188 // this.classConsumed.remove(clsProduced);
192 // find potential instances in all dependency pkgs for classes still in classConsumed.
194 if (classInstanceMap
== null){
195 classInstanceMap
= new HashMap
<String
, ArrayList
<String
>>();
197 Iterator
<String
> lic
= this.classConsumed
.keySet().iterator();
198 while(lic
.hasNext()){
199 String cls
= lic
.next();
200 if (this.classProduced
.contains(cls
) || classInstanceMap
.containsKey(cls
)) {
203 ArrayList
<String
> instances
= getInstancesForClass(cls
, depPkgList
);
204 if (instances
.size() == 0){
205 JOptionPane
.showMessageDialog(frame
, "No Applicable Instance for Library Class " +
206 cls
+ ", Platform Build will Fail.");
208 classInstanceMap
.put(cls
, instances
);
212 showClassToResolved();
219 private ArrayList
<String
> getInstancesForClass(String cls
, PackageIdentification
[] depPkgList
) throws Exception
{
220 ArrayList
<String
> al
= new ArrayList
<String
>();
222 for (int i
= 0; i
< depPkgList
.length
; ++i
) {
223 Set
<ModuleIdentification
> smi
= GlobalData
.getModules(depPkgList
[i
]);
224 Iterator ismi
= smi
.iterator();
225 while(ismi
.hasNext()) {
226 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
228 String
[] clsProduced
= getClassProduced(mi
);
230 boolean isPotential
= false;
231 for (int j
= 0; j
< clsProduced
.length
; ++j
) {
232 if (clsProduced
[j
] == null) {
235 if (clsProduced
[j
].equals(cls
)){
238 if (classProduced
.contains(clsProduced
[j
])) {
244 al
.add(mi
.getGuid() + " " + mi
.getVersion() + " " +
245 depPkgList
[i
].getGuid() + " " + depPkgList
[i
].getVersion());
253 private void removeInstance(String key
) {
254 ModuleIdentification mi
= getModuleId(key
);
256 // remove pcd information of instance from current ModuleSA
258 ffc
.removePcdDataFromLibraryInstance(moduleKey
, key
);
260 // remove class produced by this instance and add back these produced class to be bound.
262 String
[] clsProduced
= getClassProduced(mi
);
263 for (int i
= 0; i
< clsProduced
.length
; ++i
) {
265 classProduced
.remove(clsProduced
[i
]);
268 // remove class consumed by this instance. we do not need to bound it now.
270 String
[] clsConsumed
= getClassConsumed(mi
);
271 for (int i
= 0; i
< clsConsumed
.length
; ++i
) {
272 ArrayList
<String
> al
= classConsumed
.get(clsConsumed
[i
]);
275 classConsumed
.remove(clsConsumed
[i
]);
279 if (al
.size() == 0) {
280 classConsumed
.remove(clsConsumed
[i
]);
285 showClassToResolved();
289 private ModuleIdentification
getModuleId(String key
){
291 // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion into string array.
293 String
[] keyPart
= key
.split(" ");
294 Set
<PackageIdentification
> spi
= GlobalData
.getPackageList();
295 Iterator ispi
= spi
.iterator();
297 while(ispi
.hasNext()) {
298 PackageIdentification pi
= (PackageIdentification
)ispi
.next();
299 if ( !pi
.getGuid().equals(keyPart
[2]) || !pi
.getVersion().equals(keyPart
[3])){
302 Set
<ModuleIdentification
> smi
= GlobalData
.getModules(pi
);
303 Iterator ismi
= smi
.iterator();
304 while(ismi
.hasNext()) {
305 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
306 if (mi
.getGuid().equals(keyPart
[0]) && mi
.getVersion().equals(keyPart
[1])){
314 private String
[] getClassProduced(ModuleIdentification mi
){
317 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
318 SurfaceAreaQuery
.setDoc(m
);
319 String
[] clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED");
322 }catch (Exception e
) {
325 return new String
[0];
329 private String
[] getClassConsumed(ModuleIdentification mi
){
331 String
[] clsConsumed
= null;
333 Map
<String
, XmlObject
> m
= GlobalData
.getNativeMsa(mi
);
334 SurfaceAreaQuery
.setDoc(m
);
335 clsConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED");
337 }catch (Exception e
) {
343 private void showClassToResolved(){
344 model2
.setRowCount(0);
345 if (classConsumed
.size() == 0) {
348 Iterator
<String
> li
= classConsumed
.keySet().iterator();
351 String
[] s
= {li
.next()};
352 if (classConsumed
.get(s
[0]) == null) {
355 if (classConsumed
.get(s
[0]).size() == 0) {
358 if (!classProduced
.contains(s
[0])){
362 model3
.setRowCount(0);
365 * This method initializes this
369 private void initialize() {
370 this.setSize(664, 515);
372 this.setTitle("Module Settings");
373 this.setContentPane(getJContentPane());
377 * This method initializes jContentPane
379 * @return javax.swing.JPanel
381 private JPanel
getJContentPane() {
382 if (jContentPane
== null) {
383 jContentPane
= new JPanel();
384 jContentPane
.setLayout(new BorderLayout());
385 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
386 jContentPane
.add(getJPanel3(), java
.awt
.BorderLayout
.SOUTH
);
392 * This method initializes jTabbedPane
394 * @return javax.swing.JTabbedPane
396 private JTabbedPane
getJTabbedPane() {
397 if (jTabbedPane
== null) {
398 jTabbedPane
= new JTabbedPane();
399 jTabbedPane
.addTab("PCD Build Definition", null, getJPanel(), null);
400 jTabbedPane
.addTab("Libraries", null, getJPanel1(), null);
406 * This method initializes jPanel
408 * @return javax.swing.JPanel
410 private JPanel
getJPanel() {
411 if (jPanel
== null) {
412 jLabel
= new JLabel();
413 jLabel
.setText("PcdData");
414 jPanel
= new JPanel();
415 jPanel
.setLayout(new BorderLayout());
416 jPanel
.add(jLabel
, java
.awt
.BorderLayout
.NORTH
);
417 jPanel
.add(getJScrollPane(), java
.awt
.BorderLayout
.CENTER
);
418 jPanel
.add(getJPanel2(), java
.awt
.BorderLayout
.SOUTH
);
419 jPanel
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
420 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
430 * This method initializes jPanel1
432 * @return javax.swing.JPanel
434 private JPanel
getJPanel1() {
435 if (jPanel1
== null) {
436 jPanel1
= new JPanel();
437 jPanel1
.setLayout(new BorderLayout());
438 jPanel1
.add(getJSplitPane(), java
.awt
.BorderLayout
.NORTH
);
439 jPanel1
.add(getJPanel6(), java
.awt
.BorderLayout
.SOUTH
);
440 jPanel1
.add(getJPanel7(), java
.awt
.BorderLayout
.CENTER
);
441 jPanel1
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
442 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
450 * This method initializes jScrollPane
452 * @return javax.swing.JScrollPane
454 private JScrollPane
getJScrollPane() {
455 if (jScrollPane
== null) {
456 jScrollPane
= new JScrollPane();
457 jScrollPane
.setViewportView(getJTable());
463 * This method initializes jTable
465 * @return javax.swing.JTable
467 private JTable
getJTable() {
468 if (jTable
== null) {
469 model
= new PartialEditableTableModel();
470 jTable
= new JTable(model
);
471 model
.addColumn("CName");
472 model
.addColumn("TokenSpaceGUID");
473 model
.addColumn("ItemType");
474 model
.addColumn("Token");
475 model
.addColumn("DataType");
476 model
.addColumn("DefaultValue");
478 jTable
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
479 jTable
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
480 public void valueChanged(ListSelectionEvent e
) {
482 if (e
.getValueIsAdjusting()){
485 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
486 if (lsm
.isSelectionEmpty()) {
490 // int selectedRow = lsm.getMinSelectionIndex();
497 jTable
.getModel().addTableModelListener(new TableModelListener() {
498 public void tableChanged(TableModelEvent arg0
) {
499 // TODO Auto-generated method stub
500 int row
= arg0
.getFirstRow();
501 TableModel m
= (TableModel
)arg0
.getSource();
502 if (arg0
.getType() == TableModelEvent
.INSERT
) {
504 // Set combo box values for item type according to pcd values added.
508 if (arg0
.getType() == TableModelEvent
.UPDATE
){
509 //ToDo Data Validition check.
519 * This method initializes jPanel2
521 * @return javax.swing.JPanel
523 private JPanel
getJPanel2() {
524 if (jPanel2
== null) {
525 jLabel5
= new JLabel();
526 jLabel5
.setText("PCD Description");
527 jPanel2
= new JPanel();
528 jPanel2
.add(jLabel5
, null);
529 jPanel2
.add(getJScrollPane1(), null);
535 * This method initializes jScrollPane1
537 * @return javax.swing.JScrollPane
539 private JScrollPane
getJScrollPane1() {
540 if (jScrollPane1
== null) {
541 jScrollPane1
= new JScrollPane();
542 jScrollPane1
.setPreferredSize(new java
.awt
.Dimension(500,100));
543 jScrollPane1
.setViewportView(getJTextArea());
549 * This method initializes jTextArea
551 * @return javax.swing.JTextArea
553 private JTextArea
getJTextArea() {
554 if (jTextArea
== null) {
555 jTextArea
= new JTextArea();
556 jTextArea
.setEditable(false);
562 * This method initializes jPanel3
564 * @return javax.swing.JPanel
566 private JPanel
getJPanel3() {
567 if (jPanel3
== null) {
568 FlowLayout flowLayout
= new FlowLayout();
569 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
570 jPanel3
= new JPanel();
571 jPanel3
.setLayout(flowLayout
);
572 jPanel3
.add(getJButton2(), null);
573 jPanel3
.add(getJButton3(), null);
579 * This method initializes jSplitPane
581 * @return javax.swing.JSplitPane
583 private JSplitPane
getJSplitPane() {
584 if (jSplitPane
== null) {
585 jSplitPane
= new JSplitPane();
586 jSplitPane
.setDividerLocation(200);
587 jSplitPane
.setLeftComponent(getJPanel4());
588 jSplitPane
.setRightComponent(getJPanel5());
589 jSplitPane
.setPreferredSize(new java
.awt
.Dimension(202,200));
595 * This method initializes jPanel4
597 * @return javax.swing.JPanel
599 private JPanel
getJPanel4() {
600 if (jPanel4
== null) {
601 jLabel1
= new JLabel();
602 jLabel1
.setText("Library Classes Consumed");
603 jPanel4
= new JPanel();
604 jPanel4
.add(jLabel1
, null);
605 jPanel4
.add(getJScrollPane3(), null);
611 * This method initializes jPanel5
613 * @return javax.swing.JPanel
615 private JPanel
getJPanel5() {
616 if (jPanel5
== null) {
617 jLabel2
= new JLabel();
618 jLabel2
.setText("Instances Available");
619 jPanel5
= new JPanel();
620 jPanel5
.add(jLabel2
, null);
621 jPanel5
.add(getJScrollPane4(), null);
627 * This method initializes jScrollPane2
629 * @return javax.swing.JScrollPane
631 private JScrollPane
getJScrollPane2() {
632 if (jScrollPane2
== null) {
633 jScrollPane2
= new JScrollPane();
634 jScrollPane2
.setPreferredSize(new java
.awt
.Dimension(453,150));
635 jScrollPane2
.setViewportView(getJTable1());
641 * This method initializes jTable1
643 * @return javax.swing.JTable
645 private JTable
getJTable1() {
646 if (jTable1
== null) {
647 model1
= new LibraryTableModel();
648 model1
.addColumn("Name");
649 model1
.addColumn("ModuleGUID");
650 model1
.addColumn("ModuleVersion");
651 model1
.addColumn("PackageGUID");
652 model1
.addColumn("PackageVersion");
653 jTable1
= new JTable(model1
);
655 jTable1
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
656 jTable1
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
657 public void valueChanged(ListSelectionEvent e
) {
658 int selectedRow1
= -1;
659 if (e
.getValueIsAdjusting()){
662 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
663 if (lsm
.isSelectionEmpty()) {
667 selectedRow1
= lsm
.getMinSelectionIndex();
680 * This method initializes jScrollPane3
682 * @return javax.swing.JScrollPane
684 private JScrollPane
getJScrollPane3() {
685 if (jScrollPane3
== null) {
686 jScrollPane3
= new JScrollPane();
687 jScrollPane3
.setPreferredSize(new java
.awt
.Dimension(200,170));
688 jScrollPane3
.setViewportView(getJTable2());
694 * This method initializes jTable2
696 * @return javax.swing.JTable
698 private JTable
getJTable2() {
699 if (jTable2
== null) {
700 model2
= new LibraryTableModel();
701 model2
.addColumn("LibraryClass");
702 jTable2
= new JTable(model2
);
704 jTable2
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
705 jTable2
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
706 public void valueChanged(ListSelectionEvent e
) {
707 if (e
.getValueIsAdjusting()){
710 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
711 if (lsm
.isSelectionEmpty()) {
715 int selectedRow2
= lsm
.getMinSelectionIndex();
716 if (selectedRow2
< 0) {
720 // display potential lib instances according to class selection
722 model3
.setRowCount(0);
723 String cls
= model2
.getValueAt(selectedRow2
, 0).toString();
724 ArrayList
<String
> al
= classInstanceMap
.get(cls
);
725 ListIterator
<String
> li
= al
.listIterator();
726 while(li
.hasNext()) {
727 String instance
= li
.next();
728 String
[] s
= {"", "", "", "", ""};
729 if (getModuleId(instance
) != null) {
730 s
[0] = getModuleId(instance
).getName();
733 String
[] instancePart
= instance
.split(" ");
734 for (int i
= 0; i
< instancePart
.length
; ++i
){
735 s
[i
+1] = instancePart
[i
];
748 * This method initializes jScrollPane4
750 * @return javax.swing.JScrollPane
752 private JScrollPane
getJScrollPane4() {
753 if (jScrollPane4
== null) {
754 jScrollPane4
= new JScrollPane();
755 jScrollPane4
.setPreferredSize(new java
.awt
.Dimension(450,170));
756 jScrollPane4
.setViewportView(getJTable3());
762 * This method initializes jTable3
764 * @return javax.swing.JTable
766 private JTable
getJTable3() {
767 if (jTable3
== null) {
768 model3
= new LibraryTableModel();
769 model3
.addColumn("Name");
770 model3
.addColumn("ModuleGUID");
771 model3
.addColumn("ModuleVersion");
772 model3
.addColumn("PackageGUID");
773 model3
.addColumn("PackageVersion");
774 jTable3
= new JTable(model3
);
776 jTable3
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
777 jTable3
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
778 public void valueChanged(ListSelectionEvent e
) {
779 int selectedRow3
= -1;
780 if (e
.getValueIsAdjusting()){
783 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
784 if (lsm
.isSelectionEmpty()) {
788 selectedRow3
= lsm
.getMinSelectionIndex();
799 * This method initializes jPanel6
801 * @return javax.swing.JPanel
803 private JPanel
getJPanel6() {
804 if (jPanel6
== null) {
805 jPanel6
= new JPanel();
811 * This method initializes jPanel7
813 * @return javax.swing.JPanel
815 private JPanel
getJPanel7() {
816 if (jPanel7
== null) {
817 jLabel4
= new JLabel();
818 jLabel4
.setText("Instance Description");
819 jLabel3
= new JLabel();
820 jLabel3
.setText("Selected Instances");
821 jPanel7
= new JPanel();
822 jPanel7
.add(jLabel4
, null);
823 jPanel7
.add(getJScrollPane5(), null);
824 jPanel7
.add(getJButton(), null);
825 jPanel7
.add(getJButton1(), null);
826 jPanel7
.add(jLabel3
, null);
827 jPanel7
.add(getJScrollPane2(), null);
833 * This method initializes jScrollPane5
835 * @return javax.swing.JScrollPane
837 private JScrollPane
getJScrollPane5() {
838 if (jScrollPane5
== null) {
839 jScrollPane5
= new JScrollPane();
840 jScrollPane5
.setPreferredSize(new java
.awt
.Dimension(300,50));
841 jScrollPane5
.setViewportView(getJTextArea1());
847 * This method initializes jTextArea1
849 * @return javax.swing.JTextArea
851 private JTextArea
getJTextArea1() {
852 if (jTextArea1
== null) {
853 jTextArea1
= new JTextArea();
854 jTextArea1
.setEditable(false);
860 * This method initializes jButton
862 * @return javax.swing.JButton
864 private JButton
getJButton() {
865 if (jButton
== null) {
866 jButton
= new JButton();
867 jButton
.setPreferredSize(new java
.awt
.Dimension(80,20));
868 jButton
.setText("Add");
869 jButton
.addActionListener(new java
.awt
.event
.ActionListener() {
870 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
871 int row
= jTable3
.getSelectedRow();
875 Object
[] s
= {model3
.getValueAt(row
, 0), model3
.getValueAt(row
, 1),
876 model3
.getValueAt(row
, 2), model3
.getValueAt(row
, 3),
877 model3
.getValueAt(row
, 4)};
879 String instanceValue
= model3
.getValueAt(row
, 1) + " " +
880 model3
.getValueAt(row
, 2) + " " +
881 model3
.getValueAt(row
, 3) + " " +
882 model3
.getValueAt(row
, 4);
884 // Add pcd information of selected instance to current moduleSA
886 ffc
.addFrameworkModulesPcdBuildDefs(getModuleId(instanceValue
), ffc
.getModuleSA(moduleKey
));
888 resolveLibraryInstances(instanceValue
);
896 * This method initializes jButton1
898 * @return javax.swing.JButton
900 private JButton
getJButton1() {
901 if (jButton1
== null) {
902 jButton1
= new JButton();
903 jButton1
.setPreferredSize(new java
.awt
.Dimension(80,20));
904 jButton1
.setText("Delete");
905 jButton1
.addActionListener(new java
.awt
.event
.ActionListener() {
906 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
907 int row
= jTable1
.getSelectedRow();
911 removeInstance(model1
.getValueAt(row
, 1) + " " +
912 model1
.getValueAt(row
, 2) + " " +
913 model1
.getValueAt(row
, 3) + " " +
914 model1
.getValueAt(row
, 4));
915 model1
.removeRow(row
);
924 * This method initializes jButton2
926 * @return javax.swing.JButton
928 private JButton
getJButton2() {
929 if (jButton2
== null) {
930 jButton2
= new JButton();
931 jButton2
.setPreferredSize(new java
.awt
.Dimension(80,20));
932 jButton2
.setText("Ok");
933 jButton2
.addActionListener(this);
939 * This method initializes jButton3
941 * @return javax.swing.JButton
943 private JButton
getJButton3() {
944 if (jButton3
== null) {
945 jButton3
= new JButton();
946 jButton3
.setPreferredSize(new java
.awt
.Dimension(80,20));
947 jButton3
.setText("Cancel");
948 jButton3
.setVisible(false);
952 public void actionPerformed(ActionEvent arg0
) {
954 if (arg0
.getSource() == jButton2
) {
955 ffc
.removeLibraryInstances(moduleKey
);
956 for (int i
= 0; i
< model1
.getRowCount(); ++i
) {
957 String mg
= model1
.getValueAt(i
, 1)+"";
958 String mv
= model1
.getValueAt(i
, 2)+"";
959 String pg
= model1
.getValueAt(i
, 3)+"";
960 String pv
= model1
.getValueAt(i
, 4)+"";
961 ffc
.genLibraryInstance(mg
, mv
, pg
, pv
, moduleKey
);
963 this.setVisible(false);
967 } // @jve:decl-index=0:visual-constraint="10,10"
969 class PartialEditableTableModel
extends DefaultTableModel
{
973 private static final long serialVersionUID
= 1L;
975 public boolean isCellEditable(int row
, int col
) {
986 class LibraryTableModel
extends DefaultTableModel
{
990 private static final long serialVersionUID
= 1L;
992 public boolean isCellEditable(int row
, int col
) {