]>
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 | |
1faac7b6 | 23 | import java.util.Vector;\r |
a13899c5 | 24 | \r |
25 | import javax.swing.JButton;\r | |
a13899c5 | 26 | import javax.swing.JLabel;\r |
d6d24759 | 27 | import javax.swing.JOptionPane;\r |
a13899c5 | 28 | import javax.swing.JPanel;\r |
29 | import javax.swing.JScrollPane;\r | |
30 | import javax.swing.JTextArea;\r | |
31 | import javax.swing.JTextField;\r | |
e4f1ff6c | 32 | import javax.swing.event.DocumentEvent;\r |
33 | import javax.swing.event.DocumentListener;\r | |
a13899c5 | 34 | \r |
35 | \r | |
a13899c5 | 36 | \r |
37 | import org.tianocore.PlatformSurfaceAreaDocument;\r | |
a13899c5 | 38 | \r |
a13899c5 | 39 | import org.tianocore.frameworkwizard.common.DataValidation;\r |
a13899c5 | 40 | import org.tianocore.frameworkwizard.common.Tools;\r |
d6d24759 | 41 | import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r |
a13899c5 | 42 | import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r |
43 | import org.tianocore.frameworkwizard.common.ui.StarLabel;\r | |
44 | \r | |
45 | /**\r | |
46 | The class is used to create, update FpdHeader of Fpd file\r | |
47 | It extends IInternalFrame\r | |
48 | \r | |
49 | @since PackageEditor 1.0\r | |
50 | \r | |
51 | **/\r | |
e4f1ff6c | 52 | public class FpdHeader extends IInternalFrame implements DocumentListener{\r |
a13899c5 | 53 | \r |
01fa6a61 | 54 | private int dialogWidth = 560;\r |
55 | \r | |
56 | private int labelColumn = 12;\r | |
57 | \r | |
58 | private int labelWidth = 155;\r | |
59 | \r | |
60 | private int buttonWidth = 60;\r | |
61 | \r | |
62 | private final int valueColumn = 168;\r | |
63 | \r | |
64 | private final int valueWidth = 320;\r | |
65 | \r | |
66 | private final int specWidth = 420;\r | |
67 | \r | |
68 | private int shortValueWidth = valueWidth - (buttonWidth + 5);\r | |
69 | \r | |
70 | private final int oneRowHeight = 20;\r | |
71 | \r | |
72 | private final int threeRowHeight = 60;\r | |
73 | \r | |
74 | private final int fourRowHeight = 80;\r | |
75 | \r | |
76 | private final int rowSep = 5;\r | |
77 | \r | |
78 | private final int rowOne = 12;\r | |
79 | \r | |
80 | private final int rowTwo = rowOne + oneRowHeight + rowSep;\r | |
81 | \r | |
82 | private final int rowThree = rowTwo + oneRowHeight + rowSep;\r | |
83 | \r | |
84 | private final int rowFour = rowThree + oneRowHeight + rowSep;\r | |
85 | \r | |
86 | private final int rowFive = rowFour + threeRowHeight + rowSep;\r | |
87 | \r | |
88 | private final int rowSix = rowFive + fourRowHeight + rowSep;\r | |
89 | \r | |
90 | private final int rowSeven = rowSix + oneRowHeight + rowSep;\r | |
91 | \r | |
92 | private final int rowEight = rowSeven + oneRowHeight + rowSep;\r | |
93 | \r | |
94 | private final int rowNine = rowEight + fourRowHeight + threeRowHeight +rowSep;\r | |
95 | \r | |
96 | private int dialogHeight = rowNine + threeRowHeight;\r | |
a13899c5 | 97 | ///\r |
98 | /// Define class Serial Version UID\r | |
99 | ///\r | |
100 | private static final long serialVersionUID = -8152099582923006900L;\r | |
101 | \r | |
102 | //\r | |
103 | //Define class members\r | |
104 | //\r | |
105 | private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,53"\r | |
106 | \r | |
107 | private JLabel jLabelBaseName = null;\r | |
108 | \r | |
109 | private JTextField jTextFieldBaseName = null;\r | |
110 | \r | |
111 | private JLabel jLabelGuid = null;\r | |
112 | \r | |
113 | private JTextField jTextFieldGuid = null;\r | |
114 | \r | |
115 | private JLabel jLabelVersion = null;\r | |
116 | \r | |
117 | private JTextField jTextFieldVersion = null;\r | |
118 | \r | |
119 | private JButton jButtonGenerateGuid = null;\r | |
120 | \r | |
121 | private JLabel jLabelLicense = null;\r | |
122 | \r | |
123 | private JTextArea jTextAreaLicense = null;\r | |
124 | \r | |
125 | private JLabel jLabelCopyright = null;\r | |
126 | \r | |
127 | private JLabel jLabelDescription = null;\r | |
128 | \r | |
129 | private JTextArea jTextAreaDescription = null;\r | |
130 | \r | |
a13899c5 | 131 | private JTextField jTextFieldSpecification = null;\r |
132 | \r | |
133 | private JButton jButtonOk = null;\r | |
134 | \r | |
135 | private JButton jButtonCancel = null;\r | |
136 | \r | |
137 | private JScrollPane jScrollPaneLicense = null;\r | |
138 | \r | |
139 | private JScrollPane jScrollPaneDescription = null;\r | |
01fa6a61 | 140 | \r |
141 | private JScrollPane jCopyrightScrollPane = null;\r | |
a13899c5 | 142 | \r |
143 | private JLabel jLabelAbstract = null;\r | |
144 | \r | |
145 | private JTextField jTextFieldAbstract = null;\r | |
146 | \r | |
147 | private StarLabel jStarLabel1 = null;\r | |
148 | \r | |
149 | private StarLabel jStarLabel2 = null;\r | |
150 | \r | |
151 | private StarLabel jStarLabel3 = null;\r | |
152 | \r | |
153 | private StarLabel jStarLabel4 = null;\r | |
154 | \r | |
155 | private StarLabel jStarLabel5 = null;\r | |
156 | \r | |
a13899c5 | 157 | private StarLabel jStarLabel7 = null;\r |
158 | \r | |
159 | private StarLabel jStarLabel8 = null;\r | |
a13899c5 | 160 | \r |
01fa6a61 | 161 | private JTextArea jCopyrightTextArea = null;\r |
a13899c5 | 162 | \r |
163 | private JLabel jLabel = null;\r | |
164 | \r | |
4da2e625 | 165 | private JTextField jTextFieldUrl = null;\r |
a13899c5 | 166 | \r |
167 | private FpdFileContents ffc = null;\r | |
d6d24759 | 168 | \r |
169 | private OpeningPlatformType docConsole = null;\r | |
618737f8 | 170 | \r |
171 | private boolean amended = false; \r | |
a13899c5 | 172 | \r |
173 | /**\r | |
174 | This method initializes jTextFieldBaseName \r | |
175 | \r | |
176 | @return javax.swing.JTextField jTextFieldBaseName\r | |
177 | \r | |
178 | **/\r | |
179 | private JTextField getJTextFieldBaseName() {\r | |
180 | if (jTextFieldBaseName == null) {\r | |
181 | jTextFieldBaseName = new JTextField();\r | |
01fa6a61 | 182 | jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));\r |
183 | jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));\r | |
e4f1ff6c | 184 | jTextFieldBaseName.getDocument().addDocumentListener(this);\r |
a13899c5 | 185 | jTextFieldBaseName.addFocusListener(new FocusAdapter(){\r |
186 | public void focusLost(FocusEvent e) {\r | |
d6d24759 | 187 | if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) {\r |
82484861 | 188 | JOptionPane.showMessageDialog(FpdHeader.this, "Package Name does not match the UiNameType datatype.");\r |
d6d24759 | 189 | return;\r |
190 | }\r | |
a490bca8 | 191 | if (jTextFieldBaseName.getText().equals(ffc.getFpdHdrPlatformName())) {\r |
192 | return;\r | |
193 | }\r | |
a13899c5 | 194 | ffc.setFpdHdrPlatformName(jTextFieldBaseName.getText());\r |
195 | } \r | |
196 | });\r | |
197 | }\r | |
198 | return jTextFieldBaseName;\r | |
199 | }\r | |
200 | \r | |
201 | /**\r | |
202 | This method initializes jTextFieldGuid \r | |
203 | \r | |
204 | @return javax.swing.JTextField jTextFieldGuid\r | |
205 | \r | |
206 | **/\r | |
207 | private JTextField getJTextFieldGuid() {\r | |
208 | if (jTextFieldGuid == null) {\r | |
209 | jTextFieldGuid = new JTextField();\r | |
01fa6a61 | 210 | jTextFieldGuid.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));\r |
211 | jTextFieldGuid.setPreferredSize(new java.awt.Dimension(shortValueWidth,oneRowHeight));\r | |
e4f1ff6c | 212 | jTextFieldGuid.getDocument().addDocumentListener(this);\r |
a13899c5 | 213 | jTextFieldGuid.addFocusListener(new FocusAdapter(){\r |
214 | public void focusLost(FocusEvent e) {\r | |
d6d24759 | 215 | if (!DataValidation.isGuid(jTextFieldGuid.getText())) {\r |
82484861 | 216 | JOptionPane.showMessageDialog(FpdHeader.this, "Guid must be in registry (8-4-4-4-12) format.");\r |
d6d24759 | 217 | return;\r |
218 | }\r | |
a490bca8 | 219 | if (jTextFieldGuid.getText().equals(ffc.getFpdHdrGuidValue())) {\r |
220 | return;\r | |
221 | }\r | |
a13899c5 | 222 | ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());\r |
223 | } \r | |
224 | });\r | |
225 | }\r | |
226 | return jTextFieldGuid;\r | |
227 | }\r | |
228 | \r | |
229 | /**\r | |
230 | This method initializes jTextFieldVersion \r | |
231 | \r | |
232 | @return javax.swing.JTextField jTextFieldVersion\r | |
233 | \r | |
234 | **/\r | |
235 | private JTextField getJTextFieldVersion() {\r | |
236 | if (jTextFieldVersion == null) {\r | |
237 | jTextFieldVersion = new JTextField();\r | |
01fa6a61 | 238 | jTextFieldVersion.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));\r |
239 | jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));\r | |
e4f1ff6c | 240 | jTextFieldVersion.getDocument().addDocumentListener(this);\r |
a13899c5 | 241 | jTextFieldVersion.addFocusListener(new FocusAdapter(){\r |
242 | public void focusLost(FocusEvent e) {\r | |
d6d24759 | 243 | if (!DataValidation.isVersion(jTextFieldVersion.getText())) {\r |
82484861 | 244 | JOptionPane.showMessageDialog(FpdHeader.this, "Version does not match the Version datatype.");\r |
d6d24759 | 245 | return;\r |
246 | }\r | |
a490bca8 | 247 | if (jTextFieldVersion.getText().equals(ffc.getFpdHdrVer())) {\r |
248 | return;\r | |
249 | }\r | |
a13899c5 | 250 | ffc.setFpdHdrVer(jTextFieldVersion.getText());\r |
251 | } \r | |
252 | });\r | |
253 | }\r | |
254 | return jTextFieldVersion;\r | |
255 | }\r | |
256 | \r | |
257 | /**\r | |
258 | This method initializes jButtonGenerateGuid \r | |
259 | \r | |
260 | @return javax.swing.JButton jButtonGenerateGuid\r | |
261 | \r | |
262 | **/\r | |
263 | private JButton getJButtonGenerateGuid() {\r | |
264 | if (jButtonGenerateGuid == null) {\r | |
265 | jButtonGenerateGuid = new JButton();\r | |
01fa6a61 | 266 | jButtonGenerateGuid.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));\r |
a13899c5 | 267 | jButtonGenerateGuid.setText("GEN");\r |
268 | jButtonGenerateGuid.addActionListener(this);\r | |
269 | }\r | |
270 | return jButtonGenerateGuid;\r | |
271 | }\r | |
272 | \r | |
273 | /**\r | |
274 | This method initializes jTextAreaLicense \r | |
275 | \r | |
276 | @return javax.swing.JTextArea jTextAreaLicense\r | |
277 | \r | |
278 | **/\r | |
279 | private JTextArea getJTextAreaLicense() {\r | |
280 | if (jTextAreaLicense == null) {\r | |
281 | jTextAreaLicense = new JTextArea();\r | |
282 | jTextAreaLicense.setText("");\r | |
a13899c5 | 283 | jTextAreaLicense.setLineWrap(true);\r |
e4f1ff6c | 284 | jTextAreaLicense.getDocument().addDocumentListener(this);\r |
a13899c5 | 285 | jTextAreaLicense.addFocusListener(new FocusAdapter(){\r |
286 | public void focusLost(FocusEvent e) {\r | |
d6d24759 | 287 | if (jTextAreaLicense.getText().length() == 0) {\r |
82484861 | 288 | JOptionPane.showMessageDialog(FpdHeader.this, "License must be entered!");\r |
d6d24759 | 289 | return;\r |
290 | }\r | |
a490bca8 | 291 | if (jTextAreaLicense.getText().equals(ffc.getFpdHdrLicense())) {\r |
292 | return;\r | |
293 | }\r | |
a13899c5 | 294 | ffc.setFpdHdrLicense(jTextAreaLicense.getText());\r |
295 | } \r | |
296 | });\r | |
297 | }\r | |
298 | return jTextAreaLicense;\r | |
299 | }\r | |
300 | \r | |
301 | /**\r | |
302 | This method initializes jTextAreaDescription \r | |
303 | \r | |
304 | @return javax.swing.JTextArea jTextAreaDescription\r | |
305 | \r | |
306 | **/\r | |
307 | private JTextArea getJTextAreaDescription() {\r | |
308 | if (jTextAreaDescription == null) {\r | |
309 | jTextAreaDescription = new JTextArea();\r | |
310 | jTextAreaDescription.setLineWrap(true);\r | |
e4f1ff6c | 311 | jTextAreaDescription.getDocument().addDocumentListener(this);\r |
a13899c5 | 312 | jTextAreaDescription.addFocusListener(new FocusAdapter(){\r |
313 | public void focusLost(FocusEvent e) {\r | |
d6d24759 | 314 | if (jTextAreaDescription.getText().length() == 0) {\r |
82484861 | 315 | JOptionPane.showMessageDialog(FpdHeader.this, "Description must be entered.");\r |
d6d24759 | 316 | return;\r |
317 | }\r | |
a490bca8 | 318 | if (jTextAreaDescription.getText().equals(ffc.getFpdHdrDescription())) {\r |
319 | return;\r | |
320 | }\r | |
a13899c5 | 321 | ffc.setFpdHdrDescription(jTextAreaDescription.getText());\r |
322 | } \r | |
323 | });\r | |
324 | }\r | |
325 | return jTextAreaDescription;\r | |
326 | }\r | |
327 | \r | |
328 | /**\r | |
329 | This method initializes jTextFieldSpecification \r | |
330 | \r | |
331 | @return javax.swing.JTextField jTextFieldSpecification\r | |
332 | \r | |
333 | **/\r | |
334 | private JTextField getJTextFieldSpecification() {\r | |
335 | if (jTextFieldSpecification == null) {\r | |
336 | jTextFieldSpecification = new JTextField();\r | |
01fa6a61 | 337 | jTextFieldSpecification.setBounds(new java.awt.Rectangle(labelColumn,rowNine,specWidth,oneRowHeight));\r |
a13899c5 | 338 | jTextFieldSpecification.setEditable(false);\r |
01fa6a61 | 339 | jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth,oneRowHeight));\r |
340 | jTextFieldSpecification.setBorder(null);\r | |
e4f1ff6c | 341 | // jTextFieldSpecification.addFocusListener(new FocusAdapter(){\r |
342 | // public void focusLost(FocusEvent e) {\r | |
343 | // ffc.setFpdHdrSpec(jTextFieldSpecification.getText());\r | |
344 | // } \r | |
345 | // });\r | |
a13899c5 | 346 | }\r |
347 | return jTextFieldSpecification;\r | |
348 | }\r | |
349 | \r | |
350 | /**\r | |
351 | This method initializes jButtonOk \r | |
352 | \r | |
353 | @return javax.swing.JButton jButtonOk\r | |
354 | \r | |
355 | **/\r | |
356 | private JButton getJButtonOk() {\r | |
357 | if (jButtonOk == null) {\r | |
358 | jButtonOk = new JButton();\r | |
359 | jButtonOk.setText("OK");\r | |
360 | jButtonOk.setBounds(new java.awt.Rectangle(290,351,90,20));\r | |
361 | jButtonOk.setVisible(false);\r | |
362 | jButtonOk.addActionListener(this);\r | |
363 | }\r | |
364 | return jButtonOk;\r | |
365 | }\r | |
366 | \r | |
367 | /**\r | |
368 | This method initializes jButtonCancel \r | |
369 | \r | |
370 | @return javax.swing.JButton jButtonCancel\r | |
371 | \r | |
372 | **/\r | |
373 | private JButton getJButtonCancel() {\r | |
374 | if (jButtonCancel == null) {\r | |
375 | jButtonCancel = new JButton();\r | |
376 | jButtonCancel.setText("Cancel");\r | |
377 | jButtonCancel.setBounds(new java.awt.Rectangle(390,351,90,20));\r | |
378 | jButtonCancel.setVisible(false);\r | |
379 | jButtonCancel.addActionListener(this);\r | |
380 | }\r | |
381 | return jButtonCancel;\r | |
382 | }\r | |
383 | \r | |
384 | /**\r | |
385 | This method initializes jScrollPaneLicense \r | |
386 | \r | |
387 | @return javax.swing.JScrollPane jScrollPaneLicense\r | |
388 | \r | |
389 | **/\r | |
390 | private JScrollPane getJScrollPaneLicense() {\r | |
391 | if (jScrollPaneLicense == null) {\r | |
392 | jScrollPaneLicense = new JScrollPane();\r | |
01fa6a61 | 393 | jScrollPaneLicense.setBounds(new java.awt.Rectangle(valueColumn,rowFive,valueWidth,fourRowHeight));\r |
a13899c5 | 394 | jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r |
01fa6a61 | 395 | jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth,fourRowHeight));\r |
a13899c5 | 396 | jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r |
397 | }\r | |
398 | return jScrollPaneLicense;\r | |
399 | }\r | |
400 | \r | |
401 | /**\r | |
402 | This method initializes jScrollPaneDescription \r | |
403 | \r | |
404 | @return javax.swing.JScrollPane jScrollPaneDescription\r | |
405 | \r | |
406 | **/\r | |
407 | private JScrollPane getJScrollPaneDescription() {\r | |
408 | if (jScrollPaneDescription == null) {\r | |
409 | jScrollPaneDescription = new JScrollPane();\r | |
01fa6a61 | 410 | jScrollPaneDescription.setBounds(new java.awt.Rectangle(valueColumn,rowEight,valueWidth,fourRowHeight));\r |
a13899c5 | 411 | jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r |
01fa6a61 | 412 | jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));\r |
a13899c5 | 413 | jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r |
414 | }\r | |
415 | return jScrollPaneDescription;\r | |
416 | }\r | |
417 | \r | |
418 | /**\r | |
419 | This method initializes jTextFieldAbstract \r | |
420 | \r | |
421 | @return javax.swing.JTextField jTextFieldAbstract\r | |
422 | \r | |
423 | **/\r | |
424 | private JTextField getJTextFieldAbstract() {\r | |
425 | if (jTextFieldAbstract == null) {\r | |
426 | jTextFieldAbstract = new JTextField();\r | |
01fa6a61 | 427 | jTextFieldAbstract.setBounds(new java.awt.Rectangle(valueColumn,rowSeven,valueWidth,oneRowHeight));\r |
428 | jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));\r | |
e4f1ff6c | 429 | jTextFieldAbstract.getDocument().addDocumentListener(this);\r |
a13899c5 | 430 | jTextFieldAbstract.addFocusListener(new FocusAdapter(){\r |
431 | public void focusLost(FocusEvent e) {\r | |
d6d24759 | 432 | if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) {\r |
82484861 | 433 | JOptionPane.showMessageDialog(FpdHeader.this, "Abstract must be entered.");\r |
d6d24759 | 434 | return;\r |
435 | }\r | |
a490bca8 | 436 | if (jTextFieldAbstract.getText().equals(ffc.getFpdHdrAbs())) {\r |
437 | return;\r | |
438 | }\r | |
a13899c5 | 439 | ffc.setFpdHdrAbs(jTextFieldAbstract.getText());\r |
440 | } \r | |
441 | });\r | |
442 | }\r | |
443 | return jTextFieldAbstract;\r | |
444 | }\r | |
445 | \r | |
01fa6a61 | 446 | private JScrollPane getCopyrightScrollPane() {\r |
447 | if (jCopyrightScrollPane == null) {\r | |
448 | jCopyrightScrollPane = new JScrollPane();\r | |
449 | jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight));\r | |
450 | jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r | |
451 | jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));\r | |
452 | jCopyrightScrollPane.setViewportView(getJCopyrightTextArea());\r | |
453 | }\r | |
454 | return jCopyrightScrollPane;\r | |
455 | }\r | |
a13899c5 | 456 | /**\r |
457 | This method initializes jTextFieldCopyright \r | |
458 | \r | |
459 | @return javax.swing.JTextField jTextFieldCopyright\r | |
460 | \r | |
461 | **/\r | |
01fa6a61 | 462 | private JTextArea getJCopyrightTextArea() {\r |
463 | if (jCopyrightTextArea == null) {\r | |
464 | jCopyrightTextArea = new JTextArea();\r | |
465 | jCopyrightTextArea.setWrapStyleWord(true);\r | |
50d4c727 | 466 | jCopyrightTextArea.setLineWrap(true);\r |
e4f1ff6c | 467 | jCopyrightTextArea.getDocument().addDocumentListener(this);\r |
01fa6a61 | 468 | jCopyrightTextArea.addFocusListener(new FocusAdapter(){\r |
a13899c5 | 469 | public void focusLost(FocusEvent e) {\r |
01fa6a61 | 470 | if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {\r |
82484861 | 471 | JOptionPane.showMessageDialog(FpdHeader.this, "Copyright must be entered.");\r |
d6d24759 | 472 | return;\r |
473 | }\r | |
01fa6a61 | 474 | if (jCopyrightTextArea.getText().equals(ffc.getFpdHdrCopyright())) {\r |
a490bca8 | 475 | return;\r |
476 | }\r | |
01fa6a61 | 477 | ffc.setFpdHdrCopyright(jCopyrightTextArea.getText());\r |
a13899c5 | 478 | } \r |
479 | });\r | |
480 | }\r | |
01fa6a61 | 481 | return jCopyrightTextArea;\r |
a13899c5 | 482 | }\r |
483 | \r | |
484 | /**\r | |
485 | * This method initializes jTextField \r | |
486 | * \r | |
487 | * @return javax.swing.JTextField \r | |
488 | */\r | |
4da2e625 | 489 | private JTextField getJTextFieldUrl() {\r |
490 | if (jTextFieldUrl == null) {\r | |
491 | jTextFieldUrl = new JTextField();\r | |
01fa6a61 | 492 | jTextFieldUrl.setBounds(new java.awt.Rectangle(valueColumn,rowSix,valueWidth,oneRowHeight));\r |
493 | jTextFieldUrl.setPreferredSize(new Dimension(valueWidth, oneRowHeight));\r | |
e4f1ff6c | 494 | jTextFieldUrl.getDocument().addDocumentListener(this);\r |
4da2e625 | 495 | jTextFieldUrl.addFocusListener(new FocusAdapter(){\r |
a13899c5 | 496 | public void focusLost(FocusEvent e){\r |
4da2e625 | 497 | if (jTextFieldUrl.getText().length() == 0 && ffc.getFpdHdrUrl() == null) {\r |
a490bca8 | 498 | return;\r |
499 | }\r | |
4da2e625 | 500 | if (jTextFieldUrl.getText().equals(ffc.getFpdHdrUrl())) {\r |
a490bca8 | 501 | return;\r |
502 | }\r | |
a13899c5 | 503 | ffc.setFpdHdrLicense(jTextAreaLicense.getText());\r |
4da2e625 | 504 | ffc.setFpdHdrUrl(jTextFieldUrl.getText());\r |
a13899c5 | 505 | } \r |
506 | });\r | |
507 | }\r | |
4da2e625 | 508 | return jTextFieldUrl;\r |
a13899c5 | 509 | }\r |
510 | \r | |
511 | public static void main(String[] args) {\r | |
512 | new FpdHeader().setVisible(true);\r | |
513 | }\r | |
514 | \r | |
515 | /**\r | |
516 | This is the default constructor\r | |
517 | \r | |
518 | **/\r | |
519 | public FpdHeader() {\r | |
520 | super();\r | |
521 | init();\r | |
522 | this.setVisible(true);\r | |
523 | }\r | |
524 | \r | |
525 | /**\r | |
526 | This is the override edit constructor\r | |
527 | \r | |
528 | @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader\r | |
529 | \r | |
530 | **/\r | |
531 | public FpdHeader(PlatformSurfaceAreaDocument.PlatformSurfaceArea inFpd) {\r | |
532 | this();\r | |
533 | ffc = new FpdFileContents(inFpd);\r | |
534 | init(ffc);\r | |
535 | \r | |
536 | }\r | |
d6d24759 | 537 | \r |
538 | public FpdHeader(OpeningPlatformType opt) {\r | |
539 | this(opt.getXmlFpd());\r | |
540 | docConsole = opt;\r | |
618737f8 | 541 | if (amended) {\r |
542 | docConsole.setSaved(false);\r | |
543 | amended = false;\r | |
544 | }\r | |
d6d24759 | 545 | }\r |
a13899c5 | 546 | \r |
547 | /**\r | |
548 | This method initializes this\r | |
549 | \r | |
550 | **/\r | |
551 | private void init() {\r | |
552 | //this.setSize(500, 515);\r | |
553 | this.setContentPane(getJContentPane());\r | |
3658f95e | 554 | this.setTitle("Platform Surface Area Header");\r |
a13899c5 | 555 | initFrame();\r |
556 | \r | |
557 | }\r | |
558 | \r | |
559 | /**\r | |
560 | This method initializes this\r | |
561 | Fill values to all fields if these values are not empty\r | |
562 | \r | |
563 | @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader\r | |
564 | \r | |
565 | **/\r | |
566 | private void init(FpdFileContents ffc) {\r | |
567 | \r | |
568 | if (ffc.getFpdHdrPlatformName() != null) {\r | |
569 | jTextFieldBaseName.setText(ffc.getFpdHdrPlatformName());\r | |
570 | }\r | |
571 | if (ffc.getFpdHdrGuidValue() != null) {\r | |
572 | jTextFieldGuid.setText(ffc.getFpdHdrGuidValue());\r | |
573 | }\r | |
574 | if (ffc.getFpdHdrVer() != null) {\r | |
575 | jTextFieldVersion.setText(ffc.getFpdHdrVer());\r | |
576 | }\r | |
577 | if (ffc.getFpdHdrLicense() != null) {\r | |
578 | jTextAreaLicense.setText(ffc.getFpdHdrLicense());\r | |
579 | }\r | |
44053733 | 580 | if (ffc.getFpdHdrAbs() != null) {\r |
581 | jTextFieldAbstract.setText(ffc.getFpdHdrAbs());\r | |
582 | }\r | |
a13899c5 | 583 | if (ffc.getFpdHdrUrl() != null) {\r |
4da2e625 | 584 | jTextFieldUrl.setText(ffc.getFpdHdrUrl());\r |
a13899c5 | 585 | }\r |
586 | if (ffc.getFpdHdrCopyright() != null) {\r | |
01fa6a61 | 587 | jCopyrightTextArea.setText(ffc.getFpdHdrCopyright());\r |
a13899c5 | 588 | }\r |
589 | if (ffc.getFpdHdrDescription() != null) {\r | |
590 | jTextAreaDescription.setText(ffc.getFpdHdrDescription());\r | |
591 | }\r | |
592 | if (ffc.getFpdHdrSpec() != null) {\r | |
593 | jTextFieldSpecification.setText(ffc.getFpdHdrSpec());\r | |
594 | }\r | |
1faac7b6 | 595 | ffc.setFpdHdrSpec(jTextFieldSpecification.getText());\r |
596 | \r | |
618737f8 | 597 | if (ffc.getPlatformDefsSkuInfoCount() == 0) {\r |
598 | ffc.genPlatformDefsSkuInfo("0", "DEFAULT");\r | |
599 | amended = true;\r | |
600 | JOptionPane.showMessageDialog(this, "Default SKU set for this platform.");\r | |
601 | }\r | |
1faac7b6 | 602 | Vector<Object> v = new Vector<Object>();\r |
603 | ffc.getPlatformDefsSupportedArchs(v);\r | |
604 | if (v.size() == 0) {\r | |
605 | v.add("IA32");\r | |
606 | ffc.setPlatformDefsSupportedArchs(v);\r | |
618737f8 | 607 | amended = true;\r |
608 | JOptionPane.showMessageDialog(this, "Supported Arch. IA32 added for this platform.");\r | |
1faac7b6 | 609 | }\r |
610 | v.removeAllElements();\r | |
611 | ffc.getPlatformDefsBuildTargets(v);\r | |
612 | if (v.size() == 0) {\r | |
613 | v.add("DEBUG");\r | |
614 | ffc.setPlatformDefsBuildTargets(v);\r | |
618737f8 | 615 | amended = true;\r |
616 | JOptionPane.showMessageDialog(this, "Build target IA32 added for this platform.");\r | |
1faac7b6 | 617 | }\r |
618 | if (ffc.getPlatformDefsInterDir() == null) {\r | |
619 | ffc.setPlatformDefsInterDir("UNIFIED");\r | |
618737f8 | 620 | amended = true;\r |
621 | JOptionPane.showMessageDialog(this, "UNIFIED Intermediate Directory set for this platform.");\r | |
1faac7b6 | 622 | }\r |
a13899c5 | 623 | }\r |
624 | \r | |
625 | /**\r | |
626 | This method initializes jContentPane\r | |
627 | \r | |
628 | @return javax.swing.JPanel jContentPane\r | |
629 | \r | |
630 | **/\r | |
631 | private JPanel getJContentPane() {\r | |
632 | if (jContentPane == null) {\r | |
01fa6a61 | 633 | jContentPane = new JPanel();\r |
a13899c5 | 634 | jContentPane.setLayout(null);\r |
635 | jContentPane.setLocation(new java.awt.Point(0, 0));\r | |
01fa6a61 | 636 | jContentPane.setSize(new java.awt.Dimension(dialogWidth - 20 ,dialogHeight - 20));\r |
637 | \r | |
638 | jLabel = new JLabel();\r | |
639 | jLabel.setBounds(new java.awt.Rectangle(labelColumn,rowSix,labelWidth,oneRowHeight));\r | |
640 | jLabel.setText("URL");\r | |
a13899c5 | 641 | jLabelAbstract = new JLabel();\r |
01fa6a61 | 642 | jLabelAbstract.setBounds(new java.awt.Rectangle(labelColumn,rowSeven,labelWidth,oneRowHeight));\r |
a13899c5 | 643 | jLabelAbstract.setText("Abstract");\r |
a13899c5 | 644 | jLabelDescription = new JLabel();\r |
645 | jLabelDescription.setText("Description");\r | |
01fa6a61 | 646 | jLabelDescription.setBounds(new java.awt.Rectangle(labelColumn,rowEight,labelWidth,oneRowHeight));\r |
a13899c5 | 647 | jLabelCopyright = new JLabel();\r |
648 | jLabelCopyright.setText("Copyright");\r | |
01fa6a61 | 649 | jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn,rowFour,labelWidth,oneRowHeight));\r |
a13899c5 | 650 | jLabelLicense = new JLabel();\r |
651 | jLabelLicense.setText("License");\r | |
01fa6a61 | 652 | jLabelLicense.setBounds(new java.awt.Rectangle(labelColumn,rowFive,labelWidth,oneRowHeight));\r |
a13899c5 | 653 | jLabelVersion = new JLabel();\r |
654 | jLabelVersion.setText("Version");\r | |
01fa6a61 | 655 | jLabelVersion.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));\r |
a13899c5 | 656 | jLabelGuid = new JLabel();\r |
01fa6a61 | 657 | jLabelGuid.setPreferredSize(new java.awt.Dimension(labelWidth, oneRowHeight));\r |
658 | jLabelGuid.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));\r | |
a13899c5 | 659 | jLabelGuid.setText("Guid");\r |
660 | jLabelBaseName = new JLabel();\r | |
661 | jLabelBaseName.setText("Platform Name");\r | |
01fa6a61 | 662 | jLabelBaseName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));\r |
663 | jStarLabel1 = new StarLabel();\r | |
664 | jStarLabel1.setLocation(new java.awt.Point(0, rowOne));\r | |
665 | jStarLabel2 = new StarLabel();\r | |
666 | jStarLabel2.setLocation(new java.awt.Point(0, rowTwo));\r | |
667 | jStarLabel3 = new StarLabel();\r | |
668 | jStarLabel3.setLocation(new java.awt.Point(0, rowThree));\r | |
669 | jStarLabel4 = new StarLabel();\r | |
670 | jStarLabel4.setLocation(new java.awt.Point(0,rowFour));\r | |
671 | jStarLabel5 = new StarLabel();\r | |
672 | jStarLabel5.setLocation(new java.awt.Point(0,rowFive));\r | |
673 | jStarLabel7 = new StarLabel();\r | |
674 | jStarLabel7.setLocation(new java.awt.Point(0,rowSeven));\r | |
675 | jStarLabel8 = new StarLabel();\r | |
676 | jStarLabel8.setLocation(new java.awt.Point(0,rowEight));\r | |
677 | \r | |
a13899c5 | 678 | jContentPane.add(jLabelBaseName, null);\r |
679 | jContentPane.add(getJTextFieldBaseName(), null);\r | |
680 | jContentPane.add(jLabelGuid, null);\r | |
681 | jContentPane.add(getJTextFieldGuid(), null);\r | |
682 | jContentPane.add(jLabelVersion, null);\r | |
683 | jContentPane.add(getJTextFieldVersion(), null);\r | |
684 | jContentPane.add(getJButtonGenerateGuid(), null);\r | |
685 | jContentPane.add(jLabelLicense, null);\r | |
686 | jContentPane.add(jLabelCopyright, null);\r | |
687 | jContentPane.add(jLabelDescription, null);\r | |
a13899c5 | 688 | jContentPane.add(getJTextFieldSpecification(), null);\r |
689 | jContentPane.add(getJButtonOk(), null);\r | |
690 | jContentPane.add(getJButtonCancel(), null);\r | |
691 | jContentPane.add(getJScrollPaneLicense(), null);\r | |
692 | jContentPane.add(getJScrollPaneDescription(), null);\r | |
693 | jContentPane.add(jLabelAbstract, null);\r | |
694 | jContentPane.add(getJTextFieldAbstract(), null);\r | |
01fa6a61 | 695 | \r |
a13899c5 | 696 | jContentPane.add(jStarLabel1, null);\r |
697 | jContentPane.add(jStarLabel2, null);\r | |
698 | jContentPane.add(jStarLabel3, null);\r | |
699 | jContentPane.add(jStarLabel4, null);\r | |
700 | jContentPane.add(jStarLabel5, null);\r | |
a13899c5 | 701 | jContentPane.add(jStarLabel7, null);\r |
702 | jContentPane.add(jStarLabel8, null);\r | |
01fa6a61 | 703 | jContentPane.add(getCopyrightScrollPane(), null);\r |
a13899c5 | 704 | \r |
705 | jContentPane.add(jLabel, null);\r | |
4da2e625 | 706 | jContentPane.add(getJTextFieldUrl(), null);\r |
a13899c5 | 707 | }\r |
708 | return jContentPane;\r | |
709 | }\r | |
710 | \r | |
711 | /* (non-Javadoc)\r | |
712 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
713 | *\r | |
714 | * Override actionPerformed to listen all actions\r | |
715 | *\r | |
716 | */\r | |
717 | public void actionPerformed(ActionEvent arg0) {\r | |
a490bca8 | 718 | \r |
a13899c5 | 719 | if (arg0.getSource() == jButtonGenerateGuid) {\r |
a13899c5 | 720 | jTextFieldGuid.setText(Tools.generateUuidString());\r |
721 | ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());\r | |
722 | }\r | |
723 | }\r | |
724 | \r | |
a490bca8 | 725 | \r |
a13899c5 | 726 | /**\r |
727 | This method initializes Package type and Compontent type\r | |
728 | \r | |
729 | **/\r | |
730 | private void initFrame() {\r | |
731 | \r | |
732 | \r | |
733 | }\r | |
734 | \r | |
735 | /* (non-Javadoc)\r | |
736 | * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)\r | |
737 | * \r | |
738 | * Override componentResized to resize all components when frame's size is changed\r | |
739 | */\r | |
740 | public void componentResized(ComponentEvent arg0) {\r | |
01fa6a61 | 741 | int intPreferredWidth = dialogWidth;\r |
742 | int intCurrentWidth = this.getJContentPane().getWidth();\r | |
743 | \r | |
744 | // Tools.resizeComponentWidth(this.jTextFieldBaseName, this.getWidth(), intPreferredWidth);\r | |
745 | // Tools.resizeComponentWidth(this.jTextFieldGuid, this.getWidth(), intPreferredWidth);\r | |
746 | // Tools.relocateComponentX(this.jButtonGenerateGuid, this.getWidth(), jButtonGenerateGuid.getWidth(), 25);\r | |
747 | // Tools.resizeComponentWidth(this.jTextFieldVersion, this.getWidth(), intPreferredWidth);\r | |
748 | // Tools.resizeComponentWidth(this.jTextFieldCopyright, this.getWidth(), intPreferredWidth);\r | |
749 | Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);\r | |
750 | Tools.resizeComponentWidth(this.jTextFieldUrl, intCurrentWidth, intPreferredWidth);\r | |
751 | Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth); \r | |
752 | Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);\r | |
753 | // Tools.resizeComponentWidth(this.jTextFieldSpecification, this.getWidth(), intPreferredWidth);\r | |
a13899c5 | 754 | \r |
a13899c5 | 755 | \r |
01fa6a61 | 756 | \r |
a13899c5 | 757 | }\r |
e4f1ff6c | 758 | \r |
759 | /* (non-Javadoc)\r | |
760 | * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)\r | |
761 | */\r | |
762 | public void changedUpdate(DocumentEvent arg0) {\r | |
763 | // TODO Auto-generated method stub\r | |
764 | \r | |
765 | }\r | |
766 | \r | |
767 | /* (non-Javadoc)\r | |
768 | * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)\r | |
769 | */\r | |
770 | public void insertUpdate(DocumentEvent arg0) {\r | |
771 | // TODO Auto-generated method stub\r | |
772 | if (docConsole != null) {\r | |
773 | docConsole.setSaved(false);\r | |
774 | }\r | |
775 | }\r | |
776 | \r | |
777 | /* (non-Javadoc)\r | |
778 | * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)\r | |
779 | */\r | |
780 | public void removeUpdate(DocumentEvent arg0) {\r | |
781 | // TODO Auto-generated method stub\r | |
782 | if (docConsole != null) {\r | |
783 | docConsole.setSaved(false); \r | |
784 | }\r | |
785 | }\r | |
a13899c5 | 786 | }\r |