Fixed grammar and column widths (set min, preferred and max widths for version and arch)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1218 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lhauch
2006-08-09 01:09:11 +00:00
parent 13681235d4
commit a8a9de7cbb

View File

@ -35,32 +35,91 @@ public class FpdFrameworkModules extends IInternalFrame {
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
static JFrame frame; static JFrame frame;
private JSplitPane jSplitPane = null; private JSplitPane jSplitPane = null;
private JPanel jPanelTop = null; private JPanel jPanelTop = null;
private JPanel jPanelBottom = null; private JPanel jPanelBottom = null;
private JLabel jLabel = null; private JLabel jLabel = null;
private JScrollPane jScrollPaneAllModules = null; private JScrollPane jScrollPaneAllModules = null;
private JTable jTableAllModules = null; private JTable jTableAllModules = null;
private JPanel jPanelTopSouth = null; private JPanel jPanelTopSouth = null;
private JButton jButtonAddModule = null; private JButton jButtonAddModule = null;
private JLabel jLabelModulesAdded = null; private JLabel jLabelModulesAdded = null;
private JPanel jPanelBottomSouth = null; private JPanel jPanelBottomSouth = null;
private JScrollPane jScrollPaneFpdModules = null; private JScrollPane jScrollPaneFpdModules = null;
private JTable jTableFpdModules = null; private JTable jTableFpdModules = null;
private JButton jButtonSettings = null; private JButton jButtonSettings = null;
private JButton jButtonRemoveModule = null; private JButton jButtonRemoveModule = null;
private NonEditableTableModel modelAllModules = null; private NonEditableTableModel modelAllModules = null;
private NonEditableTableModel modelFpdModules = null; private NonEditableTableModel modelFpdModules = null;
private FpdModuleSA settingDlg = null; private FpdModuleSA settingDlg = null;
private FpdFileContents ffc = null; private FpdFileContents ffc = null;
private OpeningPlatformType docConsole = null; private OpeningPlatformType docConsole = null;
private Map<String, ArrayList<String>> fpdMsa = null; private Map<String, ArrayList<String>> fpdMsa = null;
private ArrayList<ModuleIdentification> miList = null; private ArrayList<ModuleIdentification> miList = null;
private final int ModNameCol = 0;
private final int ModVerCol = 1;
private final int PkgNameCol = 2;
private final int PkgVerCol = 3;
private final int ArchCol = 4;
private final int Path4Col = 4;
private final int Path5Col = 5;
private final int ModNameMinWidth = 168;
private final int ModNamePrefWidth = 200;
private final int PkgNameMinWidth = 100;
private final int PkgNamePrefWidth = 110;
private final int PkgNameMaxWidth = 150;
private final int VerMinWidth = 50;
private final int VerMaxWidth = 80;
private final int VerPrefWidth = 60;
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;
/** /**
* This method initializes jSplitPane * This method initializes jSplitPane
* *
@ -139,11 +198,30 @@ public class FpdFrameworkModules extends IInternalFrame {
jTableAllModules = new JTable(sorter); jTableAllModules = new JTable(sorter);
sorter.setTableHeader(jTableAllModules.getTableHeader()); sorter.setTableHeader(jTableAllModules.getTableHeader());
jTableAllModules.setRowHeight(20); jTableAllModules.setRowHeight(20);
modelAllModules.addColumn("ModuleName"); modelAllModules.addColumn("<html>Module<br>Name</html>");
modelAllModules.addColumn("ModuleVersion"); modelAllModules.addColumn("<html>Module<br>Version</html>");
modelAllModules.addColumn("PackageName"); modelAllModules.addColumn("<html>Package<br>Name</html>");
modelAllModules.addColumn("PackageVersion"); modelAllModules.addColumn("<html>Package<br>Version</html>");
modelAllModules.addColumn("Path"); modelAllModules.addColumn("Path");
javax.swing.table.TableColumn column = null;
column = jTableAllModules.getColumnModel().getColumn(ModNameCol);
column.setPreferredWidth(ModNamePrefWidth);
column.setMinWidth(ModNameMinWidth);
column = jTableAllModules.getColumnModel().getColumn(ModVerCol);
column.setPreferredWidth(VerPrefWidth);
column.setMaxWidth(VerMaxWidth);
column.setMinWidth(VerMinWidth);
column = jTableAllModules.getColumnModel().getColumn(PkgNameCol);
column.setPreferredWidth(PkgNamePrefWidth);
column.setMinWidth(PkgNameMinWidth);
column.setMaxWidth(PkgNameMaxWidth);
column = jTableAllModules.getColumnModel().getColumn(PkgVerCol);
column.setPreferredWidth(VerPrefWidth);
column.setMaxWidth(VerMaxWidth);
column.setMinWidth(VerMinWidth);
column = jTableAllModules.getColumnModel().getColumn(Path4Col);
column.setPreferredWidth(PathPrefWidth);
column.setMinWidth(PathMinWidth);
jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
} }
@ -185,7 +263,7 @@ public class FpdFrameworkModules extends IInternalFrame {
TableSorter sorter = (TableSorter) jTableAllModules.getModel(); TableSorter sorter = (TableSorter) jTableAllModules.getModel();
selectedRow = sorter.modelIndex(selectedRow); selectedRow = sorter.modelIndex(selectedRow);
String path = modelAllModules.getValueAt(selectedRow, 4)+""; String path = modelAllModules.getValueAt(selectedRow, Path4Col) + "";
ModuleIdentification mi = miList.get(selectedRow); ModuleIdentification mi = miList.get(selectedRow);
Vector<String> vArchs = null; Vector<String> vArchs = null;
try { try {
@ -196,7 +274,7 @@ public class FpdFrameworkModules extends IInternalFrame {
} }
if (vArchs == null) { if (vArchs == null) {
JOptionPane.showMessageDialog(frame, "No supported Archs specified in MSA file."); JOptionPane.showMessageDialog(frame, "No Supported Architectures specified in MSA file.");
return; return;
} }
@ -218,7 +296,7 @@ public class FpdFrameworkModules extends IInternalFrame {
// Archs this Module supported have already been added. // Archs this Module supported have already been added.
// //
if (vArchs.size() == 0) { if (vArchs.size() == 0) {
JOptionPane.showMessageDialog(frame, "This Module Already Added."); JOptionPane.showMessageDialog(frame, "This Module has already been added.");
return; return;
} }
//ToDo put Arch instead of null //ToDo put Arch instead of null
@ -230,8 +308,8 @@ public class FpdFrameworkModules extends IInternalFrame {
String[] row = { "", mv, "", pv, arch, path }; String[] row = { "", mv, "", pv, arch, path };
if (mi != null) { if (mi != null) {
row[0] = mi.getName(); row[ModNameCol] = mi.getName();
row[2] = mi.getPackage().getName(); row[PkgNameCol] = mi.getPackage().getName();
} }
modelFpdModules.addRow(row); modelFpdModules.addRow(row);
@ -240,19 +318,18 @@ public class FpdFrameworkModules extends IInternalFrame {
try { try {
//ToDo : specify archs need to add. //ToDo : specify archs need to add.
ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null); ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);
} } catch (Exception exception) {
catch (Exception exception) { JOptionPane.showMessageDialog(frame, "Adding " + row[ModNameCol] + " with SupArch " + arch
JOptionPane.showMessageDialog(frame, "Adding " + row[0] + " with SupArch " + arch + ": "+ exception.getMessage()); + ": " + exception.getMessage());
errorOccurred = true; errorOccurred = true;
} }
} }
String s = "This Module with Arch "+ archsAdded; String s = "This Module with Architecture " + archsAdded;
if (errorOccurred) { if (errorOccurred) {
s += " Added with Error. Platform may NOT Be Built."; s += " was added with Error. Platform may NOT Build.";
} } else {
else { s += " was added Successfully.";
s += " Added Successfully.";
} }
JOptionPane.showMessageDialog(frame, s); JOptionPane.showMessageDialog(frame, s);
jTableFpdModules.changeSelection(modelFpdModules.getRowCount() - 1, 0, false, false); jTableFpdModules.changeSelection(modelFpdModules.getRowCount() - 1, 0, false, false);
@ -305,12 +382,35 @@ public class FpdFrameworkModules extends IInternalFrame {
jTableFpdModules = new JTable(sorter); jTableFpdModules = new JTable(sorter);
sorter.setTableHeader(jTableFpdModules.getTableHeader()); sorter.setTableHeader(jTableFpdModules.getTableHeader());
jTableFpdModules.setRowHeight(20); jTableFpdModules.setRowHeight(20);
modelFpdModules.addColumn("ModuleName"); modelFpdModules.addColumn("<html>Module<br>Name</html>");
modelFpdModules.addColumn("ModuleVersion"); modelFpdModules.addColumn("<html>Module<br>Version</html>");
modelFpdModules.addColumn("PackageName"); modelFpdModules.addColumn("<html>Package<br>Name</html>");
modelFpdModules.addColumn("PackageVersion"); modelFpdModules.addColumn("<html>Package<br>Version</html>");
modelFpdModules.addColumn("SupportedArch"); modelFpdModules.addColumn("<html>Supported<br>Architectures</html>");
modelFpdModules.addColumn("Path"); modelFpdModules.addColumn("Path");
javax.swing.table.TableColumn column = null;
column = jTableFpdModules.getColumnModel().getColumn(ModNameCol);
column.setPreferredWidth(ModNamePrefWidth);
column.setMinWidth(ModNameMinWidth);
column = jTableFpdModules.getColumnModel().getColumn(ModVerCol);
column.setPreferredWidth(VerPrefWidth);
column.setMaxWidth(VerMaxWidth);
column.setMinWidth(VerMinWidth);
column = jTableFpdModules.getColumnModel().getColumn(PkgNameCol);
column.setPreferredWidth(PkgNamePrefWidth);
column.setMinWidth(PkgNameMinWidth);
column.setMaxWidth(PkgNameMaxWidth);
column = jTableFpdModules.getColumnModel().getColumn(PkgVerCol);
column.setPreferredWidth(VerPrefWidth);
column.setMaxWidth(VerMaxWidth);
column.setMinWidth(VerMinWidth);
column = jTableFpdModules.getColumnModel().getColumn(ArchCol);
column.setPreferredWidth(ArchPrefWidth);
column.setMaxWidth(ArchMaxWidth);
column.setMinWidth(ArchMinWidth);
column = jTableFpdModules.getColumnModel().getColumn(Path5Col);
column.setPreferredWidth(PathPrefWidth);
column.setMinWidth(PathMinWidth);
jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
} }
@ -352,11 +452,11 @@ public class FpdFrameworkModules extends IInternalFrame {
String[] sa = new String[5]; String[] sa = new String[5];
ffc.getFrameworkModuleInfo(selectedRow, sa); ffc.getFrameworkModuleInfo(selectedRow, sa);
String mg = sa[0]; String mg = sa[ModNameCol];
String mv = sa[1]; String mv = sa[ModVerCol];
String pg = sa[2]; String pg = sa[PkgNameCol];
String pv = sa[3]; String pv = sa[PkgVerCol];
String arch = sa[4]; String arch = sa[ArchCol];
settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow, docConsole); settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow, docConsole);
settingDlg.setVisible(true); settingDlg.setVisible(true);
} }
@ -365,7 +465,6 @@ public class FpdFrameworkModules extends IInternalFrame {
return jButtonSettings; return jButtonSettings;
} }
/** /**
* This method initializes jButton2 * This method initializes jButton2
* *
@ -388,20 +487,21 @@ public class FpdFrameworkModules extends IInternalFrame {
String[] sa = new String[5]; String[] sa = new String[5];
ffc.getFrameworkModuleInfo(selectedRow, sa); ffc.getFrameworkModuleInfo(selectedRow, sa);
String mg = sa[0]; String mg = sa[ModNameCol];
String mv = sa[1]; String mv = sa[ModVerCol];
String pg = sa[2]; String pg = sa[PkgNameCol];
String pv = sa[3]; String pv = sa[PkgVerCol];
String arch = sa[4]; String arch = sa[ArchCol];
ModuleIdentification mi = GlobalData.getModuleId(sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3] + " " + sa[4]); ModuleIdentification mi = GlobalData.getModuleId(sa[ModNameCol] + " " + sa[ModVerCol] + " "
+ sa[PkgNameCol] + " " + sa[PkgVerCol] + " "
+ sa[ArchCol]);
mv = mi.getVersion(); mv = mi.getVersion();
pv = mi.getPackage().getVersion(); pv = mi.getPackage().getVersion();
modelFpdModules.removeRow(selectedRow); modelFpdModules.removeRow(selectedRow);
if (arch == null) { if (arch == null) {
// if no arch specified in ModuleSA // if no arch specified in ModuleSA
fpdMsa.remove(mg + mv + pg + pv); fpdMsa.remove(mg + mv + pg + pv);
} } else {
else {
ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv); ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
al.remove(arch); al.remove(arch);
if (al.size() == 0) { if (al.size() == 0) {
@ -409,7 +509,6 @@ public class FpdFrameworkModules extends IInternalFrame {
} }
} }
docConsole.setSaved(false); docConsole.setSaved(false);
ffc.removeModuleSA(selectedRow); ffc.removeModuleSA(selectedRow);
} }
@ -466,28 +565,31 @@ public class FpdFrameworkModules extends IInternalFrame {
String[][] saa = new String[ffc.getFrameworkModulesCount()][5]; String[][] saa = new String[ffc.getFrameworkModulesCount()][5];
ffc.getFrameworkModulesInfo(saa); ffc.getFrameworkModulesInfo(saa);
for (int i = 0; i < saa.length; ++i) { for (int i = 0; i < saa.length; ++i) {
ModuleIdentification mi = GlobalData.getModuleId(saa[i][0]+ " "+saa[i][1]+" "+saa[i][2]+" "+saa[i][3]); ModuleIdentification mi = GlobalData.getModuleId(saa[i][ModNameCol] + " " + saa[i][ModVerCol] + " "
+ saa[i][PkgNameCol] + " " + saa[i][PkgVerCol]);
String[] row = { "", "", "", "", "", "" }; String[] row = { "", "", "", "", "", "" };
if (mi != null) { if (mi != null) {
row[0] = mi.getName(); row[ModNameCol] = mi.getName();
row[1] = mi.getVersion(); row[ModVerCol] = mi.getVersion();
row[2] = mi.getPackage().getName(); row[PkgNameCol] = mi.getPackage().getName();
row[3] = mi.getPackage().getVersion(); row[PkgVerCol] = mi.getPackage().getVersion();
row[4] = saa[i][4]; row[ArchCol] = saa[i][ArchCol];
try { try {
row[5] = GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1); row[Path5Col] = GlobalData.getMsaFile(mi).getPath().substring(
} System.getenv("WORKSPACE")
catch (Exception e) { .length() + 1);
} catch (Exception e) {
JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage()); JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage());
} }
} }
modelFpdModules.addRow(row); modelFpdModules.addRow(row);
ArrayList<String> al = fpdMsa.get(saa[i][0]+row[1]+saa[i][2]+row[3]); ArrayList<String> al = fpdMsa.get(saa[i][ModNameCol] + row[ModVerCol] + saa[i][PkgNameCol]
+ row[PkgVerCol]);
if (al == null) { if (al == null) {
al = new ArrayList<String>(); al = new ArrayList<String>();
fpdMsa.put(saa[i][0]+row[1]+saa[i][2]+row[3], al); fpdMsa.put(saa[i][ModNameCol] + row[ModVerCol] + saa[i][PkgNameCol] + row[PkgVerCol], al);
} }
al.add(saa[i][4]); al.add(saa[i][Path4Col]);
} }
} }
@ -512,14 +614,14 @@ public class FpdFrameworkModules extends IInternalFrame {
Iterator ismi = smi.iterator(); Iterator ismi = smi.iterator();
while (ismi.hasNext()) { while (ismi.hasNext()) {
ModuleIdentification mi = (ModuleIdentification) ismi.next(); ModuleIdentification mi = (ModuleIdentification) ismi.next();
s[0] = mi.getName(); s[ModNameCol] = mi.getName();
s[1] = mi.getVersion(); s[ModVerCol] = mi.getVersion();
s[2] = pi.getName(); s[PkgNameCol] = pi.getName();
s[3] = pi.getVersion(); s[PkgVerCol] = pi.getVersion();
try { try {
s[4] = GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1); s[Path4Col] = GlobalData.getMsaFile(mi).getPath()
} .substring(System.getenv("WORKSPACE").length() + 1);
catch (Exception e) { } catch (Exception e) {
JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage()); JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage());
} }
modelAllModules.addRow(s); modelAllModules.addRow(s);
@ -527,6 +629,7 @@ public class FpdFrameworkModules extends IInternalFrame {
} }
} }
} }
/** /**
* This method initializes this * This method initializes this
* *