2 Java class FpdPlatformDefs is GUI for Flash element operation in SPD file.
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
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.
13 package org
.tianocore
.frameworkwizard
.platform
.ui
;
15 import java
.awt
.BorderLayout
;
16 import javax
.swing
.JPanel
;
18 import javax
.swing
.JFrame
;
19 import javax
.swing
.JTabbedPane
;
20 import javax
.swing
.JButton
;
21 import javax
.swing
.ListSelectionModel
;
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
;
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
;
46 public class FpdPlatformDefs
extends IInternalFrame
{
48 private static boolean Debug
= false;
50 private final int dialogWidth
= 600;
52 private final int oneRowHeight
= 20;
54 private final int twoRowHeight
= 40;
56 // private final int threeRowHeight = 60;
58 private final int fourRowHeight
= 80;
60 private final int sepHeight
= 6;
62 // private final int sepWidth = 10;
64 private final int offsetWidth
= 70;
66 private final int buttonWidth
= 90;
68 private final int rowOne
= 12;
70 private final int rowTwo
= rowOne
+ oneRowHeight
+ sepHeight
* 3;
72 private final int rowThree
= rowTwo
+ oneRowHeight
+ sepHeight
;
74 private final int rowFour
= rowThree
+ oneRowHeight
+ sepHeight
;
76 private final int rowFive
= rowFour
+ fourRowHeight
+ sepHeight
* 3;
78 private final int rowSix
= rowFive
+ oneRowHeight
+ sepHeight
;
80 private final int rowSeven
= rowSix
+ oneRowHeight
+ sepHeight
;
82 private final int rowEight
= rowSeven
+ oneRowHeight
+ sepHeight
;
84 private final int rowNine
= rowEight
+ oneRowHeight
+ sepHeight
;
86 private final int rowTen
= rowNine
+ fourRowHeight
+ sepHeight
+ sepHeight
* 3;
88 private final int rowEleven
= rowTen
+ oneRowHeight
+ sepHeight
;
90 private final int rowTwelve
= rowEleven
+ oneRowHeight
+ sepHeight
;
92 private final int dialogHeight
= rowTwelve
+ twoRowHeight
;
94 private final int labelColumn
= 12;
96 private final int valueColumn
= 168;
98 private final int labelWidth
= 155;
100 private final int valueWidth
= 320;
102 private final int valueCenter
= valueColumn
+ (valueWidth
/ 2);
104 private final int tableHeight
= fourRowHeight
;
106 private final int tableWidth
= valueWidth
;
110 private JPanel jContentPane
= null;
112 private JTabbedPane jTabbedPane
= null;
114 private TargetTableModel buildTargetTableModel
= null;
116 private SkuInfoTableModel skuInfoTableModel
= null;
118 private OpeningPlatformType docConsole
= null;
120 private FpdFileContents ffc
= null;
122 private JPanel jPanelGeneralTab
= null;
124 private JPanel jPanelGeneralContainer
= null;
126 private JLabel jLabelSupArch
= null;
128 private JCheckBox jCheckBoxIa32
= null;
130 private JCheckBox jCheckBoxX64
= null;
132 private JCheckBox jCheckBoxIpf
= null;
134 private JComboBox jComboBoxInterDir
= null;
136 private JComboBox jBuildTargetComboBox
= null;
138 private JTable jTableBuildTargets
= null;
140 private JPanel jArchitectureSelections
= null;
142 private JLabel jLabelBuildTargets
= null;
144 // private JTextField jTextFieldBuildTarget = null;
146 private JButton jButtonAddBuildTarget
= null;
148 private JButton jButtonDelBuildTarget
= null;
150 private JScrollPane jScrollPaneBuildTargets
= null;
152 private JScrollPane jScrollPaneSkuInfo
= null;
154 private JTable jTableSkuInfo
= null;
156 private JCheckBox jCheckBoxEbc
= null;
158 private JCheckBox jCheckBoxArm
= null;
160 private JCheckBox jCheckBoxPpc
= null;
162 private JLabel jLabelSkuInfo
= null;
164 private JLabel jLabelSkuId
= null;
166 private JTextField jTextFieldSkuId
= null;
168 private JLabel jLabelSkuName
= null;
170 private JTextField jTextFieldSkuName
= null;
172 private JButton jButtonSkuAdd
= null;
174 private JButton jButtonSkuDel
= null;
176 private JLabel jLabelIntermediateDirs
= null;
178 private JLabel jLabelOutputDir
= null;
180 private JTextField jTextFieldOutputDir
= null;
182 private JLabel jLabelOutputInfo
= null;
184 private int selectedRow
= -1;
187 * The following are not used by the UI
189 private static final long serialVersionUID
= 1L;
191 private ToolChainId tid
= new ToolChainId();
193 public FpdPlatformDefs() {
196 this.setBounds(new java
.awt
.Rectangle(0, 0, 500, 370));
197 this.setVisible(true);
200 public FpdPlatformDefs(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
202 ffc
= new FpdFileContents(fpd
);
206 public FpdPlatformDefs(OpeningPlatformType opt
) {
207 this(opt
.getXmlFpd());
212 * This method initializes jTabbedPane
214 * @return javax.swing.JTabbedPane
216 private JTabbedPane
getJTabbedPane() {
217 if (jTabbedPane
== null) {
218 jTabbedPane
= new JTabbedPane();
219 jTabbedPane
.addTab("General", null, getJPanelGeneralTab(), null);
225 * This method initializes this
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();
239 if (jTableSkuInfo
.isEditing()) {
240 jTableSkuInfo
.getCellEditor().stopCellEditing();
247 private void init(FpdFileContents ffc
) {
248 Vector
<Object
> v
= new Vector
<Object
>();
249 ffc
.getPlatformDefsSupportedArchs(v
);
250 showSupportedArchitectures(v
);
251 v
.removeAllElements();
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
);
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
]);
266 String interDir
= ffc
.getPlatformDefsInterDir();
267 if (interDir
!= null) {
268 jComboBoxInterDir
.setSelectedItem(interDir
);
271 String outputDir
= ffc
.getPlatformDefsOutputDir();
272 if (outputDir
!= null) {
273 jTextFieldOutputDir
.setText(outputDir
);
277 private void showSupportedArchitectures(Vector
<Object
> v
) {
278 if (v
.contains("IA32")) {
279 jCheckBoxIa32
.setSelected(true);
281 jCheckBoxIa32
.setSelected(false);
283 if (v
.contains("X64")) {
284 jCheckBoxX64
.setSelected(true);
286 jCheckBoxX64
.setSelected(false);
288 if (v
.contains("IPF")) {
289 jCheckBoxIpf
.setSelected(true);
291 jCheckBoxIpf
.setSelected(false);
293 if (v
.contains("EBC")) {
294 jCheckBoxEbc
.setSelected(true);
296 jCheckBoxEbc
.setSelected(false);
298 if (v
.contains("ARM")) {
299 jCheckBoxArm
.setSelected(true);
301 jCheckBoxArm
.setSelected(false);
303 if (v
.contains("PPC")) {
304 jCheckBoxPpc
.setSelected(true);
306 jCheckBoxPpc
.setSelected(false);
310 private void getSupportedArchitectures(Vector
<Object
> v
) {
311 if (docConsole
!= null) {
312 docConsole
.setSaved(false);
314 v
.removeAllElements();
315 if (jCheckBoxIa32
.isSelected()) {
318 if (jCheckBoxX64
.isSelected()) {
321 if (jCheckBoxIpf
.isSelected()) {
324 if (jCheckBoxEbc
.isSelected()) {
327 if (jCheckBoxArm
.isSelected()) {
330 if (jCheckBoxPpc
.isSelected()) {
337 * This method initializes jContentPane
339 * @return javax.swing.JPanel
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
);
351 * This method initializes jPanel4
353 * @return javax.swing.JPanel
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);
365 return jPanelGeneralTab
;
369 * This method initializes jPanel5
371 * @return javax.swing.JPanel
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
,
397 jLabelOutputDir
= new JLabel();
398 jLabelOutputDir
.setText("Name of the Output Directory");
399 jLabelOutputDir
.setBounds(new java
.awt
.Rectangle(labelColumn
+ 10, rowTwelve
, valueWidth
, oneRowHeight
));
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
));
407 jPanelGeneralContainer
.add(jLabelSupArch
, null);
408 jPanelGeneralContainer
.add(getArchitectureSelections(), null);
410 jPanelGeneralContainer
.add(jLabelBuildTargets
, null);
411 // jPanelGeneralContainer.add(getJTextFieldBuildTarget(), null);
412 jPanelGeneralContainer
.add(getJBuildTargetComboBox(), null);
414 jPanelGeneralContainer
.add(getJButtonAddBuildTarget(), null);
415 jPanelGeneralContainer
.add(getJButtonDelBuildTarget(), null);
416 jPanelGeneralContainer
.add(getJScrollPaneBuildTargets(), null);
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);
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);
434 return jPanelGeneralContainer
;
438 * This method initializes jArchitectureSelections Row 4
440 * @return jArchitectureSelections
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>");
458 return jArchitectureSelections
;
462 * This method initializes jCheckBox1
464 * @return javax.swing.JCheckBox
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
);
476 JOptionPane
.showMessageDialog(frame
, "Platform must support at least ONE Architecture.");
479 ffc
.setPlatformDefsSupportedArchs(v
);
483 return jCheckBoxIa32
;
487 * This method initializes jCheckBox2
489 * @return javax.swing.JCheckBox
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
);
501 JOptionPane
.showMessageDialog(frame
, "Platform must support at least ONE Architecture.");
504 ffc
.setPlatformDefsSupportedArchs(v
);
512 * This method initializes jCheckBox3
514 * @return javax.swing.JCheckBox
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
);
526 JOptionPane
.showMessageDialog(frame
, "Platform must support at least ONE Architecture.");
529 ffc
.setPlatformDefsSupportedArchs(v
);
537 * This method initializes jCheckBox
539 * @return javax.swing.JCheckBox
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
);
553 JOptionPane
.showMessageDialog(frame
, "Platform must support at least ONE Architecture.");
556 ffc
.setPlatformDefsSupportedArchs(v
);
564 * This method initializes jCheckBox5
566 * @return javax.swing.JCheckBox
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
);
580 JOptionPane
.showMessageDialog(frame
, "Platform must support at least ONE Architecture.");
583 ffc
.setPlatformDefsSupportedArchs(v
);
591 * This method initializes jCheckBox6
593 * @return javax.swing.JCheckBox
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
);
607 JOptionPane
.showMessageDialog(frame
, "Platform must support at least ONE Architecture.");
610 ffc
.setPlatformDefsSupportedArchs(v
);
618 * Use a ComboBox for BuildTargets
620 * @return javax.swing.JComboBox jBuildTargetComboBox
622 private JComboBox
getJBuildTargetComboBox() {
623 if (jBuildTargetComboBox
== null) {
624 String toolBt
= null;
625 if (tid
.getToolsDefTargetNames() == null)
626 toolBt
= "DEBUG RELEASE";
628 toolBt
= tid
.getToolsDefTargetNames().trim();
630 if ((toolBt
.contains("*")) || (toolBt
.length() < 1)) {
631 toolBt
= "DEBUG RELEASE";
634 System
.out
.println("Using Build Targets: " + toolBt
.trim());
636 toolBt
= toolBt
.replaceAll(" ", ":");
637 toolBt
= " :" + toolBt
;
639 System
.out
.println("Using Build Targets: " + toolBt
.trim());
640 String
[] buildTargets
= toolBt
.trim().split(":");
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."
653 return jBuildTargetComboBox
;
657 * This method initializes jTextField1
659 * @return javax.swing.JTextField
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));
668 // return jTextFieldBuildTarget;
671 * This method initializes jButton2
673 * @return javax.swing.JButton
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);
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));
696 // docConsole.setSaved(false);
697 // ffc.setPlatformDefsBuildTargets(v);
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));
707 docConsole
.setSaved(false);
708 ffc
.setPlatformDefsBuildTargets(v
);
713 return jButtonAddBuildTarget
;
717 * This method initializes jButton3
719 * @return javax.swing.JButton
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);
731 jButtonDelBuildTarget
.addActionListener(new java
.awt
.event
.ActionListener() {
732 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
733 if (jTableBuildTargets
.getSelectedRow() < 0) {
736 if (jTableBuildTargets
.getRowCount() == 1) {
737 JOptionPane
.showMessageDialog(frame
, "At least one build target should be set for this platform.");
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));
745 docConsole
.setSaved(false);
746 ffc
.setPlatformDefsBuildTargets(v
);
750 return jButtonDelBuildTarget
;
754 * This method initializes jScrollPane2
756 * @return javax.swing.JScrollPane
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,
764 jScrollPaneBuildTargets
.setLocation(new java
.awt
.Point(valueColumn
, rowFour
));
765 jScrollPaneBuildTargets
766 .setBorder(javax
.swing
.BorderFactory
767 .createEtchedBorder(javax
.swing
.border
.EtchedBorder
.RAISED
));
769 jScrollPaneBuildTargets
.setViewportView(getJTableBuildTargets());
771 return jScrollPaneBuildTargets
;
775 * This method initializes jTable
777 * @return javax.swing.JTable
779 private JTable
getJTableBuildTargets() {
780 if (jTableBuildTargets
== null) {
781 buildTargetTableModel
= new TargetTableModel();
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");
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) {
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));
804 docConsole
.setSaved(false);
805 ffc
.setPlatformDefsBuildTargets(v
);
811 return jTableBuildTargets
;
815 * This method initializes jTextField2
817 * @return javax.swing.JTextField
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.");
827 return jTextFieldSkuId
;
831 * This method initializes jTextField3
833 * @return javax.swing.JTextField
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>");
845 return jTextFieldSkuName
;
849 * This method initializes jButton
851 * @return javax.swing.JButton
853 private JButton
getJButtonSkuAdd() {
854 if (jButtonSkuAdd
== null) {
855 jButtonSkuAdd
= new JButton();
857 jButtonSkuAdd
.setPreferredSize(new Dimension(buttonWidth
, oneRowHeight
));
858 jButtonSkuAdd
.setBounds(new java
.awt
.Rectangle(valueCenter
- buttonWidth
- 5, rowEight
, buttonWidth
,
860 jButtonSkuAdd
.setLocation(new java
.awt
.Point(valueCenter
- buttonWidth
- 5, rowEight
));
861 jButtonSkuAdd
.setText("Add");
862 jButtonSkuAdd
.setVisible(true);
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]);
875 return jButtonSkuAdd
;
879 * This method initializes jButton1
881 * @return javax.swing.JButton
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();
896 if (jTableSkuInfo
.getSelectedRow() < 1) {
899 docConsole
.setSaved(false);
900 ffc
.removePlatformDefsSkuInfo(jTableSkuInfo
.getSelectedRow());
901 skuInfoTableModel
.removeRow(jTableSkuInfo
.getSelectedRow());
905 return jButtonSkuDel
;
909 * This method initializes jScrollPane3
911 * @return javax.swing.JScrollPane
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
));
921 .setBorder(javax
.swing
.BorderFactory
922 .createEtchedBorder(javax
.swing
.border
.EtchedBorder
.RAISED
));
924 jScrollPaneSkuInfo
.setViewportView(getJTableSkuInfo());
926 return jScrollPaneSkuInfo
;
930 * This method initializes jTable2
932 * @return javax.swing.JTable
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>");
945 jTableSkuInfo
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
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
);
962 return jTableSkuInfo
;
966 * This method initializes jComboBox
968 * @return javax.swing.JComboBox
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);
988 ffc
.setPlatformDefsInterDir(jComboBoxInterDir
.getSelectedItem() + "");
992 return jComboBoxInterDir
;
996 * This method initializes jTextField
998 * @return javax.swing.JTextField Row Twelve
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,
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());
1015 return jTextFieldOutputDir
;
1018 } // @jve:decl-index=0:visual-constraint="10,10"
1020 class SkuInfoTableModel
extends DefaultTableModel
{
1021 private static final long serialVersionUID
= 1L;
1023 public boolean isCellEditable(int row
, int column
) {
1031 class TargetTableModel
extends DefaultTableModel
{
1032 private static final long serialVersionUID
= 1L;
1034 public boolean isCellEditable(int row
, int column
) {