]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java
Modify BuildOptions and Flash editors in FPD file.
[mirror_edk2.git] / Tools / 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.AbstractAction;
19 import javax.swing.ButtonGroup;
20 import javax.swing.DefaultCellEditor;
21 import javax.swing.DefaultListModel;
22 import javax.swing.JDialog;
23 import javax.swing.JFileChooser;
24 import javax.swing.JFrame;
25 import javax.swing.JInternalFrame;
26 import javax.swing.JOptionPane;
27 import javax.swing.JTabbedPane;
28 import javax.swing.JButton;
29 import javax.swing.ListSelectionModel;
30
31 import org.tianocore.PlatformSurfaceAreaDocument;
32 import org.tianocore.frameworkwizard.common.Tools;
33 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
34 import org.tianocore.frameworkwizard.common.ui.StarLabel;
35
36
37 import java.awt.FlowLayout;
38 import java.awt.event.ActionEvent;
39 import java.awt.event.ActionListener;
40 import java.awt.event.ComponentAdapter;
41 import java.awt.event.ComponentEvent;
42 import java.awt.event.FocusAdapter;
43 import java.awt.event.FocusEvent;
44 import java.awt.event.FocusListener;
45 import java.awt.event.ItemEvent;
46 import java.awt.event.ItemListener;
47 import java.awt.event.ActionEvent;
48 import java.io.File;
49 import java.util.ArrayList;
50 import java.util.Iterator;
51 import java.util.LinkedHashMap;
52 import java.util.Map;
53 import java.util.Set;
54
55 import javax.swing.JCheckBox;
56 import javax.swing.JTextField;
57 import java.awt.GridLayout;
58 import javax.swing.JLabel;
59 import javax.swing.JScrollPane;
60 import javax.swing.JTable;
61 import javax.swing.JList;
62 import javax.swing.event.ListSelectionEvent;
63 import javax.swing.event.ListSelectionListener;
64 import javax.swing.event.TableModelEvent;
65 import javax.swing.event.TableModelListener;
66 import javax.swing.table.DefaultTableModel;
67 import javax.swing.table.TableColumn;
68 import javax.swing.table.TableModel;
69 import javax.swing.JComboBox;
70 import java.awt.Dimension;
71 import javax.swing.JRadioButton;
72 import javax.swing.JTextArea;
73 import java.awt.CardLayout;
74
75 public class FpdPlatformDefs extends IInternalFrame {
76
77 static JFrame frame;
78 private JPanel jContentPane = null;
79 private JPanel jPanel = null;
80 private JPanel jPanel1 = null;
81 private JPanel jPanel2 = null;
82 private JPanel jPanel3 = null;
83 private JTabbedPane jTabbedPane = null;
84 private JButton jButtonOk = null;
85 private JButton jButtonCancel = null;
86 private JPanel jPanelFvImageW = null;
87 private JScrollPane jScrollPane = null;
88 private DefaultTableModel imageEntryPointTableModel = null;
89 private DefaultTableModel outputDirectoryTableModel = null;
90
91 private DefaultTableModel skuInfoTableModel = null;
92 private DefaultTableModel fdfBlocksTableModel = null;
93 private DefaultTableModel fdfRegionsTableModel = null;
94 private DefaultTableModel fdfSubRegionsTableModel = null;
95
96 private JLabel jLabel17 = null;
97 private DefaultListModel listModel = new DefaultListModel();
98 private FpdFileContents ffc = null;
99 private JPanel jPanel4 = null;
100 private JPanel jPanel5 = null;
101 private JLabel jLabel = null;
102 private JCheckBox jCheckBox1 = null;
103 private JCheckBox jCheckBox2 = null;
104 private JCheckBox jCheckBox3 = null;
105 private JPanel jPanel6 = null;
106 private JLabel jLabel1 = null;
107 private JCheckBox jCheckBox4 = null;
108 private JComboBox jComboBox = null;
109 private JTextField jTextField = null;
110 private JTable jTable = null;
111 private JPanel jPanel7 = null;
112 private JLabel jLabel2 = null;
113 private JTextField jTextField1 = null;
114 private JButton jButton2 = null;
115 private JButton jButton3 = null;
116 private JScrollPane jScrollPane2 = null;
117 private JTable jTable1 = null;
118 private JLabel jLabel3 = null;
119 private JScrollPane jScrollPane3 = null;
120 private JTable jTable2 = null;
121 private JLabel jLabel4 = null;
122 private JTextField jTextField2 = null;
123 private JLabel jLabel5 = null;
124 private JTextField jTextField3 = null;
125 private JLabel jLabel6 = null;
126 private JButton jButton4 = null;
127 private JButton jButton5 = null;
128 private JLabel jLabel7 = null;
129 public FpdPlatformDefs() {
130 super();
131 // TODO Auto-generated constructor stub
132
133 initialize();
134 this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
135 this.setVisible(true);
136 }
137
138 public FpdPlatformDefs(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
139 this();
140 ffc = new FpdFileContents(fpd);
141 init(ffc);
142 }
143
144 /**
145 * This method initializes jPanel
146 *
147 * @return javax.swing.JPanel
148 */
149 private JPanel getJPanel() {
150 if (jPanel == null) {
151 jPanel = new JPanel();
152 }
153 return jPanel;
154 }
155
156 /**
157 * This method initializes jPanel1
158 *
159 * @return javax.swing.JPanel
160 */
161 private JPanel getJPanel1() {
162 if (jPanel1 == null) {
163 FlowLayout flowLayout = new FlowLayout();
164 flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
165 flowLayout.setHgap(15);
166 jPanel1 = new JPanel();
167 jPanel1.setLayout(flowLayout);
168 jPanel1.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
169 jPanel1.add(getJButtonCancel(), null);
170 jPanel1.add(getJButtonOk(), null);
171 }
172 return jPanel1;
173 }
174
175 /**
176 * This method initializes jPanel2
177 *
178 * @return javax.swing.JPanel
179 */
180 private JPanel getJPanel2() {
181 if (jPanel2 == null) {
182 jPanel2 = new JPanel();
183 }
184 return jPanel2;
185 }
186
187 /**
188 * This method initializes jPanel3
189 *
190 * @return javax.swing.JPanel
191 */
192 private JPanel getJPanel3() {
193 if (jPanel3 == null) {
194 jPanel3 = new JPanel();
195 }
196 return jPanel3;
197 }
198
199 /**
200 * This method initializes jTabbedPane
201 *
202 * @return javax.swing.JTabbedPane
203 */
204 private JTabbedPane getJTabbedPane() {
205 if (jTabbedPane == null) {
206 jTabbedPane = new JTabbedPane();
207
208 jTabbedPane.addTab("General", null, getJPanel4(), null);
209
210 }
211 return jTabbedPane;
212 }
213
214 /**
215 * This method initializes jButtonOk
216 *
217 * @return javax.swing.JButton
218 */
219 private JButton getJButtonOk() {
220 if (jButtonOk == null) {
221 jButtonOk = new JButton();
222 jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
223 jButtonOk.setText("Cancel");
224 jButtonOk.setVisible(false);
225 }
226 return jButtonOk;
227 }
228
229 /**
230 * This method initializes jButtonCancel
231 *
232 * @return javax.swing.JButton
233 */
234 private JButton getJButtonCancel() {
235 if (jButtonCancel == null) {
236 jButtonCancel = new JButton();
237 jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
238 jButtonCancel.setText("Ok");
239 jButtonCancel.setVisible(false);
240 }
241 return jButtonCancel;
242 }
243
244 /**
245 * This method initializes jPanelFvImageW
246 *
247 * @return javax.swing.JPanel
248 */
249 private JPanel getJPanelFvImageW() {
250 if (jPanelFvImageW == null) {
251 jPanelFvImageW = new JPanel();
252 jPanelFvImageW.setPreferredSize(new java.awt.Dimension(10,2));
253 }
254 return jPanelFvImageW;
255 }
256
257
258 /**
259 * This method initializes this
260 *
261 * @return void
262 */
263 private void initialize() {
264 this.setSize(518, 650);
265 this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
266 this.setContentPane(getJContentPane());
267 this.setTitle("FPD Platform Definitions");
268 }
269
270 private void init(FpdFileContents ffc) {
271
272 }
273
274
275
276 /**
277 * This method initializes jContentPane
278 *
279 * @return javax.swing.JPanel
280 */
281 private JPanel getJContentPane() {
282 if (jContentPane == null) {
283 jContentPane = new JPanel();
284 jContentPane.setLayout(new BorderLayout());
285 jContentPane.add(getJPanel(), java.awt.BorderLayout.EAST);
286 jContentPane.add(getJPanel1(), java.awt.BorderLayout.SOUTH);
287 jContentPane.add(getJPanel2(), java.awt.BorderLayout.WEST);
288 jContentPane.add(getJPanel3(), java.awt.BorderLayout.NORTH);
289 jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
290 }
291 return jContentPane;
292 }
293
294 /**
295 * This method initializes jPanel4
296 *
297 * @return javax.swing.JPanel
298 */
299 private JPanel getJPanel4() {
300 if (jPanel4 == null) {
301 jPanel4 = new JPanel();
302 jPanel4.setLayout(new BorderLayout());
303 jPanel4.add(getJPanel5(), java.awt.BorderLayout.NORTH);
304 jPanel4.add(getJPanel6(), java.awt.BorderLayout.SOUTH);
305 jPanel4.add(getJPanel7(), java.awt.BorderLayout.CENTER);
306 }
307 return jPanel4;
308 }
309
310 /**
311 * This method initializes jPanel5
312 *
313 * @return javax.swing.JPanel
314 */
315 private JPanel getJPanel5() {
316 if (jPanel5 == null) {
317 jLabel = new JLabel();
318 jLabel.setText("Tool Chain Families");
319 FlowLayout flowLayout2 = new FlowLayout();
320 flowLayout2.setAlignment(FlowLayout.LEFT);
321 flowLayout2.setHgap(20);
322 jPanel5 = new JPanel();
323 jPanel5.setLayout(flowLayout2);
324 jPanel5.add(jLabel, null);
325 jPanel5.add(getJCheckBox1(), null);
326 jPanel5.add(getJCheckBox2(), null);
327 jPanel5.add(getJCheckBox3(), null);
328 }
329 return jPanel5;
330 }
331
332 /**
333 * This method initializes jCheckBox1
334 *
335 * @return javax.swing.JCheckBox
336 */
337 private JCheckBox getJCheckBox1() {
338 if (jCheckBox1 == null) {
339 jCheckBox1 = new JCheckBox();
340 jCheckBox1.setText("MSFT");
341 }
342 return jCheckBox1;
343 }
344
345 /**
346 * This method initializes jCheckBox2
347 *
348 * @return javax.swing.JCheckBox
349 */
350 private JCheckBox getJCheckBox2() {
351 if (jCheckBox2 == null) {
352 jCheckBox2 = new JCheckBox();
353 jCheckBox2.setText("GCC");
354 }
355 return jCheckBox2;
356 }
357
358 /**
359 * This method initializes jCheckBox3
360 *
361 * @return javax.swing.JCheckBox
362 */
363 private JCheckBox getJCheckBox3() {
364 if (jCheckBox3 == null) {
365 jCheckBox3 = new JCheckBox();
366 jCheckBox3.setText("INTC");
367 }
368 return jCheckBox3;
369 }
370
371 /**
372 * This method initializes jTable
373 *
374 * @return javax.swing.JTable
375 */
376 private JTable getJTable() {
377 if (jTable == null) {
378 imageEntryPointTableModel = new DefaultTableModel();
379 imageEntryPointTableModel.addColumn("Build Target");
380 }
381 return jTable;
382 }
383
384 /**
385 * This method initializes jTable1
386 *
387 * @return javax.swing.JTable
388 */
389 private JTable getJTable1() {
390 if (jTable1 == null) {
391 outputDirectoryTableModel = new DefaultTableModel();
392 outputDirectoryTableModel.addColumn("Output Directory");
393 outputDirectoryTableModel.addColumn("Intermediate Directories");
394
395 TableColumn imDirCol = jTable1.getColumnModel().getColumn(1);
396 JComboBox cb = new JComboBox();
397 cb.addItem("MODULE");
398 cb.addItem("UNIFIED");
399 imDirCol.setCellEditor(new DefaultCellEditor(cb));
400 }
401 return jTable1;
402 }
403
404
405 /**
406 * This method initializes jPanel6
407 *
408 * @return javax.swing.JPanel
409 */
410 private JPanel getJPanel6() {
411 if (jPanel6 == null) {
412 jLabel7 = new JLabel();
413 jLabel7.setPreferredSize(new java.awt.Dimension(100,20));
414 jLabel7.setText("");
415 jLabel1 = new JLabel();
416 jLabel1.setText("Output Directory");
417 FlowLayout flowLayout3 = new FlowLayout();
418 flowLayout3.setAlignment(FlowLayout.LEFT);
419 flowLayout3.setHgap(20);
420 jPanel6 = new JPanel();
421 jPanel6.setPreferredSize(new java.awt.Dimension(10,250));
422 jPanel6.setLayout(flowLayout3);
423 jPanel6.add(getJCheckBox4(), null);
424 jPanel6.add(getJComboBox(), null);
425 jPanel6.add(jLabel7, null);
426 jPanel6.add(jLabel1, null);
427 jPanel6.add(getJTextField(), null);
428 }
429 return jPanel6;
430 }
431
432 /**
433 * This method initializes jCheckBox4
434 *
435 * @return javax.swing.JCheckBox
436 */
437 private JCheckBox getJCheckBox4() {
438 if (jCheckBox4 == null) {
439 jCheckBox4 = new JCheckBox();
440 jCheckBox4.setText("Intermediate Directories");
441 }
442 return jCheckBox4;
443 }
444
445 /**
446 * This method initializes jComboBox
447 *
448 * @return javax.swing.JComboBox
449 */
450 private JComboBox getJComboBox() {
451 if (jComboBox == null) {
452 jComboBox = new JComboBox();
453 jComboBox.setPreferredSize(new Dimension(100, 20));
454 jComboBox.addItem("MODULE");
455 jComboBox.addItem("UNIFIED");
456 jComboBox.setSelectedIndex(0);
457 }
458 return jComboBox;
459 }
460
461 /**
462 * This method initializes jTextField
463 *
464 * @return javax.swing.JTextField
465 */
466 private JTextField getJTextField() {
467 if (jTextField == null) {
468 jTextField = new JTextField();
469 jTextField.setPreferredSize(new java.awt.Dimension(350,20));
470 }
471 return jTextField;
472 }
473
474 /**
475 * This method initializes jPanel7
476 *
477 * @return javax.swing.JPanel
478 */
479 private JPanel getJPanel7() {
480 if (jPanel7 == null) {
481 jLabel6 = new JLabel();
482 jLabel6.setPreferredSize(new java.awt.Dimension(280,20));
483 jLabel6.setText(" ");
484 jLabel5 = new JLabel();
485 jLabel5.setPreferredSize(new java.awt.Dimension(40,20));
486 jLabel5.setText("Name");
487 jLabel4 = new JLabel();
488 jLabel4.setPreferredSize(new java.awt.Dimension(20,20));
489 jLabel4.setText("ID");
490 jLabel3 = new JLabel();
491 jLabel3.setPreferredSize(new java.awt.Dimension(109,20));
492 jLabel3.setText("SKU Information");
493 jLabel2 = new JLabel();
494 jLabel2.setPreferredSize(new Dimension(109, 16));
495 jLabel2.setText("Build Targets");
496 FlowLayout flowLayout4 = new FlowLayout();
497 flowLayout4.setAlignment(FlowLayout.LEFT);
498 flowLayout4.setHgap(20);
499 jPanel7 = new JPanel();
500 jPanel7.setPreferredSize(new Dimension(972, 100));
501 jPanel7.setLayout(flowLayout4);
502 jPanel7.add(jLabel2, null);
503 jPanel7.add(getJTextField1(), null);
504 jPanel7.add(getJButton2(), null);
505 jPanel7.add(getJButton3(), null);
506 jPanel7.add(getJScrollPane2(), null);
507 jPanel7.add(jLabel3, null);
508 jPanel7.add(jLabel4, null);
509 jPanel7.add(getJTextField2(), null);
510 jPanel7.add(jLabel5, null);
511 jPanel7.add(getJTextField3(), null);
512 jPanel7.add(getJScrollPane3(), null);
513 jPanel7.add(jLabel6, null);
514 jPanel7.add(getJButton4(), null);
515 jPanel7.add(getJButton5(), null);
516 }
517 return jPanel7;
518 }
519
520 /**
521 * This method initializes jTextField1
522 *
523 * @return javax.swing.JTextField
524 */
525 private JTextField getJTextField1() {
526 if (jTextField1 == null) {
527 jTextField1 = new JTextField();
528 jTextField1.setPreferredSize(new Dimension(150, 20));
529 }
530 return jTextField1;
531 }
532
533 /**
534 * This method initializes jButton2
535 *
536 * @return javax.swing.JButton
537 */
538 private JButton getJButton2() {
539 if (jButton2 == null) {
540 jButton2 = new JButton();
541 jButton2.setPreferredSize(new Dimension(70, 20));
542 jButton2.setText("Add");
543 }
544 return jButton2;
545 }
546
547 /**
548 * This method initializes jButton3
549 *
550 * @return javax.swing.JButton
551 */
552 private JButton getJButton3() {
553 if (jButton3 == null) {
554 jButton3 = new JButton();
555 jButton3.setPreferredSize(new Dimension(70, 20));
556 jButton3.setText("Delete");
557 }
558 return jButton3;
559 }
560
561 /**
562 * This method initializes jScrollPane2
563 *
564 * @return javax.swing.JScrollPane
565 */
566 private JScrollPane getJScrollPane2() {
567 if (jScrollPane2 == null) {
568 jScrollPane2 = new JScrollPane();
569 jScrollPane2.setPreferredSize(new Dimension(453, 100));
570 jScrollPane2.setViewportView(getJTable());
571 }
572 return jScrollPane2;
573 }
574
575 /**
576 * This method initializes jScrollPane3
577 *
578 * @return javax.swing.JScrollPane
579 */
580 private JScrollPane getJScrollPane3() {
581 if (jScrollPane3 == null) {
582 jScrollPane3 = new JScrollPane();
583 jScrollPane3.setPreferredSize(new java.awt.Dimension(453,100));
584 jScrollPane3.setViewportView(getJTable2());
585 }
586 return jScrollPane3;
587 }
588
589 /**
590 * This method initializes jTable2
591 *
592 * @return javax.swing.JTable
593 */
594 private JTable getJTable2() {
595 if (jTable2 == null) {
596 skuInfoTableModel = new DefaultTableModel();
597 skuInfoTableModel.addColumn("SKU ID");
598 skuInfoTableModel.addColumn("Name");
599 jTable2 = new JTable(skuInfoTableModel);
600 }
601 return jTable2;
602 }
603
604 /**
605 * This method initializes jTextField2
606 *
607 * @return javax.swing.JTextField
608 */
609 private JTextField getJTextField2() {
610 if (jTextField2 == null) {
611 jTextField2 = new JTextField();
612 jTextField2.setPreferredSize(new java.awt.Dimension(50,20));
613 }
614 return jTextField2;
615 }
616
617 /**
618 * This method initializes jTextField3
619 *
620 * @return javax.swing.JTextField
621 */
622 private JTextField getJTextField3() {
623 if (jTextField3 == null) {
624 jTextField3 = new JTextField();
625 jTextField3.setPreferredSize(new Dimension(150, 20));
626 }
627 return jTextField3;
628 }
629
630 /**
631 * This method initializes jButton4
632 *
633 * @return javax.swing.JButton
634 */
635 private JButton getJButton4() {
636 if (jButton4 == null) {
637 jButton4 = new JButton();
638 jButton4.setPreferredSize(new Dimension(70, 20));
639 jButton4.setText("Add");
640 }
641 return jButton4;
642 }
643
644 /**
645 * This method initializes jButton5
646 *
647 * @return javax.swing.JButton
648 */
649 private JButton getJButton5() {
650 if (jButton5 == null) {
651 jButton5 = new JButton();
652 jButton5.setPreferredSize(new Dimension(70, 20));
653 jButton5.setText("Delete");
654 }
655 return jButton5;
656 }
657
658
659 } // @jve:decl-index=0:visual-constraint="10,10"
660
661