]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java
f7d8b01b9aa8e81ec668d0b63c530a0338bbff66
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdPlatformDefs.java
1 /** @file
2 Java class FpdPlatformDefs is GUI for Flash element operation in SPD file.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 **/
13 package org.tianocore.frameworkwizard.platform.ui;
14
15 import java.awt.BorderLayout;
16 import javax.swing.JPanel;
17
18 import javax.swing.JFrame;
19 import javax.swing.JTabbedPane;
20 import javax.swing.JButton;
21 import javax.swing.ListSelectionModel;
22
23 import org.tianocore.PlatformSurfaceAreaDocument;
24 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
25 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
26 import org.tianocore.frameworkwizard.toolchain.ToolChainId;
27
28 import javax.swing.JCheckBox;
29 import javax.swing.JOptionPane;
30 import javax.swing.JTextField;
31 import javax.swing.JLabel;
32 import javax.swing.JScrollPane;
33 import javax.swing.JTable;
34 import javax.swing.event.InternalFrameAdapter;
35 import javax.swing.event.InternalFrameEvent;
36 //import javax.swing.event.ListSelectionEvent;
37 //import javax.swing.event.ListSelectionListener;
38 import javax.swing.event.TableModelEvent;
39 import javax.swing.event.TableModelListener;
40 import javax.swing.table.DefaultTableModel;
41 import javax.swing.table.TableModel;
42 import javax.swing.JComboBox;
43 import java.awt.Dimension;
44 import java.util.Vector;
45
46 public class FpdPlatformDefs extends IInternalFrame {
47
48 private static boolean Debug = false;
49
50 private final int dialogWidth = 600;
51
52 private final int oneRowHeight = 20;
53
54 private final int twoRowHeight = 40;
55
56 // private final int threeRowHeight = 60;
57
58 private final int fourRowHeight = 80;
59
60 private final int sepHeight = 6;
61
62 // private final int sepWidth = 10;
63
64 private final int offsetWidth = 70;
65
66 private final int buttonWidth = 90;
67
68 private final int rowOne = 12;
69
70 private final int rowTwo = rowOne + oneRowHeight + sepHeight * 3;
71
72 private final int rowThree = rowTwo + oneRowHeight + sepHeight;
73
74 private final int rowFour = rowThree + oneRowHeight + sepHeight;
75
76 private final int rowFive = rowFour + fourRowHeight + sepHeight * 3;
77
78 private final int rowSix = rowFive + oneRowHeight + sepHeight;
79
80 private final int rowSeven = rowSix + oneRowHeight + sepHeight;
81
82 private final int rowEight = rowSeven + oneRowHeight + sepHeight;
83
84 private final int rowNine = rowEight + oneRowHeight + sepHeight;
85
86 private final int rowTen = rowNine + fourRowHeight + sepHeight + sepHeight * 3;
87
88 private final int rowEleven = rowTen + oneRowHeight + sepHeight;
89
90 private final int rowTwelve = rowEleven + oneRowHeight + sepHeight;
91
92 private final int dialogHeight = rowTwelve + twoRowHeight;
93
94 private final int labelColumn = 12;
95
96 private final int valueColumn = 168;
97
98 private final int labelWidth = 155;
99
100 private final int valueWidth = 320;
101
102 private final int valueCenter = valueColumn + (valueWidth / 2);
103
104 private final int tableHeight = fourRowHeight;
105
106 private final int tableWidth = valueWidth;
107
108 static JFrame frame;
109
110 private JPanel jContentPane = null;
111
112 private JTabbedPane jTabbedPane = null;
113
114 private TargetTableModel buildTargetTableModel = null;
115
116 private SkuInfoTableModel skuInfoTableModel = null;
117
118 private OpeningPlatformType docConsole = null;
119
120 private FpdFileContents ffc = null;
121
122 private JPanel jPanelGeneralTab = null;
123
124 private JPanel jPanelGeneralContainer = null;
125
126 private JLabel jLabelSupArch = null;
127
128 private JCheckBox jCheckBoxIa32 = null;
129
130 private JCheckBox jCheckBoxX64 = null;
131
132 private JCheckBox jCheckBoxIpf = null;
133
134 private JComboBox jComboBoxInterDir = null;
135
136 private JComboBox jBuildTargetComboBox = null;
137
138 private JTable jTableBuildTargets = null;
139
140 private JPanel jArchitectureSelections = null;
141
142 private JLabel jLabelBuildTargets = null;
143
144 // private JTextField jTextFieldBuildTarget = null;
145
146 private JButton jButtonAddBuildTarget = null;
147
148 private JButton jButtonDelBuildTarget = null;
149
150 private JScrollPane jScrollPaneBuildTargets = null;
151
152 private JScrollPane jScrollPaneSkuInfo = null;
153
154 private JTable jTableSkuInfo = null;
155
156 private JCheckBox jCheckBoxEbc = null;
157
158 private JCheckBox jCheckBoxArm = null;
159
160 private JCheckBox jCheckBoxPpc = null;
161
162 private JLabel jLabelSkuInfo = null;
163
164 private JLabel jLabelSkuId = null;
165
166 private JTextField jTextFieldSkuId = null;
167
168 private JLabel jLabelSkuName = null;
169
170 private JTextField jTextFieldSkuName = null;
171
172 private JButton jButtonSkuAdd = null;
173
174 private JButton jButtonSkuDel = null;
175
176 private JLabel jLabelIntermediateDirs = null;
177
178 private JLabel jLabelOutputDir = null;
179
180 private JTextField jTextFieldOutputDir = null;
181
182 private JLabel jLabelOutputInfo = null;
183
184 private int selectedRow = -1;
185
186 /**
187 * The following are not used by the UI
188 */
189 private static final long serialVersionUID = 1L;
190
191 private ToolChainId tid = new ToolChainId();
192
193 public FpdPlatformDefs() {
194 super();
195 initialize();
196 this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
197 this.setVisible(true);
198 }
199
200 public FpdPlatformDefs(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
201 this();
202 ffc = new FpdFileContents(fpd);
203 init(ffc);
204 }
205
206 public FpdPlatformDefs(OpeningPlatformType opt) {
207 this(opt.getXmlFpd());
208 docConsole = opt;
209 }
210
211 /**
212 * This method initializes jTabbedPane
213 *
214 * @return javax.swing.JTabbedPane
215 */
216 private JTabbedPane getJTabbedPane() {
217 if (jTabbedPane == null) {
218 jTabbedPane = new JTabbedPane();
219 jTabbedPane.addTab("General", null, getJPanelGeneralTab(), null);
220 }
221 return jTabbedPane;
222 }
223
224 /**
225 * This method initializes this
226 *
227 * @return void
228 */
229 private void initialize() {
230 this.setSize(dialogWidth, dialogHeight);
231 this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
232 this.setTitle("FPD Platform Definitions");
233 this.setContentPane(getJContentPane());
234 this.addInternalFrameListener(new InternalFrameAdapter() {
235 public void internalFrameDeactivated(InternalFrameEvent e) {
236 if (jTableBuildTargets.isEditing()) {
237 jTableBuildTargets.getCellEditor().stopCellEditing();
238 }
239 if (jTableSkuInfo.isEditing()) {
240 jTableSkuInfo.getCellEditor().stopCellEditing();
241 }
242
243 }
244 });
245 }
246
247 private void init(FpdFileContents ffc) {
248 Vector<Object> v = new Vector<Object>();
249 ffc.getPlatformDefsSupportedArchs(v);
250 showSupportedArchitectures(v);
251 v.removeAllElements();
252
253 ffc.getPlatformDefsBuildTargets(v);
254 buildTargetTableModel.setRowCount(0);
255 for (int i = 0; i < v.size(); ++i) {
256 Object[] row = { v.get(i) };
257 buildTargetTableModel.addRow(row);
258 }
259
260 String[][] saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];
261 ffc.getPlatformDefsSkuInfos(saa);
262 for (int i = 0; i < saa.length; ++i) {
263 skuInfoTableModel.addRow(saa[i]);
264 }
265
266 String interDir = ffc.getPlatformDefsInterDir();
267 if (interDir != null) {
268 jComboBoxInterDir.setSelectedItem(interDir);
269 }
270
271 String outputDir = ffc.getPlatformDefsOutputDir();
272 if (outputDir != null) {
273 jTextFieldOutputDir.setText(outputDir);
274 }
275 }
276
277 private void showSupportedArchitectures(Vector<Object> v) {
278 if (v.contains("IA32")) {
279 jCheckBoxIa32.setSelected(true);
280 } else {
281 jCheckBoxIa32.setSelected(false);
282 }
283 if (v.contains("X64")) {
284 jCheckBoxX64.setSelected(true);
285 } else {
286 jCheckBoxX64.setSelected(false);
287 }
288 if (v.contains("IPF")) {
289 jCheckBoxIpf.setSelected(true);
290 } else {
291 jCheckBoxIpf.setSelected(false);
292 }
293 if (v.contains("EBC")) {
294 jCheckBoxEbc.setSelected(true);
295 } else {
296 jCheckBoxEbc.setSelected(false);
297 }
298 if (v.contains("ARM")) {
299 jCheckBoxArm.setSelected(true);
300 } else {
301 jCheckBoxArm.setSelected(false);
302 }
303 if (v.contains("PPC")) {
304 jCheckBoxPpc.setSelected(true);
305 } else {
306 jCheckBoxPpc.setSelected(false);
307 }
308 }
309
310 private void getSupportedArchitectures(Vector<Object> v) {
311 if (docConsole != null) {
312 docConsole.setSaved(false);
313 }
314 v.removeAllElements();
315 if (jCheckBoxIa32.isSelected()) {
316 v.add("IA32");
317 }
318 if (jCheckBoxX64.isSelected()) {
319 v.add("X64");
320 }
321 if (jCheckBoxIpf.isSelected()) {
322 v.add("IPF");
323 }
324 if (jCheckBoxEbc.isSelected()) {
325 v.add("EBC");
326 }
327 if (jCheckBoxArm.isSelected()) {
328 v.add("ARM");
329 }
330 if (jCheckBoxPpc.isSelected()) {
331 v.add("PPC");
332 }
333
334 }
335
336 /**
337 * This method initializes jContentPane
338 *
339 * @return javax.swing.JPanel
340 */
341 private JPanel getJContentPane() {
342 if (jContentPane == null) {
343 jContentPane = new JPanel();
344 jContentPane.setLayout(new BorderLayout());
345 jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
346 }
347 return jContentPane;
348 }
349
350 /**
351 * This method initializes jPanel4
352 *
353 * @return javax.swing.JPanel
354 */
355 private JPanel getJPanelGeneralTab() {
356 if (jPanelGeneralTab == null) {
357 jPanelGeneralTab = new JPanel();
358 jPanelGeneralTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
359 jPanelGeneralTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
360 jPanelGeneralTab.setAutoscrolls(true);
361 jPanelGeneralTab.setLocation(0, 0);
362 jPanelGeneralTab.setLayout(null);
363 jPanelGeneralTab.add(getJPanelGeneralContainer(), null);
364 }
365 return jPanelGeneralTab;
366 }
367
368 /**
369 * This method initializes jPanel5
370 *
371 * @return javax.swing.JPanel
372 */
373 private JPanel getJPanelGeneralContainer() {
374 if (jPanelGeneralContainer == null) {
375 jLabelSupArch = new JLabel();
376 jLabelSupArch.setText("Supported Architectures");
377 jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
378 jLabelBuildTargets = new JLabel();
379 jLabelBuildTargets.setText("Build Targets");
380 jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
381 jLabelSkuInfo = new JLabel();
382 jLabelSkuInfo.setText("SKU Information");
383 jLabelSkuInfo.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
384 jLabelSkuId = new JLabel();
385 jLabelSkuId.setText("SKU ID Number");
386 jLabelSkuId.setBounds(new java.awt.Rectangle(labelColumn + 10, rowSix, labelWidth, oneRowHeight));
387 jLabelSkuName = new JLabel();
388 jLabelSkuName.setText("SKU Name");
389 jLabelSkuName.setBounds(new java.awt.Rectangle(labelColumn + 10, rowSeven, labelWidth, oneRowHeight));
390 jLabelOutputInfo = new JLabel();
391 jLabelOutputInfo.setText("Output Directory Configuration");
392 jLabelOutputInfo.setBounds(new java.awt.Rectangle(labelColumn, rowTen, valueWidth, oneRowHeight));
393 jLabelIntermediateDirs = new JLabel();
394 jLabelIntermediateDirs.setText("Intermediate Build Directories");
395 jLabelIntermediateDirs.setBounds(new java.awt.Rectangle(labelColumn + 10, rowEleven, valueWidth,
396 oneRowHeight));
397 jLabelOutputDir = new JLabel();
398 jLabelOutputDir.setText("Name of the Output Directory");
399 jLabelOutputDir.setBounds(new java.awt.Rectangle(labelColumn + 10, rowTwelve, valueWidth, oneRowHeight));
400
401 jPanelGeneralContainer = new JPanel();
402 jPanelGeneralContainer.setLayout(null);
403 jPanelGeneralContainer.setLocation(new java.awt.Point(2, 2));
404 jPanelGeneralContainer.setBounds(new java.awt.Rectangle(2, 2, dialogWidth * 2, dialogHeight));
405 jPanelGeneralContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
406
407 jPanelGeneralContainer.add(jLabelSupArch, null);
408 jPanelGeneralContainer.add(getArchitectureSelections(), null);
409
410 jPanelGeneralContainer.add(jLabelBuildTargets, null);
411 // jPanelGeneralContainer.add(getJTextFieldBuildTarget(), null);
412 jPanelGeneralContainer.add(getJBuildTargetComboBox(), null);
413
414 jPanelGeneralContainer.add(getJButtonAddBuildTarget(), null);
415 jPanelGeneralContainer.add(getJButtonDelBuildTarget(), null);
416 jPanelGeneralContainer.add(getJScrollPaneBuildTargets(), null);
417
418 jPanelGeneralContainer.add(jLabelSkuInfo, null);
419 jPanelGeneralContainer.add(jLabelSkuId, null);
420 jPanelGeneralContainer.add(getJTextFieldSkuId(), null);
421 jPanelGeneralContainer.add(jLabelSkuName, null);
422 jPanelGeneralContainer.add(getJTextFieldSkuName(), null);
423 jPanelGeneralContainer.add(getJButtonSkuAdd(), null);
424 jPanelGeneralContainer.add(getJButtonSkuDel(), null);
425 jPanelGeneralContainer.add(getJScrollPaneSkuInfo(), null);
426
427 jPanelGeneralContainer.add(jLabelOutputInfo, null);
428 jPanelGeneralContainer.add(jLabelIntermediateDirs, null);
429 jPanelGeneralContainer.add(getJComboBoxInterDir(), null);
430 jPanelGeneralContainer.add(jLabelOutputDir, null);
431 jPanelGeneralContainer.add(getJTextFieldOutputDir(), null);
432
433 }
434 return jPanelGeneralContainer;
435 }
436
437 /**
438 * This method initializes jArchitectureSelections Row 4
439 *
440 * @return jArchitectureSelections
441 */
442 private JPanel getArchitectureSelections() {
443 if (jArchitectureSelections == null) {
444 jArchitectureSelections = new JPanel();
445 jArchitectureSelections.setLayout(null);
446 jArchitectureSelections.add(getJCheckBoxIa32(), null);
447 jArchitectureSelections.add(getJCheckBoxX64(), null);
448 jArchitectureSelections.add(getJCheckBoxIpf(), null);
449 jArchitectureSelections.add(getJCheckBoxEbc(), null);
450 jArchitectureSelections.add(getJCheckBoxArm(), null);
451 jArchitectureSelections.add(getJCheckBoxPpc(), null);
452 jArchitectureSelections.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
453 jArchitectureSelections.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
454 jArchitectureSelections.setLocation(new java.awt.Point(valueColumn, rowOne));
455 jArchitectureSelections.setToolTipText("<html>A Platform may support one or more architectures,"
456 + "<br>at least one architecture must be selected!</html>");
457 }
458 return jArchitectureSelections;
459 }
460
461 /**
462 * This method initializes jCheckBox1
463 *
464 * @return javax.swing.JCheckBox
465 */
466 private JCheckBox getJCheckBoxIa32() {
467 if (jCheckBoxIa32 == null) {
468 jCheckBoxIa32 = new JCheckBox();
469 jCheckBoxIa32.setText("IA32");
470 jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
471 jCheckBoxIa32.addItemListener(new java.awt.event.ItemListener() {
472 public void itemStateChanged(java.awt.event.ItemEvent e) {
473 Vector<Object> v = new Vector<Object>();
474 getSupportedArchitectures(v);
475 if (v.size() == 0) {
476 JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture.");
477 return;
478 }
479 ffc.setPlatformDefsSupportedArchs(v);
480 }
481 });
482 }
483 return jCheckBoxIa32;
484 }
485
486 /**
487 * This method initializes jCheckBox2
488 *
489 * @return javax.swing.JCheckBox
490 */
491 private JCheckBox getJCheckBoxX64() {
492 if (jCheckBoxX64 == null) {
493 jCheckBoxX64 = new JCheckBox();
494 jCheckBoxX64.setText("X64");
495 jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
496 jCheckBoxX64.addItemListener(new java.awt.event.ItemListener() {
497 public void itemStateChanged(java.awt.event.ItemEvent e) {
498 Vector<Object> v = new Vector<Object>();
499 getSupportedArchitectures(v);
500 if (v.size() == 0) {
501 JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture.");
502 return;
503 }
504 ffc.setPlatformDefsSupportedArchs(v);
505 }
506 });
507 }
508 return jCheckBoxX64;
509 }
510
511 /**
512 * This method initializes jCheckBox3
513 *
514 * @return javax.swing.JCheckBox
515 */
516 private JCheckBox getJCheckBoxIpf() {
517 if (jCheckBoxIpf == null) {
518 jCheckBoxIpf = new JCheckBox();
519 jCheckBoxIpf.setText("IPF");
520 jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
521 jCheckBoxIpf.addItemListener(new java.awt.event.ItemListener() {
522 public void itemStateChanged(java.awt.event.ItemEvent e) {
523 Vector<Object> v = new Vector<Object>();
524 getSupportedArchitectures(v);
525 if (v.size() == 0) {
526 JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture.");
527 return;
528 }
529 ffc.setPlatformDefsSupportedArchs(v);
530 }
531 });
532 }
533 return jCheckBoxIpf;
534 }
535
536 /**
537 * This method initializes jCheckBox
538 *
539 * @return javax.swing.JCheckBox
540 */
541 private JCheckBox getJCheckBoxEbc() {
542 if (jCheckBoxEbc == null) {
543 jCheckBoxEbc = new JCheckBox();
544 // jCheckBoxEbc.setPreferredSize(new java.awt.Dimension(50, 20));
545 jCheckBoxEbc.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
546 jCheckBoxEbc.setText("EBC");
547 jCheckBoxEbc.setVisible(true);
548 jCheckBoxEbc.addItemListener(new java.awt.event.ItemListener() {
549 public void itemStateChanged(java.awt.event.ItemEvent e) {
550 Vector<Object> v = new Vector<Object>();
551 getSupportedArchitectures(v);
552 if (v.size() == 0) {
553 JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture.");
554 return;
555 }
556 ffc.setPlatformDefsSupportedArchs(v);
557 }
558 });
559 }
560 return jCheckBoxEbc;
561 }
562
563 /**
564 * This method initializes jCheckBox5
565 *
566 * @return javax.swing.JCheckBox
567 */
568 private JCheckBox getJCheckBoxArm() {
569 if (jCheckBoxArm == null) {
570 jCheckBoxArm = new JCheckBox();
571 // jCheckBoxArm.setPreferredSize(new java.awt.Dimension(52, 20));
572 jCheckBoxArm.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
573 jCheckBoxArm.setText("ARM");
574 jCheckBoxArm.setVisible(true);
575 jCheckBoxArm.addItemListener(new java.awt.event.ItemListener() {
576 public void itemStateChanged(java.awt.event.ItemEvent e) {
577 Vector<Object> v = new Vector<Object>();
578 getSupportedArchitectures(v);
579 if (v.size() == 0) {
580 JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture.");
581 return;
582 }
583 ffc.setPlatformDefsSupportedArchs(v);
584 }
585 });
586 }
587 return jCheckBoxArm;
588 }
589
590 /**
591 * This method initializes jCheckBox6
592 *
593 * @return javax.swing.JCheckBox
594 */
595 private JCheckBox getJCheckBoxPpc() {
596 if (jCheckBoxPpc == null) {
597 jCheckBoxPpc = new JCheckBox();
598 // jCheckBoxPpc.setPreferredSize(new Dimension(50, 20));
599 jCheckBoxPpc.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
600 jCheckBoxPpc.setText("PPC");
601 jCheckBoxPpc.setVisible(true);
602 jCheckBoxPpc.addItemListener(new java.awt.event.ItemListener() {
603 public void itemStateChanged(java.awt.event.ItemEvent e) {
604 Vector<Object> v = new Vector<Object>();
605 getSupportedArchitectures(v);
606 if (v.size() == 0) {
607 JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture.");
608 return;
609 }
610 ffc.setPlatformDefsSupportedArchs(v);
611 }
612 });
613 }
614 return jCheckBoxPpc;
615 }
616
617 /**
618 * Use a ComboBox for BuildTargets
619 *
620 * @return javax.swing.JComboBox jBuildTargetComboBox
621 */
622 private JComboBox getJBuildTargetComboBox() {
623 if (jBuildTargetComboBox == null) {
624 String toolBt = null;
625 if (tid.getToolsDefTargetNames() == null)
626 toolBt = "DEBUG RELEASE";
627 else
628 toolBt = tid.getToolsDefTargetNames().trim();
629
630 if ((toolBt.contains("*")) || (toolBt.length() < 1)) {
631 toolBt = "DEBUG RELEASE";
632 }
633 if (Debug)
634 System.out.println("Using Build Targets: " + toolBt.trim());
635
636 toolBt = toolBt.replaceAll(" ", ":");
637 toolBt = " :" + toolBt;
638 if (Debug)
639 System.out.println("Using Build Targets: " + toolBt.trim());
640 String[] buildTargets = toolBt.trim().split(":");
641
642 jBuildTargetComboBox = new JComboBox(buildTargets);
643 jBuildTargetComboBox.setEditable(true);
644 jBuildTargetComboBox.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
645 jBuildTargetComboBox.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));
646 jBuildTargetComboBox.setLocation(new java.awt.Point(valueColumn, rowTwo));
647 jBuildTargetComboBox.setToolTipText("<html>Select a defined Target and then click Add,<br>"
648 + "or enter a new, one word TargetName and then click Add.<br>"
649 + "Remember to define the Targetname in the tool defintion file."
650 + "</html>");
651
652 }
653 return jBuildTargetComboBox;
654 }
655
656 /**
657 * This method initializes jTextField1
658 *
659 * @return javax.swing.JTextField
660 */
661 // private JTextField getJTextFieldBuildTarget() {
662 // if (jTextFieldBuildTarget == null) {
663 // jTextFieldBuildTarget = new JTextField();
664 // jTextFieldBuildTarget.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
665 // jTextFieldBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));
666 // jTextFieldBuildTarget.setLocation(new java.awt.Point(valueColumn, rowTwo));
667 // }
668 // return jTextFieldBuildTarget;
669 // }
670 /**
671 * This method initializes jButton2
672 *
673 * @return javax.swing.JButton
674 */
675 private JButton getJButtonAddBuildTarget() {
676 if (jButtonAddBuildTarget == null) {
677 jButtonAddBuildTarget = new JButton();
678 jButtonAddBuildTarget.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
679 jButtonAddBuildTarget.setBounds(new java.awt.Rectangle(valueCenter - buttonWidth - 5, rowThree,
680 buttonWidth, oneRowHeight));
681 jButtonAddBuildTarget.setLocation(new java.awt.Point(valueCenter - buttonWidth - 5, rowThree));
682 jButtonAddBuildTarget.setText("Add");
683 jButtonAddBuildTarget.setVisible(true);
684
685 jButtonAddBuildTarget.addActionListener(new java.awt.event.ActionListener() {
686 public void actionPerformed(java.awt.event.ActionEvent e) {
687 // Used with Text Field
688 // if (jTextFieldBuildTarget.getText().length() > 0) {
689 // String[] row = { jTextFieldBuildTarget.getText() };
690 // jTextFieldBuildTarget.setText("");
691 // buildTargetTableModel.addRow(row);
692 // Vector<Object> v = new Vector<Object>();
693 // for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
694 // v.add(buildTargetTableModel.getValueAt(i, 0));
695 // }
696 // docConsole.setSaved(false);
697 // ffc.setPlatformDefsBuildTargets(v);
698 // }
699 // Use with ComboBox
700 if (jBuildTargetComboBox.getSelectedItem().toString().length() > 0) {
701 String[] row = { jBuildTargetComboBox.getSelectedItem().toString() };
702 buildTargetTableModel.addRow(row);
703 Vector<Object> v = new Vector<Object>();
704 for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
705 v.add(buildTargetTableModel.getValueAt(i, 0));
706 }
707 docConsole.setSaved(false);
708 ffc.setPlatformDefsBuildTargets(v);
709 }
710 }
711 });
712 }
713 return jButtonAddBuildTarget;
714 }
715
716 /**
717 * This method initializes jButton3
718 *
719 * @return javax.swing.JButton
720 */
721 private JButton getJButtonDelBuildTarget() {
722 if (jButtonDelBuildTarget == null) {
723 jButtonDelBuildTarget = new JButton();
724 jButtonDelBuildTarget.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
725 jButtonDelBuildTarget
726 .setBounds(new java.awt.Rectangle(valueCenter + 5, rowThree, buttonWidth, oneRowHeight));
727 jButtonDelBuildTarget.setLocation(new java.awt.Point(valueCenter + 5, rowThree));
728 jButtonDelBuildTarget.setText("Delete");
729 jButtonDelBuildTarget.setVisible(true);
730
731 jButtonDelBuildTarget.addActionListener(new java.awt.event.ActionListener() {
732 public void actionPerformed(java.awt.event.ActionEvent e) {
733 if (jTableBuildTargets.getSelectedRow() < 0) {
734 return;
735 }
736 if (jTableBuildTargets.getRowCount() == 1) {
737 JOptionPane.showMessageDialog(frame, "At least one build target should be set for this platform.");
738 return;
739 }
740 buildTargetTableModel.removeRow(jTableBuildTargets.getSelectedRow());
741 Vector<Object> v = new Vector<Object>();
742 for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
743 v.add(buildTargetTableModel.getValueAt(i, 0));
744 }
745 docConsole.setSaved(false);
746 ffc.setPlatformDefsBuildTargets(v);
747 }
748 });
749 }
750 return jButtonDelBuildTarget;
751 }
752
753 /**
754 * This method initializes jScrollPane2
755 *
756 * @return javax.swing.JScrollPane
757 */
758 private JScrollPane getJScrollPaneBuildTargets() {
759 if (jScrollPaneBuildTargets == null) {
760 jScrollPaneBuildTargets = new JScrollPane();
761 jScrollPaneBuildTargets.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));
762 jScrollPaneBuildTargets.setBounds(new java.awt.Rectangle(valueColumn, rowFour, tableWidth - 5,
763 tableHeight - 5));
764 jScrollPaneBuildTargets.setLocation(new java.awt.Point(valueColumn, rowFour));
765 jScrollPaneBuildTargets
766 .setBorder(javax.swing.BorderFactory
767 .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
768
769 jScrollPaneBuildTargets.setViewportView(getJTableBuildTargets());
770 }
771 return jScrollPaneBuildTargets;
772 }
773
774 /**
775 * This method initializes jTable
776 *
777 * @return javax.swing.JTable
778 */
779 private JTable getJTableBuildTargets() {
780 if (jTableBuildTargets == null) {
781 buildTargetTableModel = new TargetTableModel();
782
783 jTableBuildTargets = new JTable(buildTargetTableModel);
784 jTableBuildTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
785 jTableBuildTargets.setRowHeight(oneRowHeight);
786 jTableBuildTargets.setToolTipText("<html>Select one of the Targets from the table and<br>"
787 + "click Delete to remove the target from the platform.</html>");
788 buildTargetTableModel.addColumn("Build Target");
789
790 jTableBuildTargets.getModel().addTableModelListener(new TableModelListener() {
791 public void tableChanged(TableModelEvent arg0) {
792 // TODO Auto-generated method stub
793 selectedRow = jTableBuildTargets.getSelectedRow();
794 if (selectedRow < 0) {
795 return;
796 }
797 TableModel m = (TableModel) arg0.getSource();
798 if (arg0.getType() == TableModelEvent.UPDATE) {
799 //ToDo Data Validition check.
800 Vector<Object> v = new Vector<Object>();
801 for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
802 v.add(m.getValueAt(i, 0));
803 }
804 docConsole.setSaved(false);
805 ffc.setPlatformDefsBuildTargets(v);
806 }
807 }
808 });
809
810 }
811 return jTableBuildTargets;
812 }
813
814 /**
815 * This method initializes jTextField2
816 *
817 * @return javax.swing.JTextField
818 */
819 private JTextField getJTextFieldSkuId() {
820 if (jTextFieldSkuId == null) {
821 jTextFieldSkuId = new JTextField();
822 jTextFieldSkuId.setPreferredSize(new Dimension(40, oneRowHeight));
823 jTextFieldSkuId.setBounds(new java.awt.Rectangle(valueColumn, rowSix, 40, oneRowHeight));
824 jTextFieldSkuId.setLocation(new java.awt.Point(valueColumn, rowSix));
825 jTextFieldSkuId.setToolTipText("Enter a unique integer value.");
826 }
827 return jTextFieldSkuId;
828 }
829
830 /**
831 * This method initializes jTextField3
832 *
833 * @return javax.swing.JTextField
834 */
835 private JTextField getJTextFieldSkuName() {
836 if (jTextFieldSkuName == null) {
837 jTextFieldSkuName = new JTextField();
838 jTextFieldSkuName.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
839 jTextFieldSkuName.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));
840 jTextFieldSkuName.setLocation(new java.awt.Point(valueColumn, rowSeven));
841 jTextFieldSkuName.setToolTipText("<html>Enter a name to help identify this SKU.<br>"
842 + "This entry is not used by the build system, it is<br>"
843 + "used only by this user interface.</html>");
844 }
845 return jTextFieldSkuName;
846 }
847
848 /**
849 * This method initializes jButton
850 *
851 * @return javax.swing.JButton
852 */
853 private JButton getJButtonSkuAdd() {
854 if (jButtonSkuAdd == null) {
855 jButtonSkuAdd = new JButton();
856
857 jButtonSkuAdd.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
858 jButtonSkuAdd.setBounds(new java.awt.Rectangle(valueCenter - buttonWidth - 5, rowEight, buttonWidth,
859 oneRowHeight));
860 jButtonSkuAdd.setLocation(new java.awt.Point(valueCenter - buttonWidth - 5, rowEight));
861 jButtonSkuAdd.setText("Add");
862 jButtonSkuAdd.setVisible(true);
863
864 jButtonSkuAdd.addActionListener(new java.awt.event.ActionListener() {
865 public void actionPerformed(java.awt.event.ActionEvent e) {
866 if (jTextFieldSkuId.getText().length() > 0) {
867 String[] row = { jTextFieldSkuId.getText(), jTextFieldSkuName.getText() };
868 skuInfoTableModel.addRow(row);
869 docConsole.setSaved(false);
870 ffc.genPlatformDefsSkuInfo(row[0], row[1]);
871 }
872 }
873 });
874 }
875 return jButtonSkuAdd;
876 }
877
878 /**
879 * This method initializes jButton1
880 *
881 * @return javax.swing.JButton
882 */
883 private JButton getJButtonSkuDel() {
884 if (jButtonSkuDel == null) {
885 jButtonSkuDel = new JButton();
886 jButtonSkuDel.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
887 jButtonSkuDel.setBounds(new java.awt.Rectangle(valueCenter + 5, rowEight, buttonWidth, oneRowHeight));
888 jButtonSkuDel.setLocation(new java.awt.Point(valueCenter + 5, rowEight));
889 jButtonSkuDel.setText("Delete");
890 jButtonSkuDel.setVisible(true);
891 jButtonSkuDel.addActionListener(new java.awt.event.ActionListener() {
892 public void actionPerformed(java.awt.event.ActionEvent e) {
893 if (jTableSkuInfo.isEditing()) {
894 jTableSkuInfo.getCellEditor().stopCellEditing();
895 }
896 if (jTableSkuInfo.getSelectedRow() < 1) {
897 return;
898 }
899 docConsole.setSaved(false);
900 ffc.removePlatformDefsSkuInfo(jTableSkuInfo.getSelectedRow());
901 skuInfoTableModel.removeRow(jTableSkuInfo.getSelectedRow());
902 }
903 });
904 }
905 return jButtonSkuDel;
906 }
907
908 /**
909 * This method initializes jScrollPane3
910 *
911 * @return javax.swing.JScrollPane
912 */
913 private JScrollPane getJScrollPaneSkuInfo() {
914 if (jScrollPaneSkuInfo == null) {
915 jScrollPaneSkuInfo = new JScrollPane();
916 jScrollPaneSkuInfo.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));
917 jScrollPaneSkuInfo.setBounds(new java.awt.Rectangle(valueColumn, rowNine, tableWidth - 5, tableHeight - 5));
918 jScrollPaneSkuInfo.setLocation(new java.awt.Point(valueColumn, rowNine));
919
920 jScrollPaneSkuInfo
921 .setBorder(javax.swing.BorderFactory
922 .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
923
924 jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());
925 }
926 return jScrollPaneSkuInfo;
927 }
928
929 /**
930 * This method initializes jTable2
931 *
932 * @return javax.swing.JTable
933 */
934 private JTable getJTableSkuInfo() {
935 if (jTableSkuInfo == null) {
936 skuInfoTableModel = new SkuInfoTableModel();
937 skuInfoTableModel.addColumn("SKU ID");
938 skuInfoTableModel.addColumn("Name");
939 jTableSkuInfo = new JTable(skuInfoTableModel);
940 jTableSkuInfo.setToolTipText("<html>SKU ID 0 must always be defined as the default.<br>"
941 + "0 can mean either SKU disabled, or it can be the<br>"
942 + "default value if more than one SKU is defined, and the<br>"
943 + "platform is not jumpered to use one of the other SKU values.</html>");
944
945 jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
946
947 jTableSkuInfo.getModel().addTableModelListener(new TableModelListener() {
948 public void tableChanged(TableModelEvent arg0) {
949 // TODO Auto-generated method stub
950 int row = arg0.getFirstRow();
951 TableModel m = (TableModel) arg0.getSource();
952 if (arg0.getType() == TableModelEvent.UPDATE) {
953 //ToDo Data Validition check.
954 String id = m.getValueAt(row, 0) + "";
955 String name = m.getValueAt(row, 1) + "";
956 docConsole.setSaved(false);
957 ffc.updatePlatformDefsSkuInfo(row, id, name);
958 }
959 }
960 });
961 }
962 return jTableSkuInfo;
963 }
964
965 /**
966 * This method initializes jComboBox
967 *
968 * @return javax.swing.JComboBox
969 */
970 private JComboBox getJComboBoxInterDir() {
971 if (jComboBoxInterDir == null) {
972 jComboBoxInterDir = new JComboBox();
973 jComboBoxInterDir.setPreferredSize(new Dimension(75, oneRowHeight));
974 jComboBoxInterDir.setBounds(new java.awt.Rectangle(valueColumn + offsetWidth, rowEleven, 95, oneRowHeight));
975 jComboBoxInterDir.setLocation(new java.awt.Point(valueColumn + offsetWidth, rowEleven));
976 jComboBoxInterDir.addItem("UNIFIED");
977 jComboBoxInterDir.addItem("MODULE");
978 jComboBoxInterDir.setSelectedIndex(0);
979 jComboBoxInterDir.setToolTipText("<html>Select UNIFIED to generate intermediate directories under<br>"
980 + "under platform directory tree.<br>"
981 + "Select MODULE to generate intermediate directories under the<br>"
982 + "individual module directories.</html>");
983 jComboBoxInterDir.addItemListener(new java.awt.event.ItemListener() {
984 public void itemStateChanged(java.awt.event.ItemEvent e) {
985 if (docConsole != null) {
986 docConsole.setSaved(false);
987 }
988 ffc.setPlatformDefsInterDir(jComboBoxInterDir.getSelectedItem() + "");
989 }
990 });
991 }
992 return jComboBoxInterDir;
993 }
994
995 /**
996 * This method initializes jTextField
997 *
998 * @return javax.swing.JTextField Row Twelve
999 */
1000 private JTextField getJTextFieldOutputDir() {
1001 if (jTextFieldOutputDir == null) {
1002 jTextFieldOutputDir = new JTextField();
1003 jTextFieldOutputDir.setPreferredSize(new java.awt.Dimension(290, 20));
1004 jTextFieldOutputDir.setBounds(new java.awt.Rectangle(valueColumn + offsetWidth, rowTwelve, valueWidth - 30,
1005 oneRowHeight));
1006 jTextFieldOutputDir.setLocation(new java.awt.Point(valueColumn + offsetWidth, rowTwelve));
1007 jTextFieldOutputDir.setToolTipText("Select the name or URL for the output directory tree.");
1008 jTextFieldOutputDir.addFocusListener(new java.awt.event.FocusAdapter() {
1009 public void focusLost(java.awt.event.FocusEvent e) {
1010 docConsole.setSaved(false);
1011 ffc.setPlatformDefsOutputDir(jTextFieldOutputDir.getText());
1012 }
1013 });
1014 }
1015 return jTextFieldOutputDir;
1016 }
1017
1018 } // @jve:decl-index=0:visual-constraint="10,10"
1019
1020 class SkuInfoTableModel extends DefaultTableModel {
1021 private static final long serialVersionUID = 1L;
1022
1023 public boolean isCellEditable(int row, int column) {
1024 if (row == 0) {
1025 return false;
1026 }
1027 return true;
1028 }
1029 }
1030
1031 class TargetTableModel extends DefaultTableModel {
1032 private static final long serialVersionUID = 1L;
1033
1034 public boolean isCellEditable(int row, int column) {
1035 if (row < 2) {
1036 return false;
1037 }
1038 return true;
1039 }
1040 }