X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdFrameworkModules.java;h=0a15d3188a427f2bb83678daf71f4bf24c972abe;hp=53a3396c93c804c354fb2539399902b5430ff1cd;hb=4cd31580d8feafeddd78e3ba30095dc7374b1035;hpb=bf5abaffcce13bb8e0a1a652541f49d5b5f7a7b0 diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index 53a3396c93..0a15d3188a 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -32,156 +32,296 @@ import java.util.Vector; public class FpdFrameworkModules extends IInternalFrame { /** - * + * Initialize Globals */ private static final long serialVersionUID = 1L; + static JFrame frame; + private JSplitPane jSplitPane = null; - private JPanel jPanel = null; - private JPanel jPanel1 = null; + + private JPanel jPanelTop = null; + + private JPanel jPanelBottom = null; + private JLabel jLabel = null; - private JScrollPane jScrollPane = null; - private JTable jTable = null; - private JPanel jPanel2 = null; - private JButton jButton = null; - private JLabel jLabel1 = null; - private JPanel jPanel3 = null; - private JScrollPane jScrollPane1 = null; - private JTable jTable1 = null; - private JButton jButton1 = null; - private JButton jButton2 = null; - private NonEditableTableModel model = null; - private NonEditableTableModel model1 = null; - + + private JScrollPane jScrollPaneAllModules = null; + + private JTable jTableAllModules = null; + + private JPanel jPanelTopSouth = null; + + private JButton jButtonAddModule = null; + + private JLabel jLabelModulesAdded = null; + + private JPanel jPanelBottomSouth = null; + + private JScrollPane jScrollPaneFpdModules = null; + + private JTable jTableFpdModules = null; + + private JButton jButtonSettings = null; + + private JButton jButtonRemoveModule = null; + + private NonEditableTableModel modelAllModules = null; + + private NonEditableTableModel modelFpdModules = null; + private FpdModuleSA settingDlg = null; - + private FpdFileContents ffc = null; + private OpeningPlatformType docConsole = null; + private Map> fpdMsa = null; - + private ArrayList miList = null; + + /** + * Column settings for displaying all modules in workspace + */ + private final int modNameColForAllModTable = 0; + + private final int pkgNameColForAllModTable = 1; + + private final int pathColForAllModTable = 2; + + private final int typeColForAllModTable = 3; + + private final int pkgVerColForAllModTable = 5; + + private final int modVerColForAllModTable = 4; + + /** + * Column settings for display modules in the FPD file + */ + private final int modNameColForFpdModTable = 0; + + private final int pkgNameColForFpdModTable = 1; + + private final int pathColForFpdModTable = 2; + + private final int archColForFpdModTable = 3; + + private final int pkgVerColForFpdModTable = 6; + private final int modVerColForFpdModTable = 5; + + private final int typeColForFpdModTable = 4; + /** - * This method initializes jSplitPane + * FpdFileContents structure + */ + private final int ffcModGuid = 0; + + private final int ffcModVer = 1; + + private final int ffcPkgGuid = 2; + + private final int ffcPkgVer = 3; + + private final int ffcModArch = 4; + + /** + * Set Column Widths, Only the PATH should not have a max width. + */ + private final int modNameMinWidth = 168; + + private final int modNamePrefWidth = 200; + + private final int modNameMaxWidth = 350; + + private final int pkgNameMinWidth = 100; + + private final int pkgNamePrefWidth = 130; + + private final int pkgNameMaxWidth = 150; + + private final int verMinWidth = 60; + + private final int verMaxWidth = 80; + + private final int verPrefWidth = 70; + + private final int pathPrefWidth = 320; + + private final int pathMinWidth = 280; + + private final int archPrefWidth = 80; + + private final int archMinWidth = 60; + + private final int archMaxWidth = 100; + + private final int typePrefWidth = 145; + + private final int typeMinWidth = 100; + + private final int typeMaxWidth = 155; + + /** + * This method initializes jSplitPane + * + * This is the main edit window * - * @return javax.swing.JSplitPane + * @return javax.swing.JSplitPane jSplitPane */ private JSplitPane getJSplitPane() { if (jSplitPane == null) { jSplitPane = new JSplitPane(); jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); jSplitPane.setDividerLocation(250); - jSplitPane.setBottomComponent(getJPanel1()); - jSplitPane.setTopComponent(getJPanel()); + jSplitPane.setBottomComponent(getJPanelBottom()); + jSplitPane.setTopComponent(getJPanelTop()); } return jSplitPane; } /** - * This method initializes jPanel + * This method initializes jPanelTop + * + * This panel contains the All Modules Table * - * @return javax.swing.JPanel + * @return javax.swing.JPanel jPanelTop */ - private JPanel getJPanel() { - if (jPanel == null) { + private JPanel getJPanelTop() { + if (jPanelTop == null) { jLabel = new JLabel(); jLabel.setText("Modules in Workspace"); - jPanel = new JPanel(); - jPanel.setLayout(new BorderLayout()); - jPanel.add(jLabel, java.awt.BorderLayout.NORTH); - jPanel.add(getJScrollPane(), java.awt.BorderLayout.CENTER); - jPanel.add(getJPanel2(), java.awt.BorderLayout.SOUTH); + jPanelTop = new JPanel(); + jPanelTop.setLayout(new BorderLayout()); + jPanelTop.add(jLabel, java.awt.BorderLayout.NORTH); + jPanelTop.add(getJScrollPaneAllModules(), java.awt.BorderLayout.CENTER); + jPanelTop.add(getJPanelTopSouth(), java.awt.BorderLayout.SOUTH); } - return jPanel; + return jPanelTop; } /** - * This method initializes jPanel1 + * This method initializes jPanelBottom * - * @return javax.swing.JPanel + * This panel contains the FPD Modules Table + * + * @return javax.swing.JPanel jPanelBottom */ - private JPanel getJPanel1() { - if (jPanel1 == null) { - jLabel1 = new JLabel(); - jLabel1.setText("Modules Added"); - jPanel1 = new JPanel(); - jPanel1.setLayout(new BorderLayout()); - jPanel1.add(jLabel1, java.awt.BorderLayout.NORTH); - jPanel1.add(getJPanel3(), java.awt.BorderLayout.SOUTH); - jPanel1.add(getJScrollPane1(), java.awt.BorderLayout.CENTER); + private JPanel getJPanelBottom() { + if (jPanelBottom == null) { + jLabelModulesAdded = new JLabel(); + jLabelModulesAdded.setText("Modules Added"); + jPanelBottom = new JPanel(); + jPanelBottom.setLayout(new BorderLayout()); + jPanelBottom.add(jLabelModulesAdded, java.awt.BorderLayout.NORTH); + jPanelBottom.add(getJPanelBottomSouth(), java.awt.BorderLayout.SOUTH); + jPanelBottom.add(getJScrollPaneFpdModules(), java.awt.BorderLayout.CENTER); } - return jPanel1; + return jPanelBottom; } /** - * This method initializes jScrollPane + * This method initializes jScrollPaneAllModules * - * @return javax.swing.JScrollPane + * @return javax.swing.JScrollPane jScrollPaneAllModules */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setPreferredSize(new java.awt.Dimension(600,200)); - jScrollPane.setViewportView(getJTable()); + private JScrollPane getJScrollPaneAllModules() { + if (jScrollPaneAllModules == null) { + jScrollPaneAllModules = new JScrollPane(); + jScrollPaneAllModules.setPreferredSize(new java.awt.Dimension(600, 200)); + jScrollPaneAllModules.setViewportView(getJTableAllModules()); } - return jScrollPane; + return jScrollPaneAllModules; } /** - * This method initializes jTable + * This method initializes jTableAllModules * - * @return javax.swing.JTable + * @return javax.swing.JTable jTableAllModules */ - private JTable getJTable() { - if (jTable == null) { - model = new NonEditableTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("ModuleName"); - model.addColumn("ModuleVersion"); - model.addColumn("PackageName"); - model.addColumn("PackageVersion"); - model.addColumn("Path"); + private JTable getJTableAllModules() { + if (jTableAllModules == null) { + modelAllModules = new NonEditableTableModel(); + TableSorter sorter = new TableSorter(modelAllModules); + jTableAllModules = new JTable(sorter); + sorter.setTableHeader(jTableAllModules.getTableHeader()); + jTableAllModules.setRowHeight(20); + modelAllModules.addColumn("Module
Name"); + modelAllModules.addColumn("Package
Name"); + modelAllModules.addColumn("Path"); + modelAllModules.addColumn("Module
Type"); + modelAllModules.addColumn("Module
Version"); + modelAllModules.addColumn("Package
Version"); - jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + javax.swing.table.TableColumn column = null; + column = jTableAllModules.getColumnModel().getColumn(modNameColForAllModTable); + column.setPreferredWidth(modNamePrefWidth); + column.setMinWidth(modNameMinWidth); + column.setMaxWidth(modNameMaxWidth); + column = jTableAllModules.getColumnModel().getColumn(modVerColForAllModTable); + column.setPreferredWidth(verPrefWidth); + column.setMaxWidth(verMaxWidth); + column.setMinWidth(verMinWidth); + column = jTableAllModules.getColumnModel().getColumn(pkgNameColForAllModTable); + column.setPreferredWidth(pkgNamePrefWidth); + column.setMinWidth(pkgNameMinWidth); + column.setMaxWidth(pkgNameMaxWidth); + column = jTableAllModules.getColumnModel().getColumn(pkgVerColForAllModTable); + column.setPreferredWidth(verPrefWidth); + column.setMaxWidth(verMaxWidth); + column.setMinWidth(verMinWidth); + column = jTableAllModules.getColumnModel().getColumn(typeColForAllModTable); + column.setPreferredWidth(typePrefWidth); + column.setMaxWidth(typeMaxWidth); + column.setMinWidth(typeMinWidth); + column = jTableAllModules.getColumnModel().getColumn(pathColForAllModTable); + column.setPreferredWidth(pathPrefWidth); + column.setMinWidth(pathMinWidth); + + jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + } - return jTable; + return jTableAllModules; } /** - * This method initializes jPanel2 - * - * @return javax.swing.JPanel + * This method initializes jPanelTopSouth + * + * This panel contains the ADD button + * + * @return javax.swing.JPanel jPanelTopSouth */ - private JPanel getJPanel2() { - if (jPanel2 == null) { + private JPanel getJPanelTopSouth() { + if (jPanelTopSouth == null) { FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(java.awt.FlowLayout.RIGHT); - jPanel2 = new JPanel(); - jPanel2.setLayout(flowLayout); - jPanel2.add(getJButton(), null); + jPanelTopSouth = new JPanel(); + jPanelTopSouth.setLayout(flowLayout); + jPanelTopSouth.add(getJButtonAddModule(), null); } - return jPanel2; + return jPanelTopSouth; } /** - * This method initializes jButton + * This method initializes jButtonAddModule * - * @return javax.swing.JButton + * @return javax.swing.JButton jButtonAddModule */ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setPreferredSize(new java.awt.Dimension(130,20)); - jButton.setText("Add a Module"); - jButton.addActionListener(new java.awt.event.ActionListener() { + private JButton getJButtonAddModule() { + if (jButtonAddModule == null) { + jButtonAddModule = new JButton(); + jButtonAddModule.setPreferredSize(new java.awt.Dimension(130, 20)); + jButtonAddModule.setText("Add a Module"); + jButtonAddModule.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRow = jTable.getSelectedRow(); - if (selectedRow < 0){ + int selectedRow = jTableAllModules.getSelectedRow(); + if (selectedRow < 0) { return; } - - String path = model.getValueAt(selectedRow, 4)+""; + + TableSorter sorter = (TableSorter) jTableAllModules.getModel(); + selectedRow = sorter.modelIndex(selectedRow); + String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + ""; ModuleIdentification mi = miList.get(selectedRow); Vector vArchs = null; try { @@ -190,18 +330,19 @@ public class FpdFrameworkModules extends IInternalFrame { catch (Exception exp) { JOptionPane.showMessageDialog(frame, exp.getMessage()); } - + if (vArchs == null) { - JOptionPane.showMessageDialog(frame, "No supported Archs specified in MSA file."); + JOptionPane.showMessageDialog(frame, "No Supported Architectures specified in MSA file."); return; } - + String archsAdded = ""; String mg = mi.getGuid(); String mv = mi.getVersion(); String pg = mi.getPackage().getGuid(); String pv = mi.getPackage().getVersion(); - + String mType = mi.getModuleType(); + ArrayList al = fpdMsa.get(mg + mv + pg + pv); if (al == null) { al = new ArrayList(); @@ -214,183 +355,247 @@ public class FpdFrameworkModules extends IInternalFrame { // Archs this Module supported have already been added. // if (vArchs.size() == 0) { - JOptionPane.showMessageDialog(frame, "This Module Already Added."); + JOptionPane.showMessageDialog(frame, "This Module has already been added."); return; } //ToDo put Arch instead of null + boolean errorOccurred = false; for (int i = 0; i < vArchs.size(); ++i) { String arch = vArchs.get(i); al.add(arch); archsAdded += arch + " "; - String[] row = {"", mv, "", pv, arch, path}; - - if (mi != null) { - row[0] = mi.getName(); - row[2] = mi.getPackage().getName(); - - } - model1.addRow(row); - - docConsole.setSaved(false); - try{ - //ToDo : specify archs need to add. - ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null); - } - catch (Exception exception) { - JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); - } + String[] row = { "", "", "", "", "", "", "" }; + + if (mi != null) { + row[modNameColForFpdModTable] = mi.getName(); + row[pkgNameColForFpdModTable] = mi.getPackage().getName(); + row[pathColForFpdModTable] = path; + row[archColForFpdModTable] = arch; + row[pkgVerColForFpdModTable] = pv; + row[modVerColForFpdModTable] = mv; + row[typeColForFpdModTable] = mType; + + } + modelFpdModules.addRow(row); + + docConsole.setSaved(false); + try { + //ToDo : specify archs need to add. + ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null); + } catch (Exception exception) { + JOptionPane.showMessageDialog(frame, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch + + ": " + exception.getMessage()); + errorOccurred = true; + } } - - - JOptionPane.showMessageDialog(frame, "This Module with Arch "+ archsAdded +" Added Successfully."); - jTable1.changeSelection(model1.getRowCount()-1, 0, false, false); + + String s = "This Module with Architecture " + archsAdded; + if (errorOccurred) { + s += " was added with Error. Platform may NOT Build."; + } else { + s += " was added Successfully."; + } + JOptionPane.showMessageDialog(frame, s); + jTableFpdModules.changeSelection(modelFpdModules.getRowCount() - 1, 0, false, false); } }); } - return jButton; + return jButtonAddModule; } /** - * This method initializes jPanel3 + * This method initializes jPanelBottomSouth + * + * This panel contains the Settings and Remove Buttons * - * @return javax.swing.JPanel + * @return javax.swing.JPanel jPanelBottomSouth */ - private JPanel getJPanel3() { - if (jPanel3 == null) { + private JPanel getJPanelBottomSouth() { + if (jPanelBottomSouth == null) { FlowLayout flowLayout1 = new FlowLayout(); flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT); - jPanel3 = new JPanel(); - jPanel3.setLayout(flowLayout1); - jPanel3.add(getJButton1(), null); - jPanel3.add(getJButton2(), null); + jPanelBottomSouth = new JPanel(); + jPanelBottomSouth.setLayout(flowLayout1); + jPanelBottomSouth.add(getJButtonSettings(), null); + jPanelBottomSouth.add(getJButtonRemoveModule(), null); } - return jPanel3; + return jPanelBottomSouth; } /** - * This method initializes jScrollPane1 + * This method initializes jScrollPaneFpdModules * - * @return javax.swing.JScrollPane + * @return javax.swing.JScrollPane jScrollPaneFpdModules */ - private JScrollPane getJScrollPane1() { - if (jScrollPane1 == null) { - jScrollPane1 = new JScrollPane(); - jScrollPane1.setPreferredSize(new java.awt.Dimension(453,200)); - jScrollPane1.setViewportView(getJTable1()); + private JScrollPane getJScrollPaneFpdModules() { + if (jScrollPaneFpdModules == null) { + jScrollPaneFpdModules = new JScrollPane(); + jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(453, 200)); + jScrollPaneFpdModules.setViewportView(getJTableFpdModules()); } - return jScrollPane1; + return jScrollPaneFpdModules; } /** - * This method initializes jTable1 + * This method initializes jTableFpdModules * - * @return javax.swing.JTable + * @return javax.swing.JTable jTableFpdModules */ - private JTable getJTable1() { - if (jTable1 == null) { - model1 = new NonEditableTableModel(); - jTable1 = new JTable(model1); - jTable1.setRowHeight(20); - model1.addColumn("ModuleName"); - model1.addColumn("ModuleVersion"); - model1.addColumn("PackageName"); - model1.addColumn("PackageVersion"); - model1.addColumn("SupportedArch"); - model1.addColumn("Path"); + private JTable getJTableFpdModules() { + if (jTableFpdModules == null) { + modelFpdModules = new NonEditableTableModel(); + TableSorter sorter = new TableSorter(modelFpdModules); + jTableFpdModules = new JTable(sorter); + sorter.setTableHeader(jTableFpdModules.getTableHeader()); + jTableFpdModules.setRowHeight(20); + modelFpdModules.addColumn("Module
Name"); + modelFpdModules.addColumn("Package
Name"); + modelFpdModules.addColumn("Path"); + modelFpdModules.addColumn("Supported
Architectures"); + modelFpdModules.addColumn("Module
Type"); + modelFpdModules.addColumn("Module
Version"); + modelFpdModules.addColumn("Package
Version"); + - jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + javax.swing.table.TableColumn column = null; + column = jTableFpdModules.getColumnModel().getColumn(modNameColForFpdModTable); + column.setPreferredWidth(modNamePrefWidth); + column.setMinWidth(modNameMinWidth); + column.setMaxWidth(modNameMaxWidth); + column = jTableFpdModules.getColumnModel().getColumn(modVerColForFpdModTable); + column.setPreferredWidth(verPrefWidth); + column.setMaxWidth(verMaxWidth); + column.setMinWidth(verMinWidth); + column = jTableFpdModules.getColumnModel().getColumn(pkgNameColForFpdModTable); + column.setPreferredWidth(pkgNamePrefWidth); + column.setMinWidth(pkgNameMinWidth); + column.setMaxWidth(pkgNameMaxWidth); + column = jTableFpdModules.getColumnModel().getColumn(pkgVerColForFpdModTable); + column.setPreferredWidth(verPrefWidth); + column.setMaxWidth(verMaxWidth); + column.setMinWidth(verMinWidth); + column = jTableFpdModules.getColumnModel().getColumn(archColForFpdModTable); + column.setPreferredWidth(archPrefWidth); + column.setMaxWidth(archMaxWidth); + column.setMinWidth(archMinWidth); + column = jTableFpdModules.getColumnModel().getColumn(pathColForFpdModTable); + column.setPreferredWidth(pathPrefWidth); + column.setMinWidth(pathMinWidth); + column = jTableFpdModules.getColumnModel().getColumn(typeColForFpdModTable); + column.setPreferredWidth(typePrefWidth); + column.setMaxWidth(typeMaxWidth); + column.setMinWidth(typeMinWidth); + + jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + } - return jTable1; + return jTableFpdModules; } /** - * This method initializes jButton1 + * This method initializes jButtonSettings * - * @return javax.swing.JButton + * @return javax.swing.JButton jButtonSettings */ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setPreferredSize(new java.awt.Dimension(130,20)); - jButton1.setText("Settings"); - jButton1.addActionListener(new java.awt.event.ActionListener() { + private JButton getJButtonSettings() { + if (jButtonSettings == null) { + jButtonSettings = new JButton(); + jButtonSettings.setPreferredSize(new java.awt.Dimension(130,20)); + jButtonSettings.setText("Settings"); + jButtonSettings.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRow = jTable1.getSelectedRow(); - if (selectedRow < 0){ + int selectedRow = jTableFpdModules.getSelectedRow(); + if (selectedRow < 0) { return; } + + TableSorter sorter = (TableSorter) jTableFpdModules.getModel(); + selectedRow = sorter.modelIndex(selectedRow); + try { + if (ffc.adjustPcd(selectedRow)) { + docConsole.setSaved(false); + } + } + catch (Exception exp) { + JOptionPane.showMessageDialog(frame, exp.getMessage()); + return; + } + if (settingDlg == null) { settingDlg = new FpdModuleSA(ffc); } - docConsole.setSaved(false); + String[] sa = new String[5]; ffc.getFrameworkModuleInfo(selectedRow, sa); - String mg = sa[0]; - String mv = sa[1]; - String pg = sa[2]; - String pv = sa[3]; - String arch = sa[4]; - settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow); + String mg = sa[ffcModGuid]; + String mv = sa[ffcModVer]; + String pg = sa[ffcPkgGuid]; + String pv = sa[ffcPkgVer]; + String arch = sa[ffcModArch]; + settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow, docConsole); settingDlg.setVisible(true); } }); } - return jButton1; + return jButtonSettings; } /** - * This method initializes jButton2 + * This method initializes jButtonRemoveModule * - * @return javax.swing.JButton + * @return javax.swing.JButton jButtonRemoveModule */ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setPreferredSize(new java.awt.Dimension(130,20)); - jButton2.setText("Remove Module"); - jButton2.addActionListener(new java.awt.event.ActionListener() { + private JButton getJButtonRemoveModule() { + if (jButtonRemoveModule == null) { + jButtonRemoveModule = new JButton(); + jButtonRemoveModule.setPreferredSize(new java.awt.Dimension(130, 20)); + jButtonRemoveModule.setText("Remove Module"); + jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRow = jTable1.getSelectedRow(); - if (selectedRow < 0){ + int selectedRow = jTableFpdModules.getSelectedRow(); + if (selectedRow < 0) { return; } + + TableSorter sorter = (TableSorter) jTableFpdModules.getModel(); + selectedRow = sorter.modelIndex(selectedRow); + String[] sa = new String[5]; ffc.getFrameworkModuleInfo(selectedRow, sa); - String mg = sa[0]; - String mv = sa[1]; - String pg = sa[2]; - String pv = sa[3]; - String arch = sa[4]; - ModuleIdentification mi = getModuleId(sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3] + " " + sa[4]); + String mg = sa[ffcModGuid]; + String mv = sa[ffcModVer]; + String pg = sa[ffcPkgGuid]; + String pv = sa[ffcPkgVer]; + String arch = sa[ffcModArch]; + ModuleIdentification mi = GlobalData.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch); mv = mi.getVersion(); pv = mi.getPackage().getVersion(); - model1.removeRow(selectedRow); + modelFpdModules.removeRow(selectedRow); if (arch == null) { // if no arch specified in ModuleSA - fpdMsa.remove(mg+mv+pg+pv); - } - else { - ArrayList al = fpdMsa.get(mg+mv+pg+pv); + fpdMsa.remove(mg + mv + pg + pv); + } else { + ArrayList al = fpdMsa.get(mg + mv + pg + pv); al.remove(arch); if (al.size() == 0) { - fpdMsa.remove(mg+mv+pg+pv); + fpdMsa.remove(mg + mv + pg + pv); } } - - + docConsole.setSaved(false); ffc.removeModuleSA(selectedRow); } }); } - return jButton2; + return jButtonRemoveModule; } /** + * * @param args */ public static void main(String[] args) { - // TODO Auto-generated method stub + // Set the pane visable new FpdFrameworkModules().setVisible(true); } @@ -402,17 +607,17 @@ public class FpdFrameworkModules extends IInternalFrame { initialize(); } - public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){ + public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) { this(); init(fpd); - + } - + public FpdFrameworkModules(OpeningPlatformType opt) { this(opt.getXmlFpd()); docConsole = opt; } - + private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) { try { GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE")); @@ -420,81 +625,92 @@ public class FpdFrameworkModules extends IInternalFrame { catch(Exception e){ JOptionPane.showMessageDialog(frame, "Error occurred when getting module data."); } - - if (ffc == null){ + + if (ffc == null) { ffc = new FpdFileContents(fpd); ffc.initDynPcdMap(); } - + if (fpdMsa == null) { fpdMsa = new HashMap>(); } - + if (ffc.getFrameworkModulesCount() > 0) { String[][] saa = new String[ffc.getFrameworkModulesCount()][5]; ffc.getFrameworkModulesInfo(saa); for (int i = 0; i < saa.length; ++i) { - ModuleIdentification mi = getModuleId(saa[i][0]+ " "+saa[i][1]+" "+saa[i][2]+" "+saa[i][3]); - String[] row = {"", "", "", "", "", ""}; + ModuleIdentification mi = GlobalData.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " " + + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]); + String[] row = { "", "", "", "", "", "", "" }; if (mi != null) { - row[0] = mi.getName(); - row[1] = mi.getVersion(); - row[2] = mi.getPackage().getName(); - row[3] = mi.getPackage().getVersion(); - row[4] = saa[i][4]; - try{ - row[5] = GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1); - } - catch (Exception e) { - JOptionPane.showMessageDialog(frame, "ShowFPDModules:" + e.getMessage()); + row[modNameColForFpdModTable] = mi.getName(); + row[modVerColForFpdModTable] = mi.getVersion(); + row[typeColForFpdModTable] = mi.getModuleType(); + row[pkgNameColForFpdModTable] = mi.getPackage().getName(); + row[pkgVerColForFpdModTable] = mi.getPackage().getVersion(); + row[archColForFpdModTable] = saa[i][4]; + try { + row[pathColForFpdModTable] = GlobalData.getMsaFile(mi).getPath().substring( + System.getenv("WORKSPACE") + .length() + 1); + } catch (Exception e) { + JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage()); } } - model1.addRow(row); - ArrayList al = fpdMsa.get(saa[i][0]+row[1]+saa[i][2]+row[3]); + modelFpdModules.addRow(row); + ArrayList al = fpdMsa.get(saa[i][ffcModGuid] + saa[i][ffcModVer] + + saa[i][ffcPkgGuid] + saa[i][ffcPkgVer]); if (al == null) { al = new ArrayList(); - fpdMsa.put(saa[i][0]+row[1]+saa[i][2]+row[3], al); + fpdMsa.put(saa[i][ffcModGuid] + saa[i][ffcModVer] + saa[i][ffcPkgGuid] + saa[i][ffcPkgVer], al); } - al.add(saa[i][4]); - + al.add(saa[i][ffcModArch]); + } + TableSorter sorter = (TableSorter)jTableFpdModules.getModel(); + sorter.setSortingStatus(modNameColForFpdModTable, TableSorter.ASCENDING); } - + showAllModules(); - + } - + private void showAllModules() { - + if (miList == null) { miList = new ArrayList(); } Set spi = GlobalData.getPackageList(); Iterator ispi = spi.iterator(); - - while(ispi.hasNext()) { - PackageIdentification pi = (PackageIdentification)ispi.next(); - String[] s = {"", "", "", "", ""}; - + + while (ispi.hasNext()) { + PackageIdentification pi = (PackageIdentification) ispi.next(); + String[] s = { "", "", "", "", "", "" }; + Set smi = GlobalData.getModules(pi); Iterator ismi = smi.iterator(); - while(ismi.hasNext()) { - ModuleIdentification mi = (ModuleIdentification)ismi.next(); - s[0] = mi.getName(); - s[1] = mi.getVersion(); - s[2] = pi.getName(); - s[3] = pi.getVersion(); + while (ismi.hasNext()) { + ModuleIdentification mi = (ModuleIdentification) ismi.next(); + s[modNameColForAllModTable] = mi.getName(); + s[modVerColForAllModTable] = mi.getVersion(); + s[typeColForAllModTable] = mi.getModuleType(); + s[pkgNameColForAllModTable] = pi.getName(); + s[pkgVerColForAllModTable] = pi.getVersion(); try { - s[4] = GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1); + s[pathColForAllModTable] = GlobalData.getMsaFile(mi).getPath() + .substring(System.getenv("WORKSPACE").length() + 1); + } catch (Exception e) { + JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage()); } - catch (Exception e) { - JOptionPane.showMessageDialog(frame, "ShowAllModules:" + e.getMessage()); - } - model.addRow(s); + modelAllModules.addRow(s); miList.add(mi); } } + + TableSorter sorter = (TableSorter)jTableAllModules.getModel(); + sorter.setSortingStatus(modNameColForAllModTable, TableSorter.ASCENDING); } + /** * This method initializes this * @@ -505,47 +721,10 @@ public class FpdFrameworkModules extends IInternalFrame { this.setTitle("Framework Modules"); this.setContentPane(getJSplitPane()); this.setVisible(true); - - } - - private ModuleIdentification getModuleId(String key){ - // - // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array. - // - String[] keyPart = key.split(" "); - Set spi = GlobalData.getPackageList(); - Iterator ispi = spi.iterator(); - - while(ispi.hasNext()) { - PackageIdentification pi = (PackageIdentification)ispi.next(); - if ( !pi.getGuid().equals(keyPart[2])){ - - continue; - } - if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){ - if(!pi.getVersion().equals(keyPart[3])){ - continue; - } - } - Set smi = GlobalData.getModules(pi); - Iterator ismi = smi.iterator(); - while(ismi.hasNext()) { - ModuleIdentification mi = (ModuleIdentification)ismi.next(); - if (mi.getGuid().equals(keyPart[0])){ - if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){ - if(!mi.getVersion().equals(keyPart[1])){ - continue; - } - } - return mi; - } - } - } - return null; } -} // @jve:decl-index=0:visual-constraint="10,10" +} // @jve:decl-index=0:visual-constraint="10,10" class NonEditableTableModel extends DefaultTableModel { /**