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