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
.GlobalData
;
34 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformType
;
35 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
36 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.SurfaceAreaQuery
;
37 import org
.tianocore
.frameworkwizard
.platform
.ui
.global
.WorkspaceProfile
;
38 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
40 import java
.awt
.FlowLayout
;
41 import java
.awt
.event
.MouseEvent
;
42 import java
.util
.ArrayList
;
43 import java
.util
.HashMap
;
44 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 into Platform");
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
);
301 jTableAllModules
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
302 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
303 if (e
.getButton() == MouseEvent
.BUTTON1
&& e
.getClickCount() == 2) {
304 java
.awt
.Point p
= e
.getPoint();
305 int rowIndex
= jTableAllModules
.rowAtPoint(p
);
306 TableSorter sorter
= (TableSorter
) jTableAllModules
.getModel();
307 rowIndex
= sorter
.getModelRowIndex(rowIndex
);
308 addModuleIntoPlatform (rowIndex
);
315 return jTableAllModules
;
319 * This method initializes jPanelTopSouth
321 * This panel contains the ADD button
323 * @return javax.swing.JPanel jPanelTopSouth
325 private JPanel
getJPanelTopSouth() {
326 if (jPanelTopSouth
== null) {
327 FlowLayout flowLayout
= new FlowLayout();
328 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
329 jPanelTopSouth
= new JPanel();
330 jPanelTopSouth
.setLayout(flowLayout
);
331 jPanelTopSouth
.add(getJButtonAddModule(), null);
333 return jPanelTopSouth
;
336 private void addModuleIntoPlatform (int selectedRow
) {
337 String path
= modelAllModules
.getValueAt(selectedRow
, pathColForAllModTable
) + "";
338 ModuleIdentification mi
= miList
.get(selectedRow
);
339 Vector
<String
> vArchs
= null;
341 vArchs
= WorkspaceProfile
.getModuleSupArchs(mi
);
343 catch (Exception exp
) {
344 JOptionPane
.showMessageDialog(frame
, exp
.getMessage());
347 if (vArchs
== null) {
348 JOptionPane
.showMessageDialog(frame
, "No Supported Architectures specified in MSA file.");
352 String archsAdded
= "";
353 String mg
= mi
.getGuid();
354 String mv
= mi
.getVersion();
355 String pg
= mi
.getPackageId().getGuid();
356 String pv
= mi
.getPackageId().getVersion();
357 String mType
= SurfaceAreaQuery
.getModuleType(mi
);
359 ArrayList
<String
> al
= fpdMsa
.get(mg
+ mv
+ pg
+ pv
);
362 // if existing ModuleSA does not specify version info.
364 al
= fpdMsa
.get(mg
+ "null" + pg
+ "null");
366 al
= fpdMsa
.get(mg
+ "null" + pg
+ pv
);
368 al
= fpdMsa
.get(mg
+ mv
+ pg
+ "null");
370 al
= new ArrayList
<String
>();
371 fpdMsa
.put(mg
+ mv
+ pg
+ pv
, al
);
377 // filter from module SupArchs what archs has been added.
379 for (int i
= 0; i
< al
.size(); ++i
) {
380 vArchs
.remove(al
.get(i
));
383 // check whether archs conform to SupArch of platform.
385 Vector
<Object
> platformSupArch
= new Vector
<Object
>();
386 ffc
.getPlatformDefsSupportedArchs(platformSupArch
);
387 vArchs
.retainAll(platformSupArch
);
389 // Archs this Module supported have already been added.
391 if (vArchs
.size() == 0) {
392 JOptionPane
.showMessageDialog(frame
, "This Module has already been added.");
395 //ToDo put Arch instead of null
396 boolean errorOccurred
= false;
397 for (int i
= 0; i
< vArchs
.size(); ++i
) {
398 String arch
= vArchs
.get(i
);
400 archsAdded
+= arch
+ " ";
401 String
[] row
= { "", "", "", "", "", "", "" };
404 row
[modNameColForFpdModTable
] = mi
.getName();
405 row
[pkgNameColForFpdModTable
] = mi
.getPackageId().getName();
406 row
[pathColForFpdModTable
] = path
;
407 row
[archColForFpdModTable
] = arch
;
408 row
[pkgVerColForFpdModTable
] = pv
;
409 row
[modVerColForFpdModTable
] = mv
;
410 row
[typeColForFpdModTable
] = mType
;
413 modelFpdModules
.addRow(row
);
415 docConsole
.setSaved(false);
417 //ToDo : specify archs need to add.
418 ffc
.addFrameworkModulesPcdBuildDefs(mi
, arch
, null);
419 } catch (Exception exception
) {
420 JOptionPane
.showMessageDialog(frame
, "Adding " + row
[modNameColForFpdModTable
] + " with Supporting Architectures: " + arch
421 + ": " + exception
.getMessage());
422 errorOccurred
= true;
426 String s
= "This Module with Architecture " + archsAdded
;
428 s
+= " was added with Error. Platform may NOT Build.";
430 s
+= " was added Successfully.";
432 JOptionPane
.showMessageDialog(frame
, s
);
433 TableSorter sorterFpdModules
= (TableSorter
)jTableFpdModules
.getModel();
434 int viewIndex
= sorterFpdModules
.getViewIndexArray()[modelFpdModules
.getRowCount() - 1];
435 jTableFpdModules
.changeSelection(viewIndex
, 0, false, false);
440 * This method initializes jButtonAddModule
442 * @return javax.swing.JButton jButtonAddModule
444 private JButton
getJButtonAddModule() {
445 if (jButtonAddModule
== null) {
446 jButtonAddModule
= new JButton();
447 jButtonAddModule
.setPreferredSize(new java
.awt
.Dimension(130, 20));
448 jButtonAddModule
.setText("Add a Module");
449 jButtonAddModule
.addActionListener(new java
.awt
.event
.ActionListener() {
450 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
451 int selectedRow
= jTableAllModules
.getSelectedRow();
452 if (selectedRow
< 0) {
456 TableSorter sorter
= (TableSorter
) jTableAllModules
.getModel();
457 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
458 addModuleIntoPlatform (selectedRow
);
462 return jButtonAddModule
;
466 * This method initializes jPanelBottomSouth
468 * This panel contains the Settings and Remove Buttons
470 * @return javax.swing.JPanel jPanelBottomSouth
472 private JPanel
getJPanelBottomSouth() {
473 if (jPanelBottomSouth
== null) {
474 FlowLayout flowLayout1
= new FlowLayout();
475 flowLayout1
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
476 jPanelBottomSouth
= new JPanel();
477 jPanelBottomSouth
.setLayout(flowLayout1
);
478 jPanelBottomSouth
.add(getJButtonSettings(), null);
479 jPanelBottomSouth
.add(getJButtonRemoveModule(), null);
481 return jPanelBottomSouth
;
485 * This method initializes jScrollPaneFpdModules
487 * @return javax.swing.JScrollPane jScrollPaneFpdModules
489 private JScrollPane
getJScrollPaneFpdModules() {
490 if (jScrollPaneFpdModules
== null) {
491 jScrollPaneFpdModules
= new JScrollPane();
492 jScrollPaneFpdModules
.setPreferredSize(new java
.awt
.Dimension(453, 200));
493 jScrollPaneFpdModules
.setViewportView(getJTableFpdModules());
495 return jScrollPaneFpdModules
;
499 * This method initializes jTableFpdModules
501 * @return javax.swing.JTable jTableFpdModules
503 private JTable
getJTableFpdModules() {
504 if (jTableFpdModules
== null) {
505 modelFpdModules
= new FpdModulesTableModel();
506 TableSorter sorter
= new TableSorter(modelFpdModules
);
507 jTableFpdModules
= new JTable(sorter
);
508 sorter
.setTableHeader(jTableFpdModules
.getTableHeader());
509 jTableFpdModules
.setRowHeight(20);
510 modelFpdModules
.addColumn("<html>Module<br>Name</html>");
511 modelFpdModules
.addColumn("<html>Package<br>Name</html>");
512 modelFpdModules
.addColumn("Path");
513 modelFpdModules
.addColumn("<html>Supported<br>Architectures</html>");
514 modelFpdModules
.addColumn("<html>Module<br>Type</html>");
515 modelFpdModules
.addColumn("<html>Module<br>Version</html>");
516 modelFpdModules
.addColumn("<html>Package<br>Version</html>");
517 modelFpdModules
.addColumn("<html>Force<br>Debug</html>");
519 javax
.swing
.table
.TableColumn column
= null;
520 column
= jTableFpdModules
.getColumnModel().getColumn(modNameColForFpdModTable
);
521 column
.setPreferredWidth(modNamePrefWidth
);
522 column
.setMinWidth(modNameMinWidth
);
523 column
.setMaxWidth(modNameMaxWidth
);
524 column
= jTableFpdModules
.getColumnModel().getColumn(modVerColForFpdModTable
);
525 column
.setPreferredWidth(verPrefWidth
);
526 column
.setMaxWidth(verMaxWidth
);
527 column
.setMinWidth(verMinWidth
);
528 column
= jTableFpdModules
.getColumnModel().getColumn(pkgNameColForFpdModTable
);
529 column
.setPreferredWidth(pkgNamePrefWidth
);
530 column
.setMinWidth(pkgNameMinWidth
);
531 column
.setMaxWidth(pkgNameMaxWidth
);
532 column
= jTableFpdModules
.getColumnModel().getColumn(pkgVerColForFpdModTable
);
533 column
.setPreferredWidth(verPrefWidth
);
534 column
.setMaxWidth(verMaxWidth
);
535 column
.setMinWidth(verMinWidth
);
536 column
= jTableFpdModules
.getColumnModel().getColumn(archColForFpdModTable
);
537 column
.setPreferredWidth(archPrefWidth
);
538 column
.setMaxWidth(archMaxWidth
);
539 column
.setMinWidth(archMinWidth
);
540 column
= jTableFpdModules
.getColumnModel().getColumn(pathColForFpdModTable
);
541 column
.setPreferredWidth(pathPrefWidth
);
542 column
.setMinWidth(pathMinWidth
);
543 column
= jTableFpdModules
.getColumnModel().getColumn(typeColForFpdModTable
);
544 column
.setPreferredWidth(typePrefWidth
);
545 column
.setMaxWidth(typeMaxWidth
);
546 column
.setMinWidth(typeMinWidth
);
548 jTableFpdModules
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
549 jTableFpdModules
.setAutoResizeMode(JTable
.AUTO_RESIZE_OFF
);
551 jTableFpdModules
.addMouseListener(new java
.awt
.event
.MouseAdapter() {
552 public void mouseClicked(java
.awt
.event
.MouseEvent e
) {
553 if (e
.getButton() == MouseEvent
.BUTTON1
&& e
.getClickCount() == 2) {
554 java
.awt
.Point p
= e
.getPoint();
555 int rowIndex
= jTableFpdModules
.rowAtPoint(p
);
556 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
557 rowIndex
= sorter
.getModelRowIndex(rowIndex
);
558 showSettingsDlg (rowIndex
);
563 jTableFpdModules
.getModel().addTableModelListener(this);
565 return jTableFpdModules
;
568 public void tableChanged(TableModelEvent arg0
) {
569 if (arg0
.getType() == TableModelEvent
.UPDATE
){
570 int row
= arg0
.getFirstRow();
571 int column
= arg0
.getColumn();
572 TableModel m
= (TableModel
)arg0
.getSource();
574 if (column
!= forceDbgColForFpdModTable
) {
577 String s
= m
.getValueAt(row
, column
)+"";
578 boolean dbgEnable
= new Boolean(s
);
579 ffc
.setModuleSAForceDebug(row
, dbgEnable
);
580 docConsole
.setSaved(false);
584 private void showSettingsDlg (int row
) {
586 if (ffc
.adjustPcd(row
)) {
587 docConsole
.setSaved(false);
590 catch (Exception exp
) {
591 JOptionPane
.showMessageDialog(frame
, exp
.getMessage());
595 if (settingDlg
== null) {
596 settingDlg
= new FpdModuleSA(ffc
);
599 String
[] sa
= new String
[5];
600 ffc
.getFrameworkModuleInfo(row
, sa
);
601 String mg
= sa
[ffcModGuid
];
602 String mv
= sa
[ffcModVer
];
603 String pg
= sa
[ffcPkgGuid
];
604 String pv
= sa
[ffcPkgVer
];
605 String arch
= sa
[ffcModArch
];
606 settingDlg
.setKey(mg
+ " " + mv
+ " " + pg
+ " " + pv
+ " " + arch
, row
, docConsole
);
607 settingDlg
.setVisible(true);
610 * This method initializes jButtonSettings
612 * @return javax.swing.JButton jButtonSettings
614 private JButton
getJButtonSettings() {
615 if (jButtonSettings
== null) {
616 jButtonSettings
= new JButton();
617 jButtonSettings
.setPreferredSize(new java
.awt
.Dimension(130,20));
618 jButtonSettings
.setText("Settings");
619 jButtonSettings
.addActionListener(new java
.awt
.event
.ActionListener() {
620 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
621 int selectedRow
= jTableFpdModules
.getSelectedRow();
622 if (selectedRow
< 0) {
626 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
627 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
628 showSettingsDlg (selectedRow
);
632 return jButtonSettings
;
636 * This method initializes jButtonRemoveModule
638 * @return javax.swing.JButton jButtonRemoveModule
640 private JButton
getJButtonRemoveModule() {
641 if (jButtonRemoveModule
== null) {
642 jButtonRemoveModule
= new JButton();
643 jButtonRemoveModule
.setPreferredSize(new java
.awt
.Dimension(130, 20));
644 jButtonRemoveModule
.setText("Remove Module");
645 jButtonRemoveModule
.addActionListener(new java
.awt
.event
.ActionListener() {
646 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
647 int selectedRow
= jTableFpdModules
.getSelectedRow();
648 if (selectedRow
< 0) {
653 TableSorter sorter
= (TableSorter
) jTableFpdModules
.getModel();
654 selectedRow
= sorter
.getModelRowIndex(selectedRow
);
656 String
[] sa
= new String
[5];
657 ffc
.getFrameworkModuleInfo(selectedRow
, sa
);
658 String mg
= sa
[ffcModGuid
];
659 String mv
= sa
[ffcModVer
];
660 String pg
= sa
[ffcPkgGuid
];
661 String pv
= sa
[ffcPkgVer
];
662 String arch
= sa
[ffcModArch
];
664 // sync. module order list in BuildOptions-UserExtensions.
666 String moduleKey
= mg
+ " " + mv
+ " " + pg
+ " " + pv
+ " " + arch
;
667 String fvBindings
= ffc
.getFvBinding(moduleKey
);
668 if (fvBindings
!= null) {
669 String
[] fvArray
= fvBindings
.split(" ");
670 for (int i
= 0; i
< fvArray
.length
; ++i
) {
671 ffc
.removeModuleInBuildOptionsUserExtensions(fvArray
[i
].trim(), mg
, mv
, pg
, pv
, arch
);
675 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(mg
+ " " + mv
+ " " + pg
+ " " + pv
+ " " + arch
);
677 mv
= mi
.getVersion();
678 pv
= mi
.getPackageId().getVersion();
682 ffc
.removeModuleSA(selectedRow
);
684 catch (Exception exp
) {
685 JOptionPane
.showMessageDialog(frame
, exp
.getCause() + exp
.getMessage());
690 // if no arch specified in ModuleSA
691 fpdMsa
.remove(mg
+ mv
+ pg
+ pv
);
694 ArrayList
<String
> al
= fpdMsa
.get(mg
+ mv
+ pg
+ pv
);
697 if (al
.size() == 0) {
698 fpdMsa
.remove(mg
+ mv
+ pg
+ pv
);
703 modelFpdModules
.removeRow(selectedRow
);
704 docConsole
.setSaved(false);
708 return jButtonRemoveModule
;
715 public static void main(String
[] args
) {
716 // Set the pane visable
717 new FpdFrameworkModules().setVisible(true);
721 * This is the default constructor
723 public FpdFrameworkModules() {
728 public FpdFrameworkModules(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
734 public FpdFrameworkModules(OpeningPlatformType opt
) {
735 this(opt
.getXmlFpd());
739 private void init(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
742 ffc
= new FpdFileContents(fpd
);
746 if (fpdMsa
== null) {
747 fpdMsa
= new HashMap
<String
, ArrayList
<String
>>();
750 if (ffc
.getFrameworkModulesCount() > 0) {
751 String
[][] saa
= new String
[ffc
.getFrameworkModulesCount()][5];
752 ffc
.getFrameworkModulesInfo(saa
);
753 for (int i
= 0; i
< saa
.length
; ++i
) {
754 ModuleIdentification mi
= WorkspaceProfile
.getModuleId(saa
[i
][ffcModGuid
] + " " + saa
[i
][ffcModVer
] + " "
755 + saa
[i
][ffcPkgGuid
] + " " + saa
[i
][ffcPkgVer
]);
756 Object
[] row
= { "", "", "", "", "", "", "", "" };
758 row
[modNameColForFpdModTable
] = mi
.getName();
759 row
[modVerColForFpdModTable
] = mi
.getVersion();
760 row
[typeColForFpdModTable
] = SurfaceAreaQuery
.getModuleType(mi
);
761 row
[pkgNameColForFpdModTable
] = mi
.getPackageId().getName();
762 row
[pkgVerColForFpdModTable
] = mi
.getPackageId().getVersion();
763 row
[archColForFpdModTable
] = saa
[i
][ffcModArch
];
765 row
[pathColForFpdModTable
] = mi
.getPath().substring(System
.getenv("WORKSPACE").length() + 1);
766 } catch (Exception e
) {
767 JOptionPane
.showMessageDialog(frame
, "Show FPD Modules:" + e
.getMessage());
770 String fpdMsaKey
= saa
[i
][ffcModGuid
] + row
[modVerColForFpdModTable
]
771 + saa
[i
][ffcPkgGuid
] + row
[pkgVerColForFpdModTable
];
772 ArrayList
<String
> al
= fpdMsa
.get(fpdMsaKey
);
774 al
= new ArrayList
<String
>();
775 fpdMsa
.put(fpdMsaKey
, al
);
777 al
.add(saa
[i
][ffcModArch
]);
780 row
[modNameColForFpdModTable
] = saa
[i
][ffcModGuid
];
781 row
[modVerColForFpdModTable
] = saa
[i
][ffcModVer
];
782 row
[pkgNameColForFpdModTable
] = saa
[i
][ffcPkgGuid
];
783 row
[pkgVerColForFpdModTable
] = saa
[i
][ffcPkgVer
];
784 row
[archColForFpdModTable
] = saa
[i
][ffcModArch
];
786 row
[forceDbgColForFpdModTable
] = ffc
.getModuleSAForceDebug(i
);
787 modelFpdModules
.addRow(row
);
790 TableSorter sorter
= (TableSorter
)jTableFpdModules
.getModel();
791 sorter
.setSortState(modNameColForFpdModTable
, TableSorter
.ASCENDING
);
798 private void showAllModules() {
800 if (miList
== null) {
801 miList
= new ArrayList
<ModuleIdentification
>();
804 String
[] s
= { "", "", "", "", "", "" };
806 Iterator ismi
= GlobalData
.vModuleList
.iterator();
807 while (ismi
.hasNext()) {
808 ModuleIdentification mi
= (ModuleIdentification
) ismi
.next();
809 s
[modNameColForAllModTable
] = mi
.getName();
810 s
[modVerColForAllModTable
] = mi
.getVersion();
811 s
[typeColForAllModTable
] = SurfaceAreaQuery
.getModuleType(mi
);
812 s
[pkgNameColForAllModTable
] = mi
.getPackageId().getName();
813 s
[pkgVerColForAllModTable
] = mi
.getPackageId().getVersion();
815 s
[pathColForAllModTable
] = mi
.getPath().substring(System
.getenv("WORKSPACE").length() + 1);
816 } catch (Exception e
) {
817 JOptionPane
.showMessageDialog(frame
, "Show All Modules:" + e
.getMessage());
819 modelAllModules
.addRow(s
);
824 TableSorter sorter
= (TableSorter
)jTableAllModules
.getModel();
825 sorter
.setSortState(modNameColForAllModTable
, TableSorter
.ASCENDING
);
829 * This method initializes this
833 private void initialize() {
834 this.setSize(633, 533);
835 this.setTitle("Framework Modules");
836 this.setContentPane(getJSplitPane());
837 this.setVisible(true);
841 } // @jve:decl-index=0:visual-constraint="10,10"
843 class NonEditableTableModel
extends DefaultTableModel
{
847 private static final long serialVersionUID
= 1L;
849 public boolean isCellEditable(int row
, int col
) {
854 class FpdModulesTableModel
extends DefaultTableModel
{
859 private static final long serialVersionUID
= 1L;
861 public Class
<?
> getColumnClass (int c
) {
862 if (getValueAt(0, c
) != null){
863 return getValueAt(0, c
).getClass();
868 public boolean isCellEditable (int row
, int col
) {
869 if (col
== FpdFrameworkModules
.forceDbgColForFpdModTable
) {