]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java
Mark Guid Type as required in Guid declaration editor. Set cell editor to long text...
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / packaging / ui / SpdGuidDecls.java
1 /** @file
2 Java class SpdGuidDecls is GUI for create library definition elements of 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.packaging.ui;
14
15 import java.awt.Dimension;
16 import java.awt.Point;
17 import java.awt.event.ActionEvent;
18 import java.awt.event.ComponentEvent;
19 import java.util.Vector;
20
21 import javax.swing.JOptionPane;
22 import javax.swing.JPanel;
23 import javax.swing.JTable;
24 import javax.swing.JTextField;
25 import javax.swing.JLabel;
26 import javax.swing.JScrollPane;
27 import javax.swing.JButton;
28 import javax.swing.JFrame;
29 import javax.swing.ListSelectionModel;
30 import javax.swing.event.InternalFrameAdapter;
31 import javax.swing.event.InternalFrameEvent;
32 import javax.swing.event.ListSelectionEvent;
33 import javax.swing.event.ListSelectionListener;
34 import javax.swing.event.TableModelEvent;
35 import javax.swing.event.TableModelListener;
36 import javax.swing.table.DefaultTableModel;
37 import javax.swing.table.TableModel;
38
39 import org.tianocore.PackageSurfaceAreaDocument;
40 import org.tianocore.frameworkwizard.common.DataValidation;
41 import org.tianocore.frameworkwizard.common.Tools;
42 import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
43 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
44 import org.tianocore.frameworkwizard.common.ui.StarLabel;
45 import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
46 import org.tianocore.frameworkwizard.platform.ui.ListEditor;
47 import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
48
49 /**
50 GUI for create library definition elements of spd file.
51
52 @since PackageEditor 1.0
53 **/
54 public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
55 /**
56 *
57 */
58 private static final long serialVersionUID = 1L;
59
60 static JFrame frame;
61
62 private SpdFileContents sfc = null;
63
64 private OpeningPackageType docConsole = null;
65
66 private JTable jTable = null;
67
68 private DefaultTableModel model = null;
69
70 private JPanel jContentPane = null;
71
72 private JTextField jTextFieldGuid = null;
73
74 private JScrollPane jScrollPane = null;
75
76 private JButton jButtonAdd = null;
77
78 private JButton jButtonRemove = null;
79
80 private JButton jButtonClearAll = null;
81
82 private JButton jButtonCancel = null;
83
84 private JButton jButtonOk = null;
85
86 private JButton jButtonGen = null;
87
88 private StarLabel jStarLabel1 = null;
89
90 private StarLabel jStarLabel2 = null;
91
92 private StarLabel jStarLabel3 = null;
93
94 private StarLabel jStarLabel4 = null;
95
96 protected int selectedRow = -1;
97
98 private JLabel jLabelName = null;
99
100 private JScrollPane jScrollPaneModule = null;
101
102 private JTextField jTextFieldName = null;
103
104 private JScrollPane jScrollPaneArch = null;
105
106 private JScrollPane jScrollPaneGuid = null;
107
108 private JLabel jLabelGuid = null;
109
110 private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,213"
111
112 private JLabel jLabelCName = null;
113
114 private GenGuidDialog guidDialog = null;
115
116 private JTextField jTextFieldCName = null;
117
118 private JLabel jLabelHelp = null;
119
120 private JTextField jTextFieldHelp = null;
121
122 private JLabel jLabelSupMod = null;
123
124 private JLabel jLabelSupArch = null;
125
126 private ICheckBoxList iCheckBoxListArch = null;
127
128 private ICheckBoxList iCheckBoxListGuid = null;
129
130 private ICheckBoxList iCheckBoxListMod = null;
131
132 private JLabel jLabelGuidType = null;
133
134 protected String[][] saa = null;
135
136 protected StarLabel starLabel = null;
137
138 /**
139 This method initializes this
140
141 **/
142 protected void initialize() {
143
144 this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
145
146 }
147
148 /**
149 This method initializes jTextFieldGuid
150
151 @return javax.swing.JTextField
152 **/
153 protected JTextField getJTextFieldGuid() {
154 if (jTextFieldGuid == null) {
155 jTextFieldGuid = new JTextField();
156 jTextFieldGuid.setBounds(new java.awt.Rectangle(137,60,435,20));
157 jTextFieldGuid.setPreferredSize(new java.awt.Dimension(200,20));
158
159 }
160 return jTextFieldGuid;
161 }
162
163 /**
164 This method initializes jScrollPane
165
166 @return javax.swing.JScrollPane
167 **/
168 protected JScrollPane getJScrollPane() {
169 if (jScrollPane == null) {
170 jScrollPane = new JScrollPane();
171 jScrollPane.setBounds(new java.awt.Rectangle(5,256,472,292));
172 jScrollPane.setViewportView(getJTable());
173 }
174 return jScrollPane;
175 }
176
177 /**
178 This method initializes jTable
179
180 @return javax.swing.JTable
181 **/
182 protected JTable getJTable() {
183 if (jTable == null) {
184 model = new DefaultTableModel();
185 jTable = new JTable(model);
186 jTable.setRowHeight(20);
187 jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
188 model.addColumn("Name");
189 model.addColumn("The C Name");
190 model.addColumn("GUID Value");
191 model.addColumn("Help Text");
192 model.addColumn("Supported Architectures");
193 model.addColumn("Supported Module Types");
194 model.addColumn("GuidTypes");
195 jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());
196 jTable.getColumnModel().getColumn(3).setCellEditor(new LongTextEditor());
197
198 Vector<String> vArch = new Vector<String>();
199 vArch.add("IA32");
200 vArch.add("X64");
201 vArch.add("IPF");
202 vArch.add("EBC");
203 vArch.add("ARM");
204 vArch.add("PPC");
205 jTable.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch));
206
207 Vector<String> vModule = new Vector<String>();
208 vModule.add("BASE");
209 vModule.add("SEC");
210 vModule.add("PEI_CORE");
211 vModule.add("PEIM");
212 vModule.add("DXE_CORE");
213 vModule.add("DXE_DRIVER");
214 vModule.add("DXE_RUNTIME_DRIVER");
215 vModule.add("DXE_SAL_DRIVER");
216 vModule.add("DXE_SMM_DRIVER");
217 vModule.add("UEFI_DRIVER");
218 vModule.add("UEFI_APPLICATION");
219 vModule.add("USER_DEFINED");
220 jTable.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vModule));
221
222 Vector<String> vGuid = new Vector<String>();
223 vGuid.add("DATA_HUB_RECORD");
224 vGuid.add("EFI_EVENT");
225 vGuid.add("EFI_SYSTEM_CONFIGURATION_TABLE");
226 vGuid.add("EFI_VARIABLE");
227 vGuid.add("GUID");
228 vGuid.add("HII_PACKAGE_LIST");
229 vGuid.add("HOB");
230 vGuid.add("TOKEN_SPACE_GUID");
231 ListEditor le = new ListEditor(vGuid);
232 le.setCanNotBeEmpty(true);
233 jTable.getColumnModel().getColumn(6).setCellEditor(le);
234
235 jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
236 jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
237 public void valueChanged(ListSelectionEvent e) {
238 if (e.getValueIsAdjusting()){
239 return;
240 }
241 ListSelectionModel lsm = (ListSelectionModel)e.getSource();
242 if (lsm.isSelectionEmpty()) {
243 return;
244 }
245 else{
246 selectedRow = lsm.getMinSelectionIndex();
247
248 }
249 }
250 });
251
252 jTable.getModel().addTableModelListener(this);
253 }
254 return jTable;
255 }
256
257
258 public void tableChanged(TableModelEvent arg0) {
259 // TODO Auto-generated method stub
260 int row = arg0.getFirstRow();
261 int column = arg0.getColumn();
262 TableModel m = (TableModel)arg0.getSource();
263 if (arg0.getType() == TableModelEvent.UPDATE){
264
265 updateRow(row, column, m);
266 }
267 }
268
269 protected void updateRow(int row, int column, TableModel m){
270 String[] sa = new String[7];
271 sfc.getSpdGuidDeclaration(sa, row);
272 Object cellData = m.getValueAt(row, column);
273 if (cellData == null) {
274 cellData = "";
275 }
276 if (cellData.equals(sa[column])) {
277 return;
278 }
279
280 if (cellData.toString().length() == 0 && sa[column] == null) {
281 return;
282 }
283
284 String name = m.getValueAt(row, 0) + "";
285 String cName = m.getValueAt(row, 1) + "";
286 String guid = m.getValueAt(row, 2) + "";
287 String help = m.getValueAt(row, 3) + "";
288 String archList = null;
289 if (m.getValueAt(row, 4) != null){
290 archList = m.getValueAt(row, 4).toString();
291 }
292 String modTypeList = null;
293 if (m.getValueAt(row, 5) != null) {
294 modTypeList = m.getValueAt(row, 5).toString();
295 }
296 String guidTypeList = null;
297 if (m.getValueAt(row, 6) != null){
298 guidTypeList = m.getValueAt(row, 6).toString();
299 }
300 String[] rowData = {name, cName, guid, help};
301 if (!dataValidation(rowData)){
302 return;
303 }
304 if (docConsole != null) {
305 docConsole.setSaved(false);
306 }
307 sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
308 }
309 /**
310 This method initializes jButtonAdd
311
312 @return javax.swing.JButton
313 **/
314 protected JButton getJButtonAdd() {
315 if (jButtonAdd == null) {
316 jButtonAdd = new JButton();
317 jButtonAdd.setBounds(new java.awt.Rectangle(167,227,90,20));
318 jButtonAdd.setText("Add");
319 jButtonAdd.addActionListener(this);
320 }
321 return jButtonAdd;
322 }
323
324 /**
325 This method initializes jButtonRemove
326
327 @return javax.swing.JButton
328 **/
329 protected JButton getJButtonRemove() {
330 if (jButtonRemove == null) {
331 jButtonRemove = new JButton();
332 jButtonRemove.setBounds(new java.awt.Rectangle(270,227,90,20));
333 jButtonRemove.setText("Remove");
334 jButtonRemove.addActionListener(this);
335 }
336 return jButtonRemove;
337 }
338
339 /**
340 This method initializes jButtonRemoveAll
341
342 @return javax.swing.JButton
343 **/
344 protected JButton getJButtonClearAll() {
345 if (jButtonClearAll == null) {
346 jButtonClearAll = new JButton();
347 jButtonClearAll.setBounds(new java.awt.Rectangle(380,227,90,20));
348 jButtonClearAll.setText("Clear All");
349 jButtonClearAll.addActionListener(this);
350 }
351 return jButtonClearAll;
352 }
353
354 /**
355 This method initializes jButtonCancel
356
357 @return javax.swing.JButton
358 **/
359 protected JButton getJButtonCancel() {
360 if (jButtonCancel == null) {
361 jButtonCancel = new JButton();
362 jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
363 jButtonCancel.setLocation(new java.awt.Point(390, 305));
364 jButtonCancel.setText("Cancel");
365 jButtonCancel.setSize(new java.awt.Dimension(90, 20));
366 jButtonCancel.setVisible(false);
367 jButtonCancel.addActionListener(this);
368 }
369 return jButtonCancel;
370 }
371
372 /**
373 This method initializes jButton
374
375 @return javax.swing.JButton
376 **/
377 protected JButton getJButtonOk() {
378 if (jButtonOk == null) {
379 jButtonOk = new JButton();
380 jButtonOk.setSize(new java.awt.Dimension(90, 20));
381 jButtonOk.setText("OK");
382 jButtonOk.setLocation(new java.awt.Point(290, 305));
383 jButtonOk.setVisible(false);
384 jButtonOk.addActionListener(this);
385 }
386 return jButtonOk;
387 }
388
389 /**
390 This is the default constructor
391 **/
392 public SpdGuidDecls() {
393 super();
394 initialize();
395 init();
396
397 }
398
399 public SpdGuidDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){
400 this();
401 sfc = new SpdFileContents(inPsa);
402 init(sfc);
403 }
404
405 public SpdGuidDecls(OpeningPackageType opt) {
406 this(opt.getXmlSpd());
407 docConsole = opt;
408 }
409 /**
410 This method initializes this
411
412 @return void
413 **/
414 protected void init() {
415 this.setContentPane(getJContentPane());
416 this.addInternalFrameListener(new InternalFrameAdapter(){
417 public void internalFrameDeactivated(InternalFrameEvent e){
418 if (jTable.isEditing()) {
419 jTable.getCellEditor().stopCellEditing();
420 }
421 }
422 });
423 this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
424 this.setVisible(true);
425 initFrame();
426 }
427
428 protected void init(SpdFileContents sfc){
429 if (sfc.getSpdGuidDeclarationCount() == 0) {
430 return ;
431 }
432 //
433 // initialize table using SpdFileContents object
434 //
435 saa = new String[sfc.getSpdGuidDeclarationCount()][7];
436 sfc.getSpdGuidDeclarations(saa);
437 int i = 0;
438 while (i < saa.length) {
439 model.addRow(saa[i]);
440 i++;
441 }
442 }
443
444 protected JScrollPane getJContentPane(){
445 if (topScrollPane == null){
446 topScrollPane = new JScrollPane();
447 topScrollPane.setSize(new java.awt.Dimension(617,500));
448 topScrollPane.setPreferredSize(new java.awt.Dimension(498,500));
449 topScrollPane.setViewportView(getJContentPane1());
450 }
451 return topScrollPane;
452 }
453
454 /**
455 This method initializes jContentPane
456
457 @return javax.swing.JPanel
458 **/
459 protected JPanel getJContentPane1() {
460 if (jContentPane == null) {
461
462 jLabelGuidType = new JLabel();
463 jLabelGuidType.setBounds(new java.awt.Rectangle(420,122,103,16));
464 jLabelGuidType.setText("GUID Type List");
465 jLabelGuidType.setEnabled(true);
466 starLabel = new StarLabel();
467 starLabel.setLocation(new Point(jLabelGuidType.getX() - 20, jLabelGuidType.getY()));
468 starLabel.setVisible(true);
469 jLabelSupArch = new JLabel();
470 jLabelSupArch.setBounds(new java.awt.Rectangle(197,122,108,16));
471 jLabelSupArch.setText("Supported Arch");
472 jLabelSupArch.setEnabled(true);
473 jLabelSupMod = new JLabel();
474 jLabelSupMod.setBounds(new java.awt.Rectangle(14,120,110,16));
475 jLabelSupMod.setText("Supported Module");
476 jLabelSupMod.setEnabled(true);
477 jLabelHelp = new JLabel();
478 jLabelHelp.setText("HelpText");
479 jLabelHelp.setSize(new java.awt.Dimension(109,20));
480 jLabelHelp.setLocation(new java.awt.Point(14,85));
481 jLabelCName = new JLabel();
482 jLabelCName.setBounds(new java.awt.Rectangle(14,35,111,20));
483 jLabelCName.setText("C Name");
484 jLabelGuid = new JLabel();
485 jLabelGuid.setBounds(new java.awt.Rectangle(15,60,112,20));
486 jLabelGuid.setText("Guid Value");
487 jLabelName = new JLabel();
488 jLabelName.setBounds(new java.awt.Rectangle(15,10,113,20));
489 jLabelName.setText("Name");
490 jStarLabel1 = new StarLabel();
491 jStarLabel1.setLocation(new java.awt.Point(0, 10));
492 jStarLabel3 = new StarLabel();
493 jStarLabel3.setLocation(new java.awt.Point(0, 35));
494 jStarLabel4 = new StarLabel();
495 jStarLabel4.setLocation(new java.awt.Point(0, 60));
496 jStarLabel2 = new StarLabel();
497 jStarLabel2.setLocation(new java.awt.Point(0, 85));
498 jStarLabel2.setVisible(true);
499 jContentPane = new JPanel();
500 jContentPane.setLayout(null);
501 jContentPane.setPreferredSize(new Dimension(480, 375));
502 jContentPane.add(jStarLabel1, null);
503 jContentPane.add(jStarLabel2, null);
504 jContentPane.add(jStarLabel3, null);
505 jContentPane.add(jStarLabel4, null);
506 jContentPane.add(jLabelCName, null);
507 jContentPane.add(getJTextFieldCName(), null);
508 jContentPane.add(getJTextFieldGuid(), null);
509 jContentPane.add(getJScrollPane(), null);
510 jContentPane.add(getJButtonAdd(), null);
511 jContentPane.add(getJButtonRemove(), null);
512 jContentPane.add(getJButtonClearAll(), null);
513 jContentPane.add(getJButtonCancel(), null);
514 jContentPane.add(getJButtonOk(), null);
515
516 jContentPane.add(getJButtonGen(), null);
517 jContentPane.add(jLabelName, null);
518 jContentPane.add(getJTextFieldName(), null);
519 jContentPane.add(jLabelGuid, null);
520 jContentPane.add(jLabelHelp, null);
521 jContentPane.add(getJTextFieldHelp(), null);
522 jContentPane.add(jLabelSupMod, null);
523 jContentPane.add(jLabelSupArch, null);
524 jContentPane.add(getJScrollPaneArch(), null);
525 jContentPane.add(getJScrollPaneGuid(), null);
526 jContentPane.add(getJScrollPaneModule(), null);
527 jContentPane.add(jLabelGuidType, null);
528 jContentPane.add(starLabel, null);
529 }
530 return jContentPane;
531 }
532
533 /**
534 fill ComboBoxes with pre-defined contents
535 **/
536 protected void initFrame() {
537
538 this.setTitle("GUID Declarations");
539
540 }
541
542 /* (non-Javadoc)
543 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
544 */
545 public void actionPerformed(ActionEvent arg0) {
546
547 if (arg0.getSource() == jButtonOk) {
548 this.save();
549 this.dispose();
550
551 }
552 if (arg0.getSource() == jButtonCancel) {
553 this.dispose();
554 }
555
556 if (arg0.getSource() == jButtonAdd) {
557
558 //ToDo: check before add
559 String[] row = {"", "", "", "", "", "", ""};
560 row[3] = jTextFieldHelp.getText();
561 row[2] = jTextFieldGuid.getText();
562 row[1] = jTextFieldCName.getText();
563 row[0] = jTextFieldName.getText();
564 row[4] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
565 if (row[4].length() == 0) {
566 row[4] = null;
567 }
568 row[5] = vectorToString(iCheckBoxListMod.getAllCheckedItemsString());
569 if (row[5].length() == 0) {
570 row[5] = null;
571 }
572 row[6] = vectorToString(iCheckBoxListGuid.getAllCheckedItemsString());
573 if (row[6].length() == 0) {
574 row[6] = null;
575 }
576
577 if (!dataValidation(row)) {
578 return;
579 }
580
581 if (addRow(row) == -1) {
582 return;
583 }
584 model.addRow(row);
585 jTable.changeSelection(model.getRowCount()-1, 0, false, false);
586
587 }
588 //
589 // remove selected line
590 //
591 if (arg0.getSource() == jButtonRemove) {
592 if (jTable.isEditing()){
593 jTable.getCellEditor().stopCellEditing();
594 }
595 int rowSelected = selectedRow;
596 if (rowSelected >= 0) {
597 model.removeRow(rowSelected);
598 removeRow(rowSelected);
599 }
600 }
601
602 if (arg0.getSource() == jButtonClearAll) {
603 if (model.getRowCount() == 0) {
604 return;
605 }
606 model.setRowCount(0);
607 clearAllRow();
608 }
609
610 if (arg0.getSource() == jButtonGen) {
611 jTextFieldGuid.setText(Tools.generateUuidString());
612 }
613
614 if (arg0.getActionCommand().equals("GenGuidValue")) {
615 jTextFieldGuid.setText(guidDialog.getGuid());
616 }
617
618 }
619
620 protected boolean dataValidation(String[] row){
621 if (!DataValidation.isUiNameType(row[0])) {
622 JOptionPane.showMessageDialog(this, "Name must start with an alpha character.");
623 return false;
624 }
625 if (!DataValidation.isGuid(row[2])) {
626 JOptionPane.showMessageDialog(this, "Guid Value must be in registry format, 8-4-4-4-12.");
627 return false;
628 }
629 if (!DataValidation.isC_NameType(row[1])) {
630 JOptionPane.showMessageDialog(this, "C Name does not match C Name datatype.");
631 return false;
632 }
633 if (row[3].length() == 0) {
634 JOptionPane.showMessageDialog(this, "Help Text must be entered!");
635 return false;
636 }
637 return true;
638 }
639
640 protected int addRow(String[] row) {
641 Vector<String> vArch = iCheckBoxListArch.getAllCheckedItemsString();
642 if (vArch.size() == 0) {
643 vArch = null;
644 }
645 Vector<String> vModType = iCheckBoxListMod.getAllCheckedItemsString();
646 if (vModType.size() == 0) {
647 vModType = null;
648 }
649 Vector<String> vguidType = iCheckBoxListGuid.getAllCheckedItemsString();
650 if (vguidType.size() == 0) {
651 vguidType = null;
652 }
653 if (vguidType == null) {
654 JOptionPane.showMessageDialog(this, "You must select at least one GUID type.");
655 return -1;
656 }
657 if (docConsole != null) {
658 docConsole.setSaved(false);
659 }
660 sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType);
661 return 0;
662 }
663
664 protected void removeRow(int i){
665 sfc.removeSpdGuidDeclaration(i);
666 if (docConsole != null) {
667 docConsole.setSaved(false);
668 }
669 }
670
671 protected void clearAllRow(){
672 sfc.removeSpdGuidDeclaration();
673 if (docConsole != null) {
674 docConsole.setSaved(false);
675 }
676 }
677
678 /**
679 Add contents in list to sfc
680 **/
681 protected void save() {
682
683 }
684
685 /**
686 This method initializes jButtonBrowse
687
688 @return javax.swing.JButton
689 **/
690 protected JButton getJButtonGen() {
691 if (jButtonGen == null) {
692 jButtonGen = new JButton();
693 jButtonGen.setBounds(new java.awt.Rectangle(379,58,92,21));
694 jButtonGen.setText("Gen GUID");
695 jButtonGen.setPreferredSize(new java.awt.Dimension(80,20));
696 jButtonGen.addActionListener(this);
697 }
698 return jButtonGen;
699 }
700
701 /**
702 * This method initializes jTextFieldName
703 *
704 * @return javax.swing.JTextField
705 */
706 protected JTextField getJTextFieldName() {
707 if (jTextFieldName == null) {
708 jTextFieldName = new JTextField();
709 jTextFieldName.setBounds(new java.awt.Rectangle(138,10,337,20));
710 jTextFieldName.setPreferredSize(new java.awt.Dimension(335,20));
711 }
712 return jTextFieldName;
713 }
714
715 /**
716 * This method initializes jTextFieldCName
717 *
718 * @return javax.swing.JTextField
719 */
720 protected JTextField getJTextFieldCName() {
721 if (jTextFieldCName == null) {
722 jTextFieldCName = new JTextField();
723 jTextFieldCName.setBounds(new java.awt.Rectangle(137,35,337,20));
724 jTextFieldCName.setPreferredSize(new java.awt.Dimension(335,20));
725 }
726 return jTextFieldCName;
727 }
728
729 public void componentResized(ComponentEvent arg0) {
730 int intPreferredWidth = 500;
731
732 Tools.resizeComponentWidth(this.jTextFieldName, this.getWidth(), intPreferredWidth);
733
734 Tools.resizeComponentWidth(this.jTextFieldCName, this.getWidth(), intPreferredWidth);
735 Tools.resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);
736 Tools.resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
737 Tools.relocateComponentX(this.jButtonGen, this.getWidth(), this.getPreferredSize().width, 40);
738
739 }
740
741 /**
742 * This method initializes jTextField
743 *
744 * @return javax.swing.JTextField
745 */
746 private JTextField getJTextFieldHelp() {
747 if (jTextFieldHelp == null) {
748 jTextFieldHelp = new JTextField();
749 jTextFieldHelp.setBounds(new java.awt.Rectangle(136,85,337,20));
750 jTextFieldHelp.setPreferredSize(new Dimension(335, 20));
751 }
752 return jTextFieldHelp;
753 }
754
755 private JScrollPane getJScrollPaneArch() {
756 if (jScrollPaneArch == null) {
757 jScrollPaneArch = new JScrollPane();
758 jScrollPaneArch.setBounds(new java.awt.Rectangle(197,142,188,74));
759 jScrollPaneArch.setPreferredSize(new java.awt.Dimension(188, 74));
760 jScrollPaneArch.setViewportView(getICheckBoxListArch());
761 }
762 return jScrollPaneArch;
763 }
764 /**
765 * This method initializes iCheckBoxList
766 *
767 * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
768 */
769 private ICheckBoxList getICheckBoxListArch() {
770 if (iCheckBoxListArch == null) {
771 iCheckBoxListArch = new ICheckBoxList();
772 iCheckBoxListArch.setBounds(new java.awt.Rectangle(197,142,188,74));
773 Vector<String> v = new Vector<String>();
774 v.add("IA32");
775 v.add("X64");
776 v.add("IPF");
777 v.add("EBC");
778 v.add("ARM");
779 v.add("PPC");
780 iCheckBoxListArch.setAllItems(v);
781 }
782 return iCheckBoxListArch;
783 }
784
785 protected JScrollPane getJScrollPaneGuid() {
786 if (jScrollPaneGuid== null) {
787 jScrollPaneGuid = new JScrollPane();
788 jScrollPaneGuid.setPreferredSize(new java.awt.Dimension(190,74));
789 jScrollPaneGuid.setLocation(new java.awt.Point(400,142));
790 jScrollPaneGuid.setSize(new java.awt.Dimension(260,74));
791 jScrollPaneGuid.setViewportView(getICheckBoxListGuid());
792 }
793 return jScrollPaneGuid;
794 }
795 /**
796 * This method initializes iCheckBoxList1
797 *
798 * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
799 */
800 private ICheckBoxList getICheckBoxListGuid() {
801 if (iCheckBoxListGuid == null) {
802 iCheckBoxListGuid = new ICheckBoxList();
803 iCheckBoxListGuid.setBounds(new java.awt.Rectangle(400,142,177,74));
804 Vector<String> v = new Vector<String>();
805 v.add("DATA_HUB_RECORD");
806 v.add("EFI_EVENT");
807 v.add("EFI_SYSTEM_CONFIGURATION_TABLE");
808 v.add("EFI_VARIABLE");
809 v.add("GUID");
810 v.add("HII_PACKAGE_LIST");
811 v.add("HOB");
812 v.add("TOKEN_SPACE_GUID");
813
814 iCheckBoxListGuid.setAllItems(v);
815 }
816 return iCheckBoxListGuid;
817 }
818
819 private JScrollPane getJScrollPaneModule() {
820 if (jScrollPaneModule == null) {
821 jScrollPaneModule = new JScrollPane();
822 jScrollPaneModule.setBounds(new java.awt.Rectangle(14,142,170,74));
823 jScrollPaneModule.setPreferredSize(new java.awt.Dimension(170, 74));
824 jScrollPaneModule.setViewportView(getICheckBoxListMod());
825 }
826 return jScrollPaneModule;
827 }
828 /**
829 * This method initializes iCheckBoxList2
830 *
831 * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
832 */
833 private ICheckBoxList getICheckBoxListMod() {
834 if (iCheckBoxListMod == null) {
835 iCheckBoxListMod = new ICheckBoxList();
836 iCheckBoxListMod.setBounds(new java.awt.Rectangle(14,142,170,74));
837 Vector<String> v = new Vector<String>();
838 v.add("BASE");
839 v.add("SEC");
840 v.add("PEI_CORE");
841 v.add("PEIM");
842 v.add("DXE_CORE");
843 v.add("DXE_DRIVER");
844 v.add("DXE_RUNTIME_DRIVER");
845 v.add("DXE_SAL_DRIVER");
846 v.add("DXE_SMM_DRIVER");
847 v.add("UEFI_DRIVER");
848 v.add("UEFI_APPLICATION");
849 v.add("USER_DEFINED");
850 iCheckBoxListMod.setAllItems(v);
851 }
852 return iCheckBoxListMod;
853 }
854
855 public static void main(String[] args){
856 new SpdGuidDecls().setVisible(true);
857 }
858
859 protected DefaultTableModel getModel() {
860 return model;
861 }
862
863 protected void setModel(DefaultTableModel model) {
864 this.model = model;
865 }
866
867 protected String vectorToString(Vector<String> v) {
868 String s = " ";
869 for (int i = 0; i < v.size(); ++i) {
870 s += v.get(i);
871 s += " ";
872 }
873 return s.trim();
874 }
875
876 protected Vector<String> stringToVector(String s){
877 if (s == null) {
878 return null;
879 }
880 String[] sArray = s.split(" ");
881 Vector<String> v = new Vector<String>();
882 for (int i = 0; i < sArray.length; ++i) {
883 v.add(sArray[i]);
884 }
885 return v;
886 }
887
888 protected JLabel getJLabelGuidType() {
889 return jLabelGuidType;
890 }
891 }
892
893