cda63d0bd4c3a5a3335334338074a592c35bf1f6
[people/mcb30/edk2.git] / edk2 / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdPlatformDefs.java
1 /** @file\r
2   Java class FpdPlatformDefs is GUI for Flash element operation in SPD file.\r
3  \r
4 Copyright (c) 2006, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution.  The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9 \r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12 **/\r
13 package org.tianocore.frameworkwizard.platform.ui;\r
14 \r
15 import java.awt.BorderLayout;\r
16 import javax.swing.JPanel;\r
17 \r
18 import javax.swing.JFrame;\r
19 import javax.swing.JTabbedPane;\r
20 import javax.swing.JButton;\r
21 import javax.swing.ListSelectionModel;\r
22 \r
23 import org.tianocore.PlatformSurfaceAreaDocument;\r
24 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
25 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
26 \r
27 \r
28 import java.awt.FlowLayout;\r
29 \r
30 \r
31 import javax.swing.JCheckBox;\r
32 import javax.swing.JOptionPane;\r
33 import javax.swing.JTextField;\r
34 import javax.swing.JLabel;\r
35 import javax.swing.JScrollPane;\r
36 import javax.swing.JTable;\r
37 import javax.swing.event.InternalFrameAdapter;\r
38 import javax.swing.event.InternalFrameEvent;\r
39 import javax.swing.event.TableModelEvent;\r
40 import javax.swing.event.TableModelListener;\r
41 import javax.swing.table.DefaultTableModel;\r
42 import javax.swing.table.TableModel;\r
43 import javax.swing.JComboBox;\r
44 import java.awt.Dimension;\r
45 import java.util.Vector;\r
46 \r
47 public class FpdPlatformDefs extends IInternalFrame {\r
48 \r
49     /**\r
50      * \r
51      */\r
52     private static final long serialVersionUID = 1L;\r
53     static JFrame frame;\r
54     private JPanel jContentPane = null;\r
55     private JPanel jPanelContentEast = null;\r
56     private JPanel jPanelContentWest = null;\r
57     private JPanel jPanelContentNorth = null;\r
58     private JTabbedPane jTabbedPane = null;\r
59     private TargetTableModel buildTargetTableModel = null;\r
60     \r
61     private SkuInfoTableModel skuInfoTableModel = null;\r
62     private OpeningPlatformType docConsole = null;\r
63     private FpdFileContents ffc = null;\r
64     private JPanel jPanelGeneralTab = null;\r
65     private JPanel jPanelGeneralTabNorth = null;\r
66     private JLabel jLabel = null;\r
67     private JCheckBox jCheckBoxIa32 = null;\r
68     private JCheckBox jCheckBoxX64 = null;\r
69     private JCheckBox jCheckBoxIpf = null;\r
70     private JPanel jPanelGeneralTabSouth = null;\r
71     private JCheckBox jCheckBoxInterDir = null;\r
72     private JComboBox jComboBoxInterDir = null;\r
73     private JTable jTableBuildTargets = null;\r
74     private JPanel jPanelGeneralTabCenter = null;\r
75     private JLabel jLabelBuildTargets = null;\r
76     private JTextField jTextFieldBuildTarget = null;\r
77     private JButton jButtonAddBuildTarget = null;\r
78     private JButton jButtonDelBuildTarget = null;\r
79     private JScrollPane jScrollPaneBuildTargets = null;\r
80     private JScrollPane jScrollPaneSkuInfo = null;\r
81     private JTable jTableSkuInfo = null;\r
82     private JCheckBox jCheckBoxEbc = null;\r
83     private JCheckBox jCheckBoxArm = null;\r
84     private JCheckBox jCheckBoxPpc = null;\r
85     private JPanel jPanelDir = null;\r
86     private JLabel jLabelPad = null;\r
87     private JLabel jLabelOutputDir = null;\r
88     private JTextField jTextFieldOutputDir = null;\r
89     private JPanel jPanelSkuInfo = null;\r
90     private JLabel jLabelSkuInfo = null;\r
91     private JLabel jLabelSkuId = null;\r
92     private JTextField jTextFieldSkuId = null;\r
93     private JLabel jLabelSkuName = null;\r
94     private JTextField jTextFieldSkuName = null;\r
95     private JButton jButtonSkuAdd = null;\r
96     private JButton jButtonSkuDel = null;\r
97     private JLabel jLabelPadd = null;\r
98     public FpdPlatformDefs() {\r
99         super();\r
100         // TODO Auto-generated constructor stub\r
101 \r
102         initialize();\r
103         this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));\r
104         this.setVisible(true);\r
105     }\r
106 \r
107     public FpdPlatformDefs(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){\r
108         this();\r
109         ffc = new FpdFileContents(fpd);\r
110         init(ffc);\r
111     }\r
112     \r
113     public FpdPlatformDefs(OpeningPlatformType opt) {\r
114         this(opt.getXmlFpd());\r
115         docConsole = opt;\r
116     }\r
117     \r
118     /**\r
119      * This method initializes jPanel   \r
120      *  \r
121      * @return javax.swing.JPanel       \r
122      */\r
123     private JPanel getJPanelContentEast() {\r
124         if (jPanelContentEast == null) {\r
125             jPanelContentEast = new JPanel();\r
126         }\r
127         return jPanelContentEast;\r
128     }\r
129 \r
130     /**\r
131      * This method initializes jPanel2  \r
132      *  \r
133      * @return javax.swing.JPanel       \r
134      */\r
135     private JPanel getJPanelContentWest() {\r
136         if (jPanelContentWest == null) {\r
137             jPanelContentWest = new JPanel();\r
138         }\r
139         return jPanelContentWest;\r
140     }\r
141 \r
142     /**\r
143      * This method initializes jPanel3  \r
144      *  \r
145      * @return javax.swing.JPanel       \r
146      */\r
147     private JPanel getJPanelContentNorth() {\r
148         if (jPanelContentNorth == null) {\r
149             jPanelContentNorth = new JPanel();\r
150         }\r
151         return jPanelContentNorth;\r
152     }\r
153 \r
154     /**\r
155      * This method initializes jTabbedPane      \r
156      *  \r
157      * @return javax.swing.JTabbedPane  \r
158      */\r
159     private JTabbedPane getJTabbedPane() {\r
160         if (jTabbedPane == null) {\r
161             jTabbedPane = new JTabbedPane();\r
162             \r
163                         jTabbedPane.addTab("General", null, getJPanelGeneralTab(), null);\r
164            \r
165         }\r
166         return jTabbedPane;\r
167     }\r
168 \r
169     /**\r
170      * This method initializes this\r
171      * \r
172      * @return void\r
173      */\r
174     private void initialize() {\r
175         this.setSize(518, 650);\r
176         this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
177         this.setContentPane(getJContentPane());\r
178         this.setTitle("FPD Platform Definitions");\r
179         this.addInternalFrameListener(new InternalFrameAdapter(){\r
180             public void internalFrameDeactivated(InternalFrameEvent e){\r
181                 if (jTableBuildTargets.isEditing()) {\r
182                     jTableBuildTargets.getCellEditor().stopCellEditing();\r
183                 }\r
184                 if (jTableSkuInfo.isEditing()) {\r
185                     jTableSkuInfo.getCellEditor().stopCellEditing();\r
186                 }\r
187                \r
188             }\r
189         });\r
190     }\r
191 \r
192     private void init(FpdFileContents ffc) {\r
193         Vector<Object> v = new Vector<Object>();\r
194         ffc.getPlatformDefsSupportedArchs(v);\r
195         showToolChain(v);\r
196         \r
197         buildTargetTableModel.setRowCount(0);\r
198         v.removeAllElements();\r
199         ffc.getPlatformDefsBuildTargets(v);\r
200         for (int i = 0; i < v.size(); ++i){\r
201             Object[] row = {v.get(i)};\r
202             buildTargetTableModel.addRow(row);\r
203         }\r
204         \r
205         String[][] saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];\r
206         ffc.getPlatformDefsSkuInfos(saa);\r
207         for (int i = 0; i < saa.length; ++i) {\r
208             skuInfoTableModel.addRow(saa[i]);\r
209         }\r
210         \r
211         String interDir = ffc.getPlatformDefsInterDir();\r
212         if (interDir != null) {\r
213             jComboBoxInterDir.setSelectedItem(interDir);\r
214         }\r
215         \r
216         String outputDir = ffc.getPlatformDefsOutputDir();\r
217         if (outputDir != null) {\r
218             jTextFieldOutputDir.setText(outputDir);\r
219         }\r
220     }\r
221     \r
222    private void showToolChain(Vector<Object> v) {\r
223        if (v.contains("IA32")) {\r
224            jCheckBoxIa32.setSelected(true);\r
225        }\r
226        else{\r
227            jCheckBoxIa32.setSelected(false);\r
228        }\r
229        if (v.contains("X64")) {\r
230            jCheckBoxX64.setSelected(true);\r
231        }\r
232        else{\r
233            jCheckBoxX64.setSelected(false);\r
234        }\r
235        if (v.contains("IPF")) {\r
236            jCheckBoxIpf.setSelected(true);\r
237        }\r
238        else{\r
239            jCheckBoxIpf.setSelected(false);\r
240        }\r
241        if (v.contains("EBC")) {\r
242            jCheckBoxEbc.setSelected(true);\r
243        }\r
244        else{\r
245            jCheckBoxEbc.setSelected(false);\r
246        }\r
247        if (v.contains("ARM")) {\r
248            jCheckBoxArm.setSelected(true);\r
249        }\r
250        else{\r
251            jCheckBoxArm.setSelected(false);\r
252        }\r
253        if (v.contains("PPC")) {\r
254            jCheckBoxPpc.setSelected(true);\r
255        }\r
256        else{\r
257            jCheckBoxPpc.setSelected(false);\r
258        }\r
259    }\r
260    \r
261    private void getToolChain(Vector<Object> v) {\r
262        if (docConsole != null){\r
263            docConsole.setSaved(false);\r
264        }\r
265        v.removeAllElements();\r
266        if (jCheckBoxIa32.isSelected()) {\r
267            v.add("IA32");\r
268        }\r
269        if (jCheckBoxX64.isSelected()) {\r
270            v.add("X64");\r
271        }\r
272        if (jCheckBoxIpf.isSelected()) {\r
273            v.add("IPF");\r
274        }\r
275        if (jCheckBoxEbc.isSelected()) {\r
276            v.add("EBC");\r
277        }\r
278        if (jCheckBoxArm.isSelected()) {\r
279            v.add("ARM");\r
280        }\r
281        if (jCheckBoxPpc.isSelected()) {\r
282            v.add("PPC");\r
283        }\r
284        \r
285    }\r
286  \r
287     /**\r
288      * This method initializes jContentPane\r
289      * \r
290      * @return javax.swing.JPanel\r
291      */\r
292     private JPanel getJContentPane() {\r
293         if (jContentPane == null) {\r
294             jContentPane = new JPanel();\r
295             jContentPane.setLayout(new BorderLayout());\r
296             jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);\r
297             jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);\r
298             jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);\r
299             jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);\r
300         }\r
301         return jContentPane;\r
302     }\r
303 \r
304     /**\r
305      * This method initializes jPanel4  \r
306      *  \r
307      * @return javax.swing.JPanel       \r
308      */\r
309     private JPanel getJPanelGeneralTab() {\r
310         if (jPanelGeneralTab == null) {\r
311             jPanelGeneralTab = new JPanel();\r
312             jPanelGeneralTab.setLayout(new BorderLayout());\r
313             jPanelGeneralTab.add(getJPanelGeneralTabNorth(), java.awt.BorderLayout.NORTH);\r
314             jPanelGeneralTab.add(getJPanelGeneralTabSouth(), java.awt.BorderLayout.SOUTH);\r
315             jPanelGeneralTab.add(getJPanelGeneralTabCenter(), java.awt.BorderLayout.CENTER);\r
316         }\r
317         return jPanelGeneralTab;\r
318     }\r
319 \r
320     /**\r
321      * This method initializes jPanel5  \r
322      *  \r
323      * @return javax.swing.JPanel       \r
324      */\r
325     private JPanel getJPanelGeneralTabNorth() {\r
326         if (jPanelGeneralTabNorth == null) {\r
327             jLabel = new JLabel();\r
328             jLabel.setText("Supported Archs");\r
329             FlowLayout flowLayout2 = new FlowLayout();\r
330             flowLayout2.setAlignment(FlowLayout.LEFT);\r
331             flowLayout2.setHgap(12);\r
332             jPanelGeneralTabNorth = new JPanel();\r
333             jPanelGeneralTabNorth.setLayout(flowLayout2);\r
334             jPanelGeneralTabNorth.add(jLabel, null);\r
335             jPanelGeneralTabNorth.add(getJCheckBoxIa32(), null);\r
336             jPanelGeneralTabNorth.add(getJCheckBoxX64(), null);\r
337             jPanelGeneralTabNorth.add(getJCheckBoxIpf(), null);\r
338             jPanelGeneralTabNorth.add(getJCheckBoxEbc(), null);\r
339             jPanelGeneralTabNorth.add(getJCheckBoxArm(), null);\r
340             jPanelGeneralTabNorth.add(getJCheckBoxPpc(), null);\r
341         }\r
342         return jPanelGeneralTabNorth;\r
343     }\r
344 \r
345     /**\r
346      * This method initializes jCheckBox1       \r
347      *  \r
348      * @return javax.swing.JCheckBox    \r
349      */\r
350     private JCheckBox getJCheckBoxIa32() {\r
351         if (jCheckBoxIa32 == null) {\r
352             jCheckBoxIa32 = new JCheckBox();\r
353             jCheckBoxIa32.setText("IA32");\r
354             jCheckBoxIa32.addItemListener(new java.awt.event.ItemListener() {\r
355                 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
356                     Vector<Object> v = new Vector<Object>();\r
357                     getToolChain(v);\r
358                     if (v.size() == 0) {\r
359                         JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch.");\r
360                         return;\r
361                     }\r
362                     ffc.setPlatformDefsSupportedArchs(v);\r
363                 }\r
364             });\r
365         }\r
366         return jCheckBoxIa32;\r
367     }\r
368 \r
369     /**\r
370      * This method initializes jCheckBox2       \r
371      *  \r
372      * @return javax.swing.JCheckBox    \r
373      */\r
374     private JCheckBox getJCheckBoxX64() {\r
375         if (jCheckBoxX64 == null) {\r
376             jCheckBoxX64 = new JCheckBox();\r
377             jCheckBoxX64.setText("X64");\r
378             jCheckBoxX64.addItemListener(new java.awt.event.ItemListener() {\r
379                 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
380                     Vector<Object> v = new Vector<Object>();\r
381                     getToolChain(v);\r
382                     if (v.size() == 0) {\r
383                         JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch.");\r
384                         return;\r
385                     }\r
386                     ffc.setPlatformDefsSupportedArchs(v);\r
387                 }\r
388             });\r
389         }\r
390         return jCheckBoxX64;\r
391     }\r
392 \r
393     /**\r
394      * This method initializes jCheckBox3       \r
395      *  \r
396      * @return javax.swing.JCheckBox    \r
397      */\r
398     private JCheckBox getJCheckBoxIpf() {\r
399         if (jCheckBoxIpf == null) {\r
400             jCheckBoxIpf = new JCheckBox();\r
401             jCheckBoxIpf.setText("IPF");\r
402             jCheckBoxIpf.addItemListener(new java.awt.event.ItemListener() {\r
403                 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
404                     Vector<Object> v = new Vector<Object>();\r
405                     getToolChain(v);\r
406                     if (v.size() == 0) {\r
407                         JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch.");\r
408                         return;\r
409                     }\r
410                     ffc.setPlatformDefsSupportedArchs(v);\r
411                 }\r
412             });\r
413         }\r
414         return jCheckBoxIpf;\r
415     }\r
416     \r
417     /**\r
418      * This method initializes jTable   \r
419      *  \r
420      * @return javax.swing.JTable   \r
421      */\r
422     private JTable getJTableBuildTargets() {\r
423         if (jTableBuildTargets == null) {\r
424             buildTargetTableModel = new TargetTableModel();\r
425             buildTargetTableModel.addColumn("Build Target");\r
426             jTableBuildTargets = new JTable(buildTargetTableModel);\r
427             jTableBuildTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
428             \r
429             jTableBuildTargets.getModel().addTableModelListener(new TableModelListener() {\r
430                 public void tableChanged(TableModelEvent arg0) {\r
431                     // TODO Auto-generated method stub\r
432                     if (jTableBuildTargets.getSelectedRow() < 0) {\r
433                         return;\r
434                     }\r
435                     TableModel m = (TableModel)arg0.getSource();\r
436                     if (arg0.getType() == TableModelEvent.UPDATE){\r
437                         //ToDo Data Validition check.\r
438                         Vector<Object> v = new Vector<Object>();\r
439                         for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {\r
440                             v.add(m.getValueAt(i, 0));\r
441                         }\r
442                         docConsole.setSaved(false);\r
443                         ffc.setPlatformDefsBuildTargets(v);\r
444                     }\r
445                 }\r
446             });\r
447         }\r
448         return jTableBuildTargets;\r
449     }\r
450 \r
451     /**\r
452      * This method initializes jPanel6  \r
453      *  \r
454      * @return javax.swing.JPanel       \r
455      */\r
456     private JPanel getJPanelGeneralTabSouth() {\r
457         if (jPanelGeneralTabSouth == null) {\r
458             FlowLayout flowLayout3 = new FlowLayout();\r
459             flowLayout3.setAlignment(FlowLayout.LEFT);\r
460             flowLayout3.setHgap(20);\r
461             jPanelGeneralTabSouth = new JPanel();\r
462             jPanelGeneralTabSouth.setPreferredSize(new java.awt.Dimension(10,200));\r
463             jPanelGeneralTabSouth.setLayout(flowLayout3);\r
464             jPanelGeneralTabSouth.add(getJPanelDir(), null);\r
465         }\r
466         return jPanelGeneralTabSouth;\r
467     }\r
468 \r
469     /**\r
470      * This method initializes jCheckBox4       \r
471      *  \r
472      * @return javax.swing.JCheckBox    \r
473      */\r
474     private JCheckBox getJCheckBoxInterDir() {\r
475         if (jCheckBoxInterDir == null) {\r
476             jCheckBoxInterDir = new JCheckBox();\r
477             jCheckBoxInterDir.setText("Intermediate Directories");\r
478         }\r
479         return jCheckBoxInterDir;\r
480     }\r
481 \r
482     /**\r
483      * This method initializes jComboBox        \r
484      *  \r
485      * @return javax.swing.JComboBox    \r
486      */\r
487     private JComboBox getJComboBoxInterDir() {\r
488         if (jComboBoxInterDir == null) {\r
489             jComboBoxInterDir = new JComboBox();\r
490             jComboBoxInterDir.setPreferredSize(new Dimension(100, 20));\r
491             jComboBoxInterDir.addItem("UNIFIED");\r
492             jComboBoxInterDir.addItem("MODULE");\r
493             \r
494             jComboBoxInterDir.setSelectedIndex(0);\r
495             jComboBoxInterDir.addItemListener(new java.awt.event.ItemListener() {\r
496                 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
497                     if (docConsole != null){\r
498                         docConsole.setSaved(false);\r
499                     }\r
500                     ffc.setPlatformDefsInterDir(jComboBoxInterDir.getSelectedItem()+"");\r
501                 }\r
502             });\r
503         }\r
504         return jComboBoxInterDir;\r
505     }\r
506 \r
507     /**\r
508      * This method initializes jPanel7  \r
509      *  \r
510      * @return javax.swing.JPanel       \r
511      */\r
512     private JPanel getJPanelGeneralTabCenter() {\r
513         if (jPanelGeneralTabCenter == null) {\r
514             jLabelBuildTargets = new JLabel();\r
515             jLabelBuildTargets.setPreferredSize(new Dimension(109, 16));\r
516             jLabelBuildTargets.setText("Build Targets");\r
517             FlowLayout flowLayout4 = new FlowLayout();\r
518             flowLayout4.setAlignment(FlowLayout.LEFT);\r
519             flowLayout4.setHgap(20);\r
520             jPanelGeneralTabCenter = new JPanel();\r
521             jPanelGeneralTabCenter.setPreferredSize(new Dimension(972, 100));\r
522             jPanelGeneralTabCenter.setLayout(flowLayout4);\r
523             jPanelGeneralTabCenter.add(jLabelBuildTargets, null);\r
524             jPanelGeneralTabCenter.add(getJTextFieldBuildTarget(), null);\r
525             jPanelGeneralTabCenter.add(getJButtonAddBuildTarget(), null);\r
526             jPanelGeneralTabCenter.add(getJButtonDelBuildTarget(), null);\r
527             jPanelGeneralTabCenter.add(getJScrollPaneBuildTargets(), null);\r
528             jPanelGeneralTabCenter.add(getJPanelSkuInfo(), null);\r
529             jPanelGeneralTabCenter.add(getJScrollPaneSkuInfo(), null);\r
530         }\r
531         return jPanelGeneralTabCenter;\r
532     }\r
533 \r
534     /**\r
535      * This method initializes jTextField1      \r
536      *  \r
537      * @return javax.swing.JTextField   \r
538      */\r
539     private JTextField getJTextFieldBuildTarget() {\r
540         if (jTextFieldBuildTarget == null) {\r
541             jTextFieldBuildTarget = new JTextField();\r
542             jTextFieldBuildTarget.setPreferredSize(new Dimension(150, 20));\r
543         }\r
544         return jTextFieldBuildTarget;\r
545     }\r
546 \r
547     /**\r
548      * This method initializes jButton2 \r
549      *  \r
550      * @return javax.swing.JButton      \r
551      */\r
552     private JButton getJButtonAddBuildTarget() {\r
553         if (jButtonAddBuildTarget == null) {\r
554             jButtonAddBuildTarget = new JButton();\r
555             jButtonAddBuildTarget.setPreferredSize(new Dimension(70, 20));\r
556             jButtonAddBuildTarget.setText("Add");\r
557             jButtonAddBuildTarget.addActionListener(new java.awt.event.ActionListener() {\r
558                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
559                     if (jTextFieldBuildTarget.getText().length() > 0) {\r
560                         String[] row = {jTextFieldBuildTarget.getText()};\r
561                         buildTargetTableModel.addRow(row);\r
562                         Vector<Object> v = new Vector<Object>();\r
563                         for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {\r
564                             v.add(buildTargetTableModel.getValueAt(i, 0));\r
565                         }\r
566                         docConsole.setSaved(false);\r
567                         ffc.setPlatformDefsBuildTargets(v);\r
568                     }\r
569                 }\r
570             });\r
571         }\r
572         return jButtonAddBuildTarget;\r
573     }\r
574 \r
575     /**\r
576      * This method initializes jButton3 \r
577      *  \r
578      * @return javax.swing.JButton      \r
579      */\r
580     private JButton getJButtonDelBuildTarget() {\r
581         if (jButtonDelBuildTarget == null) {\r
582             jButtonDelBuildTarget = new JButton();\r
583             jButtonDelBuildTarget.setPreferredSize(new Dimension(70, 20));\r
584             jButtonDelBuildTarget.setText("Delete");\r
585             jButtonDelBuildTarget.setVisible(false);\r
586         }\r
587         return jButtonDelBuildTarget;\r
588     }\r
589 \r
590     /**\r
591      * This method initializes jScrollPane2     \r
592      *  \r
593      * @return javax.swing.JScrollPane  \r
594      */\r
595     private JScrollPane getJScrollPaneBuildTargets() {\r
596         if (jScrollPaneBuildTargets == null) {\r
597             jScrollPaneBuildTargets = new JScrollPane();\r
598             jScrollPaneBuildTargets.setPreferredSize(new Dimension(453, 100));\r
599             jScrollPaneBuildTargets.setViewportView(getJTableBuildTargets());\r
600         }\r
601         return jScrollPaneBuildTargets;\r
602     }\r
603 \r
604     /**\r
605      * This method initializes jScrollPane3     \r
606      *  \r
607      * @return javax.swing.JScrollPane  \r
608      */\r
609     private JScrollPane getJScrollPaneSkuInfo() {\r
610         if (jScrollPaneSkuInfo == null) {\r
611             jScrollPaneSkuInfo = new JScrollPane();\r
612             jScrollPaneSkuInfo.setPreferredSize(new java.awt.Dimension(453,100));\r
613             jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());\r
614         }\r
615         return jScrollPaneSkuInfo;\r
616     }\r
617 \r
618     /**\r
619      * This method initializes jTable2  \r
620      *  \r
621      * @return javax.swing.JTable       \r
622      */\r
623     private JTable getJTableSkuInfo() {\r
624         if (jTableSkuInfo == null) {\r
625             skuInfoTableModel = new SkuInfoTableModel();\r
626             skuInfoTableModel.addColumn("SKU ID");\r
627             skuInfoTableModel.addColumn("Name");\r
628             jTableSkuInfo = new JTable(skuInfoTableModel);\r
629             \r
630             jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
631             \r
632             jTableSkuInfo.getModel().addTableModelListener(new TableModelListener() {\r
633                 public void tableChanged(TableModelEvent arg0) {\r
634                     // TODO Auto-generated method stub\r
635                     int row = arg0.getFirstRow();\r
636                     TableModel m = (TableModel)arg0.getSource();\r
637                     if (arg0.getType() == TableModelEvent.UPDATE){\r
638                         //ToDo Data Validition check.\r
639                         String id = m.getValueAt(row, 0)+"";\r
640                         String name = m.getValueAt(row, 1)+"";\r
641                         docConsole.setSaved(false);\r
642                         ffc.updatePlatformDefsSkuInfo(row, id, name);\r
643                     }\r
644                 }\r
645             });\r
646         }\r
647         return jTableSkuInfo;\r
648     }\r
649 \r
650     /**\r
651      * This method initializes jCheckBox        \r
652      *  \r
653      * @return javax.swing.JCheckBox    \r
654      */\r
655     private JCheckBox getJCheckBoxEbc() {\r
656         if (jCheckBoxEbc == null) {\r
657             jCheckBoxEbc = new JCheckBox();\r
658             jCheckBoxEbc.setPreferredSize(new java.awt.Dimension(50,20));\r
659             jCheckBoxEbc.setText("EBC");\r
660             jCheckBoxEbc.addItemListener(new java.awt.event.ItemListener() {\r
661                 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
662                     Vector<Object> v = new Vector<Object>();\r
663                     getToolChain(v);\r
664                     if (v.size() == 0) {\r
665                         JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch.");\r
666                         return;\r
667                     }\r
668                     ffc.setPlatformDefsSupportedArchs(v);\r
669                 }\r
670             });\r
671         }\r
672         return jCheckBoxEbc;\r
673     }\r
674 \r
675     /**\r
676      * This method initializes jCheckBox5       \r
677      *  \r
678      * @return javax.swing.JCheckBox    \r
679      */\r
680     private JCheckBox getJCheckBoxArm() {\r
681         if (jCheckBoxArm == null) {\r
682             jCheckBoxArm = new JCheckBox();\r
683             jCheckBoxArm.setPreferredSize(new java.awt.Dimension(52,20));\r
684             jCheckBoxArm.setText("ARM");\r
685             jCheckBoxArm.setVisible(false);\r
686             jCheckBoxArm.addItemListener(new java.awt.event.ItemListener() {\r
687                 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
688                     Vector<Object> v = new Vector<Object>();\r
689                     getToolChain(v);\r
690                     if (v.size() == 0) {\r
691                         JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch.");\r
692                         return;\r
693                     }\r
694                     ffc.setPlatformDefsSupportedArchs(v);\r
695                 }\r
696             });\r
697         }\r
698         return jCheckBoxArm;\r
699     }\r
700 \r
701     /**\r
702      * This method initializes jCheckBox6       \r
703      *  \r
704      * @return javax.swing.JCheckBox    \r
705      */\r
706     private JCheckBox getJCheckBoxPpc() {\r
707         if (jCheckBoxPpc == null) {\r
708             jCheckBoxPpc = new JCheckBox();\r
709             jCheckBoxPpc.setPreferredSize(new Dimension(50, 20));\r
710             jCheckBoxPpc.setText("PPC");\r
711             jCheckBoxPpc.setVisible(false);\r
712             jCheckBoxPpc.addItemListener(new java.awt.event.ItemListener() {\r
713                 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
714                     Vector<Object> v = new Vector<Object>();\r
715                     getToolChain(v);\r
716                     if (v.size() == 0) {\r
717                         JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch.");\r
718                         return;\r
719                     }\r
720                     ffc.setPlatformDefsSupportedArchs(v);\r
721                 }\r
722             });\r
723         }\r
724         return jCheckBoxPpc;\r
725     }\r
726 \r
727     /**\r
728      * This method initializes jPanel8  \r
729      *  \r
730      * @return javax.swing.JPanel       \r
731      */\r
732     private JPanel getJPanelDir() {\r
733         if (jPanelDir == null) {\r
734             FlowLayout flowLayout1 = new FlowLayout();\r
735             flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);\r
736             jLabelOutputDir = new JLabel();\r
737             jLabelOutputDir.setText("Output Directory");\r
738             jLabelPad = new JLabel();\r
739             jLabelPad.setPreferredSize(new java.awt.Dimension(150,20));\r
740             jLabelPad.setText("");\r
741             jPanelDir = new JPanel();\r
742             jPanelDir.setLayout(flowLayout1);\r
743             jPanelDir.setPreferredSize(new java.awt.Dimension(450,100));\r
744             jPanelDir.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));\r
745             jPanelDir.add(getJCheckBoxInterDir(), null);\r
746             jPanelDir.add(getJComboBoxInterDir(), null);\r
747             jPanelDir.add(jLabelPad, null);\r
748             jPanelDir.add(jLabelOutputDir, null);\r
749             jPanelDir.add(getJTextFieldOutputDir(), null);\r
750         }\r
751         return jPanelDir;\r
752     }\r
753 \r
754     /**\r
755      * This method initializes jTextField       \r
756      *  \r
757      * @return javax.swing.JTextField   \r
758      */\r
759     private JTextField getJTextFieldOutputDir() {\r
760         if (jTextFieldOutputDir == null) {\r
761             jTextFieldOutputDir = new JTextField();\r
762             jTextFieldOutputDir.setPreferredSize(new java.awt.Dimension(300,20));\r
763             jTextFieldOutputDir.addFocusListener(new java.awt.event.FocusAdapter() {\r
764                 public void focusLost(java.awt.event.FocusEvent e) {\r
765                     docConsole.setSaved(false);\r
766                     ffc.setPlatformDefsOutputDir(jTextFieldOutputDir.getText());\r
767                 }\r
768             });\r
769         }\r
770         return jTextFieldOutputDir;\r
771     }\r
772 \r
773     /**\r
774      * This method initializes jPanel9  \r
775      *  \r
776      * @return javax.swing.JPanel       \r
777      */\r
778     private JPanel getJPanelSkuInfo() {\r
779         if (jPanelSkuInfo == null) {\r
780             jLabelPadd = new JLabel();\r
781             jLabelPadd.setPreferredSize(new Dimension(280, 20));\r
782             jLabelPadd.setText("                                                 ");\r
783             jLabelSkuName = new JLabel();\r
784             jLabelSkuName.setPreferredSize(new Dimension(40, 20));\r
785             jLabelSkuName.setText("Name");\r
786             jLabelSkuId = new JLabel();\r
787             jLabelSkuId.setPreferredSize(new Dimension(20, 20));\r
788             jLabelSkuId.setText("ID");\r
789             jLabelSkuInfo = new JLabel();\r
790             jLabelSkuInfo.setPreferredSize(new java.awt.Dimension(150,20));\r
791             jLabelSkuInfo.setText("SKU Information");\r
792             jPanelSkuInfo = new JPanel();\r
793             jPanelSkuInfo.setPreferredSize(new java.awt.Dimension(450,70));\r
794             jPanelSkuInfo.add(jLabelSkuInfo, null);\r
795             jPanelSkuInfo.add(jLabelPadd, null);\r
796             jPanelSkuInfo.add(jLabelSkuId, null);\r
797             jPanelSkuInfo.add(getJTextFieldSkuId(), null);\r
798             jPanelSkuInfo.add(jLabelSkuName, null);\r
799             jPanelSkuInfo.add(getJTextFieldSkuName(), null);\r
800             jPanelSkuInfo.add(getJButtonSkuAdd(), null);\r
801             jPanelSkuInfo.add(getJButtonSkuDel(), null);\r
802         }\r
803         return jPanelSkuInfo;\r
804     }\r
805 \r
806     /**\r
807      * This method initializes jTextField2      \r
808      *  \r
809      * @return javax.swing.JTextField   \r
810      */\r
811     private JTextField getJTextFieldSkuId() {\r
812         if (jTextFieldSkuId == null) {\r
813             jTextFieldSkuId = new JTextField();\r
814             jTextFieldSkuId.setPreferredSize(new Dimension(50, 20));\r
815         }\r
816         return jTextFieldSkuId;\r
817     }\r
818 \r
819     /**\r
820      * This method initializes jTextField3      \r
821      *  \r
822      * @return javax.swing.JTextField   \r
823      */\r
824     private JTextField getJTextFieldSkuName() {\r
825         if (jTextFieldSkuName == null) {\r
826             jTextFieldSkuName = new JTextField();\r
827             jTextFieldSkuName.setPreferredSize(new Dimension(150, 20));\r
828         }\r
829         return jTextFieldSkuName;\r
830     }\r
831 \r
832     /**\r
833      * This method initializes jButton  \r
834      *  \r
835      * @return javax.swing.JButton      \r
836      */\r
837     private JButton getJButtonSkuAdd() {\r
838         if (jButtonSkuAdd == null) {\r
839             jButtonSkuAdd = new JButton();\r
840             jButtonSkuAdd.setPreferredSize(new Dimension(70, 20));\r
841             jButtonSkuAdd.setText("Add");\r
842             jButtonSkuAdd.addActionListener(new java.awt.event.ActionListener() {\r
843                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
844                     if (jTextFieldSkuId.getText().length() > 0) {\r
845                         String[] row = {jTextFieldSkuId.getText(), jTextFieldSkuName.getText()};\r
846                         skuInfoTableModel.addRow(row);\r
847                         docConsole.setSaved(false);\r
848                         ffc.genPlatformDefsSkuInfo(row[0], row[1]);\r
849                     }\r
850                 }\r
851             });\r
852         }\r
853         return jButtonSkuAdd;\r
854     }\r
855 \r
856     /**\r
857      * This method initializes jButton1 \r
858      *  \r
859      * @return javax.swing.JButton      \r
860      */\r
861     private JButton getJButtonSkuDel() {\r
862         if (jButtonSkuDel == null) {\r
863             jButtonSkuDel = new JButton();\r
864             jButtonSkuDel.setPreferredSize(new Dimension(70, 20));\r
865             jButtonSkuDel.setText("Delete");\r
866             jButtonSkuDel.addActionListener(new java.awt.event.ActionListener() {\r
867                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
868                     if (jTableSkuInfo.isEditing()) {\r
869                         jTableSkuInfo.getCellEditor().stopCellEditing();\r
870                     }\r
871                     if (jTableSkuInfo.getSelectedRow() < 1) {\r
872                         return;\r
873                     }\r
874                     docConsole.setSaved(false);\r
875                     ffc.removePlatformDefsSkuInfo(jTableSkuInfo.getSelectedRow());\r
876                     skuInfoTableModel.removeRow(jTableSkuInfo.getSelectedRow());\r
877                 }\r
878             });\r
879         }\r
880         return jButtonSkuDel;\r
881     }\r
882 \r
883 \r
884 }  //  @jve:decl-index=0:visual-constraint="10,10"\r
885 \r
886 class SkuInfoTableModel extends DefaultTableModel{\r
887     /**\r
888      * \r
889      */\r
890     private static final long serialVersionUID = 1L;\r
891 \r
892     public boolean isCellEditable(int row, int column) {\r
893         if (row == 0) {\r
894             return false;\r
895         }\r
896         return true;\r
897     }\r
898 }\r
899 \r
900 class TargetTableModel extends DefaultTableModel{\r
901     private static final long serialVersionUID = 1L;\r
902 \r
903     public boolean isCellEditable(int row, int column) {\r
904         if (row < 2) {\r
905             return false;\r
906         }\r
907         return true;\r
908     }\r
909 }\r
910 \r
911 \r