sort modules by name alphabetically when start; make column width resizable and remov...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdModuleSA.java
CommitLineData
a13899c5 1package org.tianocore.frameworkwizard.platform.ui;\r
2\r
3import java.awt.BorderLayout;\r
f3b0ed9a 4import java.awt.Dimension;\r
5import java.awt.Toolkit;\r
a13899c5 6\r
a13899c5 7import javax.swing.JFrame;\r
8import javax.swing.JOptionPane;\r
9import javax.swing.JPanel;\r
10import javax.swing.JDialog;\r
11import javax.swing.JTabbedPane;\r
12import javax.swing.JLabel;\r
13import javax.swing.JScrollPane;\r
14import javax.swing.JTable;\r
a13899c5 15import javax.swing.JTextArea;\r
16import javax.swing.JSplitPane;\r
17import javax.swing.JButton;\r
18import javax.swing.ListSelectionModel;\r
19import javax.swing.event.ListSelectionEvent;\r
20import javax.swing.event.ListSelectionListener;\r
21import javax.swing.event.TableModelEvent;\r
22import javax.swing.event.TableModelListener;\r
23import javax.swing.table.DefaultTableModel;\r
a13899c5 24import javax.swing.table.TableModel;\r
25\r
26import org.apache.xmlbeans.XmlObject;\r
8f55ea73 27import org.tianocore.frameworkwizard.common.DataValidation;\r
28import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
a13899c5 29import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
30import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
31import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
32import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
33\r
34import java.awt.FlowLayout;\r
35import java.awt.event.ActionEvent;\r
36import java.awt.event.ActionListener;\r
37import java.util.ArrayList;\r
38import java.util.HashMap;\r
39import java.util.Iterator;\r
40import java.util.ListIterator;\r
41import java.util.Map;\r
42import java.util.Set;\r
1800d80f 43import java.util.Vector;\r
44\r
6a09eb19 45import javax.swing.JTextField;\r
908b1c05 46import java.awt.GridLayout;\r
47import javax.swing.JComboBox;\r
a13899c5 48\r
49public class FpdModuleSA extends JDialog implements ActionListener {\r
50\r
44053733 51 /**\r
52 * \r
53 */\r
54 private static final long serialVersionUID = 1L;\r
a13899c5 55 static JFrame frame;\r
56 private JPanel jContentPane = null;\r
57 private JTabbedPane jTabbedPane = null;\r
57d0e52a 58 private JPanel jPanelPcd = null;\r
59 private JPanel jPanelLibrary = null;\r
60 private JLabel jLabelPcdData = null;\r
61 private JScrollPane jScrollPaneTablePcd = null;\r
62 private JTable jTablePcd = null;\r
63 private JPanel jPanelPcdSouth = null;\r
64 private JScrollPane jScrollPanePcdHelp = null;\r
65 private JTextArea jTextAreaPcdHelp = null;\r
66 private JPanel jPanelContentPaneSouth = null;\r
a13899c5 67 private JSplitPane jSplitPane = null;\r
57d0e52a 68 private JPanel jPanelLibraryLeft = null;\r
69 private JPanel jPanelLibraryRight = null;\r
70 private JLabel jLabelLibClass = null;\r
71 private JLabel jLabelQualifiedInstance = null;\r
72 private JScrollPane jScrollPaneSelectedInstances = null;\r
73 private JTable jTableSelectedInstances = null;\r
74 private JScrollPane jScrollPaneLibClass = null;\r
75 private JTable jTableLibClass = null;\r
76 private JScrollPane jScrollPaneQualifiedInstance = null;\r
77 private JTable jTableLibInstances = null;\r
78 private JPanel jPanelLibrarySouth = null;\r
79 private JPanel jPanelLibraryCenter = null;\r
80 private JScrollPane jScrollPaneInstanceHelp = null;\r
81 private JTextArea jTextAreaInstanceHelp = null;\r
82 private JLabel jLabelSelectedInstances = null;\r
83 private JLabel jLabelInstanceHelp = null;\r
84 private JButton jButtonAdd = null;\r
85 private JButton jButtonDeleteInstance = null;\r
86 private JLabel jLabelPcdHelp = null;\r
87 private JButton jButtonOk = null;\r
88 private JButton jButtonCancel = null;\r
a13899c5 89 private PartialEditableTableModel model = null;\r
57d0e52a 90 private LibraryTableModel selectedInstancesTableModel = null;\r
91 private LibraryTableModel libClassTableModel = null;\r
92 private LibraryTableModel libInstanceTableModel = null;\r
1800d80f 93 private DefaultTableModel optionsTableModel = null;\r
a13899c5 94 private FpdFileContents ffc = null;\r
95 private String moduleKey = null;\r
802e0055 96 private int moduleSaNum = -1;\r
a13899c5 97 private HashMap<String, ArrayList<String>> classInstanceMap = null;\r
98 private ArrayList<String> classProduced = null;\r
a13899c5 99 private HashMap<String, ArrayList<String>> classConsumed = null;\r
57d0e52a 100 private JPanel jPanelModuleSaOpts = null;\r
101 private JLabel jLabelFvBinding = null;\r
8f55ea73 102 private JTextField jTextFieldFvBinding = null;\r
57d0e52a 103 private JLabel jLabelFfsFileGuid = null;\r
8f55ea73 104 private JTextField jTextFieldFileGuid = null;\r
57d0e52a 105 private JLabel jLabelFfsFormatKey = null;\r
8f55ea73 106 private JTextField jTextFieldFfsKey = null;\r
57d0e52a 107 private JScrollPane jScrollPaneModuleSaOptions = null;\r
108 private JTable jTableModuleSaOptions = null;\r
109 private JButton jButtonNew = null;\r
110 private JButton jButtonDeleteOption = null;\r
111 private JPanel jPanelPcdFields = null;\r
112 private JPanel jPanelPcdFieldsSecondRow = null;\r
113 private JPanel jPanelPcdFieldsThirdRow = null;\r
114 private JPanel jPanelPcdFieldsFirstRow = null;\r
115 private JLabel jLabelItemType = null;\r
116 private JComboBox jComboBoxItemType = null;\r
117 private JLabel jLabelMaxDatumSize = null;\r
118 private JTextField jTextFieldMaxDatumSize = null;\r
119 private JLabel jLabelPcdDefaultValue = null;\r
120 private JTextField jTextFieldPcdDefault = null;\r
121 private JButton jButtonUpdatePcd = null;\r
122 private JComboBox jComboBoxFeatureFlagValue = null;\r
8f55ea73 123 private OpeningPlatformType docConsole = null;\r
57d0e52a 124 private JLabel jLabelPad = null;\r
a13899c5 125 /**\r
126 * This is the default constructor\r
127 */\r
128 public FpdModuleSA() {\r
129 super();\r
130 initialize();\r
131 }\r
132 public FpdModuleSA(FpdFileContents ffc) {\r
133 this();\r
134 this.ffc = ffc;\r
135 }\r
136 \r
8f55ea73 137 public void setKey(String k, int i, OpeningPlatformType dc){\r
a13899c5 138 this.moduleKey = k;\r
802e0055 139 moduleSaNum = i;\r
8f55ea73 140 this.docConsole = dc;\r
57d0e52a 141 classProduced = null;\r
142 classConsumed = null;\r
908b1c05 143 jTabbedPane.setSelectedIndex(0);\r
055e7ae6 144 initPcdBuildDefinition(i);\r
a13899c5 145 }\r
146\r
147 /**\r
148 init will be called each time FpdModuleSA object is to be shown.\r
149 @param key Module information.\r
150 **/\r
055e7ae6 151 public void initPcdBuildDefinition(int i) {\r
a13899c5 152 //\r
153 // display pcd for key.\r
154 //\r
155 model.setRowCount(0);\r
055e7ae6 156 int pcdCount = ffc.getPcdDataCount(i);\r
a13899c5 157 if (pcdCount != 0) {\r
82961247 158 String[][] saa = new String[pcdCount][7];\r
055e7ae6 159 ffc.getPcdData(i, saa);\r
160 for (int j = 0; j < saa.length; ++j) {\r
161 model.addRow(saa[j]);\r
a13899c5 162 }\r
163 }\r
908b1c05 164 }\r
165 \r
166 public void initLibraries(String key) {\r
71baa24b 167 //\r
168 // display library classes that need to be resolved. also potential instances for them.\r
169 //\r
bf5abaff 170 resolveLibraryInstances(moduleKey);\r
a13899c5 171 //\r
172 // display lib instances already selected for key\r
173 //\r
57d0e52a 174 selectedInstancesTableModel.setRowCount(0);\r
a13899c5 175 int instanceCount = ffc.getLibraryInstancesCount(key);\r
176 if (instanceCount != 0) {\r
177 String[][] saa = new String[instanceCount][5];\r
178 ffc.getLibraryInstances(key, saa);\r
179 for (int i = 0; i < saa.length; ++i) {\r
34c614e1 180 ModuleIdentification mi = GlobalData.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
71baa24b 181 if (mi != null) {\r
182 saa[i][0] = mi.getName();\r
183 saa[i][2] = mi.getVersion();\r
184 saa[i][4] = mi.getPackage().getVersion();\r
185 //\r
186 // re-evaluate lib instance usage when adding a already-selected lib instance.\r
187 //\r
188 resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
57d0e52a 189 selectedInstancesTableModel.addRow(saa[i]);\r
a13899c5 190 }\r
191 \r
71baa24b 192 \r
a13899c5 193 }\r
194 }\r
908b1c05 195 }\r
196 \r
197 public void initModuleSAOptions(String key) {\r
1800d80f 198 //\r
199 // display module SA options\r
200 //\r
802e0055 201 jTextFieldFvBinding.setText("");\r
1800d80f 202 String fvBinding = ffc.getFvBinding(key);\r
203 if (fvBinding != null) {\r
8f55ea73 204 jTextFieldFvBinding.setText(fvBinding);\r
1800d80f 205 }\r
802e0055 206 jTextFieldFileGuid.setText("");\r
1800d80f 207 String fileGuid = ffc.getFfsFileNameGuid(key);\r
208 if (fileGuid != null) {\r
8f55ea73 209 jTextFieldFileGuid.setText(fileGuid);\r
1800d80f 210 }\r
802e0055 211 jTextFieldFfsKey.setText("");\r
1800d80f 212 String ffsKey = ffc.getFfsFormatKey(key);\r
213 if (ffsKey != null) {\r
8f55ea73 214 jTextFieldFfsKey.setText(ffsKey);\r
1800d80f 215 }\r
bf5abaff 216 \r
217 optionsTableModel.setRowCount(0);\r
218 String[][] saa = new String[ffc.getModuleSAOptionsCount(key)][6];\r
219 ffc.getModuleSAOptions(key, saa);\r
220 for (int i = 0; i < saa.length; ++i) {\r
221 optionsTableModel.addRow(saa[i]);\r
222 }\r
a13899c5 223 }\r
224 \r
225 private void resolveLibraryInstances(String key) {\r
34c614e1 226 ModuleIdentification mi = GlobalData.getModuleId(key);\r
a13899c5 227 PackageIdentification[] depPkgList = null;\r
228 try{\r
229 Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
230 SurfaceAreaQuery.setDoc(m);\r
231 //\r
232 // Get dependency pkg list into which we will search lib instances.\r
233 //\r
234 depPkgList = SurfaceAreaQuery.getDependencePkg(null);\r
235 //\r
236 // Get the lib class consumed, produced by this module itself.\r
237 //\r
238 String[] classConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED");\r
239 \r
240 if (this.classConsumed == null) {\r
241 this.classConsumed = new HashMap<String, ArrayList<String>>();\r
242 }\r
243 \r
244 for(int i = 0; i < classConsumed.length; ++i){\r
245 ArrayList<String> consumedBy = this.classConsumed.get(classConsumed[i]);\r
246 if (consumedBy == null) {\r
247 consumedBy = new ArrayList<String>();\r
248 }\r
249 consumedBy.add(key);\r
250 this.classConsumed.put(classConsumed[i], consumedBy);\r
251 }\r
252 \r
253 String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");\r
254 if (this.classProduced == null) {\r
255 this.classProduced = new ArrayList<String>();\r
256 }\r
257 for(int i = 0; i < classProduced.length; ++i){\r
258 if (!this.classProduced.contains(classProduced[i])){\r
259 this.classProduced.add(classProduced[i]);\r
260 }\r
261 }\r
f4c4325b 262 \r
a13899c5 263 //\r
264 // find potential instances in all dependency pkgs for classes still in classConsumed.\r
265 //\r
266 if (classInstanceMap == null){\r
267 classInstanceMap = new HashMap<String, ArrayList<String>>();\r
268 }\r
269 Iterator<String> lic = this.classConsumed.keySet().iterator();\r
270 while(lic.hasNext()){\r
271 String cls = lic.next();\r
272 if (this.classProduced.contains(cls) || classInstanceMap.containsKey(cls)) {\r
273 continue;\r
274 }\r
275 ArrayList<String> instances = getInstancesForClass(cls, depPkgList);\r
276 if (instances.size() == 0){\r
277 JOptionPane.showMessageDialog(frame, "No Applicable Instance for Library Class " + \r
278 cls + ", Platform Build will Fail.");\r
279 }\r
280 classInstanceMap.put(cls, instances);\r
281 \r
282 }\r
283 \r
284 showClassToResolved();\r
285 }\r
286 catch(Exception e) {\r
287 e.printStackTrace();\r
288 }\r
289 }\r
290 \r
291 private ArrayList<String> getInstancesForClass(String cls, PackageIdentification[] depPkgList) throws Exception{\r
292 ArrayList<String> al = new ArrayList<String>();\r
293 \r
294 for (int i = 0; i < depPkgList.length; ++i) {\r
295 Set<ModuleIdentification> smi = GlobalData.getModules(depPkgList[i]);\r
296 Iterator ismi = smi.iterator();\r
297 while(ismi.hasNext()) {\r
298 ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
299 \r
300 String[] clsProduced = getClassProduced(mi);\r
301 \r
302 boolean isPotential = false;\r
303 for (int j = 0; j < clsProduced.length; ++j) {\r
304 if (clsProduced[j] == null) {\r
305 continue;\r
306 }\r
307 if (clsProduced[j].equals(cls)){\r
308 isPotential = true;\r
309 }\r
310 if (classProduced.contains(clsProduced[j])) {\r
311 isPotential = false;\r
312 break;\r
313 }\r
314 }\r
315 if (isPotential) {\r
316 al.add(mi.getGuid() + " " + mi.getVersion() + " " + \r
317 depPkgList[i].getGuid() + " " + depPkgList[i].getVersion());\r
318 }\r
319 }\r
320 }\r
321 \r
322 return al;\r
323 }\r
324 \r
325 private void removeInstance(String key) {\r
34c614e1 326 ModuleIdentification mi = GlobalData.getModuleId(key); \r
a13899c5 327 //\r
328 // remove pcd information of instance from current ModuleSA\r
329 //\r
82dcbb45 330 ffc.removePcdData(moduleKey, mi);\r
a13899c5 331 //\r
332 // remove class produced by this instance and add back these produced class to be bound.\r
333 //\r
334 String[] clsProduced = getClassProduced(mi);\r
335 for (int i = 0; i < clsProduced.length; ++i) {\r
336 \r
337 classProduced.remove(clsProduced[i]);\r
338 }\r
339 //\r
340 // remove class consumed by this instance. we do not need to bound it now.\r
341 //\r
342 String[] clsConsumed = getClassConsumed(mi);\r
343 for (int i = 0; i < clsConsumed.length; ++i) {\r
344 ArrayList<String> al = classConsumed.get(clsConsumed[i]);\r
345 \r
346 if (al == null ) {\r
347 classConsumed.remove(clsConsumed[i]);\r
348 continue;\r
349 }\r
350 al.remove(key);\r
351 if (al.size() == 0) {\r
352 classConsumed.remove(clsConsumed[i]);\r
353 }\r
354 \r
355 }\r
356\r
357 showClassToResolved();\r
358 \r
359 }\r
360 \r
a13899c5 361 \r
362 private String[] getClassProduced(ModuleIdentification mi){\r
363 \r
364 try{\r
365 Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
366 SurfaceAreaQuery.setDoc(m);\r
367 String[] clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");\r
368 return clsProduced;\r
369 \r
370 }catch (Exception e) {\r
371 e.printStackTrace();\r
372 }\r
373 return new String[0];\r
374 \r
375 }\r
376 \r
377 private String[] getClassConsumed(ModuleIdentification mi){\r
378 \r
379 String[] clsConsumed = null;\r
380 try{\r
381 Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
382 SurfaceAreaQuery.setDoc(m);\r
383 clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED");\r
384 \r
385 }catch (Exception e) {\r
386 e.printStackTrace();\r
387 }\r
388 return clsConsumed;\r
389 }\r
390 \r
391 private void showClassToResolved(){\r
57d0e52a 392 libClassTableModel.setRowCount(0);\r
a13899c5 393 if (classConsumed.size() == 0) {\r
394 return;\r
395 }\r
396 Iterator<String> li = classConsumed.keySet().iterator();\r
397 while(li.hasNext()){\r
398 \r
399 String[] s = {li.next()};\r
400 if (classConsumed.get(s[0]) == null) {\r
401 continue;\r
402 }\r
403 if (classConsumed.get(s[0]).size() == 0) {\r
404 continue;\r
405 }\r
406 if (!classProduced.contains(s[0])){\r
57d0e52a 407 libClassTableModel.addRow(s);\r
a13899c5 408 }\r
409 }\r
57d0e52a 410 libInstanceTableModel.setRowCount(0);\r
a13899c5 411 }\r
412 /**\r
413 * This method initializes this\r
414 * \r
415 * @return void\r
416 */\r
417 private void initialize() {\r
418 this.setSize(664, 515);\r
f3b0ed9a 419 this.centerWindow();\r
a13899c5 420 this.setModal(true);\r
421 this.setTitle("Module Settings");\r
422 this.setContentPane(getJContentPane());\r
423 }\r
424\r
425 /**\r
426 * This method initializes jContentPane\r
427 * \r
428 * @return javax.swing.JPanel\r
429 */\r
430 private JPanel getJContentPane() {\r
431 if (jContentPane == null) {\r
432 jContentPane = new JPanel();\r
433 jContentPane.setLayout(new BorderLayout());\r
434 jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);\r
57d0e52a 435 jContentPane.add(getJPanelContentPaneSouth(), java.awt.BorderLayout.SOUTH);\r
a13899c5 436 }\r
437 return jContentPane;\r
438 }\r
439\r
440 /**\r
441 * This method initializes jTabbedPane \r
442 * \r
443 * @return javax.swing.JTabbedPane \r
444 */\r
445 private JTabbedPane getJTabbedPane() {\r
446 if (jTabbedPane == null) {\r
447 jTabbedPane = new JTabbedPane();\r
57d0e52a 448 jTabbedPane.addTab("PCD Build Definition", null, getJPanelPcd(), null);\r
449 jTabbedPane.addTab("Module SA Options", null, getJPanelModuleSaOpts(), null);\r
450 jTabbedPane.addTab("Libraries", null, getJPanelLibrary(), null);\r
a13899c5 451 }\r
452 return jTabbedPane;\r
453 }\r
454\r
455 /**\r
57d0e52a 456 * This method initializes jPanelPcd\r
a13899c5 457 * \r
458 * @return javax.swing.JPanel \r
459 */\r
57d0e52a 460 private JPanel getJPanelPcd() {\r
461 if (jPanelPcd == null) {\r
462 jLabelPcdData = new JLabel();\r
463 jLabelPcdData.setText("PcdData");\r
464 jPanelPcd = new JPanel();\r
465 jPanelPcd.setLayout(new BorderLayout());\r
466 jPanelPcd.add(jLabelPcdData, java.awt.BorderLayout.NORTH);\r
467 jPanelPcd.add(getJScrollPaneTablePcd(), java.awt.BorderLayout.CENTER);\r
468 jPanelPcd.add(getJPanelPcdSouth(), java.awt.BorderLayout.SOUTH);\r
469 jPanelPcd.addComponentListener(new java.awt.event.ComponentAdapter() {\r
a13899c5 470 public void componentShown(java.awt.event.ComponentEvent e) {\r
802e0055 471 initPcdBuildDefinition(moduleSaNum);\r
a13899c5 472 }\r
473 });\r
474 \r
475 }\r
57d0e52a 476 return jPanelPcd;\r
a13899c5 477 }\r
478\r
479 /**\r
57d0e52a 480 * This method initializes jPanelLibrary\r
a13899c5 481 * \r
482 * @return javax.swing.JPanel \r
483 */\r
57d0e52a 484 private JPanel getJPanelLibrary() {\r
485 if (jPanelLibrary == null) {\r
486 jPanelLibrary = new JPanel();\r
487 jPanelLibrary.setLayout(new BorderLayout());\r
488 jPanelLibrary.add(getJSplitPane(), java.awt.BorderLayout.NORTH);\r
489 jPanelLibrary.add(getJPanelLibrarySouth(), java.awt.BorderLayout.SOUTH);\r
490 jPanelLibrary.add(getJPanelLibraryCenter(), java.awt.BorderLayout.CENTER);\r
491 jPanelLibrary.addComponentListener(new java.awt.event.ComponentAdapter() {\r
a13899c5 492 public void componentShown(java.awt.event.ComponentEvent e) {\r
908b1c05 493 initLibraries(moduleKey);\r
a13899c5 494 }\r
495 });\r
496 }\r
57d0e52a 497 return jPanelLibrary;\r
a13899c5 498 }\r
499\r
500 /**\r
57d0e52a 501 * This method initializes jScrollPaneTablePcd\r
a13899c5 502 * \r
503 * @return javax.swing.JScrollPane \r
504 */\r
57d0e52a 505 private JScrollPane getJScrollPaneTablePcd() {\r
506 if (jScrollPaneTablePcd == null) {\r
507 jScrollPaneTablePcd = new JScrollPane();\r
508 jScrollPaneTablePcd.setViewportView(getJTablePcd());\r
a13899c5 509 }\r
57d0e52a 510 return jScrollPaneTablePcd;\r
a13899c5 511 }\r
512\r
513 /**\r
514 * This method initializes jTable \r
515 * \r
516 * @return javax.swing.JTable \r
517 */\r
57d0e52a 518 private JTable getJTablePcd() {\r
519 if (jTablePcd == null) {\r
a13899c5 520 model = new PartialEditableTableModel();\r
57d0e52a 521 jTablePcd = new JTable(model);\r
522 jTablePcd.setRowHeight(20);\r
523 jTablePcd.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
a13899c5 524 model.addColumn("CName");\r
525 model.addColumn("TokenSpaceGUID");\r
526 model.addColumn("ItemType");\r
527 model.addColumn("Token");\r
82961247 528 model.addColumn("MaxDatumSize");\r
a13899c5 529 model.addColumn("DataType");\r
530 model.addColumn("DefaultValue");\r
531 \r
57d0e52a 532 jTablePcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
533 jTablePcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r
a13899c5 534 public void valueChanged(ListSelectionEvent e) {\r
44053733 535 \r
a13899c5 536 if (e.getValueIsAdjusting()){\r
537 return;\r
538 }\r
539 ListSelectionModel lsm = (ListSelectionModel)e.getSource();\r
540 if (lsm.isSelectionEmpty()) {\r
541 return;\r
542 }\r
543 else{\r
908b1c05 544 int selectedRow = lsm.getMinSelectionIndex();\r
57d0e52a 545 String cName = jTablePcd.getValueAt(selectedRow, 0)+"";\r
1dac04ab 546 String tsGuid = jTablePcd.getValueAt(selectedRow, 1)+"";\r
908b1c05 547 String[] pcdInfo = {"", ""};\r
1dac04ab 548 getPcdInfo(cName, tsGuid, pcdInfo);\r
57d0e52a 549 jTextAreaPcdHelp.setText(pcdInfo[0]);\r
908b1c05 550 initComboBox(pcdInfo[1]);\r
57d0e52a 551 jComboBoxItemType.setSelectedItem(pcdInfo[1]);\r
552 jTextFieldMaxDatumSize.setEnabled(true);\r
553 jTextFieldMaxDatumSize.setVisible(true);\r
554 jTextFieldMaxDatumSize.setText(jTablePcd.getValueAt(selectedRow, 4)+"");\r
555 jTextFieldPcdDefault.setEnabled(true);\r
556 jTextFieldPcdDefault.setText(jTablePcd.getValueAt(selectedRow, 6)+"");\r
557 if (jTablePcd.getValueAt(selectedRow, 5).equals("VOID*")) {\r
908b1c05 558 if (pcdInfo[1].equals("FEATURE_FLAG")) {\r
57d0e52a 559 jTextFieldMaxDatumSize.setVisible(false);\r
908b1c05 560 }\r
561 else if (pcdInfo[1].equals("FIXED_AT_BUILD")) {\r
562 try{\r
57d0e52a 563 jTextFieldMaxDatumSize.setEnabled(false);\r
564 jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(jTablePcd.getValueAt(selectedRow, 6)+"")+"");\r
908b1c05 565 }\r
566 catch(Exception except){\r
567 JOptionPane.showMessageDialog(frame, "Unacceptable PCD Value: " + except.getMessage());\r
568 }\r
569 }\r
570 else{\r
57d0e52a 571 jTextFieldMaxDatumSize.setText(jTablePcd.getValueAt(selectedRow, 4)+"");\r
908b1c05 572 }\r
573 }\r
574 else {\r
57d0e52a 575 jTextFieldMaxDatumSize.setEnabled(false);\r
908b1c05 576 }\r
a13899c5 577 \r
57d0e52a 578 if (!jTablePcd.getValueAt(selectedRow, 2).equals("DYNAMIC") && !jTablePcd.getValueAt(selectedRow, 2).equals("DYNAMIC_EX")) {\r
579 jTextFieldPcdDefault.setText(jTablePcd.getValueAt(selectedRow, 6)+"");\r
580 if (jTablePcd.getValueAt(selectedRow, 2).equals("FEATURE_FLAG")){\r
581 jTextFieldPcdDefault.setVisible(false);\r
582 jComboBoxFeatureFlagValue.setVisible(true);\r
583 jComboBoxFeatureFlagValue.setSelectedItem(jTablePcd.getValueAt(selectedRow, 6)+"");\r
908b1c05 584 }\r
585 else{\r
57d0e52a 586 jTextFieldPcdDefault.setVisible(true);\r
587 jTextFieldPcdDefault.setEnabled(true);\r
588 jComboBoxFeatureFlagValue.setVisible(false);\r
908b1c05 589 }\r
590 }\r
591 else{\r
57d0e52a 592 jTextFieldPcdDefault.setEnabled(false);\r
908b1c05 593 }\r
a13899c5 594 }\r
908b1c05 595 \r
596 \r
a13899c5 597 }\r
598 });\r
599 \r
57d0e52a 600 jTablePcd.getModel().addTableModelListener(new TableModelListener() {\r
a13899c5 601 public void tableChanged(TableModelEvent arg0) {\r
602 // TODO Auto-generated method stub\r
908b1c05 603// int row = arg0.getFirstRow();\r
604// TableModel m = (TableModel)arg0.getSource();\r
605 \r
a13899c5 606 if (arg0.getType() == TableModelEvent.UPDATE){\r
908b1c05 607 //update xml doc here.\r
a13899c5 608 \r
609 }\r
610 }\r
611 });\r
612 }\r
57d0e52a 613 return jTablePcd;\r
a13899c5 614 }\r
908b1c05 615 \r
616 private void initComboBox(String originalType) {\r
57d0e52a 617 jComboBoxItemType.removeAllItems();\r
618 jComboBoxItemType.addItem(originalType);\r
908b1c05 619 if (originalType.equals("PATCHABLE_IN_MODULE")) {\r
57d0e52a 620 jComboBoxItemType.addItem("FIXED_AT_BUILD");\r
908b1c05 621 }\r
622 if (originalType.equals("DYNAMIC")) {\r
57d0e52a 623 jComboBoxItemType.addItem("FIXED_AT_BUILD");\r
624 jComboBoxItemType.addItem("PATCHABLE_IN_MODULE");\r
908b1c05 625 }\r
626 }\r
627 \r
1dac04ab 628 private void getPcdInfo(String cName, String tsGuid, String[] sa) {\r
908b1c05 629 String[][] saa = new String[ffc.getLibraryInstancesCount(moduleKey)][5];\r
630 ffc.getLibraryInstances(moduleKey, saa);\r
631 \r
632 try{\r
1dac04ab 633 if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(moduleKey), cName, tsGuid, sa)) {\r
908b1c05 634 return;\r
635 }\r
636 for (int j = 0; j < saa.length; ++j) {\r
34c614e1 637 if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),\r
1dac04ab 638 cName, tsGuid, sa)) {\r
908b1c05 639 return;\r
640 }\r
641 }\r
642 }\r
643 catch(Exception e) {\r
644 JOptionPane.showMessageDialog(this, "Get PCD details fail: " + e.getMessage());\r
645 }\r
646 }\r
a13899c5 647\r
648 /**\r
57d0e52a 649 * This method initializes jPanelPcdSouth\r
a13899c5 650 * \r
651 * @return javax.swing.JPanel \r
652 */\r
57d0e52a 653 private JPanel getJPanelPcdSouth() {\r
654 if (jPanelPcdSouth == null) {\r
655 jLabelPcdHelp = new JLabel();\r
656 jLabelPcdHelp.setText("PCD Description");\r
657 jPanelPcdSouth = new JPanel();\r
658 jPanelPcdSouth.setPreferredSize(new java.awt.Dimension(607,200));\r
659 jPanelPcdSouth.add(jLabelPcdHelp, null);\r
660 jPanelPcdSouth.add(getJScrollPanePcdHelp(), null);\r
661 jPanelPcdSouth.add(getJPanelPcdFields(), null);\r
a13899c5 662 }\r
57d0e52a 663 return jPanelPcdSouth;\r
a13899c5 664 }\r
665\r
666 /**\r
57d0e52a 667 * This method initializes jScrollPanePcdHelp\r
a13899c5 668 * \r
669 * @return javax.swing.JScrollPane \r
670 */\r
57d0e52a 671 private JScrollPane getJScrollPanePcdHelp() {\r
672 if (jScrollPanePcdHelp == null) {\r
673 jScrollPanePcdHelp = new JScrollPane();\r
674 jScrollPanePcdHelp.setPreferredSize(new java.awt.Dimension(500,100));\r
675 jScrollPanePcdHelp.setViewportView(getJTextAreaPcdHelp());\r
a13899c5 676 }\r
57d0e52a 677 return jScrollPanePcdHelp;\r
a13899c5 678 }\r
679\r
680 /**\r
57d0e52a 681 * This method initializes jTextAreaPcdHelp\r
a13899c5 682 * \r
683 * @return javax.swing.JTextArea \r
684 */\r
57d0e52a 685 private JTextArea getJTextAreaPcdHelp() {\r
686 if (jTextAreaPcdHelp == null) {\r
687 jTextAreaPcdHelp = new JTextArea();\r
688 jTextAreaPcdHelp.setEditable(false);\r
a13899c5 689 }\r
57d0e52a 690 return jTextAreaPcdHelp;\r
a13899c5 691 }\r
692\r
693 /**\r
57d0e52a 694 * This method initializes jPanelContentPaneSouth\r
a13899c5 695 * \r
696 * @return javax.swing.JPanel \r
697 */\r
57d0e52a 698 private JPanel getJPanelContentPaneSouth() {\r
699 if (jPanelContentPaneSouth == null) {\r
a13899c5 700 FlowLayout flowLayout = new FlowLayout();\r
701 flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);\r
57d0e52a 702 jPanelContentPaneSouth = new JPanel();\r
703 jPanelContentPaneSouth.setLayout(flowLayout);\r
704 jPanelContentPaneSouth.add(getJButtonOk(), null);\r
705 jPanelContentPaneSouth.add(getJButtonCancel(), null);\r
a13899c5 706 }\r
57d0e52a 707 return jPanelContentPaneSouth;\r
a13899c5 708 }\r
709\r
710 /**\r
711 * This method initializes jSplitPane \r
712 * \r
713 * @return javax.swing.JSplitPane \r
714 */\r
715 private JSplitPane getJSplitPane() {\r
716 if (jSplitPane == null) {\r
717 jSplitPane = new JSplitPane();\r
718 jSplitPane.setDividerLocation(200);\r
57d0e52a 719 jSplitPane.setLeftComponent(getJPanelLibraryLeft());\r
720 jSplitPane.setRightComponent(getJPanelLibraryRight());\r
a13899c5 721 jSplitPane.setPreferredSize(new java.awt.Dimension(202,200));\r
722 }\r
723 return jSplitPane;\r
724 }\r
725\r
726 /**\r
57d0e52a 727 * This method initializes jPanelLibraryLeft\r
a13899c5 728 * \r
729 * @return javax.swing.JPanel \r
730 */\r
57d0e52a 731 private JPanel getJPanelLibraryLeft() {\r
732 if (jPanelLibraryLeft == null) {\r
733 jLabelLibClass = new JLabel();\r
734 jLabelLibClass.setText("Library Classes Uninstantiated");\r
735 jPanelLibraryLeft = new JPanel();\r
736 jPanelLibraryLeft.add(jLabelLibClass, null);\r
737 jPanelLibraryLeft.add(getJScrollPaneLibClass(), null);\r
a13899c5 738 }\r
57d0e52a 739 return jPanelLibraryLeft;\r
a13899c5 740 }\r
741\r
742 /**\r
57d0e52a 743 * This method initializes jPanelLibraryRight\r
a13899c5 744 * \r
745 * @return javax.swing.JPanel \r
746 */\r
57d0e52a 747 private JPanel getJPanelLibraryRight() {\r
748 if (jPanelLibraryRight == null) {\r
749 jLabelQualifiedInstance = new JLabel();\r
750 jLabelQualifiedInstance.setText("Instances Available");\r
751 jPanelLibraryRight = new JPanel();\r
752 jPanelLibraryRight.add(jLabelQualifiedInstance, null);\r
753 jPanelLibraryRight.add(getJScrollPaneQualifiedInstance(), null);\r
a13899c5 754 }\r
57d0e52a 755 return jPanelLibraryRight;\r
a13899c5 756 }\r
757\r
758 /**\r
57d0e52a 759 * This method initializes jScrollPaneSelectedInstances\r
a13899c5 760 * \r
761 * @return javax.swing.JScrollPane \r
762 */\r
57d0e52a 763 private JScrollPane getJScrollPaneSelectedInstances() {\r
764 if (jScrollPaneSelectedInstances == null) {\r
765 jScrollPaneSelectedInstances = new JScrollPane();\r
766 jScrollPaneSelectedInstances.setPreferredSize(new java.awt.Dimension(453,150));\r
767 jScrollPaneSelectedInstances.setViewportView(getJTableSelectedInstances());\r
a13899c5 768 }\r
57d0e52a 769 return jScrollPaneSelectedInstances;\r
a13899c5 770 }\r
771\r
772 /**\r
57d0e52a 773 * This method initializes jTableSelectedInstances\r
a13899c5 774 * \r
775 * @return javax.swing.JTable \r
776 */\r
57d0e52a 777 private JTable getJTableSelectedInstances() {\r
778 if (jTableSelectedInstances == null) {\r
779 selectedInstancesTableModel = new LibraryTableModel();\r
780 selectedInstancesTableModel.addColumn("Name");\r
781 selectedInstancesTableModel.addColumn("ModuleGUID");\r
782 selectedInstancesTableModel.addColumn("ModuleVersion");\r
783 selectedInstancesTableModel.addColumn("PackageGUID");\r
784 selectedInstancesTableModel.addColumn("PackageVersion");\r
785 jTableSelectedInstances = new JTable(selectedInstancesTableModel);\r
786 jTableSelectedInstances.setRowHeight(20);\r
2a23019d 787 jTableSelectedInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);\r
57d0e52a 788 jTableSelectedInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
a13899c5 789 \r
790 }\r
57d0e52a 791 return jTableSelectedInstances;\r
a13899c5 792 }\r
793\r
794 /**\r
57d0e52a 795 * This method initializes jScrollPaneLibClass\r
a13899c5 796 * \r
797 * @return javax.swing.JScrollPane \r
798 */\r
57d0e52a 799 private JScrollPane getJScrollPaneLibClass() {\r
800 if (jScrollPaneLibClass == null) {\r
801 jScrollPaneLibClass = new JScrollPane();\r
802 jScrollPaneLibClass.setPreferredSize(new java.awt.Dimension(200,170));\r
803 jScrollPaneLibClass.setViewportView(getJTableLibClass());\r
a13899c5 804 }\r
57d0e52a 805 return jScrollPaneLibClass;\r
a13899c5 806 }\r
807\r
808 /**\r
57d0e52a 809 * This method initializes jTableLibClass\r
a13899c5 810 * \r
811 * @return javax.swing.JTable \r
812 */\r
57d0e52a 813 private JTable getJTableLibClass() {\r
814 if (jTableLibClass == null) {\r
815 libClassTableModel = new LibraryTableModel();\r
816 libClassTableModel.addColumn("LibraryClass");\r
817 jTableLibClass = new JTable(libClassTableModel);\r
818 jTableLibClass.setRowHeight(20);\r
819 jTableLibClass.setShowGrid(false);\r
820 jTableLibClass.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
821 jTableLibClass.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r
a13899c5 822 public void valueChanged(ListSelectionEvent e) {\r
823 if (e.getValueIsAdjusting()){\r
824 return;\r
825 }\r
826 ListSelectionModel lsm = (ListSelectionModel)e.getSource();\r
827 if (lsm.isSelectionEmpty()) {\r
828 return;\r
829 }\r
830 else{\r
831 int selectedRow2 = lsm.getMinSelectionIndex();\r
832 if (selectedRow2 < 0) {\r
833 return;\r
834 }\r
835 //\r
836 // display potential lib instances according to class selection\r
837 //\r
57d0e52a 838 libInstanceTableModel.setRowCount(0);\r
839 String cls = libClassTableModel.getValueAt(selectedRow2, 0).toString();\r
a13899c5 840 ArrayList<String> al = classInstanceMap.get(cls);\r
841 ListIterator<String> li = al.listIterator();\r
842 while(li.hasNext()) {\r
843 String instance = li.next();\r
844 String[] s = {"", "", "", "", ""};\r
34c614e1 845 if (GlobalData.getModuleId(instance) != null) {\r
846 s[0] = GlobalData.getModuleId(instance).getName();\r
a13899c5 847 }\r
848 \r
849 String[] instancePart = instance.split(" ");\r
850 for (int i = 0; i < instancePart.length; ++i){\r
851 s[i+1] = instancePart[i];\r
852 }\r
57d0e52a 853 libInstanceTableModel.addRow(s);\r
a13899c5 854 }\r
855 \r
856 }\r
857 }\r
858 });\r
859 }\r
57d0e52a 860 return jTableLibClass;\r
a13899c5 861 }\r
862\r
863 /**\r
57d0e52a 864 * This method initializes jScrollPaneQualifiedInstance\r
a13899c5 865 * \r
866 * @return javax.swing.JScrollPane \r
867 */\r
57d0e52a 868 private JScrollPane getJScrollPaneQualifiedInstance() {\r
869 if (jScrollPaneQualifiedInstance == null) {\r
870 jScrollPaneQualifiedInstance = new JScrollPane();\r
871 jScrollPaneQualifiedInstance.setPreferredSize(new java.awt.Dimension(430,170));\r
872 jScrollPaneQualifiedInstance.setViewportView(getJTableLibInstances());\r
a13899c5 873 }\r
57d0e52a 874 return jScrollPaneQualifiedInstance;\r
a13899c5 875 }\r
876\r
877 /**\r
57d0e52a 878 * This method initializes jTableLibInstances\r
a13899c5 879 * \r
880 * @return javax.swing.JTable \r
881 */\r
57d0e52a 882 private JTable getJTableLibInstances() {\r
883 if (jTableLibInstances == null) {\r
884 libInstanceTableModel = new LibraryTableModel();\r
885 libInstanceTableModel.addColumn("Name");\r
886 libInstanceTableModel.addColumn("ModuleGUID");\r
887 libInstanceTableModel.addColumn("ModuleVersion");\r
888 libInstanceTableModel.addColumn("PackageGUID");\r
889 libInstanceTableModel.addColumn("PackageVersion");\r
890 jTableLibInstances = new JTable(libInstanceTableModel);\r
891 jTableLibInstances.setRowHeight(20);\r
2a23019d 892 jTableLibInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);\r
57d0e52a 893 jTableLibInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
908b1c05 894 \r
a13899c5 895 }\r
57d0e52a 896 return jTableLibInstances;\r
a13899c5 897 }\r
898\r
899 /**\r
57d0e52a 900 * This method initializes jPanelLibrarySouth\r
a13899c5 901 * \r
902 * @return javax.swing.JPanel \r
903 */\r
57d0e52a 904 private JPanel getJPanelLibrarySouth() {\r
905 if (jPanelLibrarySouth == null) {\r
906 jPanelLibrarySouth = new JPanel();\r
a13899c5 907 }\r
57d0e52a 908 return jPanelLibrarySouth;\r
a13899c5 909 }\r
910\r
911 /**\r
57d0e52a 912 * This method initializes jPanelLibraryCenter\r
a13899c5 913 * \r
914 * @return javax.swing.JPanel \r
915 */\r
57d0e52a 916 private JPanel getJPanelLibraryCenter() {\r
917 if (jPanelLibraryCenter == null) {\r
918 jLabelInstanceHelp = new JLabel();\r
919 jLabelInstanceHelp.setText("Instance Description");\r
920 jLabelSelectedInstances = new JLabel();\r
921 jLabelSelectedInstances.setText("Selected Instances");\r
922 jPanelLibraryCenter = new JPanel();\r
923 jPanelLibraryCenter.add(jLabelInstanceHelp, null);\r
924 jPanelLibraryCenter.add(getJScrollPaneInstanceHelp(), null);\r
925 jPanelLibraryCenter.add(getJButtonAdd(), null);\r
926 jPanelLibraryCenter.add(getJButtonDeleteInstance(), null);\r
927 jPanelLibraryCenter.add(jLabelSelectedInstances, null);\r
928 jPanelLibraryCenter.add(getJScrollPaneSelectedInstances(), null);\r
a13899c5 929 }\r
57d0e52a 930 return jPanelLibraryCenter;\r
a13899c5 931 }\r
932\r
933 /**\r
57d0e52a 934 * This method initializes jScrollPaneInstanceHelp\r
a13899c5 935 * \r
936 * @return javax.swing.JScrollPane \r
937 */\r
57d0e52a 938 private JScrollPane getJScrollPaneInstanceHelp() {\r
939 if (jScrollPaneInstanceHelp == null) {\r
940 jScrollPaneInstanceHelp = new JScrollPane();\r
941 jScrollPaneInstanceHelp.setPreferredSize(new java.awt.Dimension(300,50));\r
942 jScrollPaneInstanceHelp.setViewportView(getJTextAreaInstanceHelp());\r
a13899c5 943 }\r
57d0e52a 944 return jScrollPaneInstanceHelp;\r
a13899c5 945 }\r
946\r
947 /**\r
57d0e52a 948 * This method initializes jTextAreaInstanceHelp\r
a13899c5 949 * \r
950 * @return javax.swing.JTextArea \r
951 */\r
57d0e52a 952 private JTextArea getJTextAreaInstanceHelp() {\r
953 if (jTextAreaInstanceHelp == null) {\r
954 jTextAreaInstanceHelp = new JTextArea();\r
955 jTextAreaInstanceHelp.setEditable(false);\r
a13899c5 956 }\r
57d0e52a 957 return jTextAreaInstanceHelp;\r
a13899c5 958 }\r
959\r
960 /**\r
57d0e52a 961 * This method initializes jButtonAdd\r
a13899c5 962 * \r
963 * @return javax.swing.JButton \r
964 */\r
57d0e52a 965 private JButton getJButtonAdd() {\r
966 if (jButtonAdd == null) {\r
967 jButtonAdd = new JButton();\r
968 jButtonAdd.setPreferredSize(new java.awt.Dimension(80,20));\r
969 jButtonAdd.setText("Add");\r
970 jButtonAdd.addActionListener(new java.awt.event.ActionListener() {\r
a13899c5 971 public void actionPerformed(java.awt.event.ActionEvent e) {\r
57d0e52a 972 int row = jTableLibInstances.getSelectedRow();\r
a13899c5 973 if (row < 0) {\r
974 return;\r
975 }\r
8f55ea73 976 docConsole.setSaved(false);\r
57d0e52a 977 Object[] s = {libInstanceTableModel.getValueAt(row, 0), libInstanceTableModel.getValueAt(row, 1),\r
978 libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),\r
979 libInstanceTableModel.getValueAt(row, 4)};\r
980 selectedInstancesTableModel.addRow(s);\r
981 String instanceValue = libInstanceTableModel.getValueAt(row, 1) + " " +\r
982 libInstanceTableModel.getValueAt(row, 2) + " " +\r
983 libInstanceTableModel.getValueAt(row, 3) + " " +\r
984 libInstanceTableModel.getValueAt(row, 4);\r
34c614e1 985 ModuleIdentification libMi = GlobalData.getModuleId(instanceValue);\r
82dcbb45 986 ffc.genLibraryInstance(libMi, moduleKey);\r
a13899c5 987 //\r
988 // Add pcd information of selected instance to current moduleSA\r
989 //\r
82961247 990 try{\r
82dcbb45 991 ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey));\r
82961247 992 }\r
993 catch (Exception exception) {\r
34c614e1 994 JOptionPane.showMessageDialog(frame, "Adding Instance" + s[0] + ": "+ exception.getMessage());\r
82961247 995 }\r
a13899c5 996 resolveLibraryInstances(instanceValue);\r
997 }\r
998 });\r
999 }\r
57d0e52a 1000 return jButtonAdd;\r
a13899c5 1001 }\r
1002\r
1003 /**\r
57d0e52a 1004 * This method initializes jButton1\r
a13899c5 1005 * \r
1006 * @return javax.swing.JButton \r
1007 */\r
57d0e52a 1008 private JButton getJButtonDeleteInstance() {\r
1009 if (jButtonDeleteInstance == null) {\r
1010 jButtonDeleteInstance = new JButton();\r
1011 jButtonDeleteInstance.setPreferredSize(new java.awt.Dimension(80,20));\r
1012 jButtonDeleteInstance.setText("Delete");\r
1013 jButtonDeleteInstance.addActionListener(new java.awt.event.ActionListener() {\r
a13899c5 1014 public void actionPerformed(java.awt.event.ActionEvent e) {\r
57d0e52a 1015 int row = jTableSelectedInstances.getSelectedRow();\r
a13899c5 1016 if (row < 0) {\r
1017 return;\r
1018 }\r
8f55ea73 1019 docConsole.setSaved(false);\r
57d0e52a 1020 removeInstance(selectedInstancesTableModel.getValueAt(row, 1) + " " +\r
1021 selectedInstancesTableModel.getValueAt(row, 2) + " " +\r
1022 selectedInstancesTableModel.getValueAt(row, 3) + " " +\r
1023 selectedInstancesTableModel.getValueAt(row, 4));\r
908b1c05 1024 ffc.removeLibraryInstance(moduleKey, row);\r
57d0e52a 1025 selectedInstancesTableModel.removeRow(row);\r
a13899c5 1026 \r
1027 }\r
1028 });\r
1029 }\r
57d0e52a 1030 return jButtonDeleteInstance;\r
a13899c5 1031 }\r
1032\r
1033 /**\r
1034 * This method initializes jButton2 \r
1035 * \r
1036 * @return javax.swing.JButton \r
1037 */\r
57d0e52a 1038 private JButton getJButtonOk() {\r
1039 if (jButtonOk == null) {\r
1040 jButtonOk = new JButton();\r
1041 jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));\r
1042 jButtonOk.setText("Ok");\r
1043 jButtonOk.addActionListener(this);\r
a13899c5 1044 }\r
57d0e52a 1045 return jButtonOk;\r
a13899c5 1046 }\r
1047\r
1048 /**\r
1049 * This method initializes jButton3 \r
1050 * \r
1051 * @return javax.swing.JButton \r
1052 */\r
57d0e52a 1053 private JButton getJButtonCancel() {\r
1054 if (jButtonCancel == null) {\r
1055 jButtonCancel = new JButton();\r
1056 jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));\r
1057 jButtonCancel.setText("Cancel");\r
1058 jButtonCancel.setVisible(false);\r
a13899c5 1059 }\r
57d0e52a 1060 return jButtonCancel;\r
a13899c5 1061 }\r
1062 public void actionPerformed(ActionEvent arg0) {\r
1063\r
57d0e52a 1064 if (arg0.getSource() == jButtonOk) {\r
1065 if (jTableModuleSaOptions.isEditing()) {\r
1066 jTableModuleSaOptions.getCellEditor().stopCellEditing();\r
bf5abaff 1067 }\r
a13899c5 1068 this.setVisible(false);\r
1069 }\r
1070 }\r
6a09eb19 1071 /**\r
57d0e52a 1072 * This method initializes jPanelModuleSaOpts\r
6a09eb19 1073 * \r
1074 * @return javax.swing.JPanel \r
1075 */\r
57d0e52a 1076 private JPanel getJPanelModuleSaOpts() {\r
1077 if (jPanelModuleSaOpts == null) {\r
1078 jLabelPad = new JLabel();\r
1079 jLabelPad.setText("");\r
1080 jLabelPad.setPreferredSize(new java.awt.Dimension(250,16));\r
8f55ea73 1081 FlowLayout flowLayout4 = new FlowLayout();\r
1082 flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);\r
57d0e52a 1083 jLabelFfsFormatKey = new JLabel();\r
1084 jLabelFfsFormatKey.setText("FFS Format Key");\r
1085 jLabelFfsFormatKey.setPreferredSize(new java.awt.Dimension(90,16));\r
1086 jLabelFfsFileGuid = new JLabel();\r
1087 jLabelFfsFileGuid.setText("FFS File GUID");\r
1088 jLabelFfsFileGuid.setPreferredSize(new java.awt.Dimension(90,16));\r
1089 jLabelFvBinding = new JLabel();\r
1090 jLabelFvBinding.setText("FV Binding");\r
1091 jLabelFvBinding.setPreferredSize(new java.awt.Dimension(90,16));\r
1092 jPanelModuleSaOpts = new JPanel();\r
1093 jPanelModuleSaOpts.setLayout(flowLayout4);\r
1094 jPanelModuleSaOpts.add(jLabelFvBinding, null);\r
1095 jPanelModuleSaOpts.add(getJTextFieldFvBinding(), null);\r
1096 jPanelModuleSaOpts.add(jLabelFfsFileGuid, null);\r
1097 jPanelModuleSaOpts.add(getJTextFieldFileGuid(), null);\r
1098 jPanelModuleSaOpts.add(jLabelFfsFormatKey, null);\r
1099 jPanelModuleSaOpts.add(getJTextFieldFfsKey(), null);\r
1100 jPanelModuleSaOpts.add(getJScrollPaneModuleSaOptions(), null);\r
1101 jPanelModuleSaOpts.add(jLabelPad, null);\r
1102 jPanelModuleSaOpts.add(getJButtonNew(), null);\r
1103 jPanelModuleSaOpts.add(getJButtonDeleteOption(), null);\r
1104 jPanelModuleSaOpts.addComponentListener(new java.awt.event.ComponentAdapter() {\r
71baa24b 1105 public void componentShown(java.awt.event.ComponentEvent e) {\r
908b1c05 1106 initModuleSAOptions(moduleKey);\r
71baa24b 1107 }\r
1108 });\r
6a09eb19 1109 }\r
57d0e52a 1110 return jPanelModuleSaOpts;\r
6a09eb19 1111 }\r
1112 /**\r
1113 * This method initializes jTextField \r
1114 * \r
1115 * @return javax.swing.JTextField \r
1116 */\r
8f55ea73 1117 private JTextField getJTextFieldFvBinding() {\r
1118 if (jTextFieldFvBinding == null) {\r
1119 jTextFieldFvBinding = new JTextField();\r
1120 jTextFieldFvBinding.setPreferredSize(new java.awt.Dimension(150,20));\r
1121 jTextFieldFvBinding.addFocusListener(new java.awt.event.FocusAdapter() {\r
1122 public void focusLost(java.awt.event.FocusEvent e) {\r
1123 String originalFvBinding = ffc.getFvBinding(moduleKey);\r
1124 String newFvBinding = jTextFieldFvBinding.getText();\r
1125 if (newFvBinding.equals(originalFvBinding)) {\r
1126 return;\r
1127 }\r
1128 if (newFvBinding.length() == 0 && originalFvBinding == null) {\r
1129 return;\r
1130 }\r
1131 docConsole.setSaved(false);\r
1132 ffc.setFvBinding(moduleKey, newFvBinding);\r
1133 }\r
1134 });\r
bf5abaff 1135 \r
6a09eb19 1136 }\r
8f55ea73 1137 return jTextFieldFvBinding;\r
6a09eb19 1138 }\r
1139 /**\r
1140 * This method initializes jTextField1 \r
1141 * \r
1142 * @return javax.swing.JTextField \r
1143 */\r
8f55ea73 1144 private JTextField getJTextFieldFileGuid() {\r
1145 if (jTextFieldFileGuid == null) {\r
1146 jTextFieldFileGuid = new JTextField();\r
1147 jTextFieldFileGuid.setPreferredSize(new java.awt.Dimension(300,20));\r
1148 jTextFieldFileGuid.addFocusListener(new java.awt.event.FocusAdapter() {\r
1149 public void focusLost(java.awt.event.FocusEvent e) {\r
1150 String originalFileGuid = ffc.getFfsFileNameGuid(moduleKey);\r
1151 String newFileGuid = jTextFieldFileGuid.getText();\r
1152 if (newFileGuid.equals(originalFileGuid)) {\r
1153 return;\r
1154 }\r
1155 if (newFileGuid.length() == 0 && originalFileGuid == null) {\r
1156 return;\r
1157 }\r
1158 if (newFileGuid.length() > 0) {\r
1159 if (!DataValidation.isGuid(newFileGuid)) {\r
1160 JOptionPane.showMessageDialog(frame, "FFS File Guid is NOT GUID Type.");\r
1161 return;\r
1162 }\r
1163 }\r
1164 \r
1165 docConsole.setSaved(false);\r
1166 if (newFileGuid.length() == 0) {\r
1167 newFileGuid = null;\r
1168 }\r
1169 ffc.setFfsFileNameGuid(moduleKey, newFileGuid);\r
1170 }\r
1171 });\r
bf5abaff 1172 \r
6a09eb19 1173 }\r
8f55ea73 1174 return jTextFieldFileGuid;\r
6a09eb19 1175 }\r
1176 /**\r
8f55ea73 1177 * This method initializes jTextFieldFfsKey \r
6a09eb19 1178 * \r
1179 * @return javax.swing.JTextField \r
1180 */\r
8f55ea73 1181 private JTextField getJTextFieldFfsKey() {\r
1182 if (jTextFieldFfsKey == null) {\r
1183 jTextFieldFfsKey = new JTextField();\r
802e0055 1184 jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(250,20));\r
8f55ea73 1185 jTextFieldFfsKey.addFocusListener(new java.awt.event.FocusAdapter() {\r
1186 public void focusLost(java.awt.event.FocusEvent e) {\r
1187 String originalFfsKey = ffc.getFfsFormatKey(moduleKey);\r
1188 String newFfsKey = jTextFieldFfsKey.getText();\r
1189 if (newFfsKey.equals(originalFfsKey)) {\r
1190 return;\r
1191 }\r
1192 if (newFfsKey.length() == 0 && originalFfsKey == null) {\r
1193 return;\r
1194 }\r
1195 docConsole.setSaved(false);\r
1196 ffc.setFfsFormatKey(moduleKey, newFfsKey);\r
1197 }\r
1198 });\r
bf5abaff 1199 \r
6a09eb19 1200 }\r
8f55ea73 1201 return jTextFieldFfsKey;\r
6a09eb19 1202 }\r
1203 /**\r
57d0e52a 1204 * This method initializes jScrollPaneModuleSaOptions\r
6a09eb19 1205 * \r
1206 * @return javax.swing.JScrollPane \r
1207 */\r
57d0e52a 1208 private JScrollPane getJScrollPaneModuleSaOptions() {\r
1209 if (jScrollPaneModuleSaOptions == null) {\r
1210 jScrollPaneModuleSaOptions = new JScrollPane();\r
1211 jScrollPaneModuleSaOptions.setPreferredSize(new java.awt.Dimension(600,200));\r
1212 jScrollPaneModuleSaOptions.setViewportView(getJTableModuleSaOptions());\r
6a09eb19 1213 }\r
57d0e52a 1214 return jScrollPaneModuleSaOptions;\r
6a09eb19 1215 }\r
1216 /**\r
57d0e52a 1217 * This method initializes jTableModuleSaOptions\r
6a09eb19 1218 * \r
1219 * @return javax.swing.JTable \r
1220 */\r
57d0e52a 1221 private JTable getJTableModuleSaOptions() {\r
1222 if (jTableModuleSaOptions == null) {\r
1800d80f 1223 optionsTableModel = new DefaultTableModel();\r
1224 optionsTableModel.addColumn("BuildTargets");\r
1225 optionsTableModel.addColumn("ToolChainFamily");\r
1226 optionsTableModel.addColumn("TagName");\r
1227 optionsTableModel.addColumn("ToolCode");\r
1228 optionsTableModel.addColumn("SupportedArchs");\r
1229 optionsTableModel.addColumn("Contents");\r
57d0e52a 1230 jTableModuleSaOptions = new JTable(optionsTableModel);\r
1231 jTableModuleSaOptions.setRowHeight(20);\r
f3b0ed9a 1232 Vector<String> vArch = new Vector<String>();\r
1233 vArch.add("IA32");\r
1234 vArch.add("X64");\r
1235 vArch.add("IPF");\r
1236 vArch.add("EBC");\r
1237 vArch.add("ARM");\r
1238 vArch.add("PPC");\r
57d0e52a 1239 jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch));\r
1240 jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
1241 jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
1242 jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() {\r
1800d80f 1243 public void tableChanged(TableModelEvent arg0) {\r
1244 // TODO Auto-generated method stub\r
1245 int row = arg0.getFirstRow();\r
1246 TableModel m = (TableModel)arg0.getSource();\r
1247 \r
1248 if (arg0.getType() == TableModelEvent.UPDATE){\r
1249 //ToDo Data Validition check.\r
1250 String targets = m.getValueAt(row, 0) + "";\r
f3b0ed9a 1251 Vector<Object> targetName = null;\r
1252 if (targets.length() > 0) {\r
1253 targetName = new Vector<Object>();\r
1254 String[] sArray = targets.split(" ");\r
1255 for (int i = 0; i < sArray.length; ++i) {\r
1256 targetName.add(sArray[i]);\r
1257 }\r
1800d80f 1258 }\r
f3b0ed9a 1259 \r
1800d80f 1260 String toolChain = m.getValueAt(row, 1) + "";\r
1261 String tagName = m.getValueAt(row, 2) + "";\r
1262 String toolCode = m.getValueAt(row, 3) + "";\r
1263 String archs = m.getValueAt(row, 4) + "";\r
f3b0ed9a 1264 Vector<Object> supArch = null;\r
1265 if (archs.length() > 0) {\r
1266 supArch = new Vector<Object>();\r
1267 String[] sArray1 = archs.split(" ");\r
1268 for (int i = 0; i < sArray1.length; ++i) {\r
1269 supArch.add(sArray1[i]);\r
1270 }\r
1800d80f 1271 }\r
f3b0ed9a 1272 \r
1800d80f 1273 String contents = m.getValueAt(row, 5) + "";\r
8f55ea73 1274 docConsole.setSaved(false);\r
1800d80f 1275 ffc.updateModuleSAOptionsOpt(moduleKey, row, targetName, toolChain, tagName, toolCode, supArch, contents);\r
1276 }\r
1277 }\r
1278 });\r
6a09eb19 1279 }\r
57d0e52a 1280 return jTableModuleSaOptions;\r
6a09eb19 1281 }\r
1800d80f 1282 /**\r
57d0e52a 1283 * This method initializes jButtonNew\r
1800d80f 1284 * \r
1285 * @return javax.swing.JButton \r
1286 */\r
57d0e52a 1287 private JButton getJButtonNew() {\r
1288 if (jButtonNew == null) {\r
1289 jButtonNew = new JButton();\r
1290 jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));\r
1291 jButtonNew.setText("New");\r
1292 jButtonNew.addActionListener(new java.awt.event.ActionListener() {\r
1800d80f 1293 public void actionPerformed(java.awt.event.ActionEvent e) {\r
bf5abaff 1294 String[] row = {"", "", "", "", "", ""};\r
1800d80f 1295 optionsTableModel.addRow(row);\r
1296 Vector<Object> v = new Vector<Object>();\r
bf5abaff 1297 Vector<Object> v1 = null;\r
8f55ea73 1298 docConsole.setSaved(false);\r
1800d80f 1299 ffc.genModuleSAOptionsOpt(moduleKey, v, "", "", "", v1, "");\r
1300 }\r
1301 });\r
1302 }\r
57d0e52a 1303 return jButtonNew;\r
1800d80f 1304 }\r
1305 /**\r
57d0e52a 1306 * This method initializes jButtonDelete\r
1800d80f 1307 * \r
1308 * @return javax.swing.JButton \r
1309 */\r
57d0e52a 1310 private JButton getJButtonDeleteOption() {\r
1311 if (jButtonDeleteOption == null) {\r
1312 jButtonDeleteOption = new JButton();\r
1313 jButtonDeleteOption.setPreferredSize(new java.awt.Dimension(80,20));\r
1314 jButtonDeleteOption.setText("Delete");\r
1315 jButtonDeleteOption.addActionListener(new java.awt.event.ActionListener() {\r
1800d80f 1316 public void actionPerformed(java.awt.event.ActionEvent e) {\r
57d0e52a 1317 if (jTableModuleSaOptions.getSelectedRow() < 0) {\r
1800d80f 1318 return;\r
1319 }\r
8f55ea73 1320 docConsole.setSaved(false);\r
57d0e52a 1321 ffc.removeModuleSAOptionsOpt(moduleKey, jTableModuleSaOptions.getSelectedRow());\r
1322 optionsTableModel.removeRow(jTableModuleSaOptions.getSelectedRow());\r
1800d80f 1323 }\r
1324 });\r
1325 }\r
57d0e52a 1326 return jButtonDeleteOption;\r
1800d80f 1327 }\r
f3b0ed9a 1328 \r
1329 /**\r
1330 Start the window at the center of screen\r
1331 \r
1332 **/\r
1333 protected void centerWindow(int intWidth, int intHeight) {\r
1334 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
1335 this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
1336 }\r
1337\r
1338 /**\r
1339 Start the window at the center of screen\r
1340 \r
1341 **/\r
1342 protected void centerWindow() {\r
1343 centerWindow(this.getSize().width, this.getSize().height);\r
1344 }\r
908b1c05 1345/**\r
57d0e52a 1346 * This method initializes jPanelPcdFields\r
908b1c05 1347 * \r
1348 * @return javax.swing.JPanel \r
1349 */\r
57d0e52a 1350private JPanel getJPanelPcdFields() {\r
1351 if (jPanelPcdFields == null) {\r
908b1c05 1352 GridLayout gridLayout = new GridLayout();\r
1353 gridLayout.setRows(3);\r
1354 gridLayout.setColumns(2);\r
57d0e52a 1355 jPanelPcdFields = new JPanel();\r
1356 jPanelPcdFields.setLayout(gridLayout);\r
1357 jPanelPcdFields.setPreferredSize(new java.awt.Dimension(600,90));\r
1358 jPanelPcdFields.add(getJPanelPcdFieldsFirstRow(), null);\r
1359 jPanelPcdFields.add(getJPanelPcdFieldsSecondRow(), null);\r
1360 jPanelPcdFields.add(getJPanelPcdFieldsThirdRow(), null);\r
1361 }\r
1362 return jPanelPcdFields;\r
908b1c05 1363}\r
1364/**\r
57d0e52a 1365 * This method initializes jPanelPcdFieldsSecondRow\r
908b1c05 1366 * \r
1367 * @return javax.swing.JPanel \r
1368 */\r
57d0e52a 1369private JPanel getJPanelPcdFieldsSecondRow() {\r
1370 if (jPanelPcdFieldsSecondRow == null) {\r
908b1c05 1371 FlowLayout flowLayout2 = new FlowLayout();\r
1372 flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);\r
57d0e52a 1373 jLabelMaxDatumSize = new JLabel();\r
1374 jLabelMaxDatumSize.setText("Max Datum Size");\r
1375 jPanelPcdFieldsSecondRow = new JPanel();\r
1376 jPanelPcdFieldsSecondRow.setLayout(flowLayout2);\r
1377 jPanelPcdFieldsSecondRow.add(jLabelMaxDatumSize, null);\r
1378 jPanelPcdFieldsSecondRow.add(getJTextFieldMaxDatumSize(), null);\r
1379 }\r
1380 return jPanelPcdFieldsSecondRow;\r
908b1c05 1381}\r
1382/**\r
57d0e52a 1383 * This method initializes jPanelPcdFieldsThirdRow\r
908b1c05 1384 * \r
1385 * @return javax.swing.JPanel \r
1386 */\r
57d0e52a 1387private JPanel getJPanelPcdFieldsThirdRow() {\r
1388 if (jPanelPcdFieldsThirdRow == null) {\r
908b1c05 1389 FlowLayout flowLayout3 = new FlowLayout();\r
1390 flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);\r
57d0e52a 1391 jLabelPcdDefaultValue = new JLabel();\r
1392 jLabelPcdDefaultValue.setText("Default Value");\r
1393 jLabelPcdDefaultValue.setPreferredSize(new java.awt.Dimension(91,16));\r
1394 jPanelPcdFieldsThirdRow = new JPanel();\r
1395 jPanelPcdFieldsThirdRow.setLayout(flowLayout3);\r
1396 jPanelPcdFieldsThirdRow.add(jLabelPcdDefaultValue, null);\r
1397 jPanelPcdFieldsThirdRow.add(getJTextFieldPcdDefault(), null);\r
1398 jPanelPcdFieldsThirdRow.add(getJComboBoxFeatureFlagValue(), null);\r
1399 }\r
1400 return jPanelPcdFieldsThirdRow;\r
908b1c05 1401}\r
1402/**\r
57d0e52a 1403 * This method initializes jPanelPcdFieldsFirstRow\r
908b1c05 1404 * \r
1405 * @return javax.swing.JPanel \r
1406 */\r
57d0e52a 1407private JPanel getJPanelPcdFieldsFirstRow() {\r
1408 if (jPanelPcdFieldsFirstRow == null) {\r
908b1c05 1409 FlowLayout flowLayout1 = new FlowLayout();\r
1410 flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);\r
57d0e52a 1411 jLabelItemType = new JLabel();\r
1412 jLabelItemType.setText("Item Type");\r
1413 jLabelItemType.setPreferredSize(new java.awt.Dimension(91,16));\r
1414 jPanelPcdFieldsFirstRow = new JPanel();\r
1415 jPanelPcdFieldsFirstRow.setLayout(flowLayout1);\r
1416 jPanelPcdFieldsFirstRow.add(jLabelItemType, null);\r
1417 jPanelPcdFieldsFirstRow.add(getJComboBoxItemType(), null);\r
1418 jPanelPcdFieldsFirstRow.add(getJButtonUpdatePcd(), null);\r
1419 }\r
1420 return jPanelPcdFieldsFirstRow;\r
908b1c05 1421}\r
1422/**\r
57d0e52a 1423 * This method initializes jComboBoxItemType\r
908b1c05 1424 * \r
1425 * @return javax.swing.JComboBox \r
1426 */\r
57d0e52a 1427private JComboBox getJComboBoxItemType() {\r
1428 if (jComboBoxItemType == null) {\r
1429 jComboBoxItemType = new JComboBox();\r
1430 jComboBoxItemType.setPreferredSize(new java.awt.Dimension(200,20));\r
1431 jComboBoxItemType.addItemListener(new java.awt.event.ItemListener() {\r
908b1c05 1432 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
57d0e52a 1433 int row = jTablePcd.getSelectedRow();\r
1434 if (row < 0 || jTablePcd.getValueAt(row, 2).equals(jComboBoxItemType.getSelectedItem())) {\r
908b1c05 1435 return;\r
1436 }\r
57d0e52a 1437 if (jComboBoxItemType.getItemCount() == 3) {\r
1438 if (!jComboBoxItemType.getSelectedItem().equals("DYNAMIC")) {\r
1439 pcdDynamicToNonDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+"");\r
908b1c05 1440 }\r
1441 else{\r
57d0e52a 1442 pcdNonDynamicToDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+"");\r
908b1c05 1443 }\r
1444 }\r
1445 }\r
1446 });\r
1447 }\r
57d0e52a 1448 return jComboBoxItemType;\r
908b1c05 1449}\r
1450\r
1451private void pcdDynamicToNonDynamic(String cName, String tsGuid) {\r
1452 String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];\r
1453 ffc.getDynamicPcdBuildData(saa);\r
1454 String maxSize = "";\r
1455 String value = "";\r
1456 for (int i = 0; i < saa.length; ++i) {\r
1457 if (saa[i][0].equals(cName) && saa[i][2].equals(tsGuid)) {\r
1458 maxSize = saa[i][3];\r
1459 value = ffc.getDynamicPcdBuildDataValue(i);\r
1460 break;\r
1461 }\r
1462 }\r
1463 \r
1464 ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);\r
1465 for (int i = 0; i < al.size(); ++i) {\r
1466 String[] s = al.get(i).split(" ");\r
1467 String mKey = s[0] + s[1] + s[2] + s[3];\r
57d0e52a 1468 ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", maxSize, value);\r
1469 s[4] = jComboBoxItemType.getSelectedItem()+"";\r
908b1c05 1470 al.set(i, s[0]+" "+s[1]+" "+s[2]+" "+s[3]+" "+s[4]);\r
1471 }\r
1472 \r
1473 ffc.removeDynamicPcdBuildData(cName, tsGuid);\r
1474}\r
1475\r
1476private void pcdNonDynamicToDynamic(String cName, String tsGuid) {\r
1477 ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);\r
1478 for (int i = 0; i < al.size(); ++i) {\r
1479 String[] s = al.get(i).split(" ");\r
bf5abaff 1480 String mKey = s[0] + " " + s[1]+ " " + s[2] + " " + s[3];\r
57d0e52a 1481 ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", jTextFieldMaxDatumSize.getText(), jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");\r
1482 s[4] = jComboBoxItemType.getSelectedItem()+"";\r
908b1c05 1483 al.set(i, s[0]+" "+s[1]+" "+s[2]+" "+s[3]+" "+s[4]);\r
1484 }\r
1485 try{\r
57d0e52a 1486 ffc.addDynamicPcdBuildData(cName, jTablePcd.getValueAt(jTablePcd.getSelectedRow(), 3), tsGuid, "DYNAMIC", jTablePcd.getValueAt(jTablePcd.getSelectedRow(), 5)+"", jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");\r
908b1c05 1487 }\r
1488 catch(Exception e){\r
1489 JOptionPane.showMessageDialog(frame, "PCD value format: " + e.getMessage());\r
1490 }\r
1491}\r
1492/**\r
57d0e52a 1493 * This method initializes jTextFieldMaxDatumSize\r
908b1c05 1494 * \r
1495 * @return javax.swing.JTextField \r
1496 */\r
57d0e52a 1497private JTextField getJTextFieldMaxDatumSize() {\r
1498 if (jTextFieldMaxDatumSize == null) {\r
1499 jTextFieldMaxDatumSize = new JTextField();\r
1500 jTextFieldMaxDatumSize.setPreferredSize(new java.awt.Dimension(200,20));\r
908b1c05 1501 }\r
57d0e52a 1502 return jTextFieldMaxDatumSize;\r
908b1c05 1503}\r
1504/**\r
1505 * This method initializes jTextField4 \r
1506 * \r
1507 * @return javax.swing.JTextField \r
1508 */\r
57d0e52a 1509private JTextField getJTextFieldPcdDefault() {\r
1510 if (jTextFieldPcdDefault == null) {\r
1511 jTextFieldPcdDefault = new JTextField();\r
1512 jTextFieldPcdDefault.setPreferredSize(new java.awt.Dimension(200,20));\r
908b1c05 1513 }\r
57d0e52a 1514 return jTextFieldPcdDefault;\r
908b1c05 1515}\r
1516/**\r
1517 * This method initializes jButton6 \r
1518 * \r
1519 * @return javax.swing.JButton \r
1520 */\r
57d0e52a 1521private JButton getJButtonUpdatePcd() {\r
1522 if (jButtonUpdatePcd == null) {\r
1523 jButtonUpdatePcd = new JButton();\r
1524 jButtonUpdatePcd.setPreferredSize(new java.awt.Dimension(150,20));\r
1525 jButtonUpdatePcd.setText("Update PCD Data");\r
1526 jButtonUpdatePcd.addActionListener(new java.awt.event.ActionListener() {\r
908b1c05 1527 public void actionPerformed(java.awt.event.ActionEvent e) {\r
57d0e52a 1528 int row = jTablePcd.getSelectedRow();\r
908b1c05 1529 if (row < 0) {\r
1530 return;\r
1531 }\r
8f55ea73 1532 docConsole.setSaved(false);\r
57d0e52a 1533 model.setValueAt(jComboBoxItemType.getSelectedItem(), row, 2);\r
1534 model.setValueAt(jTextFieldMaxDatumSize.getText(), row, 4);\r
1535 model.setValueAt(jTextFieldPcdDefault.isVisible()? jTextFieldPcdDefault.getText():jComboBoxFeatureFlagValue.getSelectedItem(), row, 6);\r
908b1c05 1536 ffc.updatePcdData(moduleKey, model.getValueAt(row, 0)+"", model.getValueAt(row, 1)+"", model.getValueAt(row, 2)+"", model.getValueAt(row, 4)+"", model.getValueAt(row, 6)+"");\r
1537 }\r
1538 });\r
1539 }\r
57d0e52a 1540 return jButtonUpdatePcd;\r
908b1c05 1541}\r
1542/**\r
57d0e52a 1543 * This method initializes jComboBoxFeatureFlagValue\r
908b1c05 1544 * \r
1545 * @return javax.swing.JComboBox \r
1546 */\r
57d0e52a 1547private JComboBox getJComboBoxFeatureFlagValue() {\r
1548 if (jComboBoxFeatureFlagValue == null) {\r
1549 jComboBoxFeatureFlagValue = new JComboBox();\r
1550 jComboBoxFeatureFlagValue.setPreferredSize(new java.awt.Dimension(100,20));\r
1551 jComboBoxFeatureFlagValue.setVisible(false);\r
1552 jComboBoxFeatureFlagValue.addItem("true");\r
1553 jComboBoxFeatureFlagValue.addItem("false");\r
1554 }\r
1555 return jComboBoxFeatureFlagValue;\r
908b1c05 1556}\r
f3b0ed9a 1557\r
a13899c5 1558\r
1559} // @jve:decl-index=0:visual-constraint="10,10"\r
1560\r
1561class PartialEditableTableModel extends DefaultTableModel {\r
44053733 1562 /**\r
1563 * \r
1564 */\r
1565 private static final long serialVersionUID = 1L;\r
1566\r
a13899c5 1567 public boolean isCellEditable(int row, int col) {\r
1568 switch (col){\r
1569 case 2:\r
82961247 1570 return false;\r
a13899c5 1571 default:\r
1572 return false; \r
1573 }\r
1574 \r
1575 }\r
1576}\r
1577\r
1578class LibraryTableModel extends DefaultTableModel {\r
44053733 1579 /**\r
1580 * \r
1581 */\r
1582 private static final long serialVersionUID = 1L;\r
1583\r
a13899c5 1584 public boolean isCellEditable(int row, int col) {\r
1585 return false;\r
1586 }\r
1587}\r