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