Thread work load assignment change.
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFrameworkModules.java
CommitLineData
d78abb5a 1/** @file\r
2 \r
3 The file is used to create, update FrameworkModules of Fpd file\r
4 \r
5 Copyright (c) 2006, Intel Corporation\r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13 \r
14 **/\r
a13899c5 15package org.tianocore.frameworkwizard.platform.ui;\r
16\r
17import java.awt.BorderLayout;\r
c777d1d4 18import java.awt.Dimension;\r
19import java.awt.FontMetrics;\r
a13899c5 20\r
a13899c5 21import javax.swing.JOptionPane;\r
22import javax.swing.JPanel;\r
a13899c5 23import javax.swing.JSplitPane;\r
24import javax.swing.JLabel;\r
25import javax.swing.JScrollPane;\r
26import javax.swing.JTable;\r
27import javax.swing.JButton;\r
28import javax.swing.ListSelectionModel;\r
e7cc0547 29import javax.swing.event.TableModelEvent;\r
a13899c5 30import javax.swing.table.DefaultTableModel;\r
e7cc0547 31import javax.swing.table.TableModel;\r
a13899c5 32\r
33import org.tianocore.PlatformSurfaceAreaDocument;\r
82484861 34import org.tianocore.frameworkwizard.FrameworkWizardUI;\r
3658f95e 35import org.tianocore.frameworkwizard.common.GlobalData;\r
d6d24759 36import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
a13899c5 37import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
3658f95e 38import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
1bf9fa5a 39import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
85d9e5b1 40import org.tianocore.frameworkwizard.workspace.Workspace;\r
3658f95e 41import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
a13899c5 42\r
43import java.awt.FlowLayout;\r
99125b46 44import java.awt.event.ActionEvent;\r
2a06ac5b 45import java.awt.event.KeyEvent;\r
a0783edc 46import java.awt.event.MouseEvent;\r
a13899c5 47import java.util.ArrayList;\r
48import java.util.HashMap;\r
49import java.util.Iterator;\r
50import java.util.Map;\r
bf5abaff 51import java.util.Vector;\r
a13899c5 52\r
53public class FpdFrameworkModules extends IInternalFrame {\r
54\r
44053733 55 /**\r
df4b9c3e 56 * Initialize Globals\r
44053733 57 */\r
58 private static final long serialVersionUID = 1L;\r
d78abb5a 59 \r
9babb67e 60 private static final int timeToWait = 2000;\r
2a06ac5b 61 \r
231f8bfb 62 private static final int pcdSyncThreadNumber = 10;\r
63 \r
2a06ac5b 64 private long savedMs = 0;\r
65 \r
66 String searchField = "";\r
67 \r
d78abb5a 68 public static final int forceDbgColForFpdModTable = 7;\r
a8a9de7c 69\r
a13899c5 70 private JSplitPane jSplitPane = null;\r
a8a9de7c 71\r
4da2e625 72 private JPanel jPanelTop = null;\r
a8a9de7c 73\r
4da2e625 74 private JPanel jPanelBottom = null;\r
a8a9de7c 75\r
a13899c5 76 private JLabel jLabel = null;\r
a8a9de7c 77\r
4da2e625 78 private JScrollPane jScrollPaneAllModules = null;\r
a8a9de7c 79\r
4da2e625 80 private JTable jTableAllModules = null;\r
a8a9de7c 81\r
4da2e625 82 private JPanel jPanelTopSouth = null;\r
a8a9de7c 83\r
4da2e625 84 private JButton jButtonAddModule = null;\r
a8a9de7c 85\r
4da2e625 86 private JLabel jLabelModulesAdded = null;\r
a8a9de7c 87\r
4da2e625 88 private JPanel jPanelBottomSouth = null;\r
a8a9de7c 89\r
4da2e625 90 private JScrollPane jScrollPaneFpdModules = null;\r
a8a9de7c 91\r
4da2e625 92 private JTable jTableFpdModules = null;\r
a8a9de7c 93\r
4da2e625 94 private JButton jButtonSettings = null;\r
a8a9de7c 95\r
4da2e625 96 private JButton jButtonRemoveModule = null;\r
a8a9de7c 97\r
4da2e625 98 private NonEditableTableModel modelAllModules = null;\r
a8a9de7c 99\r
d78abb5a 100 private FpdModulesTableModel modelFpdModules = null;\r
a8a9de7c 101\r
a13899c5 102 private FpdModuleSA settingDlg = null;\r
a8a9de7c 103\r
a13899c5 104 private FpdFileContents ffc = null;\r
a8a9de7c 105\r
d6d24759 106 private OpeningPlatformType docConsole = null;\r
a8a9de7c 107\r
bf5abaff 108 private Map<String, ArrayList<String>> fpdMsa = null;\r
a8a9de7c 109\r
a13899c5 110 private ArrayList<ModuleIdentification> miList = null;\r
df4b9c3e 111 \r
112 /**\r
113 * Column settings for displaying all modules in workspace\r
114 */\r
d208e1e2 115 private final int modNameColForAllModTable = 0;\r
93fd07b1 116 \r
d208e1e2 117 private final int pkgNameColForAllModTable = 1;\r
93fd07b1 118 \r
d208e1e2 119 private final int pathColForAllModTable = 2;\r
93fd07b1 120 \r
df4b9c3e 121 private final int typeColForAllModTable = 3;\r
122 \r
123 private final int pkgVerColForAllModTable = 5;\r
93fd07b1 124 \r
d208e1e2 125 private final int modVerColForAllModTable = 4;\r
93fd07b1 126 \r
df4b9c3e 127 /**\r
128 * Column settings for display modules in the FPD file\r
129 */\r
d208e1e2 130 private final int modNameColForFpdModTable = 0;\r
93fd07b1 131 \r
d208e1e2 132 private final int pkgNameColForFpdModTable = 1;\r
93fd07b1 133 \r
d208e1e2 134 private final int pathColForFpdModTable = 2;\r
93fd07b1 135 \r
d208e1e2 136 private final int archColForFpdModTable = 3;\r
93fd07b1 137 \r
4cd31580 138 private final int pkgVerColForFpdModTable = 6;\r
a8a9de7c 139\r
4cd31580 140 private final int modVerColForFpdModTable = 5;\r
141 \r
142 private final int typeColForFpdModTable = 4;\r
d208e1e2 143 \r
df4b9c3e 144 /**\r
145 * FpdFileContents structure\r
146 */\r
d208e1e2 147 private final int ffcModGuid = 0;\r
148 \r
149 private final int ffcModVer = 1;\r
150 \r
151 private final int ffcPkgGuid = 2;\r
152 \r
153 private final int ffcPkgVer = 3;\r
154 \r
155 private final int ffcModArch = 4;\r
df4b9c3e 156 \r
157 /**\r
158 * Set Column Widths, Only the PATH should not have a max width.\r
159 */\r
d208e1e2 160 private final int modNameMinWidth = 168;\r
a8a9de7c 161 \r
d208e1e2 162 private final int modNamePrefWidth = 200;\r
df4b9c3e 163 \r
164 private final int modNameMaxWidth = 350;\r
a8a9de7c 165\r
d208e1e2 166 private final int pkgNameMinWidth = 100;\r
a8a9de7c 167 \r
df4b9c3e 168 private final int pkgNamePrefWidth = 130;\r
a8a9de7c 169 \r
d208e1e2 170 private final int pkgNameMaxWidth = 150;\r
a8a9de7c 171 \r
df4b9c3e 172 private final int verMinWidth = 60;\r
a8a9de7c 173 \r
d208e1e2 174 private final int verMaxWidth = 80;\r
a8a9de7c 175 \r
df4b9c3e 176 private final int verPrefWidth = 70;\r
a8a9de7c 177 \r
4033708d 178 private final int pathPrefWidth = 600;\r
a8a9de7c 179 \r
d208e1e2 180 private final int pathMinWidth = 280;\r
a8a9de7c 181 \r
d208e1e2 182 private final int archPrefWidth = 80;\r
a8a9de7c 183 \r
d208e1e2 184 private final int archMinWidth = 60;\r
a8a9de7c 185 \r
d208e1e2 186 private final int archMaxWidth = 100;\r
a8a9de7c 187 \r
df4b9c3e 188 private final int typePrefWidth = 145;\r
189 \r
190 private final int typeMinWidth = 100;\r
191 \r
192 private final int typeMaxWidth = 155;\r
99125b46 193\r
194 private JButton jButtonApriori = null;\r
df4b9c3e 195 \r
a13899c5 196 /**\r
df4b9c3e 197 * This method initializes jSplitPane\r
198 * \r
199 * This is the main edit window\r
a13899c5 200 * \r
df4b9c3e 201 * @return javax.swing.JSplitPane jSplitPane \r
a13899c5 202 */\r
203 private JSplitPane getJSplitPane() {\r
204 if (jSplitPane == null) {\r
205 jSplitPane = new JSplitPane();\r
206 jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);\r
207 jSplitPane.setDividerLocation(250);\r
4da2e625 208 jSplitPane.setBottomComponent(getJPanelBottom());\r
209 jSplitPane.setTopComponent(getJPanelTop());\r
a13899c5 210 }\r
211 return jSplitPane;\r
212 }\r
213\r
214 /**\r
df4b9c3e 215 * This method initializes jPanelTop\r
216 * \r
217 * This panel contains the All Modules Table \r
a13899c5 218 * \r
df4b9c3e 219 * @return javax.swing.JPanel jPanelTop\r
a13899c5 220 */\r
4da2e625 221 private JPanel getJPanelTop() {\r
222 if (jPanelTop == null) {\r
a13899c5 223 jLabel = new JLabel();\r
1b69863a 224 jLabel.setText(" Modules in Workspace");\r
4da2e625 225 jPanelTop = new JPanel();\r
226 jPanelTop.setLayout(new BorderLayout());\r
227 jPanelTop.add(jLabel, java.awt.BorderLayout.NORTH);\r
228 jPanelTop.add(getJScrollPaneAllModules(), java.awt.BorderLayout.CENTER);\r
229 jPanelTop.add(getJPanelTopSouth(), java.awt.BorderLayout.SOUTH);\r
a13899c5 230 }\r
4da2e625 231 return jPanelTop;\r
a13899c5 232 }\r
233\r
234 /**\r
df4b9c3e 235 * This method initializes jPanelBottom\r
a13899c5 236 * \r
df4b9c3e 237 * This panel contains the FPD Modules Table\r
238 * \r
239 * @return javax.swing.JPanel jPanelBottom\r
a13899c5 240 */\r
4da2e625 241 private JPanel getJPanelBottom() {\r
242 if (jPanelBottom == null) {\r
243 jLabelModulesAdded = new JLabel();\r
1b69863a 244 jLabelModulesAdded.setText(" Modules Added into Platform");\r
4da2e625 245 jPanelBottom = new JPanel();\r
246 jPanelBottom.setLayout(new BorderLayout());\r
247 jPanelBottom.add(jLabelModulesAdded, java.awt.BorderLayout.NORTH);\r
248 jPanelBottom.add(getJPanelBottomSouth(), java.awt.BorderLayout.SOUTH);\r
249 jPanelBottom.add(getJScrollPaneFpdModules(), java.awt.BorderLayout.CENTER);\r
a13899c5 250 }\r
4da2e625 251 return jPanelBottom;\r
a13899c5 252 }\r
253\r
254 /**\r
df4b9c3e 255 * This method initializes jScrollPaneAllModules \r
a13899c5 256 * \r
df4b9c3e 257 * @return javax.swing.JScrollPane jScrollPaneAllModules\r
a13899c5 258 */\r
4da2e625 259 private JScrollPane getJScrollPaneAllModules() {\r
260 if (jScrollPaneAllModules == null) {\r
261 jScrollPaneAllModules = new JScrollPane();\r
a8a9de7c 262 jScrollPaneAllModules.setPreferredSize(new java.awt.Dimension(600, 200));\r
4da2e625 263 jScrollPaneAllModules.setViewportView(getJTableAllModules());\r
a13899c5 264 }\r
4da2e625 265 return jScrollPaneAllModules;\r
a13899c5 266 }\r
267\r
268 /**\r
df4b9c3e 269 * This method initializes jTableAllModules\r
a13899c5 270 * \r
df4b9c3e 271 * @return javax.swing.JTable jTableAllModules\r
a13899c5 272 */\r
4da2e625 273 private JTable getJTableAllModules() {\r
274 if (jTableAllModules == null) {\r
275 modelAllModules = new NonEditableTableModel();\r
add40ab2 276 TableSorter sorter = new TableSorter(modelAllModules);\r
277 jTableAllModules = new JTable(sorter);\r
278 sorter.setTableHeader(jTableAllModules.getTableHeader());\r
4da2e625 279 jTableAllModules.setRowHeight(20);\r
a8a9de7c 280 modelAllModules.addColumn("<html>Module<br>Name</html>");\r
a8a9de7c 281 modelAllModules.addColumn("<html>Package<br>Name</html>");\r
4da2e625 282 modelAllModules.addColumn("Path");\r
df4b9c3e 283 modelAllModules.addColumn("<html>Module<br>Type</html>");\r
93fd07b1 284 modelAllModules.addColumn("<html>Module<br>Version</html>");\r
df4b9c3e 285 modelAllModules.addColumn("<html>Package<br>Version</html>");\r
93fd07b1 286 \r
a8a9de7c 287 javax.swing.table.TableColumn column = null;\r
d208e1e2 288 column = jTableAllModules.getColumnModel().getColumn(modNameColForAllModTable);\r
289 column.setPreferredWidth(modNamePrefWidth);\r
290 column.setMinWidth(modNameMinWidth);\r
df4b9c3e 291 column.setMaxWidth(modNameMaxWidth);\r
d208e1e2 292 column = jTableAllModules.getColumnModel().getColumn(modVerColForAllModTable);\r
293 column.setPreferredWidth(verPrefWidth);\r
294 column.setMaxWidth(verMaxWidth);\r
295 column.setMinWidth(verMinWidth);\r
296 column = jTableAllModules.getColumnModel().getColumn(pkgNameColForAllModTable);\r
297 column.setPreferredWidth(pkgNamePrefWidth);\r
298 column.setMinWidth(pkgNameMinWidth);\r
299 column.setMaxWidth(pkgNameMaxWidth);\r
300 column = jTableAllModules.getColumnModel().getColumn(pkgVerColForAllModTable);\r
301 column.setPreferredWidth(verPrefWidth);\r
302 column.setMaxWidth(verMaxWidth);\r
303 column.setMinWidth(verMinWidth);\r
df4b9c3e 304 column = jTableAllModules.getColumnModel().getColumn(typeColForAllModTable);\r
305 column.setPreferredWidth(typePrefWidth);\r
306 column.setMaxWidth(typeMaxWidth);\r
307 column.setMinWidth(typeMinWidth);\r
d208e1e2 308 column = jTableAllModules.getColumnModel().getColumn(pathColForAllModTable);\r
309 column.setPreferredWidth(pathPrefWidth);\r
310 column.setMinWidth(pathMinWidth);\r
a8a9de7c 311\r
4da2e625 312 jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
4033708d 313 jTableAllModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);\r
a0783edc 314 jTableAllModules.addMouseListener(new java.awt.event.MouseAdapter() {\r
315 public void mouseClicked(java.awt.event.MouseEvent e) {\r
316 if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {\r
317 java.awt.Point p = e.getPoint();\r
318 int rowIndex = jTableAllModules.rowAtPoint(p);\r
319 TableSorter sorter = (TableSorter) jTableAllModules.getModel();\r
320 rowIndex = sorter.getModelRowIndex(rowIndex);\r
321 addModuleIntoPlatform (rowIndex);\r
322 }\r
323 }\r
324 });\r
2a06ac5b 325 jTableAllModules.addKeyListener(new java.awt.event.KeyAdapter() {\r
326 public void keyPressed(java.awt.event.KeyEvent e) {\r
327 if (e.getKeyCode() == KeyEvent.VK_ENTER) {\r
328 int selectedRow = jTableAllModules.getSelectedRow();\r
329 if (selectedRow < 0) {\r
330 return;\r
331 }\r
332 TableSorter sorter = (TableSorter) jTableAllModules.getModel();\r
333 selectedRow = sorter.getModelRowIndex(selectedRow);\r
334 addModuleIntoPlatform (selectedRow);\r
335 }\r
336 }\r
337 });\r
338 \r
339 jTableAllModules.addKeyListener(new java.awt.event.KeyAdapter() {\r
340 public void keyTyped(java.awt.event.KeyEvent e) {\r
341\r
342 if (System.currentTimeMillis() - savedMs < timeToWait) {\r
343 searchField += e.getKeyChar();\r
344 }\r
345 else {\r
346 searchField = "" + e.getKeyChar(); \r
347 }\r
348 \r
9babb67e 349 int viewIndex = gotoFoundRow (searchField, jTableAllModules);\r
2a06ac5b 350 if (viewIndex >= 0){\r
351 jTableAllModules.changeSelection(viewIndex, 0, false, false);\r
352 }\r
353 savedMs = System.currentTimeMillis();\r
354 }\r
355 });\r
a0783edc 356 \r
357 \r
a13899c5 358 }\r
4da2e625 359 return jTableAllModules;\r
a13899c5 360 }\r
2a06ac5b 361 \r
9babb67e 362 private int gotoFoundRow (String s, JTable model) {\r
2a06ac5b 363 for (int i = 0; i < model.getRowCount(); ++i) {\r
364 if (model.getValueAt(i, 0) != null && model.getValueAt(i, 0).toString().regionMatches(true, 0, s, 0, s.length())) {\r
9babb67e 365 return i;\r
2a06ac5b 366 }\r
367 }\r
368 return -1;\r
369 }\r
a13899c5 370\r
371 /**\r
df4b9c3e 372 * This method initializes jPanelTopSouth\r
373 * \r
374 * This panel contains the ADD button\r
375 * \r
376 * @return javax.swing.JPanel jPanelTopSouth\r
a13899c5 377 */\r
4da2e625 378 private JPanel getJPanelTopSouth() {\r
379 if (jPanelTopSouth == null) {\r
a13899c5 380 FlowLayout flowLayout = new FlowLayout();\r
381 flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);\r
4da2e625 382 jPanelTopSouth = new JPanel();\r
383 jPanelTopSouth.setLayout(flowLayout);\r
384 jPanelTopSouth.add(getJButtonAddModule(), null);\r
a13899c5 385 }\r
4da2e625 386 return jPanelTopSouth;\r
a13899c5 387 }\r
a0783edc 388 \r
389 private void addModuleIntoPlatform (int selectedRow) {\r
390 String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + "";\r
391 ModuleIdentification mi = miList.get(selectedRow);\r
392 Vector<String> vArchs = null;\r
4fd52612 393\r
394 vArchs = WorkspaceProfile.getModuleSupArchs(mi);\r
a0783edc 395\r
396 if (vArchs == null) {\r
82484861 397 JOptionPane.showMessageDialog(this, "No Supported Architectures specified in MSA file.");\r
a0783edc 398 return;\r
399 }\r
400\r
4fd52612 401 Vector<Object> platformSupArch = new Vector<Object>();\r
402 ffc.getPlatformDefsSupportedArchs(platformSupArch);\r
403 platformSupArch.retainAll(vArchs);\r
404 if (platformSupArch.size() == 0) {\r
82484861 405 JOptionPane.showMessageDialog(this, "This Module does not support this platform architectures.");\r
4fd52612 406 return;\r
407 }\r
408 \r
a0783edc 409 String archsAdded = "";\r
410 String mg = mi.getGuid();\r
411 String mv = mi.getVersion();\r
412 String pg = mi.getPackageId().getGuid();\r
413 String pv = mi.getPackageId().getVersion();\r
414 String mType = SurfaceAreaQuery.getModuleType(mi);\r
415\r
416 ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);\r
417 if (al == null) {\r
418 //\r
419 // if existing ModuleSA does not specify version info.\r
420 //\r
421 al = fpdMsa.get(mg + "null" + pg + "null");\r
422 if (al == null) {\r
423 al = fpdMsa.get(mg + "null" + pg + pv);\r
424 if (al == null){\r
425 al = fpdMsa.get(mg + mv + pg + "null");\r
426 if (al == null) {\r
427 al = new ArrayList<String>();\r
428 fpdMsa.put(mg + mv + pg + pv, al); \r
429 }\r
430 }\r
431 }\r
432 }\r
433 //\r
434 // filter from module SupArchs what archs has been added.\r
435 //\r
436 for (int i = 0; i < al.size(); ++i) {\r
437 vArchs.remove(al.get(i));\r
438 }\r
439 //\r
440 // check whether archs conform to SupArch of platform.\r
441 //\r
4fd52612 442 platformSupArch.removeAllElements();\r
a0783edc 443 ffc.getPlatformDefsSupportedArchs(platformSupArch);\r
444 vArchs.retainAll(platformSupArch);\r
445 //\r
446 // Archs this Module supported have already been added.\r
447 //\r
448 if (vArchs.size() == 0) {\r
82484861 449 JOptionPane.showMessageDialog(this, "This Module has already been added.");\r
a0783edc 450 return;\r
451 }\r
452 //ToDo put Arch instead of null\r
453 boolean errorOccurred = false;\r
454 for (int i = 0; i < vArchs.size(); ++i) {\r
455 String arch = vArchs.get(i);\r
456 al.add(arch);\r
457 archsAdded += arch + " ";\r
458 String[] row = { "", "", "", "", "", "", "" };\r
459\r
460 if (mi != null) {\r
461 row[modNameColForFpdModTable] = mi.getName();\r
462 row[pkgNameColForFpdModTable] = mi.getPackageId().getName();\r
463 row[pathColForFpdModTable] = path;\r
464 row[archColForFpdModTable] = arch;\r
465 row[pkgVerColForFpdModTable] = pv;\r
466 row[modVerColForFpdModTable] = mv;\r
467 row[typeColForFpdModTable] = mType;\r
468\r
469 }\r
470 modelFpdModules.addRow(row);\r
471\r
472 docConsole.setSaved(false);\r
473 try {\r
474 //ToDo : specify archs need to add.\r
475 ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);\r
476 } catch (Exception exception) {\r
82484861 477 JOptionPane.showMessageDialog(this, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch\r
a0783edc 478 + ": " + exception.getMessage());\r
479 errorOccurred = true;\r
480 }\r
481 }\r
482\r
483 String s = "This Module with Architecture " + archsAdded;\r
484 if (errorOccurred) {\r
485 s += " was added with Error. Platform may NOT Build.";\r
486 } else {\r
487 s += " was added Successfully.";\r
488 }\r
82484861 489 JOptionPane.showMessageDialog(this, s);\r
a0783edc 490 TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel();\r
491 int viewIndex = sorterFpdModules.getViewIndexArray()[modelFpdModules.getRowCount() - 1];\r
492 jTableFpdModules.changeSelection(viewIndex, 0, false, false);\r
493\r
494 }\r
a13899c5 495\r
496 /**\r
df4b9c3e 497 * This method initializes jButtonAddModule \r
a13899c5 498 * \r
df4b9c3e 499 * @return javax.swing.JButton jButtonAddModule\r
a13899c5 500 */\r
4da2e625 501 private JButton getJButtonAddModule() {\r
502 if (jButtonAddModule == null) {\r
503 jButtonAddModule = new JButton();\r
a8a9de7c 504 jButtonAddModule.setPreferredSize(new java.awt.Dimension(130, 20));\r
4da2e625 505 jButtonAddModule.setText("Add a Module");\r
506 jButtonAddModule.addActionListener(new java.awt.event.ActionListener() {\r
a13899c5 507 public void actionPerformed(java.awt.event.ActionEvent e) {\r
4da2e625 508 int selectedRow = jTableAllModules.getSelectedRow();\r
a8a9de7c 509 if (selectedRow < 0) {\r
a13899c5 510 return;\r
511 }\r
a8a9de7c 512\r
513 TableSorter sorter = (TableSorter) jTableAllModules.getModel();\r
d78abb5a 514 selectedRow = sorter.getModelRowIndex(selectedRow);\r
a0783edc 515 addModuleIntoPlatform (selectedRow); \r
82961247 516 }\r
a13899c5 517 });\r
518 }\r
4da2e625 519 return jButtonAddModule;\r
a13899c5 520 }\r
521\r
522 /**\r
df4b9c3e 523 * This method initializes jPanelBottomSouth\r
524 * \r
525 * This panel contains the Settings and Remove Buttons\r
a13899c5 526 * \r
df4b9c3e 527 * @return javax.swing.JPanel jPanelBottomSouth\r
a13899c5 528 */\r
4da2e625 529 private JPanel getJPanelBottomSouth() {\r
530 if (jPanelBottomSouth == null) {\r
a13899c5 531 FlowLayout flowLayout1 = new FlowLayout();\r
532 flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);\r
4da2e625 533 jPanelBottomSouth = new JPanel();\r
534 jPanelBottomSouth.setLayout(flowLayout1);\r
535 jPanelBottomSouth.add(getJButtonSettings(), null);\r
536 jPanelBottomSouth.add(getJButtonRemoveModule(), null);\r
99125b46 537 jPanelBottomSouth.add(getJButtonApriori(), null);\r
a13899c5 538 }\r
4da2e625 539 return jPanelBottomSouth;\r
a13899c5 540 }\r
541\r
542 /**\r
df4b9c3e 543 * This method initializes jScrollPaneFpdModules\r
a13899c5 544 * \r
df4b9c3e 545 * @return javax.swing.JScrollPane jScrollPaneFpdModules\r
a13899c5 546 */\r
4da2e625 547 private JScrollPane getJScrollPaneFpdModules() {\r
548 if (jScrollPaneFpdModules == null) {\r
549 jScrollPaneFpdModules = new JScrollPane();\r
a8a9de7c 550 jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(453, 200));\r
4da2e625 551 jScrollPaneFpdModules.setViewportView(getJTableFpdModules());\r
a13899c5 552 }\r
4da2e625 553 return jScrollPaneFpdModules;\r
a13899c5 554 }\r
555\r
556 /**\r
df4b9c3e 557 * This method initializes jTableFpdModules\r
a13899c5 558 * \r
df4b9c3e 559 * @return javax.swing.JTable jTableFpdModules\r
a13899c5 560 */\r
4da2e625 561 private JTable getJTableFpdModules() {\r
562 if (jTableFpdModules == null) {\r
d78abb5a 563 modelFpdModules = new FpdModulesTableModel();\r
add40ab2 564 TableSorter sorter = new TableSorter(modelFpdModules);\r
565 jTableFpdModules = new JTable(sorter);\r
566 sorter.setTableHeader(jTableFpdModules.getTableHeader());\r
4da2e625 567 jTableFpdModules.setRowHeight(20);\r
a8a9de7c 568 modelFpdModules.addColumn("<html>Module<br>Name</html>");\r
a8a9de7c 569 modelFpdModules.addColumn("<html>Package<br>Name</html>");\r
4da2e625 570 modelFpdModules.addColumn("Path");\r
93fd07b1 571 modelFpdModules.addColumn("<html>Supported<br>Architectures</html>");\r
4cd31580 572 modelFpdModules.addColumn("<html>Module<br>Type</html>");\r
93fd07b1 573 modelFpdModules.addColumn("<html>Module<br>Version</html>");\r
df4b9c3e 574 modelFpdModules.addColumn("<html>Package<br>Version</html>");\r
d78abb5a 575 modelFpdModules.addColumn("<html>Force<br>Debug</html>");\r
93fd07b1 576 \r
a8a9de7c 577 javax.swing.table.TableColumn column = null;\r
d208e1e2 578 column = jTableFpdModules.getColumnModel().getColumn(modNameColForFpdModTable);\r
579 column.setPreferredWidth(modNamePrefWidth);\r
580 column.setMinWidth(modNameMinWidth);\r
df4b9c3e 581 column.setMaxWidth(modNameMaxWidth);\r
d208e1e2 582 column = jTableFpdModules.getColumnModel().getColumn(modVerColForFpdModTable);\r
583 column.setPreferredWidth(verPrefWidth);\r
584 column.setMaxWidth(verMaxWidth);\r
585 column.setMinWidth(verMinWidth);\r
586 column = jTableFpdModules.getColumnModel().getColumn(pkgNameColForFpdModTable);\r
587 column.setPreferredWidth(pkgNamePrefWidth);\r
588 column.setMinWidth(pkgNameMinWidth);\r
589 column.setMaxWidth(pkgNameMaxWidth);\r
590 column = jTableFpdModules.getColumnModel().getColumn(pkgVerColForFpdModTable);\r
591 column.setPreferredWidth(verPrefWidth);\r
592 column.setMaxWidth(verMaxWidth);\r
593 column.setMinWidth(verMinWidth);\r
594 column = jTableFpdModules.getColumnModel().getColumn(archColForFpdModTable);\r
595 column.setPreferredWidth(archPrefWidth);\r
596 column.setMaxWidth(archMaxWidth);\r
597 column.setMinWidth(archMinWidth);\r
598 column = jTableFpdModules.getColumnModel().getColumn(pathColForFpdModTable);\r
599 column.setPreferredWidth(pathPrefWidth);\r
600 column.setMinWidth(pathMinWidth);\r
4cd31580 601 column = jTableFpdModules.getColumnModel().getColumn(typeColForFpdModTable);\r
602 column.setPreferredWidth(typePrefWidth);\r
603 column.setMaxWidth(typeMaxWidth);\r
604 column.setMinWidth(typeMinWidth);\r
a8a9de7c 605\r
4da2e625 606 jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
4033708d 607 jTableFpdModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);\r
e7cc0547 608 \r
a0783edc 609 jTableFpdModules.addMouseListener(new java.awt.event.MouseAdapter() {\r
610 public void mouseClicked(java.awt.event.MouseEvent e) {\r
611 if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {\r
612 java.awt.Point p = e.getPoint();\r
613 int rowIndex = jTableFpdModules.rowAtPoint(p);\r
614 TableSorter sorter = (TableSorter) jTableFpdModules.getModel();\r
615 rowIndex = sorter.getModelRowIndex(rowIndex);\r
616 showSettingsDlg (rowIndex);\r
617 }\r
618 }\r
619 });\r
620 \r
2a06ac5b 621 jTableFpdModules.addKeyListener(new java.awt.event.KeyAdapter() {\r
622 public void keyPressed(java.awt.event.KeyEvent e) {\r
623 if (e.getKeyCode() == KeyEvent.VK_ENTER) {\r
624 int selectedRow = jTableFpdModules.getSelectedRow();\r
625 if (selectedRow < 0) {\r
626 return;\r
627 }\r
628 TableSorter sorter = (TableSorter) jTableFpdModules.getModel();\r
629 selectedRow = sorter.getModelRowIndex(selectedRow);\r
630 showSettingsDlg (selectedRow);\r
631 }\r
632 }\r
633 });\r
634 \r
635 jTableFpdModules.addKeyListener(new java.awt.event.KeyAdapter() {\r
636 public void keyTyped(java.awt.event.KeyEvent e) {\r
637\r
638 if (System.currentTimeMillis() - savedMs < timeToWait) {\r
639 searchField += e.getKeyChar();\r
640 }\r
641 else {\r
642 searchField = "" + e.getKeyChar(); \r
643 }\r
644 \r
9babb67e 645 int viewIndex = gotoFoundRow (searchField, jTableFpdModules);\r
2a06ac5b 646 if (viewIndex >= 0){\r
647 jTableFpdModules.changeSelection(viewIndex, 0, false, false);\r
648 }\r
649 savedMs = System.currentTimeMillis();\r
650 }\r
651 });\r
652 \r
e7cc0547 653 jTableFpdModules.getModel().addTableModelListener(this);\r
a13899c5 654 }\r
4da2e625 655 return jTableFpdModules;\r
a13899c5 656 }\r
657\r
e7cc0547 658 public void tableChanged(TableModelEvent arg0) {\r
659 if (arg0.getType() == TableModelEvent.UPDATE){\r
660 int row = arg0.getFirstRow();\r
661 int column = arg0.getColumn();\r
662 TableModel m = (TableModel)arg0.getSource();\r
663 \r
664 if (column != forceDbgColForFpdModTable) {\r
665 return;\r
666 }\r
667 String s = m.getValueAt(row, column)+"";\r
668 boolean dbgEnable = new Boolean(s);\r
669 ffc.setModuleSAForceDebug(row, dbgEnable);\r
670 docConsole.setSaved(false);\r
671 }\r
672 }\r
a0783edc 673 \r
674 private void showSettingsDlg (int row) {\r
11c5f071 675// As PCD sync. check is full platform range now during opening FrameworkModules editor,\r
676// the following check is no longer needed.\r
677// try {\r
678// Vector<String> vExceptions = new Vector<String>();\r
679// if (ffc.adjustPcd(row, vExceptions)) {\r
680// JOptionPane.showMessageDialog(frame, "Pcd entries sync. with those in MSA files.");\r
681// docConsole.setSaved(false);\r
682// }\r
683// }\r
684// catch (Exception exp) {\r
685// JOptionPane.showMessageDialog(frame, exp.getMessage());\r
686// }\r
a0783edc 687 \r
688 if (settingDlg == null) {\r
689 settingDlg = new FpdModuleSA(ffc);\r
690 }\r
691\r
692 String[] sa = new String[5];\r
693 ffc.getFrameworkModuleInfo(row, sa);\r
694 String mg = sa[ffcModGuid];\r
695 String mv = sa[ffcModVer];\r
696 String pg = sa[ffcPkgGuid];\r
697 String pv = sa[ffcPkgVer];\r
698 String arch = sa[ffcModArch];\r
699 settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, row, docConsole);\r
700 settingDlg.setVisible(true);\r
701 }\r
a13899c5 702 /**\r
df4b9c3e 703 * This method initializes jButtonSettings\r
a13899c5 704 * \r
df4b9c3e 705 * @return javax.swing.JButton jButtonSettings\r
a13899c5 706 */\r
4da2e625 707 private JButton getJButtonSettings() {\r
708 if (jButtonSettings == null) {\r
709 jButtonSettings = new JButton();\r
710 jButtonSettings.setPreferredSize(new java.awt.Dimension(130,20));\r
711 jButtonSettings.setText("Settings");\r
712 jButtonSettings.addActionListener(new java.awt.event.ActionListener() {\r
a13899c5 713 public void actionPerformed(java.awt.event.ActionEvent e) {\r
4da2e625 714 int selectedRow = jTableFpdModules.getSelectedRow();\r
a8a9de7c 715 if (selectedRow < 0) {\r
a13899c5 716 return;\r
717 }\r
a8a9de7c 718\r
719 TableSorter sorter = (TableSorter) jTableFpdModules.getModel();\r
d78abb5a 720 selectedRow = sorter.getModelRowIndex(selectedRow);\r
a0783edc 721 showSettingsDlg (selectedRow);\r
a13899c5 722 }\r
723 });\r
724 }\r
4da2e625 725 return jButtonSettings;\r
a13899c5 726 }\r
727\r
728 /**\r
df4b9c3e 729 * This method initializes jButtonRemoveModule\r
a13899c5 730 * \r
df4b9c3e 731 * @return javax.swing.JButton jButtonRemoveModule\r
a13899c5 732 */\r
4da2e625 733 private JButton getJButtonRemoveModule() {\r
734 if (jButtonRemoveModule == null) {\r
735 jButtonRemoveModule = new JButton();\r
4da2e625 736 jButtonRemoveModule.setText("Remove Module");\r
c777d1d4 737 FontMetrics fm = jButtonRemoveModule.getFontMetrics(jButtonRemoveModule.getFont());\r
738 jButtonRemoveModule.setPreferredSize(new Dimension (fm.stringWidth(jButtonRemoveModule.getText()) + 40, 20));\r
4da2e625 739 jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() {\r
a13899c5 740 public void actionPerformed(java.awt.event.ActionEvent e) {\r
4da2e625 741 int selectedRow = jTableFpdModules.getSelectedRow();\r
a8a9de7c 742 if (selectedRow < 0) {\r
a13899c5 743 return;\r
744 }\r
bc9b3706 745 int nextSelection = selectedRow;\r
a8a9de7c 746\r
747 TableSorter sorter = (TableSorter) jTableFpdModules.getModel();\r
d78abb5a 748 selectedRow = sorter.getModelRowIndex(selectedRow);\r
a8a9de7c 749\r
bf5abaff 750 String[] sa = new String[5];\r
751 ffc.getFrameworkModuleInfo(selectedRow, sa);\r
d208e1e2 752 String mg = sa[ffcModGuid];\r
753 String mv = sa[ffcModVer];\r
754 String pg = sa[ffcPkgGuid];\r
755 String pv = sa[ffcPkgVer];\r
756 String arch = sa[ffcModArch];\r
a0783edc 757 //\r
758 // sync. module order list in BuildOptions-UserExtensions.\r
759 //\r
760 String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;\r
761 String fvBindings = ffc.getFvBinding(moduleKey);\r
762 if (fvBindings != null) {\r
763 String[] fvArray = fvBindings.split(" ");\r
764 for (int i = 0; i < fvArray.length; ++i) {\r
253fca1d 765 ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", "1", mg, mv, pg, pv, arch);\r
a0783edc 766 }\r
767 }\r
768 \r
1bf9fa5a 769 ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);\r
ac66fadf 770 if (mi != null) {\r
771 mv = mi.getVersion();\r
772 pv = mi.getPackageId().getVersion();\r
773 }\r
774 \r
775 try {\r
776 ffc.removeModuleSA(selectedRow); \r
777 }\r
778 catch (Exception exp) {\r
82484861 779 JOptionPane.showMessageDialog(FpdFrameworkModules.this, exp.getMessage());\r
ac66fadf 780 return;\r
781 }\r
782 \r
bf5abaff 783 if (arch == null) {\r
784 // if no arch specified in ModuleSA\r
a8a9de7c 785 fpdMsa.remove(mg + mv + pg + pv);\r
d96d701f 786 \r
a8a9de7c 787 } else {\r
788 ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);\r
ac66fadf 789 if (al != null) {\r
790 al.remove(arch);\r
791 if (al.size() == 0) {\r
792 fpdMsa.remove(mg + mv + pg + pv);\r
793 }\r
bf5abaff 794 }\r
795 }\r
ac66fadf 796 \r
797 modelFpdModules.removeRow(selectedRow);\r
bc9b3706 798 if (nextSelection >= jTableFpdModules.getRowCount()) {\r
799 nextSelection = jTableFpdModules.getRowCount() - 1;\r
800 }\r
801 jTableFpdModules.changeSelection(nextSelection, 0, false, false);\r
ac66fadf 802 docConsole.setSaved(false);\r
a13899c5 803 }\r
804 });\r
805 }\r
4da2e625 806 return jButtonRemoveModule;\r
a13899c5 807 }\r
808\r
99125b46 809 /**\r
810 * This method initializes jButtonApriori \r
811 * \r
812 * @return javax.swing.JButton \r
813 */\r
814 private JButton getJButtonApriori() {\r
815 if (jButtonApriori == null) {\r
816 jButtonApriori = new JButton();\r
817 jButtonApriori.setText("Apriori Files");\r
818 FontMetrics fm = jButtonApriori.getFontMetrics(jButtonApriori.getFont());\r
819 int buttonWidth = fm.stringWidth(jButtonApriori.getText()) + 40;\r
820 if (jButtonRemoveModule.getWidth() > buttonWidth) {\r
821 buttonWidth = jButtonRemoveModule.getWidth();\r
822 }\r
823 jButtonApriori.setPreferredSize(new Dimension (buttonWidth, 20));\r
824 jButtonApriori.addActionListener(new java.awt.event.ActionListener() {\r
825 public void actionPerformed(ActionEvent arg0) {\r
826 new GenAprioriFileDialog(ffc, docConsole).setVisible(true);\r
827 }});\r
828 }\r
829 return jButtonApriori;\r
830 }\r
831\r
a13899c5 832 /**\r
df4b9c3e 833 * \r
a13899c5 834 * @param args\r
835 */\r
836 public static void main(String[] args) {\r
4cd31580 837 // Set the pane visable\r
a13899c5 838 new FpdFrameworkModules().setVisible(true);\r
839 }\r
840\r
55c30c85 841 private class PcdSyncTask extends Thread {\r
842 \r
231f8bfb 843 boolean pcdSynced = false;\r
55c30c85 844 public void run () {\r
845 Vector<String> vExceptions = new Vector<String>();\r
231f8bfb 846 pcdSync(vExceptions);\r
847 if (pcdSynced) {\r
55c30c85 848 JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "PCD in this platform are synchronized with those in MSA files."); \r
849 docConsole.setSaved(false);\r
850 }\r
851 if (vExceptions.size() > 0) {\r
852 String errorMsg = "";\r
853 for (int i = 0; i < vExceptions.size(); ++i) {\r
854 errorMsg += " " + vExceptions.get(i) + "\n";\r
855 }\r
856 JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Error occurred during synchronization:\n" + errorMsg);\r
857 }\r
858 }\r
231f8bfb 859 \r
860 private void pcdSync(Vector<String> v) {\r
861 \r
862 Vector<PcdSyncSubTask> vThreads = new Vector<PcdSyncSubTask> ();\r
863 int moduleCount = jTableFpdModules.getRowCount();\r
864 int start = 0;\r
865 for (int i = 0; i < FpdFrameworkModules.pcdSyncThreadNumber; ++i) {\r
21801bb3 866 int end = start + moduleCount/FpdFrameworkModules.pcdSyncThreadNumber + 1;\r
231f8bfb 867 if (end > moduleCount) {\r
868 end = moduleCount;\r
869 }\r
870 vThreads.add(new PcdSyncSubTask (start, end, v));\r
871 start = end;\r
872 }\r
873 \r
21801bb3 874 for (int i = 0; i < vThreads.size(); ++i) {\r
231f8bfb 875 vThreads.get(i).start();\r
876 }\r
877 \r
878 try {\r
21801bb3 879 for (int i = 0; i < vThreads.size(); ++i) {\r
231f8bfb 880 vThreads.get(i).join();\r
881 }\r
882 }\r
883 catch (InterruptedException e) {\r
884 \r
885 }\r
886 \r
887 }\r
888 \r
889 private class PcdSyncSubTask extends Thread {\r
890 \r
891 private int startModule = 0;\r
892 private int endModulePlusOne = 1;\r
893 private Vector<String> v = null;\r
894\r
895 PcdSyncSubTask (int start, int endPlusOne, Vector<String> vErr) {\r
896 startModule = start;\r
897 endModulePlusOne = endPlusOne;\r
898 v = vErr;\r
899 }\r
900 \r
901 public void run () {\r
902 String[] sa = new String[5];\r
903 for (int i = startModule; i < endModulePlusOne; ++i) {\r
904 try {\r
905 ffc.getFrameworkModuleInfo(i, sa);\r
906 String mg = sa[ffcModGuid];\r
907 String mv = sa[ffcModVer];\r
908 String pg = sa[ffcPkgGuid];\r
909 String pv = sa[ffcPkgVer];\r
910 String arch = sa[ffcModArch];\r
911 String key = mg + " " + mv + " " + pg + " " + pv + " " + arch;\r
912 if (ffc.adjustPcd(key, v)) {\r
913 pcdSynced = true;\r
914 }\r
915 }\r
916 catch (Exception exp) {\r
917// JOptionPane.showMessageDialog(frame, exp.getMessage());\r
918 continue;\r
919 }\r
920 }\r
921 }\r
922 }\r
55c30c85 923 }\r
924\r
a13899c5 925 /**\r
926 * This is the default constructor\r
927 */\r
928 public FpdFrameworkModules() {\r
929 super();\r
930 initialize();\r
931 }\r
932\r
a8a9de7c 933 public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
a13899c5 934 this();\r
935 init(fpd);\r
a8a9de7c 936\r
a13899c5 937 }\r
a8a9de7c 938\r
55c30c85 939 private PcdSyncTask pst = null;\r
d6d24759 940 public FpdFrameworkModules(OpeningPlatformType opt) {\r
941 this(opt.getXmlFpd());\r
942 docConsole = opt;\r
55c30c85 943 if (pst == null) {\r
944 pst = new PcdSyncTask();\r
ed7aa83f 945 }\r
55c30c85 946 pst.start();\r
d6d24759 947 }\r
a8a9de7c 948\r
a13899c5 949 private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
a8a9de7c 950\r
951 if (ffc == null) {\r
a13899c5 952 ffc = new FpdFileContents(fpd);\r
953 ffc.initDynPcdMap();\r
954 }\r
a8a9de7c 955\r
a13899c5 956 if (fpdMsa == null) {\r
bf5abaff 957 fpdMsa = new HashMap<String, ArrayList<String>>();\r
a13899c5 958 }\r
a8a9de7c 959\r
a13899c5 960 if (ffc.getFrameworkModulesCount() > 0) {\r
961 String[][] saa = new String[ffc.getFrameworkModulesCount()][5];\r
962 ffc.getFrameworkModulesInfo(saa);\r
963 for (int i = 0; i < saa.length; ++i) {\r
1bf9fa5a 964 ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "\r
d208e1e2 965 + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);\r
d78abb5a 966 Object[] row = { "", "", "", "", "", "", "", "" };\r
f3b0ed9a 967 if (mi != null) {\r
d208e1e2 968 row[modNameColForFpdModTable] = mi.getName();\r
969 row[modVerColForFpdModTable] = mi.getVersion();\r
3658f95e 970 row[typeColForFpdModTable] = SurfaceAreaQuery.getModuleType(mi);\r
971 row[pkgNameColForFpdModTable] = mi.getPackageId().getName();\r
972 row[pkgVerColForFpdModTable] = mi.getPackageId().getVersion();\r
d96d701f 973 row[archColForFpdModTable] = saa[i][ffcModArch];\r
a8a9de7c 974 try {\r
85d9e5b1 975 row[pathColForFpdModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);\r
a8a9de7c 976 } catch (Exception e) {\r
82484861 977 JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show FPD Modules:" + e.getMessage());\r
bf5abaff 978 }\r
d96d701f 979 \r
d96d701f 980 String fpdMsaKey = saa[i][ffcModGuid] + row[modVerColForFpdModTable]\r
981 + saa[i][ffcPkgGuid] + row[pkgVerColForFpdModTable];\r
982 ArrayList<String> al = fpdMsa.get(fpdMsaKey);\r
983 if (al == null) {\r
984 al = new ArrayList<String>();\r
985 fpdMsa.put(fpdMsaKey, al);\r
986 }\r
987 al.add(saa[i][ffcModArch]);\r
bf5abaff 988 }\r
701d95b3 989 else {\r
990 row[modNameColForFpdModTable] = saa[i][ffcModGuid];\r
991 row[modVerColForFpdModTable] = saa[i][ffcModVer];\r
992 row[pkgNameColForFpdModTable] = saa[i][ffcPkgGuid];\r
993 row[pkgVerColForFpdModTable] = saa[i][ffcPkgVer];\r
994 row[archColForFpdModTable] = saa[i][ffcModArch];\r
995 }\r
d78abb5a 996 row[forceDbgColForFpdModTable] = ffc.getModuleSAForceDebug(i);\r
1bf9fa5a 997 modelFpdModules.addRow(row);\r
a8a9de7c 998\r
a13899c5 999 }\r
f4c4325b 1000 TableSorter sorter = (TableSorter)jTableFpdModules.getModel();\r
d78abb5a 1001 sorter.setSortState(modNameColForFpdModTable, TableSorter.ASCENDING);\r
a13899c5 1002 }\r
a8a9de7c 1003\r
a13899c5 1004 showAllModules();\r
0227d24c 1005 \r
a13899c5 1006 }\r
a8a9de7c 1007\r
a13899c5 1008 private void showAllModules() {\r
a8a9de7c 1009\r
a13899c5 1010 if (miList == null) {\r
1011 miList = new ArrayList<ModuleIdentification>();\r
1012 }\r
a8a9de7c 1013\r
df4b9c3e 1014 String[] s = { "", "", "", "", "", "" };\r
3658f95e 1015 \r
1016 Iterator ismi = GlobalData.vModuleList.iterator();\r
a8a9de7c 1017 while (ismi.hasNext()) {\r
1018 ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
d208e1e2 1019 s[modNameColForAllModTable] = mi.getName();\r
1020 s[modVerColForAllModTable] = mi.getVersion();\r
3658f95e 1021 s[typeColForAllModTable] = SurfaceAreaQuery.getModuleType(mi);\r
1022 s[pkgNameColForAllModTable] = mi.getPackageId().getName();\r
1023 s[pkgVerColForAllModTable] = mi.getPackageId().getVersion();\r
bf5abaff 1024 try {\r
85d9e5b1 1025 s[pathColForAllModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);\r
a8a9de7c 1026 } catch (Exception e) {\r
82484861 1027 JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show All Modules:" + e.getMessage());\r
bf5abaff 1028 }\r
4da2e625 1029 modelAllModules.addRow(s);\r
a13899c5 1030 miList.add(mi);\r
1031 }\r
3658f95e 1032 \r
f4c4325b 1033 \r
1034 TableSorter sorter = (TableSorter)jTableAllModules.getModel();\r
d78abb5a 1035 sorter.setSortState(modNameColForAllModTable, TableSorter.ASCENDING);\r
a13899c5 1036 }\r
a8a9de7c 1037\r
a13899c5 1038 /**\r
1039 * This method initializes this\r
1040 * \r
1041 * @return void\r
1042 */\r
1043 private void initialize() {\r
1044 this.setSize(633, 533);\r
1045 this.setTitle("Framework Modules");\r
1046 this.setContentPane(getJSplitPane());\r
1047 this.setVisible(true);\r
a8a9de7c 1048\r
a13899c5 1049 }\r
a13899c5 1050\r
a8a9de7c 1051} // @jve:decl-index=0:visual-constraint="10,10"\r
a13899c5 1052\r
1053class NonEditableTableModel extends DefaultTableModel {\r
44053733 1054 /**\r
1055 * \r
1056 */\r
1057 private static final long serialVersionUID = 1L;\r
1058\r
a13899c5 1059 public boolean isCellEditable(int row, int col) {\r
1060 return false;\r
1061 }\r
1062}\r
d78abb5a 1063\r
1064class FpdModulesTableModel extends DefaultTableModel {\r
1065\r
1066 /**\r
1067 * \r
1068 */\r
1069 private static final long serialVersionUID = 1L;\r
1070 \r
1071 public Class<?> getColumnClass (int c) {\r
1072 if (getValueAt(0, c) != null){\r
1073 return getValueAt(0, c).getClass();\r
1074 }\r
1075 return String.class;\r
1076 }\r
1077 \r
1078 public boolean isCellEditable (int row, int col) {\r
1079 if (col == FpdFrameworkModules.forceDbgColForFpdModTable) {\r
1080 return true;\r
1081 }\r
1082 return false;\r
1083 }\r
1084}\r