Refine the code for PCD tools.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / packaging / ui / SpdHeader.java
CommitLineData
a13899c5 1/** @file\r
2 \r
3 The file is used to create, update spdHeader of Spd file\r
4 \r
5 Copyright (c) 2006, Intel Corporation\r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13 \r
14 **/\r
15\r
16package org.tianocore.frameworkwizard.packaging.ui;\r
17\r
a13899c5 18import java.awt.event.ActionEvent;\r
19import java.awt.event.ComponentEvent;\r
20import java.awt.event.FocusAdapter;\r
21import java.awt.event.FocusEvent;\r
22\r
23import javax.swing.JButton;\r
ce73a791 24import javax.swing.JFrame;\r
a13899c5 25import javax.swing.JLabel;\r
ce73a791 26import javax.swing.JOptionPane;\r
a13899c5 27import javax.swing.JPanel;\r
28import javax.swing.JScrollPane;\r
29import javax.swing.JTextArea;\r
30import javax.swing.JTextField;\r
31\r
209abc92 32\r
a13899c5 33import org.tianocore.PackageSurfaceAreaDocument;\r
34import org.tianocore.frameworkwizard.common.DataValidation;\r
a13899c5 35import org.tianocore.frameworkwizard.common.Tools;\r
d6d24759 36import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r
a13899c5 37import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
38import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
39\r
40/**\r
41 The class is used to create, update spdHeader of Spd file\r
42 It extends IInternalFrame\r
43 \r
44 @since PackageEditor 1.0\r
45\r
46 **/\r
47public class SpdHeader extends IInternalFrame {\r
48\r
49 ///\r
50 /// Define class Serial Version UID\r
51 ///\r
52 private static final long serialVersionUID = -8152099582923006900L;\r
53\r
54 //\r
55 //Define class members\r
56 //\r
ce73a791 57 static JFrame frame;\r
58 \r
a13899c5 59 private JPanel jContentPane = null;\r
60\r
61 private JLabel jLabelBaseName = null;\r
62\r
63 private JTextField jTextFieldBaseName = null;\r
64\r
65 private JLabel jLabelGuid = null;\r
66\r
67 private JTextField jTextFieldGuid = null;\r
68\r
69 private JLabel jLabelVersion = null;\r
70\r
71 private JTextField jTextFieldVersion = null;\r
72\r
73 private JButton jButtonGenerateGuid = null;\r
74\r
75 private JLabel jLabelLicense = null;\r
76\r
77 private JTextArea jTextAreaLicense = null;\r
78\r
79 private JLabel jLabelCopyright = null;\r
80\r
81 private JLabel jLabelDescription = null;\r
82\r
83 private JTextArea jTextAreaDescription = null;\r
84\r
85 private JLabel jLabelSpecification = null;\r
86\r
87 private JTextField jTextFieldSpecification = null;\r
88\r
89 private JButton jButtonOk = null;\r
90\r
91 private JButton jButtonCancel = null;\r
92\r
93 private JScrollPane jScrollPaneLicense = null;\r
94\r
95 private JScrollPane jScrollPaneDescription = null;\r
96\r
97 private JLabel jLabelAbstract = null;\r
98\r
99 private JTextField jTextFieldAbstract = null;\r
100\r
101 private StarLabel jStarLabel1 = null;\r
102\r
103 private StarLabel jStarLabel2 = null;\r
104\r
105 private StarLabel jStarLabel3 = null;\r
106\r
107 private StarLabel jStarLabel4 = null;\r
108\r
109 private StarLabel jStarLabel5 = null;\r
110\r
111 private StarLabel jStarLabel6 = null;\r
112\r
113 private StarLabel jStarLabel7 = null;\r
114\r
115 private StarLabel jStarLabel9 = null;\r
116 \r
117 private SpdFileContents sfc = null;\r
d6d24759 118 \r
119 private OpeningPackageType docConsole = null;\r
a13899c5 120\r
121 private JTextField jTextFieldCopyright = null;\r
122 \r
123 private JScrollPane topScrollPane = null;\r
124\r
125 private JLabel jLabel = null;\r
126\r
4da2e625 127 private JTextField jTextFieldUrl = null;\r
a13899c5 128\r
129 /**\r
130 This method initializes jTextFieldBaseName \r
131 \r
132 @return javax.swing.JTextField jTextFieldBaseName\r
133 \r
134 **/\r
135 private JTextField getJTextFieldBaseName() {\r
136 if (jTextFieldBaseName == null) {\r
137 jTextFieldBaseName = new JTextField();\r
138 jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
139 jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(320,20));\r
140 jTextFieldBaseName.addFocusListener(new FocusAdapter(){\r
141 public void focusLost(FocusEvent e){\r
ce73a791 142 if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) {\r
143 JOptionPane.showMessageDialog(frame, "Package Name is NOT UiNameType.");\r
144 return;\r
145 }\r
a490bca8 146 if (jTextFieldBaseName.getText().equals(sfc.getSpdHdrPkgName())) {\r
147 return;\r
148 }\r
d6d24759 149 docConsole.setSaved(false);\r
a13899c5 150 sfc.setSpdHdrPkgName(jTextFieldBaseName.getText());\r
151 }\r
152 });\r
153 }\r
154 return jTextFieldBaseName;\r
155 }\r
156\r
157 /**\r
158 This method initializes jTextFieldGuid \r
159 \r
160 @return javax.swing.JTextField jTextFieldGuid\r
161 \r
162 **/\r
163 private JTextField getJTextFieldGuid() {\r
164 if (jTextFieldGuid == null) {\r
165 jTextFieldGuid = new JTextField();\r
166 jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));\r
167 jTextFieldGuid.setPreferredSize(new java.awt.Dimension(250,20));\r
168 jTextFieldGuid.addFocusListener(new FocusAdapter(){\r
169 public void focusLost(FocusEvent e){\r
ce73a791 170 if (!DataValidation.isGuid(jTextFieldGuid.getText())) {\r
171 JOptionPane.showMessageDialog(frame, "Guid is NOT GuidType.");\r
172 return;\r
173 }\r
a490bca8 174 if (jTextFieldGuid.getText().equals(sfc.getSpdHdrGuidValue())) {\r
175 return;\r
176 }\r
d6d24759 177 docConsole.setSaved(false);\r
a13899c5 178 sfc.setSpdHdrGuidValue(jTextFieldGuid.getText());\r
179 }\r
180 });\r
181 }\r
182 return jTextFieldGuid;\r
183 }\r
184\r
185 /**\r
186 This method initializes jTextFieldVersion \r
187 \r
188 @return javax.swing.JTextField jTextFieldVersion\r
189 \r
190 **/\r
191 private JTextField getJTextFieldVersion() {\r
192 if (jTextFieldVersion == null) {\r
193 jTextFieldVersion = new JTextField();\r
194 jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
195 jTextFieldVersion.setPreferredSize(new java.awt.Dimension(320,20));\r
196 jTextFieldVersion.addFocusListener(new FocusAdapter(){\r
197 public void focusLost(FocusEvent e){\r
ce73a791 198 if (!DataValidation.isVersion(jTextFieldVersion.getText())) {\r
199 JOptionPane.showMessageDialog(frame, "Version is NOT version type.");\r
200 return;\r
201 }\r
a490bca8 202 if (jTextFieldVersion.getText().equals(sfc.getSpdHdrVer())){\r
203 return;\r
204 }\r
d6d24759 205 docConsole.setSaved(false);\r
a13899c5 206 sfc.setSpdHdrVer(jTextFieldVersion.getText());\r
207 } \r
208 });\r
209 }\r
210 return jTextFieldVersion;\r
211 }\r
212\r
213 /**\r
214 This method initializes jButtonGenerateGuid \r
215 \r
216 @return javax.swing.JButton jButtonGenerateGuid\r
217 \r
218 **/\r
219 private JButton getJButtonGenerateGuid() {\r
220 if (jButtonGenerateGuid == null) {\r
221 jButtonGenerateGuid = new JButton();\r
222 jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
223 jButtonGenerateGuid.setText("GEN");\r
224 jButtonGenerateGuid.addActionListener(this);\r
225 }\r
226 return jButtonGenerateGuid;\r
227 }\r
228\r
229 /**\r
230 This method initializes jTextAreaLicense \r
231 \r
232 @return javax.swing.JTextArea jTextAreaLicense\r
233 \r
234 **/\r
235 private JTextArea getJTextAreaLicense() {\r
236 if (jTextAreaLicense == null) {\r
237 jTextAreaLicense = new JTextArea();\r
238 jTextAreaLicense.setText("");\r
a13899c5 239 jTextAreaLicense.setLineWrap(true);\r
240 jTextAreaLicense.addFocusListener(new FocusAdapter(){\r
241 public void focusLost(FocusEvent e){\r
ce73a791 242 if (jTextAreaLicense.getText().length() == 0) {\r
243 JOptionPane.showMessageDialog(frame, "License contents could NOT be empty.");\r
244 return;\r
245 }\r
a490bca8 246 if (jTextAreaLicense.getText().equals(sfc.getSpdHdrLicense())) {\r
247 return;\r
248 }\r
d6d24759 249 docConsole.setSaved(false);\r
a13899c5 250 sfc.setSpdHdrLicense(jTextAreaLicense.getText());\r
251 }\r
252 });\r
253 }\r
254 return jTextAreaLicense;\r
255 }\r
256\r
257 /**\r
258 This method initializes jTextAreaDescription \r
259 \r
260 @return javax.swing.JTextArea jTextAreaDescription\r
261 \r
262 **/\r
263 private JTextArea getJTextAreaDescription() {\r
264 if (jTextAreaDescription == null) {\r
265 jTextAreaDescription = new JTextArea();\r
266 jTextAreaDescription.setLineWrap(true);\r
a13899c5 267 jTextAreaDescription.addFocusListener(new FocusAdapter(){\r
268 public void focusLost(FocusEvent e){\r
ce73a791 269 if (jTextAreaDescription.getText().length() == 0) {\r
270 JOptionPane.showMessageDialog(frame, "Description contents could NOT be empty.");\r
271 return;\r
272 }\r
a490bca8 273 if (jTextAreaDescription.getText().equals(sfc.getSpdHdrDescription())) {\r
274 return;\r
275 }\r
d6d24759 276 docConsole.setSaved(false);\r
a13899c5 277 sfc.setSpdHdrDescription(jTextAreaDescription.getText());\r
278 }\r
279 });\r
280 }\r
281 return jTextAreaDescription;\r
282 }\r
283\r
284 /**\r
285 This method initializes jTextFieldSpecification \r
286 \r
287 @return javax.swing.JTextField jTextFieldSpecification\r
288 \r
289 **/\r
290 private JTextField getJTextFieldSpecification() {\r
291 if (jTextFieldSpecification == null) {\r
292 jTextFieldSpecification = new JTextField();\r
410e0e9f 293 jTextFieldSpecification.setBounds(new java.awt.Rectangle(161,330,320,20));\r
a13899c5 294 jTextFieldSpecification.setEditable(false);\r
295 jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320,20));\r
296 jTextFieldSpecification.addFocusListener(new FocusAdapter(){\r
297 public void focusLost(FocusEvent e){\r
298 sfc.setSpdHdrSpec(jTextFieldSpecification.getText());\r
299 }\r
300 });\r
301 }\r
302 return jTextFieldSpecification;\r
303 }\r
304\r
305 /**\r
306 This method initializes jButtonOk \r
307 \r
308 @return javax.swing.JButton jButtonOk\r
309 \r
310 **/\r
311 private JButton getJButtonOk() {\r
312 if (jButtonOk == null) {\r
313 jButtonOk = new JButton();\r
314 jButtonOk.setText("OK");\r
315 jButtonOk.setBounds(new java.awt.Rectangle(290, 445, 90, 20));\r
316 jButtonOk.setVisible(false);\r
317 jButtonOk.addActionListener(this);\r
318 }\r
319 return jButtonOk;\r
320 }\r
321\r
322 /**\r
323 This method initializes jButtonCancel \r
324 \r
325 @return javax.swing.JButton jButtonCancel\r
326 \r
327 **/\r
328 private JButton getJButtonCancel() {\r
329 if (jButtonCancel == null) {\r
330 jButtonCancel = new JButton();\r
331 jButtonCancel.setText("Cancel");\r
332 jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, 20));\r
333 jButtonCancel.setVisible(false);\r
334 jButtonCancel.addActionListener(this);\r
335 }\r
336 return jButtonCancel;\r
337 }\r
338\r
339 /**\r
340 This method initializes jScrollPaneLicense \r
341 \r
342 @return javax.swing.JScrollPane jScrollPaneLicense\r
343 \r
344 **/\r
345 private JScrollPane getJScrollPaneLicense() {\r
346 if (jScrollPaneLicense == null) {\r
347 jScrollPaneLicense = new JScrollPane();\r
410e0e9f 348 jScrollPaneLicense.setBounds(new java.awt.Rectangle(161,108,320,80));\r
a13899c5 349 jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
350 jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(320,80));\r
351 jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r
352 }\r
353 return jScrollPaneLicense;\r
354 }\r
355\r
356 /**\r
357 This method initializes jScrollPaneDescription \r
358 \r
359 @return javax.swing.JScrollPane jScrollPaneDescription\r
360 \r
361 **/\r
362 private JScrollPane getJScrollPaneDescription() {\r
363 if (jScrollPaneDescription == null) {\r
364 jScrollPaneDescription = new JScrollPane();\r
410e0e9f 365 jScrollPaneDescription.setBounds(new java.awt.Rectangle(160,244,320,80));\r
a13899c5 366 jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
367 jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r
368 }\r
369 return jScrollPaneDescription;\r
370 }\r
371\r
372 /**\r
373 This method initializes jTextFieldAbstract \r
374 \r
375 @return javax.swing.JTextField jTextFieldAbstract\r
376 \r
377 **/\r
378 private JTextField getJTextFieldAbstract() {\r
379 if (jTextFieldAbstract == null) {\r
380 jTextFieldAbstract = new JTextField();\r
410e0e9f 381 jTextFieldAbstract.setBounds(new java.awt.Rectangle(161,220,320,20));\r
a13899c5 382 jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(320, 20));\r
383 jTextFieldAbstract.addFocusListener(new FocusAdapter(){\r
384 public void focusLost(FocusEvent e){\r
ce73a791 385 if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) {\r
386 JOptionPane.showMessageDialog(frame, "Abstract could NOT be empty.");\r
387 return;\r
388 }\r
a490bca8 389 if (jTextFieldAbstract.getText().equals(sfc.getSpdHdrAbs())) {\r
390 return;\r
391 }\r
d6d24759 392 docConsole.setSaved(false);\r
a13899c5 393 sfc.setSpdHdrAbs(jTextFieldAbstract.getText());\r
394 }\r
395 });\r
396 }\r
397 return jTextFieldAbstract;\r
398 }\r
399\r
400 /**\r
401 This method initializes jTextFieldCopyright \r
402 \r
403 @return javax.swing.JTextField jTextFieldCopyright\r
404 \r
405 **/\r
406 private JTextField getJTextFieldCopyright() {\r
407 if (jTextFieldCopyright == null) {\r
408 jTextFieldCopyright = new JTextField();\r
410e0e9f 409 jTextFieldCopyright.setBounds(new java.awt.Rectangle(160,86,320,20));\r
a13899c5 410 jTextFieldCopyright.setPreferredSize(new java.awt.Dimension(320,20));\r
411 jTextFieldCopyright.addFocusListener(new FocusAdapter(){\r
412 public void focusLost(FocusEvent e){\r
ce73a791 413 if (!DataValidation.isCopyright(jTextFieldCopyright.getText())) {\r
414 JOptionPane.showMessageDialog(frame, "Copyright contents could not be empty.");\r
415 return;\r
416 }\r
a490bca8 417 if (jTextFieldCopyright.getText().equals(sfc.getSpdHdrCopyright())) {\r
418 return;\r
419 }\r
d6d24759 420 docConsole.setSaved(false);\r
a13899c5 421 sfc.setSpdHdrCopyright(jTextFieldCopyright.getText());\r
422 } \r
423 });\r
424 }\r
425 return jTextFieldCopyright;\r
426 }\r
427\r
428 /**\r
429 * This method initializes jTextField \r
430 * \r
431 * @return javax.swing.JTextField \r
432 */\r
4da2e625 433 private JTextField getJTextFieldUrl() {\r
434 if (jTextFieldUrl == null) {\r
435 jTextFieldUrl = new JTextField();\r
436 jTextFieldUrl.setBounds(new java.awt.Rectangle(161,195,320,20));\r
437 jTextFieldUrl.setPreferredSize(new java.awt.Dimension(320, 20));\r
438 jTextFieldUrl.addFocusListener(new FocusAdapter(){\r
a13899c5 439 public void focusLost(FocusEvent e){\r
4da2e625 440 if (jTextFieldUrl.getText().length() == 0 && sfc.getSpdHdrUrl() == null) {\r
a490bca8 441 return;\r
442 }\r
4da2e625 443 if (jTextFieldUrl.getText().equals(sfc.getSpdHdrUrl())) {\r
a490bca8 444 return;\r
445 }\r
a13899c5 446 sfc.setSpdHdrLicense(jTextAreaLicense.getText());\r
4da2e625 447 sfc.setSpdHdrUrl(jTextFieldUrl.getText());\r
d6d24759 448 docConsole.setSaved(false);\r
a13899c5 449 } \r
450 });\r
451 }\r
4da2e625 452 return jTextFieldUrl;\r
a13899c5 453 }\r
454\r
455 public static void main(String[] args) {\r
456 new SpdHeader().setVisible(true);\r
457 }\r
458\r
459 /**\r
460 This is the default constructor\r
461 \r
462 **/\r
463 public SpdHeader() {\r
464 super();\r
465 init();\r
466 this.setVisible(true);\r
467 }\r
468\r
469 /**\r
470 This is the override edit constructor\r
471 \r
472 @param inspdHeader The input data of spdHeaderDocument.spdHeader\r
473 \r
474 **/\r
475 public SpdHeader(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {\r
476 this();\r
477 sfc = new SpdFileContents(inPsa);\r
478 init(sfc);\r
479 }\r
d6d24759 480 \r
481 public SpdHeader(OpeningPackageType opt){\r
482 this(opt.getXmlSpd());\r
483 docConsole = opt;\r
484 }\r
a13899c5 485 /**\r
486 This method initializes this\r
487 \r
488 **/\r
489 private void init() {\r
490 this.setContentPane(getTopScrollPane());\r
491 this.setTitle("Package Surface Area Header");\r
492 initFrame();\r
493 }\r
494\r
495 /**\r
496 This method initializes this\r
497 Fill values to all fields if these values are not empty\r
498 \r
499 @param inspdHeader The input data of spdHeaderDocument.spdHeader\r
500 \r
501 **/\r
502 private void init(SpdFileContents sfc) {\r
503 if (sfc.getSpdHdrPkgName() != null) {\r
504 jTextFieldBaseName.setText(sfc.getSpdHdrPkgName());\r
505 }\r
506 if (sfc.getSpdHdrGuidValue() != null) {\r
507 jTextFieldGuid.setText(sfc.getSpdHdrGuidValue());\r
508 }\r
509 if (sfc.getSpdHdrVer() != null) {\r
510 jTextFieldVersion.setText(sfc.getSpdHdrVer());\r
511 }\r
512 if (sfc.getSpdHdrLicense() != null) {\r
513 jTextAreaLicense.setText(sfc.getSpdHdrLicense());\r
514 }\r
515 if (sfc.getSpdHdrUrl() != null) {\r
4da2e625 516 jTextFieldUrl.setText(sfc.getSpdHdrUrl());\r
a13899c5 517 }\r
518 if (sfc.getSpdHdrCopyright() != null) {\r
519 jTextFieldCopyright.setText(sfc.getSpdHdrCopyright());\r
520 }\r
521 if (sfc.getSpdHdrAbs() != null) {\r
522 jTextFieldAbstract.setText(sfc.getSpdHdrAbs());\r
523 }\r
524 if (sfc.getSpdHdrDescription() != null) {\r
525 jTextAreaDescription.setText(sfc.getSpdHdrDescription());\r
526 }\r
527 if (sfc.getSpdHdrSpec() != null) {\r
528 jTextFieldSpecification.setText(sfc.getSpdHdrSpec());\r
529 }\r
12e17a0a 530 sfc.setSpdHdrSpec(jTextFieldSpecification.getText());\r
9a8d6d9f 531 \r
532 if (!sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
533 sfc.setSpdPkgDefsRdOnly("false");\r
534 }\r
535 if (!sfc.getSpdPkgDefsRePkg().equals("true")) {\r
536 sfc.setSpdPkgDefsRePkg("false");\r
537 }\r
538 \r
a13899c5 539 }\r
540\r
541 /**\r
542 This method initializes jContentPane\r
543 \r
544 @return javax.swing.JPanel jContentPane\r
545 \r
546 **/\r
547 private JPanel getJContentPane() {\r
548 if (jContentPane == null) {\r
549 jLabel = new JLabel();\r
410e0e9f 550 jLabel.setBounds(new java.awt.Rectangle(16,195,140,20));\r
a13899c5 551 jLabel.setText("URL");\r
552 jContentPane = new JPanel();\r
553 jContentPane.setLayout(null);\r
554 jContentPane.setLocation(new java.awt.Point(0, 0));\r
555 jContentPane.setPreferredSize(new java.awt.Dimension(500, 524));\r
556 jLabelAbstract = new JLabel();\r
410e0e9f 557 jLabelAbstract.setBounds(new java.awt.Rectangle(16,245,140,20));\r
a13899c5 558 jLabelAbstract.setText("Description");\r
559 jLabelSpecification = new JLabel();\r
560 jLabelSpecification.setText("Specification");\r
410e0e9f 561 jLabelSpecification.setBounds(new java.awt.Rectangle(16,330,140,20));\r
a13899c5 562 jLabelDescription = new JLabel();\r
563 jLabelDescription.setText("Abstract");\r
410e0e9f 564 jLabelDescription.setBounds(new java.awt.Rectangle(16,220,140,20));\r
a13899c5 565 jLabelCopyright = new JLabel();\r
566 jLabelCopyright.setText("Copyright");\r
410e0e9f 567 jLabelCopyright.setBounds(new java.awt.Rectangle(15,86,140,20));\r
a13899c5 568 jLabelLicense = new JLabel();\r
569 jLabelLicense.setText("License");\r
410e0e9f 570 jLabelLicense.setBounds(new java.awt.Rectangle(16,110,140,20));\r
a13899c5 571 jLabelVersion = new JLabel();\r
572 jLabelVersion.setText("Version");\r
573 jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
574 jLabelGuid = new JLabel();\r
575 jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));\r
576 jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
577 jLabelGuid.setText("Guid");\r
578 jLabelBaseName = new JLabel();\r
579 jLabelBaseName.setText("Package Name");\r
580 jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
581 jContentPane.add(jLabelBaseName, null);\r
582 jContentPane.add(getJTextFieldBaseName(), null);\r
583 jContentPane.add(jLabelGuid, null);\r
584 jContentPane.add(getJTextFieldGuid(), null);\r
585 jContentPane.add(jLabelVersion, null);\r
586 jContentPane.add(getJTextFieldVersion(), null);\r
587 jContentPane.add(getJButtonGenerateGuid(), null);\r
588 jContentPane.add(jLabelLicense, null);\r
589 jContentPane.add(jLabelCopyright, null);\r
590 jContentPane.add(jLabelDescription, null);\r
591 jContentPane.add(jLabelSpecification, null);\r
592 jContentPane.add(getJTextFieldSpecification(), null);\r
593 jContentPane.add(getJButtonOk(), null);\r
594 jContentPane.add(getJButtonCancel(), null);\r
595 jContentPane.add(getJScrollPaneLicense(), null);\r
596 jContentPane.add(getJScrollPaneDescription(), null);\r
597 jContentPane.add(jLabelAbstract, null);\r
598 jContentPane.add(getJTextFieldAbstract(), null);\r
599 jStarLabel1 = new StarLabel();\r
600 jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
601 jStarLabel2 = new StarLabel();\r
602 jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
603 jStarLabel3 = new StarLabel();\r
604 jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
605 jStarLabel4 = new StarLabel();\r
410e0e9f 606 jStarLabel4.setLocation(new java.awt.Point(1,110));\r
a13899c5 607 jStarLabel5 = new StarLabel();\r
410e0e9f 608 jStarLabel5.setLocation(new java.awt.Point(0,86));\r
a13899c5 609 jStarLabel6 = new StarLabel();\r
410e0e9f 610 jStarLabel6.setLocation(new java.awt.Point(1,220));\r
a13899c5 611 jStarLabel7 = new StarLabel();\r
410e0e9f 612 jStarLabel7.setLocation(new java.awt.Point(1,330));\r
a13899c5 613 jStarLabel7.setEnabled(false);\r
614 jStarLabel9 = new StarLabel();\r
410e0e9f 615 jStarLabel9.setLocation(new java.awt.Point(1,245));\r
a13899c5 616 jContentPane.add(jStarLabel1, null);\r
617 jContentPane.add(jStarLabel2, null);\r
618 jContentPane.add(jStarLabel3, null);\r
619 jContentPane.add(jStarLabel4, null);\r
620 jContentPane.add(jStarLabel5, null);\r
621 jContentPane.add(jStarLabel6, null);\r
622 jContentPane.add(jStarLabel7, null);\r
623 jContentPane.add(jStarLabel9, null);\r
624 jContentPane.add(getJTextFieldCopyright(), null);\r
625\r
626 jContentPane.add(jLabel, null);\r
4da2e625 627 jContentPane.add(getJTextFieldUrl(), null);\r
a13899c5 628 }\r
629 return jContentPane;\r
630 }\r
631\r
632 /* (non-Javadoc)\r
633 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
634 *\r
635 * Override actionPerformed to listen all actions\r
636 *\r
637 */\r
638 public void actionPerformed(ActionEvent arg0) {\r
a490bca8 639 \r
a13899c5 640 if (arg0.getSource() == jButtonGenerateGuid) {\r
641 //ToDo: invoke GuidValueEditor\r
642 jTextFieldGuid.setText(Tools.generateUuidString());\r
a490bca8 643 docConsole.setSaved(false);\r
a13899c5 644 sfc.setSpdHdrGuidValue(jTextFieldGuid.getText());\r
645 }\r
646 }\r
a490bca8 647 \r
a13899c5 648 /**\r
649 This method initializes Package type and Compontent type\r
650 \r
651 **/\r
652 private void initFrame() {\r
653 \r
654 }\r
655\r
656 /* (non-Javadoc)\r
657 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)\r
658 * \r
659 * Override componentResized to resize all components when frame's size is changed\r
660 */\r
661 public void componentResized(ComponentEvent arg0) {\r
662 int intPreferredWidth = 500;\r
663 int intCurrentWidth = this.getJContentPane().getWidth();\r
664 \r
665 resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth,intPreferredWidth);\r
666 resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth,intPreferredWidth);\r
667 resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth,intPreferredWidth);\r
4da2e625 668 resizeComponentWidth(this.jTextFieldUrl, intCurrentWidth,intPreferredWidth);\r
a13899c5 669 resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth,intPreferredWidth);\r
670 resizeComponentWidth(this.jTextFieldCopyright, intCurrentWidth,intPreferredWidth);\r
671 resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth,intPreferredWidth);\r
672 resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth,intPreferredWidth);\r
673 resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth,intPreferredWidth);\r
674 relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, jButtonGenerateGuid.getWidth(),30);\r
675 }\r
676\r
677 private JScrollPane getTopScrollPane() {\r
678 if (topScrollPane == null){\r
679 topScrollPane = new JScrollPane();\r
680 topScrollPane.setViewportView(getJContentPane());\r
681 }\r
682 return topScrollPane;\r
683 }\r
684}\r