3 The file is used to create, update FrameworkModules of Fpd file
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.platform
.ui
;
17 import java
.awt
.BorderLayout
;
19 import javax
.swing
.JFrame
;
20 import javax
.swing
.JOptionPane
;
21 import javax
.swing
.JPanel
;
22 import javax
.swing
.JSplitPane
;
23 import javax
.swing
.JLabel
;
24 import javax
.swing
.JScrollPane
;
25 import javax
.swing
.JTable
;
26 import javax
.swing
.JButton
;
27 import javax
.swing
.ListSelectionModel
;
28 import javax
.swing
.event
.TableModelEvent
;
29 import javax
.swing
.table
.DefaultTableModel
;
30 import javax
.swing
.table
.TableModel
;
32 import org
.tianocore
.PlatformSurfaceAreaDocument
;
33 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformType
;
34 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
35 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.WorkspaceProfile
;
36 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.ModuleIdentification
;
37 import org
.tianocore
.frameworkwizard
.platform
.ui
.id
.PackageIdentification
;
39 import java
.awt
.FlowLayout
;
41 import java
.util
.ArrayList
;
42 import java
.util
.HashMap
;
43 import java
.util
.Iterator
;
46 import java
.util
.Vector
;
48 public class FpdFrameworkModules
extends IInternalFrame
{
53 private static final long serialVersionUID
= 1L;
55 public static final int forceDbgColForFpdModTable
= 7;
59 private JSplitPane jSplitPane
= null;
61 private JPanel jPanelTop
= null;
63 private JPanel jPanelBottom
= null;
65 private JLabel jLabel
= null;
67 private JScrollPane jScrollPaneAllModules
= null;
69 private JTable jTableAllModules
= null;
71 private JPanel jPanelTopSouth
= null;
73 private JButton jButtonAddModule
= null;
75 private JLabel jLabelModulesAdded
= null;
77 private JPanel jPanelBottomSouth
= null;
79 private JScrollPane jScrollPaneFpdModules
= null;
81 private JTable jTableFpdModules
= null;
83 private JButton jButtonSettings
= null;
85 private JButton jButtonRemoveModule
= null;
87 private NonEditableTableModel modelAllModules
= null;
89 private FpdModulesTableModel modelFpdModules
= null;
91 private FpdModuleSA settingDlg
= null;
93 private FpdFileContents ffc
= null;
95 private OpeningPlatformType docConsole
= null;
97 private Map
<String
, ArrayList
<String
>> fpdMsa
= null;
99 private ArrayList
<ModuleIdentification
> miList
= null;
102 * Column settings for displaying all modules in workspace
104 private final int modNameColForAllModTable
= 0;
106 private final int pkgNameColForAllModTable
= 1;
108 private final int pathColForAllModTable
= 2;
110 private final int typeColForAllModTable
= 3;
112 private final int pkgVerColForAllModTable
= 5;
114 private final int modVerColForAllModTable
= 4;
117 * Column settings for display modules in the FPD file
119 private final int modNameColForFpdModTable
= 0;
121 private final int pkgNameColForFpdModTable
= 1;
123 private final int pathColForFpdModTable
= 2;
125 private final int archColForFpdModTable
= 3;
127 private final int pkgVerColForFpdModTable
= 6;
129 private final int modVerColForFpdModTable
= 5;
131 private final int typeColForFpdModTable
= 4;
134 * FpdFileContents structure
136 private final int ffcModGuid
= 0;
138 private final int ffcModVer
= 1;
140 private final int ffcPkgGuid
= 2;
142 private final int ffcPkgVer
= 3;
144 private final int ffcModArch
= 4;
147 * Set Column Widths, Only the PATH should not have a max width.
149 private final int modNameMinWidth
= 168;
151 private final int modNamePrefWidth
= 200;
153 private final int modNameMaxWidth
= 350;
155 private final int pkgNameMinWidth
= 100;
157 private final int pkgNamePrefWidth
= 130;
159 private final int pkgNameMaxWidth
= 150;
161 private final int verMinWidth
= 60;
163 private final int verMaxWidth
= 80;
165 private final int verPrefWidth
= 70;
167 private final int pathPrefWidth
= 600;
169 private final int pathMinWidth
= 280;
171 private final int archPrefWidth
= 80;
173 private final int archMinWidth
= 60;
175 private final int archMaxWidth
= 100;
177 private final int typePrefWidth
= 145;
179 private final int typeMinWidth
= 100;
181 private final int typeMaxWidth
= 155;
184 * This method initializes jSplitPane
186 * This is the main edit window
188 * @return javax.swing.JSplitPane jSplitPane
190 private JSplitPane
getJSplitPane() {
191 if (jSplitPane
== null) {
192 jSplitPane
= new JSplitPane();
193 jSplitPane
.setOrientation(javax
.swing
.JSplitPane
.VERTICAL_SPLIT
);
194 jSplitPane
.setDividerLocation(250);
195 jSplitPane
.setBottomComponent(getJPanelBottom());
196 jSplitPane
.setTopComponent(getJPanelTop());
202 * This method initializes jPanelTop
204 * This panel contains the All Modules Table
206 * @return javax.swing.JPanel jPanelTop
208 private JPanel
getJPanelTop() {
209 if (jPanelTop
== null) {
210 jLabel
= new JLabel();
211 jLabel
.setText("Modules in Workspace");
212 jPanelTop
= new JPanel();
213 jPanelTop
.setLayout(new BorderLayout());
214 jPanelTop
.add(jLabel
, java
.awt
.BorderLayout
.NORTH
);
215 jPanelTop
.add(getJScrollPaneAllModules(), java
.awt
.BorderLayout
.CENTER
);
216 jPanelTop
.add(getJPanelTopSouth(), java
.awt
.BorderLayout
.SOUTH
);
222 * This method initializes jPanelBottom
224 * This panel contains the FPD Modules Table
226 * @return javax.swing.JPanel jPanelBottom
228 private JPanel
getJPanelBottom() {
229 if (jPanelBottom
== null) {
230 jLabelModulesAdded
= new JLabel();
231 jLabelModulesAdded
.setText("Modules Added");
232 jPanelBottom
= new JPanel();
233 jPanelBottom
.setLayout(new BorderLayout());
234 jPanelBottom
.add(jLabelModulesAdded
, java
.awt
.BorderLayout
.NORTH
);
235 jPanelBottom
.add(getJPanelBottomSouth(), java
.awt
.BorderLayout
.SOUTH
);
236 jPanelBottom
.add(getJScrollPaneFpdModules(), java
.awt
.BorderLayout
.CENTER
);
242 * This method initializes jScrollPaneAllModules
244 * @return javax.swing.JScrollPane jScrollPaneAllModules
246 private JScrollPane
getJScrollPaneAllModules() {
247 if (jScrollPaneAllModules
== null) {
248 jScrollPaneAllModules
= new JScrollPane();
249 jScrollPaneAllModules
.setPreferredSize(new java
.awt
.Dimension(600, 200));
250 jScrollPaneAllModules
.setViewportView(getJTableAllModules());
252 return jScrollPaneAllModules
;
256 * This method initializes jTableAllModules
258 * @return javax.swing.JTable jTableAllModules
260 private JTable
getJTableAllModules() {
261 if (jTableAllModules
== null) {
262 modelAllModules
= new NonEditableTableModel();
263 TableSorter sorter
= new TableSorter(modelAllModules
);
264 jTableAllModules
= new JTable(sorter
);
265 sorter
.setTableHeader(jTableAllModules
.getTableHeader());
266 jTableAllModules
.setRowHeight(20);
267 modelAllModules
.addColumn("<html>Module<br>Name</html>");
268 modelAllModules
.addColumn("<html>Package<br>Name</html>");
269 modelAllModules
.addColumn("Path");
270 modelAllModules
.addColumn("<html>Module<br>Type</html>");
271 modelAllModules
.addColumn("<html>Module<br>Version</html>");
272 modelAllModules
.addColumn("<html>Package<br>Version</html>");
274 javax
.swing
.table
.TableColumn column
= null;
275 column
= jTableAllModules
.getColumnModel().getColumn(modNameColForAllModTable
);
276 column
.setPreferredWidth(modNamePrefWidth
);
277 column
.setMinWidth(modNameMinWidth
);
278 column
.setMaxWidth(modNameMaxWidth
);
279 column
= jTableAllModules
.getColumnModel().getColumn(modVerColForAllModTable
);
280 column
.setPreferredWidth(verPrefWidth
);
281 column
.setMaxWidth(verMaxWidth
);
282 column
.setMinWidth(verMinWidth
);
283 column
= jTableAllModules
.getColumnModel().getColumn(pkgNameColForAllModTable
);
284 column
.setPreferredWidth(pkgNamePrefWidth
);
285 column
.setMinWidth(pkgNameMinWidth
);
286 column
.setMaxWidth(pkgNameMaxWidth
);
287 column
= jTableAllModules
.getColumnModel().getColumn(pkgVerColForAllModTable
);
288 column
.setPreferredWidth(verPrefWidth
);
289 column
.setMaxWidth(verMaxWidth
);
290 column
.setMinWidth(verMinWidth
);
291 column
= jTableAllModules
.getColumnModel().getColumn(typeColForAllModTable
);
292 column
.setPreferredWidth(typePrefWidth
);
293 column
.setMaxWidth(typeMaxWidth
);
294 column
.setMinWidth(typeMinWidth
);
295 column
= jTableAllModules
.getColumnModel().getColumn(pathColForAllModTable
);
296 column
.setPreferredWidth(pathPrefWidth
);
297 column
.setMinWidth(pathMinWidth
);
299 jTableAllModules
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
300 jTableAllModules
.setAutoResizeMode(JTable
.AUTO_RESIZE_OFF
);
303 return jTableAllModules
;
307 * This method initializes jPanelTopSouth
309 * This panel contains the ADD button
311 * @return javax.swing.JPanel jPanelTopSouth
313 private JPanel
getJPanelTopSouth() {
314 if (jPanelTopSouth
== null) {
315 FlowLayout flowLayout
= new FlowLayout();
316 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
317 jPanelTopSouth
= new JPanel();
318 jPanelTopSouth
.setLayout(flowLayout
);
319 jPanelTopSouth
.add(getJButtonAddModule(), null);
321 return jPanelTopSouth
;
325 * This method initializes jButtonAddModule
327 * @return javax.swing.JButton jButtonAddModule
329 private JButton
getJButtonAddModule() {
330 if (jButtonAddModule
== null) {
331 jButtonAddModule
= new JButton();
332 jButtonAddModule
.setPreferredSize(new java
.awt
.Dimension(130, 20));
333 jButtonAddModule
.setText("Add a Module");
334 jButtonAddModule
.addActionListener(new java
.awt
.event
.ActionListener() {
335 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
336 int selectedRow
= jTableAllModules
.getSelectedRow();
337 if (selectedRow
< 0) {
341 TableSorter sorter
= (TableSorter
) jTableAllModules
.getModel();
342 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
343 String path
= modelAllModules
.getValueAt(selectedRow
, pathColForAllModTable
) + "";
344 ModuleIdentification mi
= miList
.get(selectedRow
);
345 Vector
<String
> vArchs
= null;
347 vArchs
= WorkspaceProfile
.getModuleSupArchs(mi
);
349 catch (Exception exp
) {
350 JOptionPane
.showMessageDialog(frame
, exp
.getMessage());
353 if (vArchs
== null) {
354 JOptionPane
.showMessageDialog(frame
, "No Supported Architectures specified in MSA file.");
358 String archsAdded
= "";
359 String mg
= mi
.getGuid();
360 String mv
= mi
.getVersion();
361 String pg
= mi
.getPackage().getGuid();
362 String pv
= mi
.getPackage().getVersion();
363 String mType
= mi
.getModuleType();
365 ArrayList
<String
> al
= fpdMsa
.get(mg
+ mv
+ pg
+ pv
);
368 // if existing ModuleSA does not specify version info.
370 al
= fpdMsa
.get(mg
+ "null" + pg
+ "null");
372 al
= fpdMsa
.get(mg
+ "null" + pg
+ pv
);
374 al
= fpdMsa
.get(mg
+ mv
+ pg
+ "null");
376 al
= new ArrayList
<String
>();
377 fpdMsa
.put(mg
+ mv
+ pg
+ pv
, al
);
383 // filter from module SupArchs what archs has been added.
385 for (int i
= 0; i
< al
.size(); ++i
) {
386 vArchs
.remove(al
.get(i
));
389 // check whether archs conform to SupArch of platform.
391 Vector
<Object
> platformSupArch
= new Vector
<Object
>();
392 ffc
.getPlatformDefsSupportedArchs(platformSupArch
);
393 vArchs
.retainAll(platformSupArch
);
395 // Archs this Module supported have already been added.
397 if (vArchs
.size() == 0) {
398 JOptionPane
.showMessageDialog(frame
, "This Module has already been added.");
401 //ToDo put Arch instead of null
402 boolean errorOccurred
= false;
403 for (int i
= 0; i
< vArchs
.size(); ++i
) {
404 String arch
= vArchs
.get(i
);
406 archsAdded
+= arch
+ " ";
407 String
[] row
= { "", "", "", "", "", "", "" };
410 row
[modNameColForFpdModTable
] = mi
.getName();
411 row
[pkgNameColForFpdModTable
] = mi
.getPackage().getName();
412 row
[pathColForFpdModTable
] = path
;
413 row
[archColForFpdModTable
] = arch
;
414 row
[pkgVerColForFpdModTable
] = pv
;
415 row
[modVerColForFpdModTable
] = mv
;
416 row
[typeColForFpdModTable
] = mType
;
419 modelFpdModules
.addRow(row
);
421 docConsole
.setSaved(false);
423 //ToDo : specify archs need to add.
424 ffc
.addFrameworkModulesPcdBuildDefs(mi
, arch
, null);
425 } catch (Exception exception
) {
426 JOptionPane
.showMessageDialog(frame
, "Adding " + row
[modNameColForFpdModTable
] + " with Supporting Architectures: " + arch
427 + ": " + exception
.getMessage());
428 errorOccurred
= true;
432 String s
= "This Module with Architecture " + archsAdded
;
434 s
+= " was added with Error. Platform may NOT Build.";
436 s
+= " was added Successfully.";
438 JOptionPane
.showMessageDialog(frame
, s
);
439 TableSorter sorterFpdModules
= (TableSorter
)jTableFpdModules
.getModel();
440 int viewIndex
= sorterFpdModules
.getViewIndexArray()[modelFpdModules
.getRowCount() - 1];
441 jTableFpdModules
.changeSelection(viewIndex
, 0, false, false);
445 return jButtonAddModule
;
449 * This method initializes jPanelBottomSouth
451 * This panel contains the Settings and Remove Buttons
453 * @return javax.swing.JPanel jPanelBottomSouth
455 private JPanel
getJPanelBottomSouth() {
456 if (jPanelBottomSouth
== null) {
457 FlowLayout flowLayout1
= new FlowLayout();
458 flowLayout1
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
459 jPanelBottomSouth
= new JPanel();
460 jPanelBottomSouth
.setLayout(flowLayout1
);
461 jPanelBottomSouth
.add(getJButtonSettings(), null);
462 jPanelBottomSouth
.add(getJButtonRemoveModule(), null);
464 return jPanelBottomSouth
;
468 * This method initializes jScrollPaneFpdModules
470 * @return javax.swing.JScrollPane jScrollPaneFpdModules
472 private JScrollPane
getJScrollPaneFpdModules() {
473 if (jScrollPaneFpdModules
== null) {
474 jScrollPaneFpdModules
= new JScrollPane();
475 jScrollPaneFpdModules
.setPreferredSize(new java
.awt
.Dimension(453, 200));
476 jScrollPaneFpdModules
.setViewportView(getJTableFpdModules());
478 return jScrollPaneFpdModules
;
482 * This method initializes jTableFpdModules
484 * @return javax.swing.JTable jTableFpdModules
486 private JTable
getJTableFpdModules() {
487 if (jTableFpdModules
== null) {
488 modelFpdModules
= new FpdModulesTableModel();
489 TableSorter sorter
= new TableSorter(modelFpdModules
);
490 jTableFpdModules
= new JTable(sorter
);
491 sorter
.setTableHeader(jTableFpdModules
.getTableHeader());
492 jTableFpdModules
.setRowHeight(20);
493 modelFpdModules
.addColumn("<html>Module<br>Name</html>");
494 modelFpdModules
.addColumn("<html>Package<br>Name</html>");
495 modelFpdModules
.addColumn("Path");
496 modelFpdModules
.addColumn("<html>Supported<br>Architectures</html>");
497 modelFpdModules
.addColumn("<html>Module<br>Type</html>");
498 modelFpdModules
.addColumn("<html>Module<br>Version</html>");
499 modelFpdModules
.addColumn("<html>Package<br>Version</html>");
500 modelFpdModules
.addColumn("<html>Force<br>Debug</html>");
502 javax
.swing
.table
.TableColumn column
= null;
503 column
= jTableFpdModules
.getColumnModel().getColumn(modNameColForFpdModTable
);
504 column
.setPreferredWidth(modNamePrefWidth
);
505 column
.setMinWidth(modNameMinWidth
);
506 column
.setMaxWidth(modNameMaxWidth
);
507 column
= jTableFpdModules
.getColumnModel().getColumn(modVerColForFpdModTable
);
508 column
.setPreferredWidth(verPrefWidth
);
509 column
.setMaxWidth(verMaxWidth
);
510 column
.setMinWidth(verMinWidth
);
511 column
= jTableFpdModules
.getColumnModel().getColumn(pkgNameColForFpdModTable
);
512 column
.setPreferredWidth(pkgNamePrefWidth
);
513 column
.setMinWidth(pkgNameMinWidth
);
514 column
.setMaxWidth(pkgNameMaxWidth
);
515 column
= jTableFpdModules
.getColumnModel().getColumn(pkgVerColForFpdModTable
);
516 column
.setPreferredWidth(verPrefWidth
);
517 column
.setMaxWidth(verMaxWidth
);
518 column
.setMinWidth(verMinWidth
);
519 column
= jTableFpdModules
.getColumnModel().getColumn(archColForFpdModTable
);
520 column
.setPreferredWidth(archPrefWidth
);
521 column
.setMaxWidth(archMaxWidth
);
522 column
.setMinWidth(archMinWidth
);
523 column
= jTableFpdModules
.getColumnModel().getColumn(pathColForFpdModTable
);
524 column
.setPreferredWidth(pathPrefWidth
);
525 column
.setMinWidth(pathMinWidth
);
526 column
= jTableFpdModules
.getColumnModel().getColumn(typeColForFpdModTable
);
527 column
.setPreferredWidth(typePrefWidth
);
528 column
.setMaxWidth(typeMaxWidth
);
529 column
.setMinWidth(typeMinWidth
);
531 jTableFpdModules
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
532 jTableFpdModules
.setAutoResizeMode(JTable
.AUTO_RESIZE_OFF
);
534 jTableFpdModules
.getModel().addTableModelListener(this);
536 return jTableFpdModules
;
539 public void tableChanged(TableModelEvent arg0
) {
540 if (arg0
.getType() == TableModelEvent
.UPDATE
){
541 int row
= arg0
.getFirstRow();
542 int column
= arg0
.getColumn();
543 TableModel m
= (TableModel
)arg0
.getSource();
545 if (column
!= forceDbgColForFpdModTable
) {
548 String s
= m
.getValueAt(row
, column
)+"";
549 boolean dbgEnable
= new Boolean(s
);
550 ffc
.setModuleSAForceDebug(row
, dbgEnable
);
551 docConsole
.setSaved(false);
555 * This method initializes jButtonSettings
557 * @return javax.swing.JButton jButtonSettings
559 private JButton
getJButtonSettings() {
560 if (jButtonSettings
== null) {
561 jButtonSettings
= new JButton();
562 jButtonSettings
.setPreferredSize(new java
.awt
.Dimension(130,20));
563 jButtonSettings
.setText("Settings");
564 jButtonSettings
.addActionListener(new java
.awt
.event
.ActionListener() {
565 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
566 int selectedRow
= jTableFpdModules
.getSelectedRow();
567 if (selectedRow
< 0) {
571 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
572 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
574 if (ffc
.adjustPcd(selectedRow
)) {
575 docConsole
.setSaved(false);
578 catch (Exception exp
) {
579 JOptionPane
.showMessageDialog(frame
, exp
.getMessage());
583 if (settingDlg
== null) {
584 settingDlg
= new FpdModuleSA(ffc
);
587 String
[] sa
= new String
[5];
588 ffc
.getFrameworkModuleInfo(selectedRow
, sa
);
589 String mg
= sa
[ffcModGuid
];
590 String mv
= sa
[ffcModVer
];
591 String pg
= sa
[ffcPkgGuid
];
592 String pv
= sa
[ffcPkgVer
];
593 String arch
= sa
[ffcModArch
];
594 settingDlg
.setKey(mg
+ " " + mv
+ " " + pg
+ " " + pv
+ " " + arch
, selectedRow
, docConsole
);
595 settingDlg
.setVisible(true);
599 return jButtonSettings
;
603 * This method initializes jButtonRemoveModule
605 * @return javax.swing.JButton jButtonRemoveModule
607 private JButton
getJButtonRemoveModule() {
608 if (jButtonRemoveModule
== null) {
609 jButtonRemoveModule
= new JButton();
610 jButtonRemoveModule
.setPreferredSize(new java
.awt
.Dimension(130, 20));
611 jButtonRemoveModule
.setText("Remove Module");
612 jButtonRemoveModule
.addActionListener(new java
.awt
.event
.ActionListener() {
613 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
614 int selectedRow
= jTableFpdModules
.getSelectedRow();
615 if (selectedRow
< 0) {
618 docConsole
.setSaved(false);
620 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
621 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
623 String
[] sa
= new String
[5];
624 ffc
.getFrameworkModuleInfo(selectedRow
, sa
);
625 String mg
= sa
[ffcModGuid
];
626 String mv
= sa
[ffcModVer
];
627 String pg
= sa
[ffcPkgGuid
];
628 String pv
= sa
[ffcPkgVer
];
629 String arch
= sa
[ffcModArch
];
630 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(mg
+ " " + mv
+ " " + pg
+ " " + pv
+ " " + arch
);
631 mv
= mi
.getVersion();
632 pv
= mi
.getPackage().getVersion();
633 modelFpdModules
.removeRow(selectedRow
);
635 // if no arch specified in ModuleSA
636 fpdMsa
.remove(mg
+ mv
+ pg
+ pv
);
639 ArrayList
<String
> al
= fpdMsa
.get(mg
+ mv
+ pg
+ pv
);
641 if (al
.size() == 0) {
642 fpdMsa
.remove(mg
+ mv
+ pg
+ pv
);
646 ffc
.removeModuleSA(selectedRow
);
650 return jButtonRemoveModule
;
657 public static void main(String
[] args
) {
658 // Set the pane visable
659 new FpdFrameworkModules().setVisible(true);
663 * This is the default constructor
665 public FpdFrameworkModules() {
670 public FpdFrameworkModules(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
676 public FpdFrameworkModules(OpeningPlatformType opt
) {
677 this(opt
.getXmlFpd());
681 private void init(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
683 WorkspaceProfile
.initInfo("Tools" + File
.separator
+ "Conf" + File
.separator
+ "FrameworkDatabase.db", System
.getenv("WORKSPACE"));
686 JOptionPane
.showMessageDialog(frame
, "Error occurred when getting module data.");
690 ffc
= new FpdFileContents(fpd
);
694 if (fpdMsa
== null) {
695 fpdMsa
= new HashMap
<String
, ArrayList
<String
>>();
698 if (ffc
.getFrameworkModulesCount() > 0) {
699 String
[][] saa
= new String
[ffc
.getFrameworkModulesCount()][5];
700 ffc
.getFrameworkModulesInfo(saa
);
701 for (int i
= 0; i
< saa
.length
; ++i
) {
702 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(saa
[i
][ffcModGuid
] + " " + saa
[i
][ffcModVer
] + " "
703 + saa
[i
][ffcPkgGuid
] + " " + saa
[i
][ffcPkgVer
]);
704 Object
[] row
= { "", "", "", "", "", "", "", "" };
706 row
[modNameColForFpdModTable
] = mi
.getName();
707 row
[modVerColForFpdModTable
] = mi
.getVersion();
708 row
[typeColForFpdModTable
] = mi
.getModuleType();
709 row
[pkgNameColForFpdModTable
] = mi
.getPackage().getName();
710 row
[pkgVerColForFpdModTable
] = mi
.getPackage().getVersion();
711 row
[archColForFpdModTable
] = saa
[i
][ffcModArch
];
713 row
[pathColForFpdModTable
] = WorkspaceProfile
.getMsaFile(mi
).getPath().substring(
714 System
.getenv("WORKSPACE")
716 } catch (Exception e
) {
717 JOptionPane
.showMessageDialog(frame
, "Show FPD Modules:" + e
.getMessage());
720 String fpdMsaKey
= saa
[i
][ffcModGuid
] + row
[modVerColForFpdModTable
]
721 + saa
[i
][ffcPkgGuid
] + row
[pkgVerColForFpdModTable
];
722 ArrayList
<String
> al
= fpdMsa
.get(fpdMsaKey
);
724 al
= new ArrayList
<String
>();
725 fpdMsa
.put(fpdMsaKey
, al
);
727 al
.add(saa
[i
][ffcModArch
]);
729 row
[forceDbgColForFpdModTable
] = ffc
.getModuleSAForceDebug(i
);
730 modelFpdModules
.addRow(row
);
733 TableSorter sorter
= (TableSorter
)jTableFpdModules
.getModel();
734 sorter
.setSortState(modNameColForFpdModTable
, TableSorter
.ASCENDING
);
741 private void showAllModules() {
743 if (miList
== null) {
744 miList
= new ArrayList
<ModuleIdentification
>();
746 Set
<PackageIdentification
> spi
= WorkspaceProfile
.getPackageList();
747 Iterator ispi
= spi
.iterator();
749 while (ispi
.hasNext()) {
750 PackageIdentification pi
= (PackageIdentification
) ispi
.next();
751 String
[] s
= { "", "", "", "", "", "" };
753 Set
<ModuleIdentification
> smi
= WorkspaceProfile
.getModules(pi
);
754 Iterator ismi
= smi
.iterator();
755 while (ismi
.hasNext()) {
756 ModuleIdentification mi
= (ModuleIdentification
) ismi
.next();
757 s
[modNameColForAllModTable
] = mi
.getName();
758 s
[modVerColForAllModTable
] = mi
.getVersion();
759 s
[typeColForAllModTable
] = mi
.getModuleType();
760 s
[pkgNameColForAllModTable
] = pi
.getName();
761 s
[pkgVerColForAllModTable
] = pi
.getVersion();
763 s
[pathColForAllModTable
] = WorkspaceProfile
.getMsaFile(mi
).getPath()
764 .substring(System
.getenv("WORKSPACE").length() + 1);
765 } catch (Exception e
) {
766 JOptionPane
.showMessageDialog(frame
, "Show All Modules:" + e
.getMessage());
768 modelAllModules
.addRow(s
);
773 TableSorter sorter
= (TableSorter
)jTableAllModules
.getModel();
774 sorter
.setSortState(modNameColForAllModTable
, TableSorter
.ASCENDING
);
778 * This method initializes this
782 private void initialize() {
783 this.setSize(633, 533);
784 this.setTitle("Framework Modules");
785 this.setContentPane(getJSplitPane());
786 this.setVisible(true);
790 } // @jve:decl-index=0:visual-constraint="10,10"
792 class NonEditableTableModel
extends DefaultTableModel
{
796 private static final long serialVersionUID
= 1L;
798 public boolean isCellEditable(int row
, int col
) {
803 class FpdModulesTableModel
extends DefaultTableModel
{
808 private static final long serialVersionUID
= 1L;
810 public Class
<?
> getColumnClass (int c
) {
811 if (getValueAt(0, c
) != null){
812 return getValueAt(0, c
).getClass();
817 public boolean isCellEditable (int row
, int col
) {
818 if (col
== FpdFrameworkModules
.forceDbgColForFpdModTable
) {