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