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
.DefaultCellEditor
;
19 import javax
.swing
.DefaultListModel
;
20 import javax
.swing
.JFrame
;
21 import javax
.swing
.JTabbedPane
;
22 import javax
.swing
.JButton
;
24 import org
.tianocore
.PlatformSurfaceAreaDocument
;
25 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
28 import java
.awt
.FlowLayout
;
31 import javax
.swing
.JCheckBox
;
32 import javax
.swing
.JTextField
;
33 import javax
.swing
.JLabel
;
34 import javax
.swing
.JScrollPane
;
35 import javax
.swing
.JTable
;
36 import javax
.swing
.event
.InternalFrameAdapter
;
37 import javax
.swing
.event
.InternalFrameEvent
;
38 import javax
.swing
.event
.ListSelectionEvent
;
39 import javax
.swing
.event
.ListSelectionListener
;
40 import javax
.swing
.event
.TableModelEvent
;
41 import javax
.swing
.event
.TableModelListener
;
42 import javax
.swing
.table
.DefaultTableModel
;
43 import javax
.swing
.table
.TableColumn
;
44 import javax
.swing
.table
.TableModel
;
45 import javax
.swing
.JComboBox
;
46 import java
.awt
.Dimension
;
47 import javax
.swing
.JRadioButton
;
48 import javax
.swing
.JTextArea
;
49 import java
.awt
.CardLayout
;
51 public class FpdPlatformDefs
extends IInternalFrame
{
56 private static final long serialVersionUID
= 1L;
58 private JPanel jContentPane
= null;
59 private JPanel jPanel
= null;
60 private JPanel jPanel1
= null;
61 private JPanel jPanel2
= null;
62 private JPanel jPanel3
= null;
63 private JTabbedPane jTabbedPane
= null;
64 private JButton jButtonOk
= null;
65 private JButton jButtonCancel
= null;
66 private JPanel jPanelFvImageW
= null;
67 private JScrollPane jScrollPane
= null;
68 private DefaultTableModel imageEntryPointTableModel
= null;
69 private DefaultTableModel outputDirectoryTableModel
= null;
71 private DefaultTableModel skuInfoTableModel
= null;
72 private DefaultTableModel fdfBlocksTableModel
= null;
73 private DefaultTableModel fdfRegionsTableModel
= null;
74 private DefaultTableModel fdfSubRegionsTableModel
= null;
76 private JLabel jLabel17
= null;
77 private DefaultListModel listModel
= new DefaultListModel();
78 private FpdFileContents ffc
= null;
79 private JPanel jPanel4
= null;
80 private JPanel jPanel5
= null;
81 private JLabel jLabel
= null;
82 private JCheckBox jCheckBox1
= null;
83 private JCheckBox jCheckBox2
= null;
84 private JCheckBox jCheckBox3
= null;
85 private JPanel jPanel6
= null;
86 private JLabel jLabel1
= null;
87 private JCheckBox jCheckBox4
= null;
88 private JComboBox jComboBox
= null;
89 private JTextField jTextField
= null;
90 private JTable jTable
= null;
91 private JPanel jPanel7
= null;
92 private JLabel jLabel2
= null;
93 private JTextField jTextField1
= null;
94 private JButton jButton2
= null;
95 private JButton jButton3
= null;
96 private JScrollPane jScrollPane2
= null;
97 private JTable jTable1
= null;
98 private JLabel jLabel3
= null;
99 private JScrollPane jScrollPane3
= null;
100 private JTable jTable2
= null;
101 private JLabel jLabel4
= null;
102 private JTextField jTextField2
= null;
103 private JLabel jLabel5
= null;
104 private JTextField jTextField3
= null;
105 private JLabel jLabel6
= null;
106 private JButton jButton4
= null;
107 private JButton jButton5
= null;
108 private JLabel jLabel7
= null;
109 public FpdPlatformDefs() {
111 // TODO Auto-generated constructor stub
114 this.setBounds(new java
.awt
.Rectangle(0, 0, 500, 370));
115 this.setVisible(true);
118 public FpdPlatformDefs(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
){
120 ffc
= new FpdFileContents(fpd
);
125 * This method initializes jPanel
127 * @return javax.swing.JPanel
129 private JPanel
getJPanel() {
130 if (jPanel
== null) {
131 jPanel
= new JPanel();
137 * This method initializes jPanel1
139 * @return javax.swing.JPanel
141 private JPanel
getJPanel1() {
142 if (jPanel1
== null) {
143 FlowLayout flowLayout
= new FlowLayout();
144 flowLayout
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
145 flowLayout
.setHgap(15);
146 jPanel1
= new JPanel();
147 jPanel1
.setLayout(flowLayout
);
148 jPanel1
.setComponentOrientation(java
.awt
.ComponentOrientation
.LEFT_TO_RIGHT
);
149 jPanel1
.add(getJButtonCancel(), null);
150 jPanel1
.add(getJButtonOk(), null);
156 * This method initializes jPanel2
158 * @return javax.swing.JPanel
160 private JPanel
getJPanel2() {
161 if (jPanel2
== null) {
162 jPanel2
= new JPanel();
168 * This method initializes jPanel3
170 * @return javax.swing.JPanel
172 private JPanel
getJPanel3() {
173 if (jPanel3
== null) {
174 jPanel3
= new JPanel();
180 * This method initializes jTabbedPane
182 * @return javax.swing.JTabbedPane
184 private JTabbedPane
getJTabbedPane() {
185 if (jTabbedPane
== null) {
186 jTabbedPane
= new JTabbedPane();
188 jTabbedPane
.addTab("General", null, getJPanel4(), null);
195 * This method initializes jButtonOk
197 * @return javax.swing.JButton
199 private JButton
getJButtonOk() {
200 if (jButtonOk
== null) {
201 jButtonOk
= new JButton();
202 jButtonOk
.setPreferredSize(new java
.awt
.Dimension(80,20));
203 jButtonOk
.setText("Cancel");
204 jButtonOk
.setVisible(false);
210 * This method initializes jButtonCancel
212 * @return javax.swing.JButton
214 private JButton
getJButtonCancel() {
215 if (jButtonCancel
== null) {
216 jButtonCancel
= new JButton();
217 jButtonCancel
.setPreferredSize(new java
.awt
.Dimension(80,20));
218 jButtonCancel
.setText("Ok");
219 jButtonCancel
.setVisible(false);
221 return jButtonCancel
;
225 * This method initializes jPanelFvImageW
227 * @return javax.swing.JPanel
229 private JPanel
getJPanelFvImageW() {
230 if (jPanelFvImageW
== null) {
231 jPanelFvImageW
= new JPanel();
232 jPanelFvImageW
.setPreferredSize(new java
.awt
.Dimension(10,2));
234 return jPanelFvImageW
;
239 * This method initializes this
243 private void initialize() {
244 this.setSize(518, 650);
245 this.setDefaultCloseOperation(javax
.swing
.WindowConstants
.DISPOSE_ON_CLOSE
);
246 this.setContentPane(getJContentPane());
247 this.setTitle("FPD Platform Definitions");
248 this.addInternalFrameListener(new InternalFrameAdapter(){
249 public void internalFrameDeactivated(InternalFrameEvent e
){
250 if (jTable
.isEditing()) {
251 jTable
.getCellEditor().stopCellEditing();
253 if (jTable2
.isEditing()) {
254 jTable2
.getCellEditor().stopCellEditing();
261 private void init(FpdFileContents ffc
) {
268 * This method initializes jContentPane
270 * @return javax.swing.JPanel
272 private JPanel
getJContentPane() {
273 if (jContentPane
== null) {
274 jContentPane
= new JPanel();
275 jContentPane
.setLayout(new BorderLayout());
276 jContentPane
.add(getJPanel(), java
.awt
.BorderLayout
.EAST
);
277 jContentPane
.add(getJPanel1(), java
.awt
.BorderLayout
.SOUTH
);
278 jContentPane
.add(getJPanel2(), java
.awt
.BorderLayout
.WEST
);
279 jContentPane
.add(getJPanel3(), java
.awt
.BorderLayout
.NORTH
);
280 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
286 * This method initializes jPanel4
288 * @return javax.swing.JPanel
290 private JPanel
getJPanel4() {
291 if (jPanel4
== null) {
292 jPanel4
= new JPanel();
293 jPanel4
.setLayout(new BorderLayout());
294 jPanel4
.add(getJPanel5(), java
.awt
.BorderLayout
.NORTH
);
295 jPanel4
.add(getJPanel6(), java
.awt
.BorderLayout
.SOUTH
);
296 jPanel4
.add(getJPanel7(), java
.awt
.BorderLayout
.CENTER
);
302 * This method initializes jPanel5
304 * @return javax.swing.JPanel
306 private JPanel
getJPanel5() {
307 if (jPanel5
== null) {
308 jLabel
= new JLabel();
309 jLabel
.setText("Tool Chain Families");
310 FlowLayout flowLayout2
= new FlowLayout();
311 flowLayout2
.setAlignment(FlowLayout
.LEFT
);
312 flowLayout2
.setHgap(20);
313 jPanel5
= new JPanel();
314 jPanel5
.setLayout(flowLayout2
);
315 jPanel5
.add(jLabel
, null);
316 jPanel5
.add(getJCheckBox1(), null);
317 jPanel5
.add(getJCheckBox2(), null);
318 jPanel5
.add(getJCheckBox3(), null);
324 * This method initializes jCheckBox1
326 * @return javax.swing.JCheckBox
328 private JCheckBox
getJCheckBox1() {
329 if (jCheckBox1
== null) {
330 jCheckBox1
= new JCheckBox();
331 jCheckBox1
.setText("MSFT");
337 * This method initializes jCheckBox2
339 * @return javax.swing.JCheckBox
341 private JCheckBox
getJCheckBox2() {
342 if (jCheckBox2
== null) {
343 jCheckBox2
= new JCheckBox();
344 jCheckBox2
.setText("GCC");
350 * This method initializes jCheckBox3
352 * @return javax.swing.JCheckBox
354 private JCheckBox
getJCheckBox3() {
355 if (jCheckBox3
== null) {
356 jCheckBox3
= new JCheckBox();
357 jCheckBox3
.setText("INTC");
363 * This method initializes jTable
365 * @return javax.swing.JTable
367 private JTable
getJTable() {
368 if (jTable
== null) {
369 imageEntryPointTableModel
= new DefaultTableModel();
370 imageEntryPointTableModel
.addColumn("Build Target");
376 * This method initializes jTable1
378 * @return javax.swing.JTable
380 private JTable
getJTable1() {
381 if (jTable1
== null) {
382 outputDirectoryTableModel
= new DefaultTableModel();
383 outputDirectoryTableModel
.addColumn("Output Directory");
384 outputDirectoryTableModel
.addColumn("Intermediate Directories");
386 TableColumn imDirCol
= jTable1
.getColumnModel().getColumn(1);
387 JComboBox cb
= new JComboBox();
388 cb
.addItem("MODULE");
389 cb
.addItem("UNIFIED");
390 imDirCol
.setCellEditor(new DefaultCellEditor(cb
));
397 * This method initializes jPanel6
399 * @return javax.swing.JPanel
401 private JPanel
getJPanel6() {
402 if (jPanel6
== null) {
403 jLabel7
= new JLabel();
404 jLabel7
.setPreferredSize(new java
.awt
.Dimension(100,20));
406 jLabel1
= new JLabel();
407 jLabel1
.setText("Output Directory");
408 FlowLayout flowLayout3
= new FlowLayout();
409 flowLayout3
.setAlignment(FlowLayout
.LEFT
);
410 flowLayout3
.setHgap(20);
411 jPanel6
= new JPanel();
412 jPanel6
.setPreferredSize(new java
.awt
.Dimension(10,250));
413 jPanel6
.setLayout(flowLayout3
);
414 jPanel6
.add(getJCheckBox4(), null);
415 jPanel6
.add(getJComboBox(), null);
416 jPanel6
.add(jLabel7
, null);
417 jPanel6
.add(jLabel1
, null);
418 jPanel6
.add(getJTextField(), null);
424 * This method initializes jCheckBox4
426 * @return javax.swing.JCheckBox
428 private JCheckBox
getJCheckBox4() {
429 if (jCheckBox4
== null) {
430 jCheckBox4
= new JCheckBox();
431 jCheckBox4
.setText("Intermediate Directories");
437 * This method initializes jComboBox
439 * @return javax.swing.JComboBox
441 private JComboBox
getJComboBox() {
442 if (jComboBox
== null) {
443 jComboBox
= new JComboBox();
444 jComboBox
.setPreferredSize(new Dimension(100, 20));
445 jComboBox
.addItem("MODULE");
446 jComboBox
.addItem("UNIFIED");
447 jComboBox
.setSelectedIndex(0);
453 * This method initializes jTextField
455 * @return javax.swing.JTextField
457 private JTextField
getJTextField() {
458 if (jTextField
== null) {
459 jTextField
= new JTextField();
460 jTextField
.setPreferredSize(new java
.awt
.Dimension(350,20));
466 * This method initializes jPanel7
468 * @return javax.swing.JPanel
470 private JPanel
getJPanel7() {
471 if (jPanel7
== null) {
472 jLabel6
= new JLabel();
473 jLabel6
.setPreferredSize(new java
.awt
.Dimension(280,20));
474 jLabel6
.setText(" ");
475 jLabel5
= new JLabel();
476 jLabel5
.setPreferredSize(new java
.awt
.Dimension(40,20));
477 jLabel5
.setText("Name");
478 jLabel4
= new JLabel();
479 jLabel4
.setPreferredSize(new java
.awt
.Dimension(20,20));
480 jLabel4
.setText("ID");
481 jLabel3
= new JLabel();
482 jLabel3
.setPreferredSize(new java
.awt
.Dimension(109,20));
483 jLabel3
.setText("SKU Information");
484 jLabel2
= new JLabel();
485 jLabel2
.setPreferredSize(new Dimension(109, 16));
486 jLabel2
.setText("Build Targets");
487 FlowLayout flowLayout4
= new FlowLayout();
488 flowLayout4
.setAlignment(FlowLayout
.LEFT
);
489 flowLayout4
.setHgap(20);
490 jPanel7
= new JPanel();
491 jPanel7
.setPreferredSize(new Dimension(972, 100));
492 jPanel7
.setLayout(flowLayout4
);
493 jPanel7
.add(jLabel2
, null);
494 jPanel7
.add(getJTextField1(), null);
495 jPanel7
.add(getJButton2(), null);
496 jPanel7
.add(getJButton3(), null);
497 jPanel7
.add(getJScrollPane2(), null);
498 jPanel7
.add(jLabel3
, null);
499 jPanel7
.add(jLabel4
, null);
500 jPanel7
.add(getJTextField2(), null);
501 jPanel7
.add(jLabel5
, null);
502 jPanel7
.add(getJTextField3(), null);
503 jPanel7
.add(getJScrollPane3(), null);
504 jPanel7
.add(jLabel6
, null);
505 jPanel7
.add(getJButton4(), null);
506 jPanel7
.add(getJButton5(), null);
512 * This method initializes jTextField1
514 * @return javax.swing.JTextField
516 private JTextField
getJTextField1() {
517 if (jTextField1
== null) {
518 jTextField1
= new JTextField();
519 jTextField1
.setPreferredSize(new Dimension(150, 20));
525 * This method initializes jButton2
527 * @return javax.swing.JButton
529 private JButton
getJButton2() {
530 if (jButton2
== null) {
531 jButton2
= new JButton();
532 jButton2
.setPreferredSize(new Dimension(70, 20));
533 jButton2
.setText("Add");
539 * This method initializes jButton3
541 * @return javax.swing.JButton
543 private JButton
getJButton3() {
544 if (jButton3
== null) {
545 jButton3
= new JButton();
546 jButton3
.setPreferredSize(new Dimension(70, 20));
547 jButton3
.setText("Delete");
553 * This method initializes jScrollPane2
555 * @return javax.swing.JScrollPane
557 private JScrollPane
getJScrollPane2() {
558 if (jScrollPane2
== null) {
559 jScrollPane2
= new JScrollPane();
560 jScrollPane2
.setPreferredSize(new Dimension(453, 100));
561 jScrollPane2
.setViewportView(getJTable());
567 * This method initializes jScrollPane3
569 * @return javax.swing.JScrollPane
571 private JScrollPane
getJScrollPane3() {
572 if (jScrollPane3
== null) {
573 jScrollPane3
= new JScrollPane();
574 jScrollPane3
.setPreferredSize(new java
.awt
.Dimension(453,100));
575 jScrollPane3
.setViewportView(getJTable2());
581 * This method initializes jTable2
583 * @return javax.swing.JTable
585 private JTable
getJTable2() {
586 if (jTable2
== null) {
587 skuInfoTableModel
= new DefaultTableModel();
588 skuInfoTableModel
.addColumn("SKU ID");
589 skuInfoTableModel
.addColumn("Name");
590 jTable2
= new JTable(skuInfoTableModel
);
596 * This method initializes jTextField2
598 * @return javax.swing.JTextField
600 private JTextField
getJTextField2() {
601 if (jTextField2
== null) {
602 jTextField2
= new JTextField();
603 jTextField2
.setPreferredSize(new java
.awt
.Dimension(50,20));
609 * This method initializes jTextField3
611 * @return javax.swing.JTextField
613 private JTextField
getJTextField3() {
614 if (jTextField3
== null) {
615 jTextField3
= new JTextField();
616 jTextField3
.setPreferredSize(new Dimension(150, 20));
622 * This method initializes jButton4
624 * @return javax.swing.JButton
626 private JButton
getJButton4() {
627 if (jButton4
== null) {
628 jButton4
= new JButton();
629 jButton4
.setPreferredSize(new Dimension(70, 20));
630 jButton4
.setText("Add");
636 * This method initializes jButton5
638 * @return javax.swing.JButton
640 private JButton
getJButton5() {
641 if (jButton5
== null) {
642 jButton5
= new JButton();
643 jButton5
.setPreferredSize(new Dimension(70, 20));
644 jButton5
.setText("Delete");
650 } // @jve:decl-index=0:visual-constraint="10,10"