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