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
.JOptionPane
;
8 import javax
.swing
.JPanel
;
9 import javax
.swing
.JDialog
;
10 import javax
.swing
.JTabbedPane
;
11 import javax
.swing
.JLabel
;
12 import javax
.swing
.JScrollPane
;
13 import javax
.swing
.JTable
;
14 import javax
.swing
.JTextArea
;
15 import javax
.swing
.JSplitPane
;
16 import javax
.swing
.JButton
;
17 import javax
.swing
.ListSelectionModel
;
18 import javax
.swing
.event
.ListSelectionEvent
;
19 import javax
.swing
.event
.ListSelectionListener
;
20 import javax
.swing
.event
.TableModelEvent
;
21 import javax
.swing
.event
.TableModelListener
;
22 import javax
.swing
.table
.DefaultTableModel
;
23 import javax
.swing
.table
.TableColumn
;
24 import javax
.swing
.table
.TableModel
;
26 import org
.tianocore
.frameworkwizard
.FrameworkWizardUI
;
27 import org
.tianocore
.frameworkwizard
.common
.DataValidation
;
28 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
29 import org
.tianocore
.frameworkwizard
.common
.IDefaultTableModel
;
30 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformType
;
31 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.LibraryClassDescriptor
;
32 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.WorkspaceProfile
;
33 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.SurfaceAreaQuery
;
34 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
35 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
37 import java
.awt
.FlowLayout
;
38 import java
.awt
.event
.ActionEvent
;
39 import java
.awt
.event
.ActionListener
;
40 import java
.util
.ArrayList
;
41 import java
.util
.HashMap
;
42 import java
.util
.Iterator
;
43 import java
.util
.ListIterator
;
44 import java
.util
.Vector
;
46 import javax
.swing
.JTextField
;
47 import java
.awt
.GridLayout
;
48 import javax
.swing
.JComboBox
;
50 public class FpdModuleSA
extends JDialog
implements ActionListener
{
55 private static final long serialVersionUID
= 1L;
56 private JPanel jContentPane
= null;
57 private JTabbedPane jTabbedPane
= null;
58 private JPanel jPanelPcd
= null;
59 private JPanel jPanelLibrary
= null;
60 private JLabel jLabelPcdData
= null;
61 private JScrollPane jScrollPaneTablePcd
= null;
62 private JTable jTablePcd
= null;
63 private JPanel jPanelPcdSouth
= null;
64 private JScrollPane jScrollPanePcdHelp
= null;
65 private JTextArea jTextAreaPcdHelp
= null;
66 private JPanel jPanelContentPaneSouth
= null;
67 private JSplitPane jSplitPane
= null;
68 private JPanel jPanelLibraryLeft
= null;
69 private JPanel jPanelLibraryRight
= null;
70 private JLabel jLabelLibClass
= null;
71 private JLabel jLabelQualifiedInstance
= null;
72 private JScrollPane jScrollPaneSelectedInstances
= null;
73 private JTable jTableSelectedInstances
= null;
74 private JScrollPane jScrollPaneLibClass
= null;
75 private JTable jTableLibClass
= null;
76 private JScrollPane jScrollPaneQualifiedInstance
= null;
77 private JTable jTableLibInstances
= null;
78 private JPanel jPanelLibrarySouth
= null;
79 private JPanel jPanelLibraryCenter
= null;
80 private JScrollPane jScrollPaneInstanceHelp
= null;
81 private JTextArea jTextAreaInstanceHelp
= null;
82 private JLabel jLabelSelectedInstances
= null;
83 private JLabel jLabelInstanceHelp
= null;
84 private JButton jButtonAdd
= null;
85 private JButton jButtonDeleteInstance
= null;
86 private JLabel jLabelPcdHelp
= null;
87 private JButton jButtonOk
= null;
88 private JButton jButtonCancel
= null;
89 private IDefaultTableModel model
= null;
90 private IDefaultTableModel selectedInstancesTableModel
= null;
91 private IDefaultTableModel libClassTableModel
= null;
92 private IDefaultTableModel libInstanceTableModel
= null;
93 private DefaultTableModel optionsTableModel
= null;
94 private FpdFileContents ffc
= null;
95 private String moduleKey
= null;
96 private int moduleSaNum
= -1;
97 private HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classInstanceMap
= null;
99 // map of <{libName, supArch, supMod}, list of Module information>
101 private HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classConsumed
= null;
102 private HashMap
<LibraryClassDescriptor
, ArrayList
<String
>> classProduced
= null;
104 private JPanel jPanelModuleSaOpts
= null;
105 private JLabel jLabelFvBinding
= null;
106 private JTextField jTextFieldFvBinding
= null;
107 private JLabel jLabelFfsFileGuid
= null;
108 private JTextField jTextFieldFileGuid
= null;
109 private JLabel jLabelFfsFormatKey
= null;
110 private JTextField jTextFieldFfsKey
= null;
111 private JScrollPane jScrollPaneModuleSaOptions
= null;
112 private JTable jTableModuleSaOptions
= null;
113 private JButton jButtonNew
= null;
114 private JButton jButtonDeleteOption
= null;
115 private JPanel jPanelPcdFields
= null;
116 private JPanel jPanelPcdFieldsSecondRow
= null;
117 private JPanel jPanelPcdFieldsThirdRow
= null;
118 private JPanel jPanelPcdFieldsFirstRow
= null;
119 private JLabel jLabelItemType
= null;
120 private JComboBox jComboBoxItemType
= null;
121 private JLabel jLabelMaxDatumSize
= null;
122 private JTextField jTextFieldMaxDatumSize
= null;
123 private JLabel jLabelPcdDefaultValue
= null;
124 private JTextField jTextFieldPcdDefault
= null;
125 private JButton jButtonUpdatePcd
= null;
126 private JComboBox jComboBoxFeatureFlagValue
= null;
127 private OpeningPlatformType docConsole
= null;
128 private JPanel jPanelCustomToolChain
= null;
129 private JPanel jPanelToolchainS
= null;
130 private JPanel jPanelLibraryCenterN
= null;
131 private JPanel jPanelLibraryCenterC
= null; // @jve:decl-index=0:visual-constraint="20,224"
133 private final int buildTargetWidth
= 150;
134 private final int toolChainFamilyWidth
= 150;
135 private final int supportArchWidth
= 150;
136 private final int toolCmdCodeWidth
= 200;
137 private final int tagNameWidth
= 150;
138 private final int argWidth
= 400;
141 * This is the default constructor
143 public FpdModuleSA() {
144 super(FrameworkWizardUI
.getInstance());
147 public FpdModuleSA(FpdFileContents ffc
) {
152 public void setKey(String k
, int i
, OpeningPlatformType dc
){
155 this.docConsole
= dc
;
156 classInstanceMap
= null;
157 classProduced
= null;
158 classConsumed
= null;
159 jTabbedPane
.setSelectedIndex(0);
160 initPcdBuildDefinition(i
);
161 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(moduleKey
);
165 int tabIndex
= jTabbedPane
.indexOfTab("Libraries");
166 if (mi
.isLibrary()) {
167 jTabbedPane
.setEnabledAt(tabIndex
, false);
170 jTabbedPane
.setEnabledAt(tabIndex
, true);
175 init will be called each time FpdModuleSA object is to be shown.
176 @param key Module information.
178 public void initPcdBuildDefinition(int i
) {
180 // display pcd for key.
182 model
.setRowCount(0);
183 jTextAreaPcdHelp
.setText("");
184 jComboBoxItemType
.setSelectedIndex(-1);
185 jTextFieldMaxDatumSize
.setText("");
186 jTextFieldPcdDefault
.setText("");
187 int pcdCount
= ffc
.getPcdDataCount(i
);
189 String
[][] saa
= new String
[pcdCount
][7];
190 ffc
.getPcdData(i
, saa
);
191 for (int j
= 0; j
< saa
.length
; ++j
) {
192 model
.addRow(saa
[j
]);
197 public void initLibraries(String key
) {
198 libClassTableModel
.setRowCount(0);
199 libInstanceTableModel
.setRowCount(0);
200 selectedInstancesTableModel
.setRowCount(0);
201 Vector
<String
> errorMsg
= new Vector
<String
>();
204 // display library classes that need to be resolved. also potential instances for them.
206 resolveLibraryInstances(moduleKey
, errorMsg
);
207 } catch (Exception e
) {
208 String exceptionMsg
= e
.getCause() + " " + e
.getMessage();
209 errorMsg
.add(exceptionMsg
);
210 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), exceptionMsg
);
213 // display lib instances already selected for key
216 int instanceCount
= ffc
.getLibraryInstancesCount(key
);
217 if (instanceCount
!= 0) {
218 String
[][] saa
= new String
[instanceCount
][5];
219 ffc
.getLibraryInstances(key
, saa
);
220 for (int i
= 0; i
< saa
.length
; ++i
) {
221 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3]
225 // ToDo: verify this instance first.
227 saa
[i
][0] = mi
.getName();
228 saa
[i
][2] = mi
.getVersion();
229 saa
[i
][4] = mi
.getPackageId().getVersion();
231 // re-evaluate lib instance usage when adding a already-selected lib instance.
234 resolveLibraryInstances(saa
[i
][1] + " " + saa
[i
][2] + " " + saa
[i
][3] + " " + saa
[i
][4], errorMsg
);
235 } catch (Exception e
) {
236 String exceptionMsg
= e
.getCause() + " " + e
.getMessage();
237 if (!errorMsg
.contains(exceptionMsg
)) {
238 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), e
.getCause() + " " + e
.getMessage());
241 selectedInstancesTableModel
.addRow(saa
[i
]);
246 if (errorMsg
.size() > 0) {
248 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
249 errors
+= " " + errorMsg
.get(i
) + "\n";
251 JOptionPane
.showMessageDialog(FrameworkWizardUI
.getInstance(), errors
);
253 showClassToResolved();
256 public void initFvInfo (String key
) {
258 // display module SA options
260 jTextFieldFvBinding
.setText("");
261 String fvBinding
= ffc
.getFvBinding(key
);
262 if (fvBinding
!= null) {
263 jTextFieldFvBinding
.setText(fvBinding
);
265 jTextFieldFileGuid
.setText("");
266 String fileGuid
= ffc
.getFfsFileNameGuid(key
);
267 if (fileGuid
!= null) {
268 jTextFieldFileGuid
.setText(fileGuid
);
270 jTextFieldFfsKey
.setText("");
271 String ffsKey
= ffc
.getFfsFormatKey(key
);
272 if (ffsKey
!= null) {
273 jTextFieldFfsKey
.setText(ffsKey
);
277 public void initToolChainOptions(String key
) {
279 optionsTableModel
.setRowCount(0);
280 String
[][] saa
= new String
[ffc
.getModuleSAOptionsCount(key
)][6];
281 ffc
.getModuleSAOptions(key
, saa
);
282 for (int i
= 0; i
< saa
.length
; ++i
) {
283 optionsTableModel
.addRow(saa
[i
]);
287 private void filterClassConsumedByArch (Vector
<LibraryClassDescriptor
> v
) {
288 String
[] moduleInfo
= moduleKey
.split(" ");
289 Vector
<String
> vModuleArchs
= new Vector
<String
>();
291 // Skip guid, version information, get archs to check.
293 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
294 vModuleArchs
.add(moduleInfo
[i
]);
297 // if module will be built on all platforms, no filter needed for lib classes.
299 if (vModuleArchs
.size() == 0) {
303 Iterator
<LibraryClassDescriptor
> iter
= v
.iterator();
304 while (iter
.hasNext()) {
305 LibraryClassDescriptor libInfo
= iter
.next();
307 Vector
<String
> vSupArchs
= libInfo
.getVectorFromString(libInfo
.supArchs
);
309 if (vSupArchs
.size() == 0 || (vSupArchs
.size() == 1 && vSupArchs
.get(0).equalsIgnoreCase(""))) {
311 // update lib info to module archs only.
313 libInfo
.supArchs
= "";
314 for (int i
= 0; i
< vModuleArchs
.size(); ++i
) {
315 libInfo
.supArchs
+= vModuleArchs
.get(i
);
316 libInfo
.supArchs
+= " ";
318 libInfo
.supArchs
.trim();
322 // only retain those lib class used by module archs.
324 vSupArchs
.retainAll(vModuleArchs
);
325 if (vSupArchs
.size() > 0) {
327 // update lib info to reflect which kind of arch need to select instance.
329 libInfo
.supArchs
= "";
330 for (int i
= 0; i
< vSupArchs
.size(); ++i
) {
331 libInfo
.supArchs
+= vSupArchs
.get(i
);
332 libInfo
.supArchs
+= " ";
334 libInfo
.supArchs
.trim();
338 // remove this lib definition if it supports no archs module will be built under.
344 private void resolveLibraryInstances(String key
, Vector
<String
> errorMsg
) throws MultipleInstanceException
, NoInstanceException
{
345 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
346 PackageIdentification
[] depPkgList
= null;
349 // Get dependency pkg list into which we will search lib instances.
351 depPkgList
= SurfaceAreaQuery
.getDependencePkg(null, mi
);
353 // Get the lib class consumed, produced by this module itself.
355 Vector
<LibraryClassDescriptor
> vClassConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
356 filterClassConsumedByArch(vClassConsumed
);
357 if (this.classConsumed
== null) {
358 this.classConsumed
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
361 for (int i
= 0; i
< vClassConsumed
.size(); ++i
) {
362 ArrayList
<String
> consumedBy
= this.classConsumed
.get(vClassConsumed
.get(i
));
363 if (consumedBy
== null) {
364 consumedBy
= new ArrayList
<String
>();
367 this.classConsumed
.put(vClassConsumed
.get(i
), consumedBy
);
370 Vector
<LibraryClassDescriptor
> vClassProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
371 if (this.classProduced
== null) {
372 this.classProduced
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
374 for (int i
= 0; i
< vClassProduced
.size(); ++i
) {
375 ArrayList
<String
> producedBy
= this.classProduced
.get(vClassProduced
.get(i
));
376 if (producedBy
== null) {
377 producedBy
= new ArrayList
<String
>();
380 // class already produced by previous module (lib instance).
382 if (producedBy.size() == 1) {
383 String instanceKey = producedBy.get(0);
384 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
385 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
387 Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
388 while (lcdi.hasNext()) {
389 LibraryClassDescriptor lcd = lcdi.next();
390 if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
391 ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
392 String instanceKey = alreadyProducedBy.get(0);
393 ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
394 throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
401 this.classProduced
.put(vClassProduced
.get(i
), producedBy
);
406 // find potential instances in all pkgs for classes still in classConsumed.
408 if (classInstanceMap
== null) {
409 classInstanceMap
= new HashMap
<LibraryClassDescriptor
, ArrayList
<String
>>();
411 Iterator
<LibraryClassDescriptor
> lic
= this.classConsumed
.keySet().iterator();
412 while (lic
.hasNext()) {
413 LibraryClassDescriptor cls
= lic
.next();
414 if (isBoundedClass(cls
)) {
417 ArrayList
<String
> instances
= getInstancesForClass(cls
, depPkgList
);
418 if (instances
.size() == 0) {
419 // throw new NoInstanceException (cls.className);
420 String exceptionMsg
= new NoInstanceException (cls
.className
).getMessage();
421 if (!errorMsg
.contains(exceptionMsg
)) {
422 errorMsg
.add(exceptionMsg
);
426 classInstanceMap
.put(cls
, instances
);
429 // showClassToResolved();
432 /**Search classProduced map to see if this class has been produced by some instance (module).
436 private boolean isBoundedClass (LibraryClassDescriptor cls
) {
437 if (this.classProduced
.containsKey(cls
)) {
440 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
441 while (lcdi
.hasNext()) {
442 LibraryClassDescriptor lcd
= lcdi
.next();
443 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)) {
451 private ArrayList
<String
> getInstancesForClass(LibraryClassDescriptor cls
, PackageIdentification
[] depPkgList
){
452 ArrayList
<String
> al
= new ArrayList
<String
>();
454 // for (int i = 0; i < depPkgList.length; ++i) {
455 Iterator ismi
= GlobalData
.vModuleList
.iterator();
456 while(ismi
.hasNext()) {
457 ModuleIdentification mi
= (ModuleIdentification
)ismi
.next();
458 // if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
461 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
463 boolean isPotential
= false;
464 Iterator
<LibraryClassDescriptor
> lcdi
= clsProduced
.iterator();
465 while (lcdi
.hasNext()) {
466 LibraryClassDescriptor lcd
= lcdi
.next();
467 if (cls
.isSubSetByArchs(lcd
) && cls
.isSubSetByModTypes(lcd
)){
471 if (hasBeenProduced(lcd
)) {
477 al
.add(mi
.getGuid() + " " + mi
.getVersion() + " " +
478 mi
.getPackageId().getGuid() + " " + mi
.getPackageId().getVersion());
486 private boolean hasBeenProduced (LibraryClassDescriptor cls
) {
487 Iterator
<LibraryClassDescriptor
> lcdi
= this.classProduced
.keySet().iterator();
488 while (lcdi
.hasNext()) {
489 LibraryClassDescriptor lcd
= lcdi
.next();
490 if (cls
.hasInterSectionWith(lcd
)) {
497 private ArrayList
<String
> getConsumedBy (String className
) {
498 Iterator
<LibraryClassDescriptor
> lcdi
= this.classConsumed
.keySet().iterator();
499 while (lcdi
.hasNext()) {
500 LibraryClassDescriptor lcd
= lcdi
.next();
501 if ((lcd
.className
!= null) && lcd
.className
.equals(className
)) {
502 return this.classConsumed
.get(lcd
);
508 private void removeInstance(String key
) {
509 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(key
);
511 // remove pcd information of instance from current ModuleSA
513 ffc
.removePcdData(moduleKey
, mi
);
515 // remove class produced by this instance and add back these produced class to be bound.
517 Vector
<LibraryClassDescriptor
> clsProduced
= getClassProduced(mi
);
518 for (int i
= 0; i
< clsProduced
.size(); ++i
) {
520 classProduced
.remove(clsProduced
.get(i
));
523 // remove class consumed by this instance. we do not need to bound it now.
525 String
[] clsConsumed
= getClassConsumed(mi
);
526 for (int i
= 0; i
< clsConsumed
.length
; ++i
) {
527 ArrayList
<String
> al
= getConsumedBy (clsConsumed
[i
]);
536 showClassToResolved();
541 private Vector
<LibraryClassDescriptor
> getClassProduced(ModuleIdentification mi
){
543 Vector
<LibraryClassDescriptor
> clsProduced
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_PRODUCED", mi
);
545 // String[] sClassProduced = new String[clsProduced.size()];
546 // for (int i = 0; i < clsProduced.size(); ++i) {
547 // sClassProduced[i] = clsProduced.get(i).className;
549 // return sClassProduced;
552 private String
[] getClassConsumed(ModuleIdentification mi
){
554 Vector
<LibraryClassDescriptor
> clsConsumed
= SurfaceAreaQuery
.getLibraryClasses("ALWAYS_CONSUMED", mi
);
555 String
[] sClassConsumed
= new String
[clsConsumed
.size()];
556 for (int i
= 0; i
< clsConsumed
.size(); ++i
) {
557 sClassConsumed
[i
] = clsConsumed
.get(i
).className
;
559 return sClassConsumed
;
562 private void showClassToResolved(){
563 libClassTableModel
.setRowCount(0);
564 libInstanceTableModel
.setRowCount(0);
565 if (classConsumed
== null || classConsumed
.size() == 0) {
568 Iterator
<LibraryClassDescriptor
> li
= classConsumed
.keySet().iterator();
570 LibraryClassDescriptor lcd
= li
.next();
571 String
[] s
= {lcd
.className
, lcd
.supArchs
, lcd
.supModTypes
};
572 if (classConsumed
.get(lcd
) == null || classConsumed
.get(lcd
).size() == 0) {
576 if (!isBoundedClass(lcd
)){
577 libClassTableModel
.addRow(s
);
583 private String
getModuleArch () {
585 String
[] moduleInfo
= moduleKey
.split(" ");
586 for (int i
= 4; i
< moduleInfo
.length
; ++i
) {
587 arch
+= moduleInfo
[i
];
592 private void addLibInstance (ModuleIdentification libMi
) throws Exception
{
595 // Add pcd information of selected instance to current moduleSA
597 ffc
.addFrameworkModulesPcdBuildDefs(libMi
, getModuleArch(), ffc
.getModuleSA(moduleKey
));
599 ffc
.genLibraryInstance(libMi
, moduleKey
);
602 * This method initializes this
606 private void initialize() {
607 this.setSize(877, 555);
608 this.setResizable(false);
611 this.setTitle("Module Settings");
612 this.setContentPane(getJContentPane());
616 * This method initializes jContentPane
618 * @return javax.swing.JPanel
620 private JPanel
getJContentPane() {
621 if (jContentPane
== null) {
622 jContentPane
= new JPanel();
623 jContentPane
.setLayout(new BorderLayout());
624 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
625 jContentPane
.add(getJPanelContentPaneSouth(), java
.awt
.BorderLayout
.SOUTH
);
631 * This method initializes jTabbedPane
633 * @return javax.swing.JTabbedPane
635 private JTabbedPane
getJTabbedPane() {
636 if (jTabbedPane
== null) {
637 jTabbedPane
= new JTabbedPane();
638 jTabbedPane
.addTab("PCD Build Definition", null, getJPanelPcd(), null);
639 jTabbedPane
.addTab("Libraries", null, getJPanelLibrary(), null);
640 jTabbedPane
.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
641 jTabbedPane
.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
648 * This method initializes jPanelPcd
650 * @return javax.swing.JPanel
652 private JPanel
getJPanelPcd() {
653 if (jPanelPcd
== null) {
654 jLabelPcdData
= new JLabel();
655 jLabelPcdData
.setText(" PCD Data");
656 jPanelPcd
= new JPanel();
657 jPanelPcd
.setLayout(new BorderLayout());
658 jPanelPcd
.add(jLabelPcdData
, java
.awt
.BorderLayout
.NORTH
);
659 jPanelPcd
.add(getJScrollPaneTablePcd(), java
.awt
.BorderLayout
.CENTER
);
660 jPanelPcd
.add(getJPanelPcdSouth(), java
.awt
.BorderLayout
.SOUTH
);
661 jPanelPcd
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
662 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
663 initPcdBuildDefinition(moduleSaNum
);
672 * This method initializes jPanelLibrary
674 * @return javax.swing.JPanel
676 private JPanel
getJPanelLibrary() {
677 if (jPanelLibrary
== null) {
678 jPanelLibrary
= new JPanel();
679 jPanelLibrary
.setLayout(new BorderLayout());
680 jPanelLibrary
.add(getJSplitPane(), java
.awt
.BorderLayout
.NORTH
);
681 jPanelLibrary
.add(getJPanelLibrarySouth(), java
.awt
.BorderLayout
.SOUTH
);
682 jPanelLibrary
.add(getJPanelLibraryCenter(), java
.awt
.BorderLayout
.CENTER
);
683 jPanelLibrary
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
684 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
685 initLibraries(moduleKey
);
689 return jPanelLibrary
;
693 * This method initializes jScrollPaneTablePcd
695 * @return javax.swing.JScrollPane
697 private JScrollPane
getJScrollPaneTablePcd() {
698 if (jScrollPaneTablePcd
== null) {
699 jScrollPaneTablePcd
= new JScrollPane();
700 jScrollPaneTablePcd
.setViewportView(getJTablePcd());
702 return jScrollPaneTablePcd
;
706 * This method initializes jTable
708 * @return javax.swing.JTable
710 private JTable
getJTablePcd() {
711 if (jTablePcd
== null) {
712 model
= new IDefaultTableModel();
713 jTablePcd
= new JTable(model
);
714 jTablePcd
.setRowHeight(20);
715 jTablePcd
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_ALL_COLUMNS
);
716 model
.addColumn("CName");
717 model
.addColumn("TokenSpaceGUID");
718 model
.addColumn("ItemType");
719 model
.addColumn("Token");
720 model
.addColumn("MaxDatumSize");
721 model
.addColumn("DataType");
722 model
.addColumn("DefaultValue");
724 jTablePcd
.getColumnModel().getColumn(0).setMinWidth(250);
726 TableColumn tokenColumn
= jTablePcd
.getColumnModel().getColumn(3);
727 jTablePcd
.removeColumn(tokenColumn
);
729 jTablePcd
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
730 jTablePcd
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
731 public void valueChanged(ListSelectionEvent e
) {
733 if (e
.getValueIsAdjusting()){
736 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
737 if (lsm
.isSelectionEmpty()) {
741 int selectedRow
= lsm
.getMinSelectionIndex();
742 String cName
= model
.getValueAt(selectedRow
, 0)+"";
743 String tsGuid
= model
.getValueAt(selectedRow
, 1)+"";
744 String itemType
= model
.getValueAt(selectedRow
, 2)+"";
746 // array for pcd related information: helpText, itemType, moduleType.
748 String
[] pcdInfo
= {"", "", ""};
749 Vector
<String
> validPcdTypes
= new Vector
<String
>();
750 getPcdInfo(moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
751 jTextAreaPcdHelp
.setText(pcdInfo
[0]);
752 initComboBox(pcdInfo
[1], pcdInfo
[2], validPcdTypes
);
753 jComboBoxItemType
.setSelectedItem(itemType
);
754 jTextFieldMaxDatumSize
.setEnabled(true);
755 jTextFieldMaxDatumSize
.setVisible(true);
756 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
757 jTextFieldPcdDefault
.setEnabled(true);
758 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
759 if ((model
.getValueAt(selectedRow
, 5) != null) && model
.getValueAt(selectedRow
, 5).equals("VOID*")) {
760 if (pcdInfo
[1].equals("FEATURE_FLAG")) {
761 jTextFieldMaxDatumSize
.setVisible(false);
763 else if (pcdInfo
[1].equals("FIXED_AT_BUILD")) {
765 jTextFieldMaxDatumSize
.setEnabled(false);
766 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(model
.getValueAt(selectedRow
, 6)+"")+"");
768 catch(Exception except
){
769 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Unacceptable PCD Value: " + except
.getMessage());
773 jTextFieldMaxDatumSize
.setText(model
.getValueAt(selectedRow
, 4)+"");
777 jTextFieldMaxDatumSize
.setEnabled(false);
780 if (!model
.getValueAt(selectedRow
, 2).equals("DYNAMIC") && !model
.getValueAt(selectedRow
, 2).equals("DYNAMIC_EX")) {
781 jTextFieldPcdDefault
.setText(model
.getValueAt(selectedRow
, 6)+"");
782 if (model
.getValueAt(selectedRow
, 2).equals("FEATURE_FLAG")){
783 jTextFieldPcdDefault
.setVisible(false);
784 jComboBoxFeatureFlagValue
.setVisible(true);
785 jComboBoxFeatureFlagValue
.setSelectedItem(model
.getValueAt(selectedRow
, 6)+"");
788 jTextFieldPcdDefault
.setVisible(true);
789 jTextFieldPcdDefault
.setEnabled(true);
790 jComboBoxFeatureFlagValue
.setVisible(false);
794 jTextFieldPcdDefault
.setEnabled(false);
806 private void initComboBox(String originalType
, String mType
, Vector
<String
> validPcdTypes
) {
807 jComboBoxItemType
.removeAllItems();
809 if (originalType
.equals("DYNAMIC")) {
810 for (int i
= 0; i
< validPcdTypes
.size(); ++i
) {
811 jComboBoxItemType
.addItem(validPcdTypes
.get(i
));
815 jComboBoxItemType
.addItem(originalType
);
822 * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
824 private void getPcdInfo(String moduleKey
, String cName
, String tsGuid
, String
[] sa
, Vector
<String
> validPcdTypes
) {
825 String
[][] saa
= new String
[ffc
.getLibraryInstancesCount(moduleKey
)][5];
826 ffc
.getLibraryInstances(moduleKey
, saa
);
829 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(moduleKey
), cName
, tsGuid
, sa
, validPcdTypes
)) {
832 for (int j
= 0; j
< saa
.length
; ++j
) {
833 if (ffc
.getPcdBuildDataInfo(WorkspaceProfile
.getModuleId(saa
[j
][1] + " " + saa
[j
][2] + " " + saa
[j
][3] + " " + saa
[j
][4]),
834 cName
, tsGuid
, sa
, validPcdTypes
)) {
840 JOptionPane
.showMessageDialog(this, "Get PCD details fail: " + e
.getMessage());
845 * This method initializes jPanelPcdSouth
847 * @return javax.swing.JPanel
849 private JPanel
getJPanelPcdSouth() {
850 if (jPanelPcdSouth
== null) {
851 jLabelPcdHelp
= new JLabel();
852 jLabelPcdHelp
.setText("PCD Description");
853 jPanelPcdSouth
= new JPanel();
854 jPanelPcdSouth
.setPreferredSize(new java
.awt
.Dimension(607,200));
855 jPanelPcdSouth
.add(jLabelPcdHelp
, null);
856 jPanelPcdSouth
.add(getJScrollPanePcdHelp(), null);
857 jPanelPcdSouth
.add(getJPanelPcdFields(), null);
859 return jPanelPcdSouth
;
863 * This method initializes jScrollPanePcdHelp
865 * @return javax.swing.JScrollPane
867 private JScrollPane
getJScrollPanePcdHelp() {
868 if (jScrollPanePcdHelp
== null) {
869 jScrollPanePcdHelp
= new JScrollPane();
870 jScrollPanePcdHelp
.setPreferredSize(new java
.awt
.Dimension(500,100));
871 jScrollPanePcdHelp
.setViewportView(getJTextAreaPcdHelp());
873 return jScrollPanePcdHelp
;
877 * This method initializes jTextAreaPcdHelp
879 * @return javax.swing.JTextArea
881 private JTextArea
getJTextAreaPcdHelp() {
882 if (jTextAreaPcdHelp
== null) {
883 jTextAreaPcdHelp
= new JTextArea();
884 jTextAreaPcdHelp
.setEditable(false);
886 return jTextAreaPcdHelp
;
890 * This method initializes jPanelContentPaneSouth
892 * @return javax.swing.JPanel
894 private JPanel
getJPanelContentPaneSouth() {
895 if (jPanelContentPaneSouth
== null) {
896 FlowLayout flowLayout
= new FlowLayout();
897 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
898 jPanelContentPaneSouth
= new JPanel();
899 jPanelContentPaneSouth
.setLayout(flowLayout
);
900 jPanelContentPaneSouth
.add(getJButtonOk(), null);
901 jPanelContentPaneSouth
.add(getJButtonCancel(), null);
903 return jPanelContentPaneSouth
;
907 * This method initializes jSplitPane
909 * @return javax.swing.JSplitPane
911 private JSplitPane
getJSplitPane() {
912 if (jSplitPane
== null) {
913 jSplitPane
= new JSplitPane();
914 jSplitPane
.setDividerLocation(200);
915 jSplitPane
.setLeftComponent(getJPanelLibraryLeft());
916 jSplitPane
.setRightComponent(getJPanelLibraryRight());
917 jSplitPane
.setPreferredSize(new java
.awt
.Dimension(202,200));
923 * This method initializes jPanelLibraryLeft
925 * @return javax.swing.JPanel
927 private JPanel
getJPanelLibraryLeft() {
928 if (jPanelLibraryLeft
== null) {
929 jLabelLibClass
= new JLabel();
930 jLabelLibClass
.setText("Library Classes Uninstantiated");
931 jPanelLibraryLeft
= new JPanel();
932 jPanelLibraryLeft
.add(jLabelLibClass
, null);
933 jPanelLibraryLeft
.add(getJScrollPaneLibClass(), null);
935 return jPanelLibraryLeft
;
939 * This method initializes jPanelLibraryRight
941 * @return javax.swing.JPanel
943 private JPanel
getJPanelLibraryRight() {
944 if (jPanelLibraryRight
== null) {
945 jLabelQualifiedInstance
= new JLabel();
946 jLabelQualifiedInstance
.setText("Instances Available");
947 jPanelLibraryRight
= new JPanel();
948 jPanelLibraryRight
.add(jLabelQualifiedInstance
, null);
949 jPanelLibraryRight
.add(getJScrollPaneQualifiedInstance(), null);
951 return jPanelLibraryRight
;
955 * This method initializes jScrollPaneSelectedInstances
957 * @return javax.swing.JScrollPane
959 private JScrollPane
getJScrollPaneSelectedInstances() {
960 if (jScrollPaneSelectedInstances
== null) {
961 jScrollPaneSelectedInstances
= new JScrollPane();
962 jScrollPaneSelectedInstances
.setPreferredSize(new java
.awt
.Dimension(600,150));
963 jScrollPaneSelectedInstances
.setViewportView(getJTableSelectedInstances());
965 return jScrollPaneSelectedInstances
;
969 * This method initializes jTableSelectedInstances
971 * @return javax.swing.JTable
973 private JTable
getJTableSelectedInstances() {
974 if (jTableSelectedInstances
== null) {
975 selectedInstancesTableModel
= new IDefaultTableModel();
976 selectedInstancesTableModel
.addColumn("Name");
977 selectedInstancesTableModel
.addColumn("ModuleGUID");
978 selectedInstancesTableModel
.addColumn("ModuleVersion");
979 selectedInstancesTableModel
.addColumn("PackageGUID");
980 selectedInstancesTableModel
.addColumn("PackageVersion");
981 jTableSelectedInstances
= new JTable(selectedInstancesTableModel
);
982 jTableSelectedInstances
.setRowHeight(20);
984 jTableSelectedInstances
.getColumnModel().getColumn(0).setMinWidth(250);
986 jTableSelectedInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
987 jTableSelectedInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
990 return jTableSelectedInstances
;
994 * This method initializes jScrollPaneLibClass
996 * @return javax.swing.JScrollPane
998 private JScrollPane
getJScrollPaneLibClass() {
999 if (jScrollPaneLibClass
== null) {
1000 jScrollPaneLibClass
= new JScrollPane();
1001 jScrollPaneLibClass
.setPreferredSize(new java
.awt
.Dimension(200,170));
1002 jScrollPaneLibClass
.setViewportView(getJTableLibClass());
1004 return jScrollPaneLibClass
;
1008 * This method initializes jTableLibClass
1010 * @return javax.swing.JTable
1012 private JTable
getJTableLibClass() {
1013 if (jTableLibClass
== null) {
1014 libClassTableModel
= new IDefaultTableModel();
1015 libClassTableModel
.addColumn("LibraryClass");
1016 libClassTableModel
.addColumn("Arch");
1017 libClassTableModel
.addColumn("ModType");
1018 jTableLibClass
= new JTable(libClassTableModel
);
1019 jTableLibClass
.setRowHeight(20);
1020 jTableLibClass
.setShowGrid(false);
1021 jTableLibClass
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1023 TableColumn column
= jTableLibClass
.getColumnModel().getColumn(1);
1024 jTableLibClass
.getColumnModel().removeColumn(column
);
1025 column
= jTableLibClass
.getColumnModel().getColumn(1);
1026 jTableLibClass
.getColumnModel().removeColumn(column
);
1028 jTableLibClass
.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
1029 public void valueChanged(ListSelectionEvent e
) {
1030 if (e
.getValueIsAdjusting()){
1033 ListSelectionModel lsm
= (ListSelectionModel
)e
.getSource();
1034 if (lsm
.isSelectionEmpty()) {
1038 int selectedRow2
= lsm
.getMinSelectionIndex();
1039 if (selectedRow2
< 0) {
1043 // display potential lib instances according to class selection
1045 libInstanceTableModel
.setRowCount(0);
1046 String cls
= libClassTableModel
.getValueAt(selectedRow2
, 0).toString();
1047 String arch
= libClassTableModel
.getValueAt(selectedRow2
, 1).toString();
1048 String modType
= libClassTableModel
.getValueAt(selectedRow2
, 2).toString();
1049 ArrayList
<String
> al
= classInstanceMap
.get(new LibraryClassDescriptor(cls
, arch
, modType
));
1053 ListIterator
<String
> li
= al
.listIterator();
1054 while(li
.hasNext()) {
1055 String instance
= li
.next();
1056 String
[] s
= {"", "", "", "", ""};
1057 if (WorkspaceProfile
.getModuleId(instance
) != null) {
1058 s
[0] = WorkspaceProfile
.getModuleId(instance
).getName();
1061 String
[] instancePart
= instance
.split(" ");
1062 for (int i
= 0; i
< instancePart
.length
; ++i
){
1063 s
[i
+1] = instancePart
[i
];
1065 libInstanceTableModel
.addRow(s
);
1072 return jTableLibClass
;
1076 * This method initializes jScrollPaneQualifiedInstance
1078 * @return javax.swing.JScrollPane
1080 private JScrollPane
getJScrollPaneQualifiedInstance() {
1081 if (jScrollPaneQualifiedInstance
== null) {
1082 jScrollPaneQualifiedInstance
= new JScrollPane();
1083 jScrollPaneQualifiedInstance
.setPreferredSize(new java
.awt
.Dimension(600,170));
1084 jScrollPaneQualifiedInstance
.setViewportView(getJTableLibInstances());
1086 return jScrollPaneQualifiedInstance
;
1090 * This method initializes jTableLibInstances
1092 * @return javax.swing.JTable
1094 private JTable
getJTableLibInstances() {
1095 if (jTableLibInstances
== null) {
1096 libInstanceTableModel
= new IDefaultTableModel();
1097 libInstanceTableModel
.addColumn("Name");
1098 libInstanceTableModel
.addColumn("ModuleGUID");
1099 libInstanceTableModel
.addColumn("ModuleVersion");
1100 libInstanceTableModel
.addColumn("PackageGUID");
1101 libInstanceTableModel
.addColumn("PackageVersion");
1102 jTableLibInstances
= new JTable(libInstanceTableModel
);
1103 jTableLibInstances
.setRowHeight(20);
1105 jTableLibInstances
.getColumnModel().getColumn(0).setMinWidth(250);
1107 jTableLibInstances
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_SUBSEQUENT_COLUMNS
);
1108 jTableLibInstances
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1111 return jTableLibInstances
;
1115 * This method initializes jPanelLibrarySouth
1117 * @return javax.swing.JPanel
1119 private JPanel
getJPanelLibrarySouth() {
1120 if (jPanelLibrarySouth
== null) {
1121 jPanelLibrarySouth
= new JPanel();
1123 return jPanelLibrarySouth
;
1127 * This method initializes jPanelLibraryCenter
1129 * @return javax.swing.JPanel
1131 private JPanel
getJPanelLibraryCenter() {
1132 if (jPanelLibraryCenter
== null) {
1133 jLabelInstanceHelp
= new JLabel();
1134 jLabelInstanceHelp
.setText("Instance Description");
1135 jLabelSelectedInstances
= new JLabel();
1136 jLabelSelectedInstances
.setText("Selected Instances");
1137 jPanelLibraryCenter
= new JPanel();
1138 jPanelLibraryCenter
.setLayout(new BorderLayout());
1140 jPanelLibraryCenter
.add(getJPanelLibraryCenterC(), java
.awt
.BorderLayout
.CENTER
);
1141 jPanelLibraryCenter
.add(getJPanelLibraryCenterN(), java
.awt
.BorderLayout
.NORTH
);
1144 return jPanelLibraryCenter
;
1148 * This method initializes jScrollPaneInstanceHelp
1150 * @return javax.swing.JScrollPane
1152 private JScrollPane
getJScrollPaneInstanceHelp() {
1153 if (jScrollPaneInstanceHelp
== null) {
1154 jScrollPaneInstanceHelp
= new JScrollPane();
1155 jScrollPaneInstanceHelp
.setPreferredSize(new java
.awt
.Dimension(400,50));
1156 jScrollPaneInstanceHelp
.setViewportView(getJTextAreaInstanceHelp());
1158 return jScrollPaneInstanceHelp
;
1162 * This method initializes jTextAreaInstanceHelp
1164 * @return javax.swing.JTextArea
1166 private JTextArea
getJTextAreaInstanceHelp() {
1167 if (jTextAreaInstanceHelp
== null) {
1168 jTextAreaInstanceHelp
= new JTextArea();
1169 jTextAreaInstanceHelp
.setEditable(false);
1171 return jTextAreaInstanceHelp
;
1175 * This method initializes jButtonAdd
1177 * @return javax.swing.JButton
1179 private JButton
getJButtonAdd() {
1180 if (jButtonAdd
== null) {
1181 jButtonAdd
= new JButton();
1182 jButtonAdd
.setPreferredSize(new java
.awt
.Dimension(80,20));
1183 jButtonAdd
.setText("Add");
1184 jButtonAdd
.addActionListener(new java
.awt
.event
.ActionListener() {
1185 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1186 int row
= jTableLibInstances
.getSelectedRow();
1191 String instanceValue
= libInstanceTableModel
.getValueAt(row
, 1) + " " +
1192 libInstanceTableModel
.getValueAt(row
, 2) + " " +
1193 libInstanceTableModel
.getValueAt(row
, 3) + " " +
1194 libInstanceTableModel
.getValueAt(row
, 4);
1195 ModuleIdentification libMi
= WorkspaceProfile
.getModuleId(instanceValue
);
1197 addLibInstance (libMi
);
1199 catch (Exception exception
) {
1200 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Adding Instance " + libMi
.getName() + " : \n"+ exception
.getMessage());
1203 docConsole
.setSaved(false);
1204 Object
[] s
= {libInstanceTableModel
.getValueAt(row
, 0), libInstanceTableModel
.getValueAt(row
, 1),
1205 libInstanceTableModel
.getValueAt(row
, 2), libInstanceTableModel
.getValueAt(row
, 3),
1206 libInstanceTableModel
.getValueAt(row
, 4)};
1207 selectedInstancesTableModel
.addRow(s
);
1209 Vector
<String
> errorMsg
= new Vector
<String
>();
1211 resolveLibraryInstances(instanceValue
, errorMsg
);
1213 catch (Exception exp
) {
1214 JOptionPane
.showMessageDialog(FpdModuleSA
.this, exp
.getMessage());
1217 if (errorMsg
.size() > 0) {
1219 for (int i
= 0; i
< errorMsg
.size(); ++i
) {
1220 errors
+= " " + errorMsg
.get(i
) + "\n";
1222 JOptionPane
.showMessageDialog(FpdModuleSA
.this, errors
);
1224 showClassToResolved();
1232 * This method initializes jButton1
1234 * @return javax.swing.JButton
1236 private JButton
getJButtonDeleteInstance() {
1237 if (jButtonDeleteInstance
== null) {
1238 jButtonDeleteInstance
= new JButton();
1239 jButtonDeleteInstance
.setPreferredSize(new java
.awt
.Dimension(80,20));
1240 jButtonDeleteInstance
.setText("Delete");
1241 jButtonDeleteInstance
.addActionListener(new java
.awt
.event
.ActionListener() {
1242 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1243 int row
= jTableSelectedInstances
.getSelectedRow();
1247 docConsole
.setSaved(false);
1248 removeInstance(selectedInstancesTableModel
.getValueAt(row
, 1) + " " +
1249 selectedInstancesTableModel
.getValueAt(row
, 2) + " " +
1250 selectedInstancesTableModel
.getValueAt(row
, 3) + " " +
1251 selectedInstancesTableModel
.getValueAt(row
, 4));
1252 ffc
.removeLibraryInstance(moduleKey
, row
);
1253 selectedInstancesTableModel
.removeRow(row
);
1258 return jButtonDeleteInstance
;
1262 * This method initializes jButton2
1264 * @return javax.swing.JButton
1266 private JButton
getJButtonOk() {
1267 if (jButtonOk
== null) {
1268 jButtonOk
= new JButton();
1269 jButtonOk
.setPreferredSize(new java
.awt
.Dimension(80,20));
1270 jButtonOk
.setText("Close");
1271 jButtonOk
.addActionListener(this);
1277 * This method initializes jButton3
1279 * @return javax.swing.JButton
1281 private JButton
getJButtonCancel() {
1282 if (jButtonCancel
== null) {
1283 jButtonCancel
= new JButton();
1284 jButtonCancel
.setPreferredSize(new java
.awt
.Dimension(80,20));
1285 jButtonCancel
.setText("Cancel");
1286 jButtonCancel
.setVisible(false);
1288 return jButtonCancel
;
1290 public void actionPerformed(ActionEvent arg0
) {
1292 if (arg0
.getSource() == jButtonOk
) {
1293 if (jTableModuleSaOptions
.isEditing()) {
1294 jTableModuleSaOptions
.getCellEditor().stopCellEditing();
1296 this.setVisible(false);
1300 * This method initializes jPanelModuleSaOpts
1302 * @return javax.swing.JPanel
1304 private JPanel
getJPanelModuleSaOpts() {
1305 if (jPanelModuleSaOpts
== null) {
1306 FlowLayout flowLayout4
= new FlowLayout();
1307 flowLayout4
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1308 jLabelFfsFormatKey
= new JLabel();
1309 jLabelFfsFormatKey
.setText("FFS Format Key");
1310 jLabelFfsFormatKey
.setPreferredSize(new java
.awt
.Dimension(90,16));
1311 jLabelFfsFileGuid
= new JLabel();
1312 jLabelFfsFileGuid
.setText("FFS File GUID");
1313 jLabelFfsFileGuid
.setPreferredSize(new java
.awt
.Dimension(90,16));
1314 jLabelFfsFileGuid
.setVisible(false);
1315 jLabelFvBinding
= new JLabel();
1316 jLabelFvBinding
.setText("FV Binding");
1317 jLabelFvBinding
.setPreferredSize(new java
.awt
.Dimension(90,16));
1318 jPanelModuleSaOpts
= new JPanel();
1319 jPanelModuleSaOpts
.setLayout(flowLayout4
);
1320 jPanelModuleSaOpts
.add(jLabelFvBinding
, null);
1321 jPanelModuleSaOpts
.add(getJTextFieldFvBinding(), null);
1322 jPanelModuleSaOpts
.add(jLabelFfsFileGuid
, null);
1323 jPanelModuleSaOpts
.add(getJTextFieldFileGuid(), null);
1324 jPanelModuleSaOpts
.add(jLabelFfsFormatKey
, null);
1325 jPanelModuleSaOpts
.add(getJTextFieldFfsKey(), null);
1326 jPanelModuleSaOpts
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
1327 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
1328 initFvInfo(moduleKey
);
1332 return jPanelModuleSaOpts
;
1335 private Vector
<String
> getVectorFromString (String s
) {
1336 if (s
== null || s
.equals("null")) {
1339 String
[] sa1
= s
.split(" ");
1340 Vector
<String
> v
= new Vector
<String
>();
1341 for (int i
= 0; i
< sa1
.length
; ++i
) {
1348 * This method initializes jTextField
1350 * @return javax.swing.JTextField
1352 private JTextField
getJTextFieldFvBinding() {
1353 if (jTextFieldFvBinding
== null) {
1354 jTextFieldFvBinding
= new JTextField();
1355 jTextFieldFvBinding
.setPreferredSize(new java
.awt
.Dimension(400,20));
1356 jTextFieldFvBinding
.setEditable(true);
1357 jTextFieldFvBinding
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1358 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1359 String originalFvBinding
= ffc
.getFvBinding(moduleKey
);
1360 String newFvBinding
= jTextFieldFvBinding
.getText();
1361 if (newFvBinding
.equals(originalFvBinding
)) {
1364 if (newFvBinding
.length() == 0 && originalFvBinding
== null) {
1368 Vector
<String
> oldFvList
= getVectorFromString (originalFvBinding
);
1369 Vector
<String
> newFvList
= getVectorFromString (newFvBinding
);
1370 String moduleInfo
[] = moduleKey
.split(" ");
1371 ffc
.setFvBinding(moduleKey
, newFvBinding
);
1373 // remove module from Fvs that not in newFvList now.
1375 oldFvList
.removeAll(newFvList
);
1376 for (int j
= 0; j
< oldFvList
.size(); ++j
) {
1377 ffc
.removeModuleInBuildOptionsUserExtensions(oldFvList
.get(j
), "IMAGES", 1, moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1380 // add module to Fvs that were not in oldFvList.
1382 oldFvList
= getVectorFromString (originalFvBinding
);
1383 newFvList
.removeAll(oldFvList
);
1384 for (int i
= 0; i
< newFvList
.size(); ++i
) {
1385 ffc
.addModuleIntoBuildOptionsUserExtensions(newFvList
.get(i
), "IMAGES", 1, moduleInfo
[0], moduleInfo
[1], moduleInfo
[2], moduleInfo
[3], moduleInfo
[4]);
1387 docConsole
.setSaved(false);
1392 return jTextFieldFvBinding
;
1395 * This method initializes jTextField1
1397 * @return javax.swing.JTextField
1399 private JTextField
getJTextFieldFileGuid() {
1400 if (jTextFieldFileGuid
== null) {
1401 jTextFieldFileGuid
= new JTextField();
1402 jTextFieldFileGuid
.setPreferredSize(new java
.awt
.Dimension(300,20));
1403 jTextFieldFileGuid
.setVisible(false);
1404 jTextFieldFileGuid
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1405 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1406 String originalFileGuid
= ffc
.getFfsFileNameGuid(moduleKey
);
1407 String newFileGuid
= jTextFieldFileGuid
.getText();
1408 if (newFileGuid
.equals(originalFileGuid
)) {
1411 if (newFileGuid
.length() == 0 && originalFileGuid
== null) {
1414 if (newFileGuid
.length() > 0) {
1415 if (!DataValidation
.isGuid(newFileGuid
)) {
1416 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "FFS File Guid is NOT GUID Type.");
1421 docConsole
.setSaved(false);
1422 if (newFileGuid
.length() == 0) {
1425 ffc
.setFfsFileNameGuid(moduleKey
, newFileGuid
);
1430 return jTextFieldFileGuid
;
1433 * This method initializes jTextFieldFfsKey
1435 * @return javax.swing.JTextField
1437 private JTextField
getJTextFieldFfsKey() {
1438 if (jTextFieldFfsKey
== null) {
1439 jTextFieldFfsKey
= new JTextField();
1440 jTextFieldFfsKey
.setPreferredSize(new java
.awt
.Dimension(250,20));
1441 jTextFieldFfsKey
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1442 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1443 String originalFfsKey
= ffc
.getFfsFormatKey(moduleKey
);
1444 String newFfsKey
= jTextFieldFfsKey
.getText();
1445 if (newFfsKey
.equals(originalFfsKey
)) {
1448 if (newFfsKey
.length() == 0 && originalFfsKey
== null) {
1451 docConsole
.setSaved(false);
1452 ffc
.setFfsFormatKey(moduleKey
, newFfsKey
);
1457 return jTextFieldFfsKey
;
1460 * This method initializes jScrollPaneModuleSaOptions
1462 * @return javax.swing.JScrollPane
1464 private JScrollPane
getJScrollPaneModuleSaOptions() {
1465 if (jScrollPaneModuleSaOptions
== null) {
1466 jScrollPaneModuleSaOptions
= new JScrollPane();
1467 jScrollPaneModuleSaOptions
.setPreferredSize(new java
.awt
.Dimension(600,350));
1468 jScrollPaneModuleSaOptions
.setViewportView(getJTableModuleSaOptions());
1470 return jScrollPaneModuleSaOptions
;
1473 * This method initializes jTableModuleSaOptions
1475 * @return javax.swing.JTable
1477 private JTable
getJTableModuleSaOptions() {
1478 if (jTableModuleSaOptions
== null) {
1479 optionsTableModel
= new DefaultTableModel();
1480 optionsTableModel
.addColumn("BuildTargets");
1481 optionsTableModel
.addColumn("ToolChainFamily");
1482 optionsTableModel
.addColumn("TagName");
1483 optionsTableModel
.addColumn("ToolCode");
1484 optionsTableModel
.addColumn("SupportedArchs");
1485 optionsTableModel
.addColumn("Contents");
1486 jTableModuleSaOptions
= new JTable(optionsTableModel
);
1487 jTableModuleSaOptions
.setRowHeight(20);
1489 jTableModuleSaOptions
.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth
);
1490 jTableModuleSaOptions
.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth
);
1491 jTableModuleSaOptions
.getColumnModel().getColumn(2).setMinWidth(tagNameWidth
);
1492 jTableModuleSaOptions
.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth
);
1493 jTableModuleSaOptions
.getColumnModel().getColumn(4).setMinWidth(supportArchWidth
);
1494 jTableModuleSaOptions
.getColumnModel().getColumn(5).setMinWidth(argWidth
);
1495 // javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
1496 // JComboBox cb = new JComboBox();
1497 // cb.addItem("MSFT");
1498 // cb.addItem("GCC");
1499 // cb.addItem("CYGWIN");
1500 // cb.addItem("INTEL");
1501 // cb.addItem("USER_DEFINED");
1502 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1504 Vector
<String
> vArch
= new Vector
<String
>();
1511 jTableModuleSaOptions
.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch
, FrameworkWizardUI
.getInstance()));
1513 jTableModuleSaOptions
.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI
.getInstance()));
1515 jTableModuleSaOptions
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1516 jTableModuleSaOptions
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
1517 jTableModuleSaOptions
.getModel().addTableModelListener(new TableModelListener() {
1518 public void tableChanged(TableModelEvent arg0
) {
1519 // TODO Auto-generated method stub
1520 int row
= arg0
.getFirstRow();
1521 TableModel m
= (TableModel
)arg0
.getSource();
1523 if (arg0
.getType() == TableModelEvent
.UPDATE
){
1524 //ToDo Data Validition check.
1525 String targets
= m
.getValueAt(row
, 0) + "";
1526 Vector
<Object
> targetName
= null;
1527 if (targets
.length() > 0) {
1528 targetName
= new Vector
<Object
>();
1529 String
[] sArray
= targets
.split(" ");
1530 for (int i
= 0; i
< sArray
.length
; ++i
) {
1531 targetName
.add(sArray
[i
]);
1535 String toolChain
= m
.getValueAt(row
, 1) + "";
1536 String tagName
= m
.getValueAt(row
, 2) + "";
1537 String toolCode
= m
.getValueAt(row
, 3) + "";
1538 String archs
= m
.getValueAt(row
, 4) + "";
1539 Vector
<Object
> supArch
= null;
1540 if (archs
.length() > 0) {
1541 supArch
= new Vector
<Object
>();
1542 String
[] sArray1
= archs
.split(" ");
1543 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1544 supArch
.add(sArray1
[i
]);
1548 String contents
= m
.getValueAt(row
, 5) + "";
1549 docConsole
.setSaved(false);
1550 ffc
.updateModuleSAOptionsOpt(moduleKey
, row
, targetName
, toolChain
, tagName
, toolCode
, supArch
, contents
);
1555 return jTableModuleSaOptions
;
1558 * This method initializes jButtonNew
1560 * @return javax.swing.JButton
1562 private JButton
getJButtonNew() {
1563 if (jButtonNew
== null) {
1564 jButtonNew
= new JButton();
1565 jButtonNew
.setPreferredSize(new java
.awt
.Dimension(80,20));
1566 jButtonNew
.setText("New");
1567 jButtonNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1568 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1569 String
[] row
= {"", "", "", "", "", ""};
1570 optionsTableModel
.addRow(row
);
1571 Vector
<Object
> v
= null;
1572 Vector
<Object
> v1
= null;
1573 docConsole
.setSaved(false);
1574 ffc
.genModuleSAOptionsOpt(moduleKey
, v
, "", "", "", v1
, "");
1581 * This method initializes jButtonDelete
1583 * @return javax.swing.JButton
1585 private JButton
getJButtonDeleteOption() {
1586 if (jButtonDeleteOption
== null) {
1587 jButtonDeleteOption
= new JButton();
1588 jButtonDeleteOption
.setPreferredSize(new java
.awt
.Dimension(80,20));
1589 jButtonDeleteOption
.setText("Delete");
1590 jButtonDeleteOption
.addActionListener(new java
.awt
.event
.ActionListener() {
1591 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1592 if (jTableModuleSaOptions
.getSelectedRow() < 0) {
1595 docConsole
.setSaved(false);
1596 ffc
.removeModuleSAOptionsOpt(moduleKey
, jTableModuleSaOptions
.getSelectedRow());
1597 optionsTableModel
.removeRow(jTableModuleSaOptions
.getSelectedRow());
1601 return jButtonDeleteOption
;
1605 Start the window at the center of screen
1608 protected void centerWindow(int intWidth
, int intHeight
) {
1609 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
1610 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
1614 Start the window at the center of screen
1617 protected void centerWindow() {
1618 centerWindow(this.getSize().width
, this.getSize().height
);
1621 * This method initializes jPanelPcdFields
1623 * @return javax.swing.JPanel
1625 private JPanel
getJPanelPcdFields() {
1626 if (jPanelPcdFields
== null) {
1627 GridLayout gridLayout
= new GridLayout();
1628 gridLayout
.setRows(3);
1629 gridLayout
.setColumns(2);
1630 jPanelPcdFields
= new JPanel();
1631 jPanelPcdFields
.setLayout(gridLayout
);
1632 jPanelPcdFields
.setPreferredSize(new java
.awt
.Dimension(600,90));
1633 jPanelPcdFields
.add(getJPanelPcdFieldsFirstRow(), null);
1634 jPanelPcdFields
.add(getJPanelPcdFieldsSecondRow(), null);
1635 jPanelPcdFields
.add(getJPanelPcdFieldsThirdRow(), null);
1637 return jPanelPcdFields
;
1640 * This method initializes jPanelPcdFieldsSecondRow
1642 * @return javax.swing.JPanel
1644 private JPanel
getJPanelPcdFieldsSecondRow() {
1645 if (jPanelPcdFieldsSecondRow
== null) {
1646 FlowLayout flowLayout2
= new FlowLayout();
1647 flowLayout2
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1648 jLabelMaxDatumSize
= new JLabel();
1649 jLabelMaxDatumSize
.setText("Max Datum Size");
1650 jPanelPcdFieldsSecondRow
= new JPanel();
1651 jPanelPcdFieldsSecondRow
.setLayout(flowLayout2
);
1652 jPanelPcdFieldsSecondRow
.add(jLabelMaxDatumSize
, null);
1653 jPanelPcdFieldsSecondRow
.add(getJTextFieldMaxDatumSize(), null);
1655 return jPanelPcdFieldsSecondRow
;
1658 * This method initializes jPanelPcdFieldsThirdRow
1660 * @return javax.swing.JPanel
1662 private JPanel
getJPanelPcdFieldsThirdRow() {
1663 if (jPanelPcdFieldsThirdRow
== null) {
1664 FlowLayout flowLayout3
= new FlowLayout();
1665 flowLayout3
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1666 jLabelPcdDefaultValue
= new JLabel();
1667 jLabelPcdDefaultValue
.setText("Default Value");
1668 jLabelPcdDefaultValue
.setPreferredSize(new java
.awt
.Dimension(91,16));
1669 jPanelPcdFieldsThirdRow
= new JPanel();
1670 jPanelPcdFieldsThirdRow
.setLayout(flowLayout3
);
1671 jPanelPcdFieldsThirdRow
.add(jLabelPcdDefaultValue
, null);
1672 jPanelPcdFieldsThirdRow
.add(getJTextFieldPcdDefault(), null);
1673 jPanelPcdFieldsThirdRow
.add(getJComboBoxFeatureFlagValue(), null);
1674 jPanelPcdFieldsThirdRow
.add(getJButtonUpdatePcd(), null);
1676 return jPanelPcdFieldsThirdRow
;
1679 * This method initializes jPanelPcdFieldsFirstRow
1681 * @return javax.swing.JPanel
1683 private JPanel
getJPanelPcdFieldsFirstRow() {
1684 if (jPanelPcdFieldsFirstRow
== null) {
1685 FlowLayout flowLayout1
= new FlowLayout();
1686 flowLayout1
.setAlignment(java
.awt
.FlowLayout
.LEFT
);
1687 jLabelItemType
= new JLabel();
1688 jLabelItemType
.setText("Item Type");
1689 jLabelItemType
.setPreferredSize(new java
.awt
.Dimension(91,16));
1690 jPanelPcdFieldsFirstRow
= new JPanel();
1691 jPanelPcdFieldsFirstRow
.setLayout(flowLayout1
);
1692 jPanelPcdFieldsFirstRow
.add(jLabelItemType
, null);
1693 jPanelPcdFieldsFirstRow
.add(getJComboBoxItemType(), null);
1695 return jPanelPcdFieldsFirstRow
;
1698 * This method initializes jComboBoxItemType
1700 * @return javax.swing.JComboBox
1702 private JComboBox
getJComboBoxItemType() {
1703 if (jComboBoxItemType
== null) {
1704 jComboBoxItemType
= new JComboBox();
1705 jComboBoxItemType
.setPreferredSize(new java
.awt
.Dimension(200,20));
1706 jComboBoxItemType
.addItemListener(new java
.awt
.event
.ItemListener() {
1707 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
1709 int row
= jTablePcd
.getSelectedRow();
1714 if (jComboBoxItemType
.getSelectedItem() != null && jComboBoxItemType
.getSelectedItem().equals("FIXED_AT_BUILD")) {
1715 jTextFieldPcdDefault
.setEnabled(true);
1718 jTextFieldPcdDefault
.setEnabled(false);
1723 return jComboBoxItemType
;
1726 private void pcdDynamicToNonDynamic(String cName
, String tsGuid
) {
1727 String
[][] saa
= new String
[ffc
.getDynamicPcdBuildDataCount()][5];
1728 ffc
.getDynamicPcdBuildData(saa
);
1729 String maxSize
= "";
1731 for (int i
= 0; i
< saa
.length
; ++i
) {
1732 if (saa
[i
][0].equals(cName
) && saa
[i
][2].equals(tsGuid
)) {
1733 maxSize
= saa
[i
][3];
1734 value
= ffc
.getDynamicPcdBuildDataValue(i
);
1739 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1740 for (int i
= 0; i
< al
.size(); ++i
) {
1741 String mKey
= moduleInfo (al
.get(i
));
1743 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1744 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, maxSize
, value
);
1745 al
.set(i
, mKey
+ " " + itemType
);
1748 ffc
.removeDynamicPcdBuildData(cName
, tsGuid
);
1751 private void pcdNonDynamicToDynamic(String cName
, String tsGuid
) {
1752 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1753 for (int i
= 0; i
< al
.size(); ++i
) {
1754 String mKey
= moduleInfo (al
.get(i
));
1755 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1756 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, jTextFieldMaxDatumSize
.getText(), jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1757 al
.set(i
, mKey
+ " " + itemType
);
1760 ffc
.addDynamicPcdBuildData(cName
, model
.getValueAt(jTablePcd
.getSelectedRow(), 3), tsGuid
, "DYNAMIC", model
.getValueAt(jTablePcd
.getSelectedRow(), 5)+"", jTextFieldPcdDefault
.isVisible() ? jTextFieldPcdDefault
.getText() : jComboBoxFeatureFlagValue
.getSelectedItem()+"");
1763 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD value format: " + e
.getMessage());
1767 private void changePcdTypeWithinSameCategory (String cName
, String tsGuid
) {
1768 ArrayList
<String
> al
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1769 for (int i
= 0; i
< al
.size(); ++i
) {
1770 String mKey
= moduleInfo (al
.get(i
));
1771 String itemType
= jComboBoxItemType
.getSelectedItem()+"";
1772 ffc
.updatePcdData(mKey
, cName
, tsGuid
, itemType
, null, null);
1773 al
.set(i
, mKey
+ " " + itemType
);
1777 private String
moduleInfo (String pcdInfo
) {
1779 return pcdInfo
.substring(0, pcdInfo
.lastIndexOf(" "));
1783 * This method initializes jTextFieldMaxDatumSize
1785 * @return javax.swing.JTextField
1787 private JTextField
getJTextFieldMaxDatumSize() {
1788 if (jTextFieldMaxDatumSize
== null) {
1789 jTextFieldMaxDatumSize
= new JTextField();
1790 jTextFieldMaxDatumSize
.setPreferredSize(new java
.awt
.Dimension(200,20));
1792 return jTextFieldMaxDatumSize
;
1795 * This method initializes jTextField4
1797 * @return javax.swing.JTextField
1799 private JTextField
getJTextFieldPcdDefault() {
1800 if (jTextFieldPcdDefault
== null) {
1801 jTextFieldPcdDefault
= new JTextField();
1802 jTextFieldPcdDefault
.setPreferredSize(new java
.awt
.Dimension(200,20));
1804 return jTextFieldPcdDefault
;
1807 * This method initializes jButton6
1809 * @return javax.swing.JButton
1811 private JButton
getJButtonUpdatePcd() {
1812 if (jButtonUpdatePcd
== null) {
1813 jButtonUpdatePcd
= new JButton();
1814 jButtonUpdatePcd
.setPreferredSize(new java
.awt
.Dimension(150,20));
1815 jButtonUpdatePcd
.setText("Update PCD Data");
1816 jButtonUpdatePcd
.addActionListener(new java
.awt
.event
.ActionListener() {
1817 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1818 int row
= jTablePcd
.getSelectedRow();
1823 String cName
= model
.getValueAt(row
, 0)+"";
1824 String tsGuid
= model
.getValueAt(row
, 1)+"";
1825 String oldItemType
= model
.getValueAt(row
, 2)+"";
1826 String dataType
= model
.getValueAt(row
, 5)+"";
1827 String newItemType
= jComboBoxItemType
.getSelectedItem()+"";
1828 String newValue
= jTextFieldPcdDefault
.isVisible()? jTextFieldPcdDefault
.getText():jComboBoxFeatureFlagValue
.getSelectedItem()+"";
1829 if (newValue
.length() == 0){
1831 if (dataType
.equals("UINT8") || dataType
.equals("UINT16") || dataType
.equals("UINT32") || dataType
.equals("UINT64")) {
1834 if (dataType
.equals("BOOLEAN")){
1837 if (dataType
.equals("VOID*")) {
1842 String
[] pcdInfo
= {"", "", ""};
1843 Vector
<String
> validPcdTypes
= new Vector
<String
>();
1844 getPcdInfo (moduleKey
, cName
, tsGuid
, pcdInfo
, validPcdTypes
);
1845 if (pcdInfo
[1].equals("FIXED_AT_BUILD") && model
.getValueAt(row
, 5).equals("VOID*")) {
1847 jTextFieldMaxDatumSize
.setText(ffc
.setMaxSizeForPointer(newValue
)+"");
1849 catch (Exception exp
) {
1850 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "PCD Value MalFormed: " + exp
.getMessage());
1854 String newMaxDatumSize
= jTextFieldMaxDatumSize
.getText();
1856 if (!newItemType
.equals(oldItemType
)) {
1857 Vector
<ModuleIdentification
> moduleInfo
= new Vector
<ModuleIdentification
>();
1859 boolean changable
= itemTypeCouldBeChanged (cName
, tsGuid
, newItemType
, moduleInfo
);
1861 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName());
1865 catch (Exception exp
) {
1866 JOptionPane
.showMessageDialog(FpdModuleSA
.this, "Can NOT Change Pcd Type in: " + moduleInfo
.get(0).getName() + " contained in package " + moduleInfo
.get(0).getPackageId().getName() + " " + exp
.getMessage());
1870 if ((oldItemType
.equals("DYNAMIC") || oldItemType
.equals("DYNAMIC_EX")) && !newItemType
.equals("DYNAMIC") && !newItemType
.equals("DYNAMIC_EX")) {
1871 pcdDynamicToNonDynamic(cName
, tsGuid
);
1873 if (!oldItemType
.equals("DYNAMIC") && !oldItemType
.equals("DYNAMIC_EX") && (newItemType
.equals("DYNAMIC") || newItemType
.equals("DYNAMIC_EX"))) {
1874 pcdNonDynamicToDynamic(cName
, tsGuid
);
1877 changePcdTypeWithinSameCategory (cName
, tsGuid
);
1879 model
.setValueAt(newItemType
, row
, 2);
1882 ffc
.updatePcdData(moduleKey
, cName
, tsGuid
, model
.getValueAt(row
, 2)+"", newMaxDatumSize
, newValue
);
1883 docConsole
.setSaved(false);
1884 model
.setValueAt(newValue
, row
, 6);
1885 model
.setValueAt(newMaxDatumSize
, row
, 4);
1890 return jButtonUpdatePcd
;
1893 private boolean itemTypeCouldBeChanged (String cName
, String tsGuid
, String newItemType
, Vector
<ModuleIdentification
> mi
) throws Exception
{
1894 ArrayList
<String
> pcdConsumers
= ffc
.getDynPcdMapValue(cName
+ " " + tsGuid
);
1895 for (int i
= 0; i
< pcdConsumers
.size(); ++i
) {
1896 String consumerInfo
= moduleInfo (pcdConsumers
.get(i
));
1897 mi
.removeAllElements();
1898 mi
.add(WorkspaceProfile
.getModuleId(consumerInfo
));
1899 String
[] sa
= {"", "", ""};
1900 Vector
<String
> validPcdTypes
= new Vector
<String
>();
1901 getPcdInfo (consumerInfo
, cName
, tsGuid
, sa
, validPcdTypes
);
1902 if (validPcdTypes
.size() == 0) {
1905 if (!sa
[1].equals("DYNAMIC")) {
1908 if (!validPcdTypes
.contains(newItemType
)) {
1916 * This method initializes jComboBoxFeatureFlagValue
1918 * @return javax.swing.JComboBox
1920 private JComboBox
getJComboBoxFeatureFlagValue() {
1921 if (jComboBoxFeatureFlagValue
== null) {
1922 jComboBoxFeatureFlagValue
= new JComboBox();
1923 jComboBoxFeatureFlagValue
.setPreferredSize(new java
.awt
.Dimension(100,20));
1924 jComboBoxFeatureFlagValue
.setVisible(false);
1925 jComboBoxFeatureFlagValue
.addItem("TRUE");
1926 jComboBoxFeatureFlagValue
.addItem("FALSE");
1928 return jComboBoxFeatureFlagValue
;
1931 * This method initializes jPanelCustomToolChain
1933 * @return javax.swing.JPanel
1935 private JPanel
getJPanelCustomToolChain() {
1936 if (jPanelCustomToolChain
== null) {
1937 jPanelCustomToolChain
= new JPanel();
1938 jPanelCustomToolChain
.setLayout(new BorderLayout());
1939 jPanelCustomToolChain
.add(getJPanelToolchainS(), java
.awt
.BorderLayout
.SOUTH
);
1940 jPanelCustomToolChain
.add(getJScrollPaneModuleSaOptions(), java
.awt
.BorderLayout
.CENTER
);
1941 jPanelCustomToolChain
.addComponentListener(new java
.awt
.event
.ComponentAdapter() {
1942 public void componentShown(java
.awt
.event
.ComponentEvent e
) {
1943 initToolChainOptions(moduleKey
);
1947 return jPanelCustomToolChain
;
1950 * This method initializes jPanelToolchainS
1952 * @return javax.swing.JPanel
1954 private JPanel
getJPanelToolchainS() {
1955 if (jPanelToolchainS
== null) {
1956 jPanelToolchainS
= new JPanel();
1957 jPanelToolchainS
.add(getJButtonNew(), null);
1958 jPanelToolchainS
.add(getJButtonDeleteOption(), null);
1960 return jPanelToolchainS
;
1964 * This method initializes jPanelLibraryCenterN
1966 * @return javax.swing.JPanel
1968 private JPanel
getJPanelLibraryCenterN() {
1969 if (jPanelLibraryCenterN
== null) {
1970 FlowLayout flowLayout5
= new FlowLayout();
1971 flowLayout5
.setAlignment(java
.awt
.FlowLayout
.CENTER
);
1972 flowLayout5
.setHgap(10);
1973 jPanelLibraryCenterN
= new JPanel();
1974 jPanelLibraryCenterN
.setLayout(flowLayout5
);
1975 jPanelLibraryCenterN
.add(jLabelInstanceHelp
, null);
1976 jPanelLibraryCenterN
.add(getJScrollPaneInstanceHelp(), null);
1977 jPanelLibraryCenterN
.add(getJButtonAdd(), null);
1978 jPanelLibraryCenterN
.add(getJButtonDeleteInstance(), null);
1980 return jPanelLibraryCenterN
;
1983 * This method initializes jPanelLibraryCenterC
1985 * @return javax.swing.JPanel
1987 private JPanel
getJPanelLibraryCenterC() {
1988 if (jPanelLibraryCenterC
== null) {
1989 jPanelLibraryCenterC
= new JPanel();
1990 jPanelLibraryCenterC
.add(jLabelSelectedInstances
, null);
1991 jPanelLibraryCenterC
.add(getJScrollPaneSelectedInstances(), null);
1993 return jPanelLibraryCenterC
;
1997 } // @jve:decl-index=0:visual-constraint="10,10"
1999 class MultipleInstanceException
extends Exception
{
2004 private static final long serialVersionUID
= -9148463005930920297L;
2005 private String className
= null;
2006 private String libInstance1
= null;
2007 private String libInstance2
= null;
2009 MultipleInstanceException (String libClass
, String instance1
, String instance2
) {
2011 className
= libClass
;
2012 libInstance1
= instance1
;
2013 libInstance2
= instance2
;
2017 * @see java.lang.Throwable#getMessage()
2020 public String
getMessage() {
2021 // TODO Auto-generated method stub
2022 return " Library Class " + className
+ "is Produced by Two Instances: "
2023 + libInstance1
+ " and " + libInstance2
+ ". Platform Build will Fail.";
2028 class NoInstanceException
extends Exception
{
2033 private static final long serialVersionUID
= 1987122786598970598L;
2035 private String className
= null;
2037 NoInstanceException (String libClass
) {
2038 className
= libClass
;
2041 public String
getMessage() {
2042 return "No Applicable Instance for Library Class " + className
2043 + ", Platform Build will Fail.";