From 99125b466d093f5a528642aa996da05ef9ec1acd Mon Sep 17 00:00:00 2001 From: jlin16 Date: Wed, 8 Nov 2006 02:59:31 +0000 Subject: [PATCH] Provide UI for generating Apriori file of PEI or DXE phase. The module order information are put into BuildOptions->UserExtensions with UserId as "APRIORI" and Identifier as "0" for PEI phase and "1" for DXE phase. Build tools will use these UserExtensions information to produce the Apriori files that will be placed into each FV image. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1912 6f19259b-4bc3-4df7-8a09-765794883524 --- .../platform/ui/FpdFileContents.java | 60 +- .../frameworkwizard/platform/ui/FpdFlash.java | 1248 ++++++++--------- .../platform/ui/FpdFrameworkModules.java | 29 +- .../platform/ui/FpdModuleSA.java | 4 +- .../platform/ui/GenAprioriFileDialog.java | 265 ++++ 5 files changed, 927 insertions(+), 679 deletions(-) create mode 100644 Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 82a3ded696..fdf5fb55e7 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -1800,15 +1800,15 @@ public class FpdFileContents { return fpdBuildOpts; } - public void genBuildOptionsUserExtensions(String fvName, String outputFileName, Vector includeModules) { + public void genBuildOptionsUserExtensions(String fvName, String userId, String id, String outputFileName, Vector includeModules) { QName elementFvName = new QName (xmlNs, "FvName"); QName elementIncludeModules = new QName(xmlNs, "IncludeModules"); QName elementInfFileName = new QName(xmlNs, "InfFileName"); QName elementModule = new QName(xmlNs, "Module"); UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions(); - userExts.setUserID("IMAGES"); - userExts.setIdentifier(new BigInteger("1")); + userExts.setUserID(userId); + userExts.setIdentifier(new BigInteger(id)); XmlCursor cursor = userExts.newCursor(); cursor.toEndToken(); @@ -1817,7 +1817,7 @@ public class FpdFileContents { cursor.toNextToken(); cursor.beginElement(elementInfFileName); - cursor.insertChars(fvName + ".inf"); + cursor.insertChars(outputFileName); cursor.toNextToken(); cursor.beginElement(elementIncludeModules); @@ -1839,15 +1839,19 @@ public class FpdFileContents { cursor.dispose(); } - public int getUserExtsIncModCount (String fvName) { + public int getUserExtsIncModCount (String fvName, String userId, int id) { if (getfpdBuildOpts().getUserExtensionsList() == null) { return -1; } + ListIterator li = getfpdBuildOpts().getUserExtensionsList().listIterator(); QName elementIncludeModules = new QName(xmlNs, "IncludeModules"); while (li.hasNext()) { UserExtensionsDocument.UserExtensions ues = li.next(); - if (!ues.getUserID().equals("IMAGES")) { + if (!ues.getUserID().equals(userId)) { + continue; + } + if (ues.getIdentifier() == null || ues.getIdentifier().intValue() != id) { continue; } XmlCursor cursor = ues.newCursor(); @@ -1869,14 +1873,15 @@ public class FpdFileContents { return -1; } - public void getUserExtsIncMods(String fvName, String[][] saa) { + public void getUserExtsIncMods(String fvName, String userId, int id, String[][] saa) { if (getfpdBuildOpts().getUserExtensionsList() == null) { return; } - + XmlCursor cursor = getfpdBuildOpts().newCursor(); QName elementUserExts = new QName (xmlNs, "UserExtensions"); QName attribUserId = new QName ("UserID"); + QName attribId = new QName ("Identifier"); QName elementFvName = new QName (xmlNs, "FvName"); QName elementIncludeModules = new QName(xmlNs, "IncludeModules"); QName attribModuleGuid = new QName("ModuleGuid"); @@ -1888,7 +1893,7 @@ public class FpdFileContents { if (cursor.toChild(elementUserExts)) { do { cursor.push(); - if (cursor.getAttributeText(attribUserId).equals("IMAGES")) { + if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id+"")) { cursor.toChild(elementFvName); String elementName = cursor.getTextValue(); if (elementName.equals(fvName)) { @@ -1935,15 +1940,18 @@ public class FpdFileContents { } - public void removeBuildOptionsUserExtensions (String fvName) { + public void removeBuildOptionsUserExtensions (String fvName, String userId, int id) { if (getfpdBuildOpts().getUserExtensionsList() == null) { return; } - + ListIterator li = getfpdBuildOpts().getUserExtensionsList().listIterator(); while (li.hasNext()) { UserExtensionsDocument.UserExtensions ues = li.next(); - if (!ues.getUserID().equals("IMAGES")) { + if (!ues.getUserID().equals(userId)) { + continue; + } + if (ues.getIdentifier()== null || ues.getIdentifier().intValue() != id) { continue; } XmlCursor cursor = ues.newCursor(); @@ -1974,13 +1982,13 @@ public class FpdFileContents { return false; } - public boolean moduleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { + public boolean moduleInBuildOptionsUserExtensions (String fvName, String userId, int id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { boolean inList = false; - if (getUserExtsIncModCount(fvName) > 0) { - + if (getUserExtsIncModCount(fvName, userId, id) > 0) { XmlCursor cursor = getfpdBuildOpts().newCursor(); QName elementUserExts = new QName (xmlNs, "UserExtensions"); QName attribUserId = new QName ("UserID"); + QName attribId = new QName ("Identifier"); QName elementFvName = new QName (xmlNs, "FvName"); QName elementIncludeModules = new QName(xmlNs, "IncludeModules"); QName attribModuleGuid = new QName("ModuleGuid"); @@ -1992,7 +2000,7 @@ public class FpdFileContents { if (cursor.toChild(elementUserExts)) { do { cursor.push(); - if (cursor.getAttributeText(attribUserId).equals("IMAGES")) { + if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id+"")) { cursor.toChild(elementFvName); String elementName = cursor.getTextValue(); if (elementName.equals(fvName)) { @@ -2035,21 +2043,21 @@ public class FpdFileContents { return inList; } - public void removeModuleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { + public void removeModuleInBuildOptionsUserExtensions (String fvName, String userId, int id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { // // if there is only one module before remove operation, the whole user extension should be removed. // - int moduleAmount = getUserExtsIncModCount(fvName); + int moduleAmount = getUserExtsIncModCount(fvName, userId, id); if (moduleAmount == 1) { - removeBuildOptionsUserExtensions(fvName); + removeBuildOptionsUserExtensions(fvName, userId, id); return; } if (moduleAmount > 1) { - XmlCursor cursor = getfpdBuildOpts().newCursor(); QName elementUserExts = new QName (xmlNs, "UserExtensions"); QName attribUserId = new QName ("UserID"); + QName attribId = new QName ("Identifier"); QName elementFvName = new QName (xmlNs, "FvName"); QName elementIncludeModules = new QName(xmlNs, "IncludeModules"); QName attribModuleGuid = new QName("ModuleGuid"); @@ -2061,7 +2069,7 @@ public class FpdFileContents { if (cursor.toChild(elementUserExts)) { do { cursor.push(); - if (cursor.getAttributeText(attribUserId).equals("IMAGES")) { + if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id+"")) { cursor.toChild(elementFvName); String elementName = cursor.getTextValue(); if (elementName.equals(fvName)) { @@ -2102,16 +2110,20 @@ public class FpdFileContents { } } - public void addModuleIntoBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { - if (moduleInBuildOptionsUserExtensions (fvName, moduleGuid, moduleVersion, packageGuid, packageVersion, arch)) { + public void addModuleIntoBuildOptionsUserExtensions (String fvName, String userId, int id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { + if (moduleInBuildOptionsUserExtensions (fvName, userId, id, moduleGuid, moduleVersion, packageGuid, packageVersion, arch)) { return; } + ListIterator li = getfpdBuildOpts().getUserExtensionsList().listIterator(); QName elementIncludeModules = new QName(xmlNs, "IncludeModules"); QName elementModule = new QName(xmlNs, "Module"); while (li.hasNext()) { UserExtensionsDocument.UserExtensions ues = li.next(); - if (!ues.getUserID().equals("IMAGES")) { + if (!ues.getUserID().equals(userId)) { + continue; + } + if (ues.getIdentifier() == null || ues.getIdentifier().intValue() != id) { continue; } XmlCursor cursor = ues.newCursor(); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java index a880ae41f2..5717b3b781 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java @@ -34,6 +34,7 @@ import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile; import java.awt.FlowLayout; import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.ItemEvent; @@ -1268,7 +1269,10 @@ public class FpdFlash extends IInternalFrame { if (index >= startIndexOfDynamicTab) { return; } - jTabbedPane.addTab(fvName, null, new ModuleOrderPane(fvName, outputFile), null); + ModuleOrderPane pane = new ModuleOrderPane(fvName, outputFile, ffc, this); + pane.showModulesInFv(fvName); + pane.showAllModulesInPlatform(); + jTabbedPane.addTab(fvName, null, pane, null); } /** * This method initializes jTextField4 @@ -1799,7 +1803,10 @@ public class FpdFlash extends IInternalFrame { ffc.updateFvImageNameAll(oldFvName, newFvName); } else { - jTabbedPane.addTab(newFvName, new ModuleOrderPane(newFvName, "")); + ModuleOrderPane pane = new ModuleOrderPane(newFvName, "", ffc, FpdFlash.this); + pane.showModulesInFv(newFvName); + pane.showAllModulesInPlatform(); + jTabbedPane.addTab(newFvName, pane); // Add FvImageNames in Flash String[] fvNames = {newFvName}; ffc.addFvImageFvImageNames(fvNames); @@ -2475,718 +2482,655 @@ public class FpdFlash extends IInternalFrame { } } + + /* (non-Javadoc) + * @see org.tianocore.frameworkwizard.common.ui.IInternalFrame#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent arg0) { + if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) { + docConsole.setSaved(false); + jTabbedPane.setSelectedIndex(0); + } + else if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) { + jTabbedPane.setSelectedIndex(0); + } + else { + return; + } + } -// class ModuleSAInfo { -// private int rowNumber = -1; -// private String moduleGuid = null; -// private String moduleVersion = null; -// private String packageGuid = null; -// private String packageVersion = null; -// private String arch = null; -// -// public ModuleSAInfo (String mg, String mv, String pg, String pv, String a) { -// moduleGuid = mg; -// moduleVersion = mv; -// packageGuid = pg; -// packageVersion = pv; -// arch = a; -// } -// -// /** -// * @return Returns the arch. -// */ -// public String getArch() { -// return arch; -// } -// -// /** -// * @param arch The arch to set. -// */ -// public void setArch(String arch) { -// this.arch = arch; -// } -// -// /** -// * @return Returns the moduleGuid. -// */ -// public String getModuleGuid() { -// return moduleGuid; -// } -// -// /** -// * @param moduleGuid The moduleGuid to set. -// */ -// public void setModuleGuid(String moduleGuid) { -// this.moduleGuid = moduleGuid; -// } -// -// /** -// * @return Returns the moduleVersion. -// */ -// public String getModuleVersion() { -// return moduleVersion; -// } -// -// /** -// * @param moduleVersion The moduleVersion to set. -// */ -// public void setModuleVersion(String moduleVersion) { -// this.moduleVersion = moduleVersion; -// } -// -// /** -// * @return Returns the packageGuid. -// */ -// public String getPackageGuid() { -// return packageGuid; -// } -// -// /** -// * @param packageGuid The packageGuid to set. -// */ -// public void setPackageGuid(String packageGuid) { -// this.packageGuid = packageGuid; -// } -// -// /** -// * @return Returns the packageVersion. -// */ -// public String getPackageVersion() { -// return packageVersion; -// } -// -// /** -// * @param packageVersion The packageVersion to set. -// */ -// public void setPackageVersion(String packageVersion) { -// this.packageVersion = packageVersion; -// } -// -// /** -// * @return Returns the rowNumber. -// */ -// public int getRowNumber() { -// return rowNumber; -// } -// -// /** -// * @param rowNumber The rowNumber to set. -// */ -// public void setRowNumber(int rowNumber) { -// this.rowNumber = rowNumber; -// } -// } +} // @jve:decl-index=0:visual-constraint="10,10" + +class ModuleOrderPane extends JPanel implements ActionListener{ + + /** + * + */ + private static final long serialVersionUID = 1L; + private JPanel jPanelModOrderN = null; + private JPanel jPanelModOrderS = null; + private JPanel jPanelModOrderC = null; + private JScrollPane jScrollPaneModInFv = null; + private JTable jTableModInFv = null; + private JPanel jPanelController = null; + private JScrollPane jScrollPaneFpdModules = null; + private JTable jTableFpdModules = null; + private JButton jButtonUp = null; + private JButton jButtonInsert = null; + private JButton jButtonRemove = null; + private JButton jButtonDown = null; + private JButton jButtonOk = null; + private JButton jButtonCancel = null; + private IDefaultTableModel modInFvTableModel = null; + private IDefaultTableModel fpdModTableModel = null; + private FpdFileContents ffc = null; + private String title = null; + private String outputFileName = null; - private class ModuleOrderPane extends JPanel { - - /** - * - */ - private static final long serialVersionUID = 1L; - private JPanel jPanelModOrderN = null; - private JPanel jPanelModOrderS = null; - private JPanel jPanelModOrderC = null; - private JScrollPane jScrollPaneModInFv = null; - private JTable jTableModInFv = null; - private JPanel jPanelController = null; - private JScrollPane jScrollPaneFpdModules = null; - private JTable jTableFpdModules = null; - private JButton jButtonUp = null; - private JButton jButtonInsert = null; - private JButton jButtonRemove = null; - private JButton jButtonDown = null; - private JButton jButtonOk = null; - private JButton jButtonCancel = null; - private IDefaultTableModel modInFvTableModel = null; - private IDefaultTableModel fpdModTableModel = null; -// private ArrayList listTableModInFvModuleSAInfo = null; -// private ArrayList listTableFpdModulesModuleSAInfo = null; - private String title = null; - private String outputFileName = null; + public ModuleOrderPane(String tabTitle, String file, FpdFileContents inputFfc, ActionListener action) { + super(new BorderLayout()); + title = tabTitle; + outputFileName = file; + ffc = inputFfc; + add(getJPanelModOrderN(), java.awt.BorderLayout.NORTH); + add(getJPanelModOrderS(), java.awt.BorderLayout.SOUTH); + add(getJPanelModOrderC(), java.awt.BorderLayout.CENTER); + jButtonOk.addActionListener(action); + jButtonCancel.addActionListener(action); - public ModuleOrderPane(String tabTitle, String file) { - super(new BorderLayout()); - title = tabTitle; - outputFileName = file; -// listTableModInFvModuleSAInfo = new ArrayList(); -// listTableFpdModulesModuleSAInfo = new ArrayList(); - add(getJPanelModOrderN(), java.awt.BorderLayout.NORTH); - add(getJPanelModOrderS(), java.awt.BorderLayout.SOUTH); - add(getJPanelModOrderC(), java.awt.BorderLayout.CENTER); - showModulesInFv(title); - showAllModulesInPlatform(); - } + } + + public void showModulesInFv(String fvName) { - private void showModulesInFv(String fvName) { - int size = ffc.getUserExtsIncModCount(fvName); - - if (size != -1) { - String[][] saa = new String[size][5]; - ffc.getUserExtsIncMods(fvName, saa); - - for (int i = 0; i < size; ++i) { - String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3]; - ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); - String name = "N/A"; - if (mi != null) { - name = mi.getName(); - } - - String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] }; - modInFvTableModel.addRow(row); - } - } - // - // From ModuleSAs, get module guids with FvBinding = fvName. - // - Vector vModuleSA = new Vector(); - ffc.getFrameworkModuleSAByFvBinding(fvName, vModuleSA); - // - // If BuildOptions->UserExtensions already contain these module info, - // no need to add them into table again. - // - Iterator iter = vModuleSA.iterator(); - while (iter.hasNext()){ - String[] sa = iter.next(); - if (!moduleInfoInTable (sa, modInFvTableModel)) { - String moduleKey = sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3]; - ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); - String name = "N/A"; - if (mi != null) { - name = mi.getName(); - } - String[] row = { name, sa[0] , sa[1], sa[2] , sa[3], sa[4] }; - modInFvTableModel.addRow(row); - } - } - + if (modInFvTableModel == null) { + return; } + int size = ffc.getUserExtsIncModCount(fvName, "IMAGES", 1); - private void showAllModulesInPlatform() { - int size = ffc.getFrameworkModulesCount(); + if (size != -1) { String[][] saa = new String[size][5]; - ffc.getFrameworkModulesInfo(saa); - + ffc.getUserExtsIncMods(fvName, "IMAGES", 1, saa); + for (int i = 0; i < size; ++i) { - if (moduleInfoInTable(saa[i], modInFvTableModel) || moduleInfoInTable(saa[i], fpdModTableModel)) { - continue; - } String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3]; ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); String name = "N/A"; if (mi != null) { name = mi.getName(); } + String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] }; - fpdModTableModel.addRow(row); + modInFvTableModel.addRow(row); } - - TableSorter sorter = (TableSorter)jTableFpdModules.getModel(); - sorter.setSortState(0, TableSorter.ASCENDING); } - - - private boolean moduleInfoInTable (String[] moduleInfo, DefaultTableModel model) { - boolean matched = false; - int size = model.getDataVector().size(); - for (int i = 0; i < size; ++i) { - Vector rowData = (Vector)model.getDataVector().elementAt(i); - for (int j = 1; j < rowData.size(); ++j) { - if (rowData.elementAt(j) == null && moduleInfo[j-1] == null) { - matched = true; - } - else if (rowData.elementAt(j).equals("null") && moduleInfo[j-1] == null) { - matched = true; - } - else if (rowData.elementAt(j) == null && moduleInfo[j-1].equals("null")) { - matched = true; - } - else if (rowData.elementAt(j) != null && rowData.elementAt(j).toString().equalsIgnoreCase(moduleInfo[j-1])) { - matched = true; - } - else { - matched = false; - break; - } - } - - if (matched) { - return true; + // + // From ModuleSAs, get module guids with FvBinding = fvName. + // + Vector vModuleSA = new Vector(); + ffc.getFrameworkModuleSAByFvBinding(fvName, vModuleSA); + // + // If BuildOptions->UserExtensions already contain these module info, + // no need to add them into table again. + // + Iterator iter = vModuleSA.iterator(); + while (iter.hasNext()){ + String[] sa = iter.next(); + if (!moduleInfoInTable (sa, modInFvTableModel)) { + String moduleKey = sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3]; + ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); + String name = "N/A"; + if (mi != null) { + name = mi.getName(); } - + String[] row = { name, sa[0] , sa[1], sa[2] , sa[3], sa[4] }; + modInFvTableModel.addRow(row); } - return false; } + + } + + public void showAllModulesInPlatform() { + if (modInFvTableModel == null || fpdModTableModel == null) { + return; + } + int size = ffc.getFrameworkModulesCount(); + String[][] saa = new String[size][5]; + ffc.getFrameworkModulesInfo(saa); - - /** - * This method initializes jPanelModOrderN - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelModOrderN() { - if (jPanelModOrderN == null) { - jPanelModOrderN = new JPanel(); + for (int i = 0; i < size; ++i) { + if (moduleInfoInTable(saa[i], modInFvTableModel) || moduleInfoInTable(saa[i], fpdModTableModel)) { + continue; } - return jPanelModOrderN; - } - - /** - * This method initializes jPanelModOrderS - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelModOrderS() { - if (jPanelModOrderS == null) { - FlowLayout flowLayout6 = new FlowLayout(); - flowLayout6.setAlignment(java.awt.FlowLayout.RIGHT); - jPanelModOrderS = new JPanel(); - jPanelModOrderS.setLayout(flowLayout6); - jPanelModOrderS.add(getJButtonOk(), null); - jPanelModOrderS.add(getJButtonCancel(), null); + String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3]; + ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); + String name = "N/A"; + if (mi != null) { + name = mi.getName(); } - return jPanelModOrderS; - } - - /** - * This method initializes jPanelModOrderC - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelModOrderC() { - if (jPanelModOrderC == null) { - jPanelModOrderC = new JPanel(); - jPanelModOrderC.add(getJScrollPaneModInFv(), null); - jPanelModOrderC.add(getJPanelController(), null); - jPanelModOrderC.add(getJScrollPaneFpdModules(), null); + String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] }; + fpdModTableModel.addRow(row); + } + + TableSorter sorter = (TableSorter)jTableFpdModules.getModel(); + sorter.setSortState(0, TableSorter.ASCENDING); + } + + + protected boolean moduleInfoInTable (String[] moduleInfo, DefaultTableModel model) { + boolean matched = false; + int size = model.getDataVector().size(); + for (int i = 0; i < size; ++i) { + Vector rowData = (Vector)model.getDataVector().elementAt(i); + for (int j = 1; j < rowData.size(); ++j) { + if (rowData.elementAt(j) == null && moduleInfo[j-1] == null) { + matched = true; + } + else if (rowData.elementAt(j).equals("null") && moduleInfo[j-1] == null) { + matched = true; + } + else if (rowData.elementAt(j) == null && moduleInfo[j-1].equals("null")) { + matched = true; + } + else if (rowData.elementAt(j) != null && rowData.elementAt(j).toString().equalsIgnoreCase(moduleInfo[j-1])) { + matched = true; + } + else { + matched = false; + break; + } } - return jPanelModOrderC; - } - - /** - * This method initializes jScrollPaneModInFv - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPaneModInFv() { - if (jScrollPaneModInFv == null) { - jScrollPaneModInFv = new JScrollPane(); - jScrollPaneModInFv.setPreferredSize(new java.awt.Dimension(200,500)); - jScrollPaneModInFv.setViewportView(getJTableModInFv()); + + if (matched) { + return true; } - return jScrollPaneModInFv; + + } + return false; + } + + + + /** + * This method initializes jPanelModOrderN + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelModOrderN() { + if (jPanelModOrderN == null) { + jPanelModOrderN = new JPanel(); } + return jPanelModOrderN; + } - /** - * This method initializes jTableModInFv - * - * @return javax.swing.JTable - */ - private JTable getJTableModInFv() { - if (jTableModInFv == null) { - modInFvTableModel = new IDefaultTableModel(); - - jTableModInFv = new JTable(modInFvTableModel){ - /** - * - */ - private static final long serialVersionUID = 4903583933542581721L; - - public String getToolTipText(MouseEvent e) { - String tip = null; - java.awt.Point p = e.getPoint(); - int rowIndex = rowAtPoint(p); -// int colIndex = columnAtPoint(p); -// int realColumnIndex = convertColumnIndexToModel(colIndex); - - TableModel model = getModel(); + /** + * This method initializes jPanelModOrderS + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelModOrderS() { + if (jPanelModOrderS == null) { + FlowLayout flowLayout6 = new FlowLayout(); + flowLayout6.setAlignment(java.awt.FlowLayout.RIGHT); + jPanelModOrderS = new JPanel(); + jPanelModOrderS.setLayout(flowLayout6); + jPanelModOrderS.add(getJButtonOk(), null); + jPanelModOrderS.add(getJButtonCancel(), null); + } + return jPanelModOrderS; + } + + /** + * This method initializes jPanelModOrderC + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelModOrderC() { + if (jPanelModOrderC == null) { + jPanelModOrderC = new JPanel(); + jPanelModOrderC.add(getJScrollPaneModInFv(), null); + jPanelModOrderC.add(getJPanelController(), null); + jPanelModOrderC.add(getJScrollPaneFpdModules(), null); + } + return jPanelModOrderC; + } + + /** + * This method initializes jScrollPaneModInFv + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPaneModInFv() { + if (jScrollPaneModInFv == null) { + jScrollPaneModInFv = new JScrollPane(); + jScrollPaneModInFv.setPreferredSize(new java.awt.Dimension(200,500)); + jScrollPaneModInFv.setViewportView(getJTableModInFv()); + } + return jScrollPaneModInFv; + } + + /** + * This method initializes jTableModInFv + * + * @return javax.swing.JTable + */ + protected JTable getJTableModInFv() { + if (jTableModInFv == null) { + modInFvTableModel = new IDefaultTableModel(); + + jTableModInFv = new JTable(modInFvTableModel){ + /** + * + */ + private static final long serialVersionUID = 4903583933542581721L; + + public String getToolTipText(MouseEvent e) { + String tip = null; + java.awt.Point p = e.getPoint(); + int rowIndex = rowAtPoint(p); +// int colIndex = columnAtPoint(p); +// int realColumnIndex = convertColumnIndexToModel(colIndex); + + TableModel model = getModel(); + String mg = (String) model.getValueAt(rowIndex, 1); + String mv = (String) model.getValueAt(rowIndex, 2); + String pg = (String) model.getValueAt(rowIndex, 3); + String pv = (String) model.getValueAt(rowIndex, 4); + String arch = (String) model.getValueAt(rowIndex, 5); + ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv); + if (mi != null) { + tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";"; + } + else { + tip = "No Module Path Information."; + } + + return tip; + } + + }; + modInFvTableModel.addColumn("Module Orders in FV"); + modInFvTableModel.addColumn("mg"); + modInFvTableModel.addColumn("mv"); + modInFvTableModel.addColumn("pg"); + modInFvTableModel.addColumn("pv"); + modInFvTableModel.addColumn("arch"); + + for (int i = 1; i < 6; ++i) { + jTableModInFv.removeColumn(jTableModInFv.getColumnModel().getColumn(jTableModInFv.getColumnCount()-1)); + } + + jTableModInFv.setRowHeight(20); + jTableModInFv.setShowGrid(false); + jTableModInFv.setAutoCreateColumnsFromModel(false); + jTableModInFv.addMouseListener(new MouseAdapter() { + + /* (non-Javadoc) + * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) + */ + @Override + public void mouseClicked(MouseEvent arg0) { + if (arg0.getButton() == MouseEvent.BUTTON3) { + java.awt.Point p = arg0.getPoint(); + int rowIndex = jTableModInFv.rowAtPoint(p); + TableModel model = jTableModInFv.getModel(); String mg = (String) model.getValueAt(rowIndex, 1); String mv = (String) model.getValueAt(rowIndex, 2); String pg = (String) model.getValueAt(rowIndex, 3); String pv = (String) model.getValueAt(rowIndex, 4); - String arch = (String) model.getValueAt(rowIndex, 5); ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv); + String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv; if (mi != null) { - tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";"; - } - else { - tip = "No Module Path Information."; + details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv; } - - return tip; + JOptionPane.showMessageDialog(ModuleOrderPane.this, details); } - - }; - modInFvTableModel.addColumn("Module Orders in FV"); - modInFvTableModel.addColumn("mg"); - modInFvTableModel.addColumn("mv"); - modInFvTableModel.addColumn("pg"); - modInFvTableModel.addColumn("pv"); - modInFvTableModel.addColumn("arch"); - - for (int i = 1; i < 6; ++i) { - jTableModInFv.removeColumn(jTableModInFv.getColumnModel().getColumn(jTableModInFv.getColumnCount()-1)); } - jTableModInFv.setRowHeight(20); - jTableModInFv.setShowGrid(false); - jTableModInFv.setAutoCreateColumnsFromModel(false); - jTableModInFv.addMouseListener(new MouseAdapter() { - - /* (non-Javadoc) - * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) - */ - @Override - public void mouseClicked(MouseEvent arg0) { - if (arg0.getButton() == MouseEvent.BUTTON3) { - java.awt.Point p = arg0.getPoint(); - int rowIndex = jTableModInFv.rowAtPoint(p); - TableModel model = jTableModInFv.getModel(); - String mg = (String) model.getValueAt(rowIndex, 1); - String mv = (String) model.getValueAt(rowIndex, 2); - String pg = (String) model.getValueAt(rowIndex, 3); - String pv = (String) model.getValueAt(rowIndex, 4); - ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv); - String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv; - if (mi != null) { - details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv; - } - JOptionPane.showMessageDialog(frame, details); - } + }); + } + return jTableModInFv; + } + + /** + * This method initializes jPanelController + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelController() { + if (jPanelController == null) { + FlowLayout flowLayout5 = new FlowLayout(); + flowLayout5.setVgap(50); + flowLayout5.setHgap(50); + jPanelController = new JPanel(); + jPanelController.setLayout(flowLayout5); + jPanelController.setPreferredSize(new java.awt.Dimension(150,500)); + jPanelController.add(getJButtonUp(), null); + jPanelController.add(getJButtonInsert(), null); + jPanelController.add(getJButtonRemove(), null); + jPanelController.add(getJButtonDown(), null); + } + return jPanelController; + } + + /** + * This method initializes jScrollPaneFpdModules + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPaneFpdModules() { + if (jScrollPaneFpdModules == null) { + jScrollPaneFpdModules = new JScrollPane(); + jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(200,500)); + jScrollPaneFpdModules.setViewportView(getJTableFpdModules()); + } + return jScrollPaneFpdModules; + } + + /** + * This method initializes jTableFpdModules + * + * @return javax.swing.JTable + */ + private JTable getJTableFpdModules() { + if (jTableFpdModules == null) { + fpdModTableModel = new IDefaultTableModel(); + TableSorter sorter = new TableSorter(fpdModTableModel); + jTableFpdModules = new JTable(sorter){ + /** + * + */ + private static final long serialVersionUID = -4666296888377637808L; + + public String getToolTipText(MouseEvent e) { + String tip = null; + java.awt.Point p = e.getPoint(); + int rowIndex = rowAtPoint(p); +// int colIndex = columnAtPoint(p); +// int realColumnIndex = convertColumnIndexToModel(colIndex); + + TableModel model = getModel(); + String mg = (String) model.getValueAt(rowIndex, 1); + String mv = (String) model.getValueAt(rowIndex, 2); + String pg = (String) model.getValueAt(rowIndex, 3); + String pv = (String) model.getValueAt(rowIndex, 4); + String arch = (String) model.getValueAt(rowIndex, 5); + ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv); + if (mi != null) { + tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";"; } - - }); - } - return jTableModInFv; - } - - /** - * This method initializes jPanelController - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelController() { - if (jPanelController == null) { - FlowLayout flowLayout5 = new FlowLayout(); - flowLayout5.setVgap(50); - flowLayout5.setHgap(50); - jPanelController = new JPanel(); - jPanelController.setLayout(flowLayout5); - jPanelController.setPreferredSize(new java.awt.Dimension(150,500)); - jPanelController.add(getJButtonUp(), null); - jPanelController.add(getJButtonInsert(), null); - jPanelController.add(getJButtonRemove(), null); - jPanelController.add(getJButtonDown(), null); - } - return jPanelController; - } - - /** - * This method initializes jScrollPaneFpdModules - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPaneFpdModules() { - if (jScrollPaneFpdModules == null) { - jScrollPaneFpdModules = new JScrollPane(); - jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(200,500)); - jScrollPaneFpdModules.setViewportView(getJTableFpdModules()); + else { + tip = "No Module Path Information."; + } + + return tip; + } + + }; + + fpdModTableModel.addColumn("Modules in Platform"); + fpdModTableModel.addColumn("mg"); + fpdModTableModel.addColumn("mv"); + fpdModTableModel.addColumn("pg"); + fpdModTableModel.addColumn("pv"); + fpdModTableModel.addColumn("arch"); + + for (int i = 1; i < 6; ++i) { + jTableFpdModules.removeColumn(jTableFpdModules.getColumnModel().getColumn(jTableFpdModules.getColumnCount()-1)); } - return jScrollPaneFpdModules; - } - - /** - * This method initializes jTableFpdModules - * - * @return javax.swing.JTable - */ - private JTable getJTableFpdModules() { - if (jTableFpdModules == null) { - fpdModTableModel = new IDefaultTableModel(); - TableSorter sorter = new TableSorter(fpdModTableModel); - jTableFpdModules = new JTable(sorter){ - /** - * - */ - private static final long serialVersionUID = -4666296888377637808L; - - public String getToolTipText(MouseEvent e) { - String tip = null; - java.awt.Point p = e.getPoint(); - int rowIndex = rowAtPoint(p); -// int colIndex = columnAtPoint(p); -// int realColumnIndex = convertColumnIndexToModel(colIndex); - - TableModel model = getModel(); + jTableFpdModules.setRowHeight(20); + jTableFpdModules.setShowGrid(false); + jTableFpdModules.setAutoCreateColumnsFromModel(false); + jTableFpdModules.addMouseListener(new MouseAdapter() { + + /* (non-Javadoc) + * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) + */ + @Override + public void mouseClicked(MouseEvent arg0) { + if (arg0.getButton() == MouseEvent.BUTTON3) { + java.awt.Point p = arg0.getPoint(); + int rowIndex = jTableFpdModules.rowAtPoint(p); + TableModel model = jTableFpdModules.getModel(); String mg = (String) model.getValueAt(rowIndex, 1); String mv = (String) model.getValueAt(rowIndex, 2); String pg = (String) model.getValueAt(rowIndex, 3); String pv = (String) model.getValueAt(rowIndex, 4); - String arch = (String) model.getValueAt(rowIndex, 5); ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv); + String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv; if (mi != null) { - tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";"; - } - else { - tip = "No Module Path Information."; + details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv; } - - return tip; + JOptionPane.showMessageDialog(ModuleOrderPane.this, details); } - - }; - - fpdModTableModel.addColumn("Modules in Platform"); - fpdModTableModel.addColumn("mg"); - fpdModTableModel.addColumn("mv"); - fpdModTableModel.addColumn("pg"); - fpdModTableModel.addColumn("pv"); - fpdModTableModel.addColumn("arch"); - - for (int i = 1; i < 6; ++i) { - jTableFpdModules.removeColumn(jTableFpdModules.getColumnModel().getColumn(jTableFpdModules.getColumnCount()-1)); } - jTableFpdModules.setRowHeight(20); - jTableFpdModules.setShowGrid(false); - jTableFpdModules.setAutoCreateColumnsFromModel(false); - jTableFpdModules.addMouseListener(new MouseAdapter() { - - /* (non-Javadoc) - * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) - */ - @Override - public void mouseClicked(MouseEvent arg0) { - if (arg0.getButton() == MouseEvent.BUTTON3) { - java.awt.Point p = arg0.getPoint(); - int rowIndex = jTableFpdModules.rowAtPoint(p); - TableModel model = jTableFpdModules.getModel(); - String mg = (String) model.getValueAt(rowIndex, 1); - String mv = (String) model.getValueAt(rowIndex, 2); - String pg = (String) model.getValueAt(rowIndex, 3); - String pv = (String) model.getValueAt(rowIndex, 4); - ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv); - String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv; - if (mi != null) { - details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv; - } - JOptionPane.showMessageDialog(frame, details); - } + + }); + + } + return jTableFpdModules; + } + + /** + * This method initializes jButtonUp + * + * @return javax.swing.JButton + */ + private JButton getJButtonUp() { + if (jButtonUp == null) { + jButtonUp = new JButton(); + jButtonUp.setPreferredSize(new java.awt.Dimension(60,20)); + jButtonUp.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14)); + jButtonUp.setText("^"); + jButtonUp.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + int selectedRow = jTableModInFv.getSelectedRow(); + if (selectedRow <= 0) { + return; } - - }); + modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow - 1); + jTableModInFv.changeSelection(selectedRow - 1, 0, false, false); + } + }); + } + return jButtonUp; + } - } - return jTableFpdModules; - } - - /** - * This method initializes jButtonUp - * - * @return javax.swing.JButton - */ - private JButton getJButtonUp() { - if (jButtonUp == null) { - jButtonUp = new JButton(); - jButtonUp.setPreferredSize(new java.awt.Dimension(60,20)); - jButtonUp.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14)); - jButtonUp.setText("^"); - jButtonUp.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRow = jTableModInFv.getSelectedRow(); - if (selectedRow <= 0) { - return; - } - modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow - 1); - jTableModInFv.changeSelection(selectedRow - 1, 0, false, false); + /** + * This method initializes jButtonInsert + * + * @return javax.swing.JButton + */ + private JButton getJButtonInsert() { + if (jButtonInsert == null) { + jButtonInsert = new JButton(); + jButtonInsert.setText("<"); + jButtonInsert.setPreferredSize(new java.awt.Dimension(60,20)); + jButtonInsert.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + int selectedRowRight = jTableFpdModules.getSelectedRow(); + if (selectedRowRight < 0) { + return; } - }); - } - return jButtonUp; - } - - /** - * This method initializes jButtonInsert - * - * @return javax.swing.JButton - */ - private JButton getJButtonInsert() { - if (jButtonInsert == null) { - jButtonInsert = new JButton(); - jButtonInsert.setText("<"); - jButtonInsert.setPreferredSize(new java.awt.Dimension(60,20)); - jButtonInsert.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRowRight = jTableFpdModules.getSelectedRow(); - if (selectedRowRight < 0) { - return; - } - - int rowInModel = ((TableSorter)jTableFpdModules.getModel()).getModelRowIndex(selectedRowRight); - String name = fpdModTableModel.getValueAt(rowInModel, 0)+""; - String mg = fpdModTableModel.getValueAt(rowInModel, 1)+""; - String mv = fpdModTableModel.getValueAt(rowInModel, 2)+""; - String pg = fpdModTableModel.getValueAt(rowInModel, 3)+""; - String pv = fpdModTableModel.getValueAt(rowInModel, 4)+""; - String arch = fpdModTableModel.getValueAt(rowInModel, 5)+""; - String[] row = {name, mg, mv, pg, pv, arch}; - if (name.length() == 0 || name.equals("N/A")) { - return; - } - - int selectedRowLeft = jTableModInFv.getSelectedRow(); - if (selectedRowLeft < 0) { - modInFvTableModel.addRow(row); - jTableModInFv.changeSelection(jTableModInFv.getRowCount() - 1, 0, false, false); - } - else { - modInFvTableModel.insertRow(selectedRowLeft, row); - jTableModInFv.changeSelection(selectedRowLeft, 0, false, false); - } - fpdModTableModel.removeRow(rowInModel); + + int rowInModel = ((TableSorter)jTableFpdModules.getModel()).getModelRowIndex(selectedRowRight); + String name = fpdModTableModel.getValueAt(rowInModel, 0)+""; + String mg = fpdModTableModel.getValueAt(rowInModel, 1)+""; + String mv = fpdModTableModel.getValueAt(rowInModel, 2)+""; + String pg = fpdModTableModel.getValueAt(rowInModel, 3)+""; + String pv = fpdModTableModel.getValueAt(rowInModel, 4)+""; + String arch = fpdModTableModel.getValueAt(rowInModel, 5)+""; + String[] row = {name, mg, mv, pg, pv, arch}; + if (name.length() == 0 || name.equals("N/A")) { + return; } - }); - } - return jButtonInsert; - } - - /** - * This method initializes jButtonRemove - * - * @return javax.swing.JButton - */ - private JButton getJButtonRemove() { - if (jButtonRemove == null) { - jButtonRemove = new JButton(); - jButtonRemove.setPreferredSize(new java.awt.Dimension(60,20)); - jButtonRemove.setText(">"); - jButtonRemove.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRowLeft = jTableModInFv.getSelectedRow(); - if (selectedRowLeft < 0) { - return; - } - - String name = modInFvTableModel.getValueAt(selectedRowLeft, 0)+""; - String mg = modInFvTableModel.getValueAt(selectedRowLeft, 1)+""; - String mv = modInFvTableModel.getValueAt(selectedRowLeft, 2)+""; - String pg = modInFvTableModel.getValueAt(selectedRowLeft, 3)+""; - String pv = modInFvTableModel.getValueAt(selectedRowLeft, 4)+""; - String arch = modInFvTableModel.getValueAt(selectedRowLeft, 5)+""; - String[] row = {name, mg, mv, pg, pv, arch}; - String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch; - if (name.length() == 0 || name.equals("N/A") || ffc.getModuleSA(moduleKey) == null) { - JOptionPane.showMessageDialog(frame, "Module " + name + " not exists in platform. If you want to add back this module, please first add it into current platform. " + moduleKey ); - modInFvTableModel.removeRow(selectedRowLeft); - return; - } - - fpdModTableModel.addRow(row); - int viewIndex = ((TableSorter) jTableFpdModules.getModel()).getViewIndexArray()[jTableFpdModules - .getRowCount() - 1]; - jTableFpdModules.changeSelection(viewIndex, 0, false, false); - modInFvTableModel.removeRow(selectedRowLeft); + + int selectedRowLeft = jTableModInFv.getSelectedRow(); + if (selectedRowLeft < 0) { + modInFvTableModel.addRow(row); + jTableModInFv.changeSelection(jTableModInFv.getRowCount() - 1, 0, false, false); } - }); - } - return jButtonRemove; - } - - /** - * This method initializes jButtonDown - * - * @return javax.swing.JButton - */ - private JButton getJButtonDown() { - if (jButtonDown == null) { - jButtonDown = new JButton(); - jButtonDown.setPreferredSize(new java.awt.Dimension(60,20)); - jButtonDown.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10)); - jButtonDown.setText("v"); - jButtonDown.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRow = jTableModInFv.getSelectedRow(); - if (selectedRow >= jTableModInFv.getRowCount() - 1) { - return; - } - modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow + 1); - jTableModInFv.changeSelection(selectedRow + 1, 0, false, false); + else { + modInFvTableModel.insertRow(selectedRowLeft, row); + jTableModInFv.changeSelection(selectedRowLeft, 0, false, false); } - }); - } - return jButtonDown; + fpdModTableModel.removeRow(rowInModel); + } + }); } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setPreferredSize(new java.awt.Dimension(80,20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - // need reset FvBindings in ModuleSA. - ffc.removeFvBindingAll(title); - // - // collect module order information to store them into -> . - // also update the FvBinding info in . - // - Vector vModInFv = new Vector(); - for (int i = 0; i < jTableModInFv.getRowCount(); ++i) { - String moduleName = modInFvTableModel.getValueAt(i, 0)+""; - if (moduleName.length() == 0 || moduleName.equals("N/A")) { - continue; - } - - String mg = modInFvTableModel.getValueAt(i, 1)+""; - String mv = modInFvTableModel.getValueAt(i, 2)+""; - String pg = modInFvTableModel.getValueAt(i, 3)+""; - String pv = modInFvTableModel.getValueAt(i, 4)+""; - String arch = modInFvTableModel.getValueAt(i, 5)+""; - - String moduleInfo = mg + " " + mv + " " + pg + " " + pv + " " + arch; - - String[] sa = { mg, mv, pg, pv, arch}; - vModInFv.add(sa); - ffc.updateFvBindingInModuleSA(moduleInfo, title); - - } - ffc.removeBuildOptionsUserExtensions(title); - ffc.genBuildOptionsUserExtensions(title, outputFileName, vModInFv); - - docConsole.setSaved(false); - jTabbedPane.setSelectedIndex(0); + return jButtonInsert; + } + + /** + * This method initializes jButtonRemove + * + * @return javax.swing.JButton + */ + private JButton getJButtonRemove() { + if (jButtonRemove == null) { + jButtonRemove = new JButton(); + jButtonRemove.setPreferredSize(new java.awt.Dimension(60,20)); + jButtonRemove.setText(">"); + jButtonRemove.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + int selectedRowLeft = jTableModInFv.getSelectedRow(); + if (selectedRowLeft < 0) { + return; } - }); - } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - jTabbedPane.setSelectedIndex(0); + + String name = modInFvTableModel.getValueAt(selectedRowLeft, 0)+""; + String mg = modInFvTableModel.getValueAt(selectedRowLeft, 1)+""; + String mv = modInFvTableModel.getValueAt(selectedRowLeft, 2)+""; + String pg = modInFvTableModel.getValueAt(selectedRowLeft, 3)+""; + String pv = modInFvTableModel.getValueAt(selectedRowLeft, 4)+""; + String arch = modInFvTableModel.getValueAt(selectedRowLeft, 5)+""; + String[] row = {name, mg, mv, pg, pv, arch}; + String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch; + if (name.length() == 0 || name.equals("N/A") || ffc.getModuleSA(moduleKey) == null) { + JOptionPane.showMessageDialog(ModuleOrderPane.this, "Module " + name + " not exists in platform. If you want to add back this module, please first add it into current platform. " + moduleKey ); + modInFvTableModel.removeRow(selectedRowLeft); + return; } - }); + + fpdModTableModel.addRow(row); + int viewIndex = ((TableSorter) jTableFpdModules.getModel()).getViewIndexArray()[jTableFpdModules + .getRowCount() - 1]; + jTableFpdModules.changeSelection(viewIndex, 0, false, false); + modInFvTableModel.removeRow(selectedRowLeft); + } + }); + } + return jButtonRemove; + } + + /** + * This method initializes jButtonDown + * + * @return javax.swing.JButton + */ + private JButton getJButtonDown() { + if (jButtonDown == null) { + jButtonDown = new JButton(); + jButtonDown.setPreferredSize(new java.awt.Dimension(60,20)); + jButtonDown.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10)); + jButtonDown.setText("v"); + jButtonDown.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + int selectedRow = jTableModInFv.getSelectedRow(); + if (selectedRow >= jTableModInFv.getRowCount() - 1) { + return; + } + modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow + 1); + jTableModInFv.changeSelection(selectedRow + 1, 0, false, false); + } + }); + } + return jButtonDown; + } + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + */ + protected JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setPreferredSize(new java.awt.Dimension(80,20)); + jButtonOk.setText("Ok"); + jButtonOk.setActionCommand("ModuleOrderPaneOk"); + jButtonOk.addActionListener(this); + + } + return jButtonOk; + } + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + */ + protected JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.setActionCommand("ModuleOrderPaneCancel"); + + } + return jButtonCancel; + } + + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + // need reset FvBindings in ModuleSA. + ffc.removeFvBindingAll(title); + // + // collect module order information to store them into -> . + // also update the FvBinding info in . + // + Vector vModInFv = new Vector(); + for (int i = 0; i < jTableModInFv.getRowCount(); ++i) { + String moduleName = modInFvTableModel.getValueAt(i, 0)+""; + if (moduleName.length() == 0 || moduleName.equals("N/A")) { + continue; + } + + String mg = modInFvTableModel.getValueAt(i, 1)+""; + String mv = modInFvTableModel.getValueAt(i, 2)+""; + String pg = modInFvTableModel.getValueAt(i, 3)+""; + String pv = modInFvTableModel.getValueAt(i, 4)+""; + String arch = modInFvTableModel.getValueAt(i, 5)+""; + + String moduleInfo = mg + " " + mv + " " + pg + " " + pv + " " + arch; + + String[] sa = { mg, mv, pg, pv, arch}; + vModInFv.add(sa); + ffc.updateFvBindingInModuleSA(moduleInfo, title); + } - return jButtonCancel; + ffc.removeBuildOptionsUserExtensions(title, "IMAGES", 1); + ffc.genBuildOptionsUserExtensions(title, "IMAGES", "1", outputFileName, vModInFv); + } } -} // @jve:decl-index=0:visual-constraint="10,10" + /** + * @return Returns the fpdModTableModel. + */ + protected IDefaultTableModel getFpdModTableModel() { + return fpdModTableModel; + } + + /** + * @return Returns the modInFvTableModel. + */ + protected IDefaultTableModel getModInFvTableModel() { + return modInFvTableModel; + } +} + class FvOptsTableModel extends DefaultTableModel { diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index 7c41dd9623..d8b193413b 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -40,6 +40,7 @@ import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile; import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; import java.awt.FlowLayout; +import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -188,6 +189,8 @@ public class FpdFrameworkModules extends IInternalFrame { private final int typeMinWidth = 100; private final int typeMaxWidth = 155; + + private JButton jButtonApriori = null; /** * This method initializes jSplitPane @@ -526,6 +529,7 @@ public class FpdFrameworkModules extends IInternalFrame { jPanelBottomSouth.setLayout(flowLayout1); jPanelBottomSouth.add(getJButtonSettings(), null); jPanelBottomSouth.add(getJButtonRemoveModule(), null); + jPanelBottomSouth.add(getJButtonApriori(), null); } return jPanelBottomSouth; } @@ -751,7 +755,7 @@ public class FpdFrameworkModules extends IInternalFrame { if (fvBindings != null) { String[] fvArray = fvBindings.split(" "); for (int i = 0; i < fvArray.length; ++i) { - ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), mg, mv, pg, pv, arch); + ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", 1, mg, mv, pg, pv, arch); } } @@ -795,6 +799,29 @@ public class FpdFrameworkModules extends IInternalFrame { return jButtonRemoveModule; } + /** + * This method initializes jButtonApriori + * + * @return javax.swing.JButton + */ + private JButton getJButtonApriori() { + if (jButtonApriori == null) { + jButtonApriori = new JButton(); + jButtonApriori.setText("Apriori Files"); + FontMetrics fm = jButtonApriori.getFontMetrics(jButtonApriori.getFont()); + int buttonWidth = fm.stringWidth(jButtonApriori.getText()) + 40; + if (jButtonRemoveModule.getWidth() > buttonWidth) { + buttonWidth = jButtonRemoveModule.getWidth(); + } + jButtonApriori.setPreferredSize(new Dimension (buttonWidth, 20)); + jButtonApriori.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent arg0) { + new GenAprioriFileDialog(ffc, docConsole).setVisible(true); + }}); + } + return jButtonApriori; + } + /** * * @param args diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index 8f6d31057f..db54307c43 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -1331,7 +1331,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { // oldFvList.removeAll(newFvList); for (int j = 0; j < oldFvList.size(); ++j) { - ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); + ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), "IMAGES", 1, moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); } // // add module to Fvs that were not in oldFvList. @@ -1339,7 +1339,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { oldFvList = getVectorFromString (originalFvBinding); newFvList.removeAll(oldFvList); for (int i = 0; i < newFvList.size(); ++i) { - ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); + ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), "IMAGES", 1, moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); } docConsole.setSaved(false); } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java new file mode 100644 index 0000000000..3ec3572411 --- /dev/null +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java @@ -0,0 +1,265 @@ +/** + * + */ +package org.tianocore.frameworkwizard.platform.ui; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Toolkit; + +import javax.swing.JPanel; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Vector; + +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JComboBox; +import javax.swing.JTabbedPane; + +import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; +import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; +import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile; + +/** + * @author jlin16 + * + */ +public class GenAprioriFileDialog extends JDialog implements ActionListener { + + /** + * + */ + private static final long serialVersionUID = 3627991301208644354L; + private JPanel jContentPane = null; + private JPanel jPanelN = null; + private JLabel jLabelFvName = null; + private JComboBox jComboBoxFvNames = null; + private JTabbedPane jTabbedPane = null; + private FpdFileContents ffc = null; + private OpeningPlatformType docConsole = null; + + /** + * This is the default constructor + */ + public GenAprioriFileDialog(FpdFileContents inputFfc, OpeningPlatformType dc) { + super(); + ffc = inputFfc; + docConsole = dc; + initialize(); + } + + /** + * This method initializes this + * + * @return void + */ + private void initialize() { + this.setSize(670, 670); + this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + this.setTitle("Apriori Files"); + this.setContentPane(getJContentPane()); + this.setResizable(false); + this.setModal(true); + + String fvName = jComboBoxFvNames.getSelectedItem()+""; + if (fvName.length() > 0) { + jTabbedPane.removeAll(); + AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true); + peiPane.showModulesInFv(fvName); + peiPane.showAllModulesInPlatform(); + jTabbedPane.addTab("PEIMs", peiPane); + AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false); + dxePane.showModulesInFv(fvName); + dxePane.showAllModulesInPlatform(); + jTabbedPane.addTab("DXE Drivers", dxePane); + } + this.centerWindow(); + } + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(new BorderLayout()); + jContentPane.add(getJPanelN(), java.awt.BorderLayout.NORTH); + jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER); + } + return jContentPane; + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) { + docConsole.setSaved(false); + return; + } + if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) { + this.dispose(); + } + } + + /** + Start the window at the center of screen + + **/ + protected void centerWindow(int intWidth, int intHeight) { + Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); + this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); + } + + /** + Start the window at the center of screen + + **/ + protected void centerWindow() { + centerWindow(this.getSize().width, this.getSize().height); + } + +/** + * This method initializes jPanelN + * + * @return javax.swing.JPanel + */ +private JPanel getJPanelN() { + if (jPanelN == null) { + jLabelFvName = new JLabel(); + jLabelFvName.setText("FV Name"); + jPanelN = new JPanel(); + jPanelN.add(jLabelFvName, null); + jPanelN.add(getJComboBoxFvNames(), null); + } + return jPanelN; +} + +/** + * This method initializes jComboBoxFvNames + * + * @return javax.swing.JComboBox + */ +private JComboBox getJComboBoxFvNames() { + if (jComboBoxFvNames == null) { + jComboBoxFvNames = new JComboBox(); + jComboBoxFvNames.setPreferredSize(new java.awt.Dimension(200,20)); + Vector vFvNames = new Vector(); + ffc.getFvImagesFvImageFvImageNames(vFvNames); + for (int i = 0; i < vFvNames.size(); ++i) { + jComboBoxFvNames.addItem(vFvNames.get(i)); + } +// if (jComboBoxFvNames.getItemCount() > 0) { +// jComboBoxFvNames.setSelectedIndex(0); +// +// } + jComboBoxFvNames.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent e) { + String fvName = jComboBoxFvNames.getSelectedItem()+""; + if (fvName.length() > 0) { + jTabbedPane.removeAll(); + AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true); + peiPane.showModulesInFv(fvName); + peiPane.showAllModulesInPlatform(); + jTabbedPane.addTab("PEIMs", peiPane); + AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false); + dxePane.showModulesInFv(fvName); + dxePane.showAllModulesInPlatform(); + jTabbedPane.addTab("DXE Drivers", dxePane); + } + + } + }); + } + return jComboBoxFvNames; +} + +/** + * This method initializes jTabbedPane + * + * @return javax.swing.JTabbedPane + */ +private JTabbedPane getJTabbedPane() { + if (jTabbedPane == null) { + jTabbedPane = new JTabbedPane(); + } + return jTabbedPane; +} + +private class AprioriModuleOrderPane extends ModuleOrderPane { + /** + * + */ + private static final long serialVersionUID = -7952853414833230546L; + private boolean forPEI = false; + private String fvName = null; + + AprioriModuleOrderPane (String fvName, String file, ActionListener action, boolean b) { + + super(fvName, file, ffc, action); + this.fvName = fvName; + forPEI = b; + getJTableModInFv().getColumnModel().getColumn(0).setHeaderValue("Modules in Apriori File"); + getJButtonOk().setText("Save"); + getJButtonCancel().setText("Close"); + } + + public void showModulesInFv (String fvName) { + int id = 1; + if (forPEI) { + id = 0; + } + int size = ffc.getUserExtsIncModCount(fvName, "APRIORI", id); + + if (size != -1) { + String[][] saa = new String[size][5]; + ffc.getUserExtsIncMods(fvName, "APRIORI", id, saa); + + for (int i = 0; i < size; ++i) { + String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3]; + ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); + String name = "N/A"; + if (mi != null) { + name = mi.getName(); + } + + String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] }; + getModInFvTableModel().addRow(row); + } + } + } + + public void actionPerformed(ActionEvent arg0) { + if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) { + int id = 1; + if (forPEI) { + id = 0; + } + + Vector vModInFv = new Vector(); + for (int i = 0; i < getJTableModInFv().getRowCount(); ++i) { + String moduleName = getModInFvTableModel().getValueAt(i, 0)+""; + if (moduleName.length() == 0 || moduleName.equals("N/A")) { + continue; + } + + String mg = getModInFvTableModel().getValueAt(i, 1)+""; + String mv = getModInFvTableModel().getValueAt(i, 2)+""; + String pg = getModInFvTableModel().getValueAt(i, 3)+""; + String pv = getModInFvTableModel().getValueAt(i, 4)+""; + String arch = getModInFvTableModel().getValueAt(i, 5)+""; + + String[] sa = { mg, mv, pg, pv, arch}; + vModInFv.add(sa); + + } + + ffc.removeBuildOptionsUserExtensions(fvName, "APRIORI", id); + ffc.genBuildOptionsUserExtensions(fvName, "APRIORI", id+"", "", vModInFv); + + } + } +} +} // @jve:decl-index=0:visual-constraint="10,10" -- 2.39.2