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