]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | \r | |
3 | The file is used to show a Finish page in the last step of setup\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.packaging.workspace.ui;\r | |
17 | \r | |
18 | import java.awt.event.ActionEvent;\r | |
19 | import java.awt.event.ActionListener;\r | |
20 | import java.awt.event.WindowEvent;\r | |
21 | \r | |
22 | import javax.swing.JButton;\r | |
23 | import javax.swing.JFrame;\r | |
24 | import javax.swing.JLabel;\r | |
25 | import javax.swing.JPanel;\r | |
26 | import javax.swing.JScrollPane;\r | |
27 | import javax.swing.JTextArea;\r | |
28 | \r | |
29 | import org.tianocore.packaging.common.ui.IFrame;\r | |
30 | \r | |
31 | /**\r | |
32 | The class is used to show a Finish page in the last step of setup\r | |
33 | \r | |
34 | @since CreateMdkPkg 1.0\r | |
35 | \r | |
36 | **/\r | |
37 | public class Finish extends IFrame implements ActionListener {\r | |
38 | \r | |
39 | ///\r | |
40 | /// Define class Serial Version UID\r | |
41 | ///\r | |
42 | private static final long serialVersionUID = 9055339173915836187L;\r | |
43 | \r | |
44 | //\r | |
45 | // Define class members\r | |
46 | //\r | |
47 | private JPanel jContentPane = null;\r | |
48 | \r | |
49 | private JTextArea jTextAreaTitle = null;\r | |
50 | \r | |
51 | private JTextArea jTextAreaContent = null;\r | |
52 | \r | |
53 | private JPanel jPanel = null;\r | |
54 | \r | |
55 | private JButton jButtonFinish = null;\r | |
56 | \r | |
57 | private JLabel jLabel = null;\r | |
58 | \r | |
59 | private JLabel jLabel1 = null;\r | |
60 | \r | |
61 | private JScrollPane jScrollPane = null;\r | |
62 | \r | |
63 | private JTextArea jTextAreaComment = null;\r | |
64 | \r | |
65 | private String strInstallDir = "";\r | |
66 | \r | |
67 | /**\r | |
68 | This method initializes jTextAreaTitle \r | |
69 | \r | |
70 | @return javax.swing.JTextArea jTextAreaTitle\r | |
71 | \r | |
72 | **/\r | |
73 | private JTextArea getJTextAreaTitle() {\r | |
74 | if (jTextAreaTitle == null) {\r | |
75 | jTextAreaTitle = new JTextArea();\r | |
76 | jTextAreaTitle.setLocation(new java.awt.Point(0, 0));\r | |
77 | jTextAreaTitle.setText(" Click button \"Install\" to start installation");\r | |
78 | jTextAreaTitle.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));\r | |
79 | jTextAreaTitle.setEditable(false);\r | |
80 | jTextAreaTitle.setSize(new java.awt.Dimension(495, 20));\r | |
81 | }\r | |
82 | return jTextAreaTitle;\r | |
83 | }\r | |
84 | \r | |
85 | /**\r | |
86 | This method initializes jTextAreaContent \r | |
87 | \r | |
88 | @return javax.swing.JTextArea jTextAreaContent\r | |
89 | \r | |
90 | **/\r | |
91 | private JTextArea getJTextAreaContent() {\r | |
92 | if (jTextAreaContent == null) {\r | |
93 | jTextAreaContent = new JTextArea();\r | |
94 | jTextAreaContent.setLocation(new java.awt.Point(0, 20));\r | |
95 | jTextAreaContent.setText("");\r | |
96 | jTextAreaContent.setEditable(false);\r | |
97 | jTextAreaContent.setSize(new java.awt.Dimension(495, 35));\r | |
98 | }\r | |
99 | return jTextAreaContent;\r | |
100 | }\r | |
101 | \r | |
102 | /**\r | |
103 | This method initializes jPanel \r | |
104 | \r | |
105 | @return javax.swing.JPanel jPanel\r | |
106 | \r | |
107 | **/\r | |
108 | private JPanel getJPanel() {\r | |
109 | if (jPanel == null) {\r | |
110 | jLabel1 = new JLabel();\r | |
111 | jLabel1.setText("");\r | |
112 | jLabel1.setLocation(new java.awt.Point(30, 40));\r | |
113 | jLabel1.setSize(new java.awt.Dimension(435, 20));\r | |
114 | jLabel = new JLabel();\r | |
115 | jLabel.setText("");\r | |
116 | jLabel.setLocation(new java.awt.Point(30, 15));\r | |
117 | jLabel.setSize(new java.awt.Dimension(435, 20));\r | |
118 | jPanel = new JPanel();\r | |
119 | jPanel.setLayout(null);\r | |
120 | jPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));\r | |
121 | jPanel.setSize(new java.awt.Dimension(494, 251));\r | |
122 | jPanel.setLocation(new java.awt.Point(0, 55));\r | |
123 | jPanel.add(jLabel, null);\r | |
124 | jPanel.add(jLabel1, null);\r | |
125 | jPanel.add(getJScrollPane(), null);\r | |
126 | }\r | |
127 | return jPanel;\r | |
128 | }\r | |
129 | \r | |
130 | /**\r | |
131 | This method initializes jButtonFinish \r | |
132 | \r | |
133 | @return javax.swing.JButton jButtonFinish\r | |
134 | \r | |
135 | **/\r | |
136 | private JButton getJButtonCancel() {\r | |
137 | if (jButtonFinish == null) {\r | |
138 | jButtonFinish = new JButton();\r | |
139 | jButtonFinish.setText("Finish");\r | |
140 | jButtonFinish.setBounds(new java.awt.Rectangle(360, 315, 90, 20));\r | |
141 | jButtonFinish.setEnabled(true);\r | |
142 | jButtonFinish.setSelected(false);\r | |
143 | jButtonFinish.setMnemonic('C');\r | |
144 | jButtonFinish.addActionListener(this);\r | |
145 | }\r | |
146 | return jButtonFinish;\r | |
147 | }\r | |
148 | \r | |
149 | /**\r | |
150 | This method initializes jScrollPane \r | |
151 | \r | |
152 | @return javax.swing.JScrollPane jScrollPane\r | |
153 | \r | |
154 | **/\r | |
155 | private JScrollPane getJScrollPane() {\r | |
156 | if (jScrollPane == null) {\r | |
157 | jScrollPane = new JScrollPane();\r | |
158 | jScrollPane.setLocation(new java.awt.Point(30, 65));\r | |
159 | jScrollPane.setSize(new java.awt.Dimension(435, 180));\r | |
160 | jScrollPane.setViewportView(getJTextAreaComment());\r | |
161 | }\r | |
162 | return jScrollPane;\r | |
163 | }\r | |
164 | \r | |
165 | /**\r | |
166 | This method initializes jTextAreaComment \r | |
167 | \r | |
168 | @return javax.swing.JTextArea jTextAreaComment\r | |
169 | \r | |
170 | **/\r | |
171 | private JTextArea getJTextAreaComment() {\r | |
172 | if (jTextAreaComment == null) {\r | |
173 | jTextAreaComment = new JTextArea();\r | |
174 | jTextAreaComment.setEditable(false);\r | |
175 | jTextAreaComment.setLineWrap(true);\r | |
176 | jTextAreaComment.setWrapStyleWord(false);\r | |
177 | }\r | |
178 | return jTextAreaComment;\r | |
179 | }\r | |
180 | \r | |
181 | /**\r | |
182 | Main class, used for test\r | |
183 | \r | |
184 | @param args\r | |
185 | **/\r | |
186 | public static void main(String[] args) {\r | |
187 | Finish f = new Finish();\r | |
188 | f.setVisible(true);\r | |
189 | }\r | |
190 | \r | |
191 | /**\r | |
192 | This is the override constructor\r | |
193 | \r | |
194 | @param InstallDir The install target dir\r | |
195 | \r | |
196 | **/\r | |
197 | public Finish(String InstallDir) {\r | |
198 | super();\r | |
199 | this.strInstallDir = InstallDir;\r | |
200 | init();\r | |
201 | }\r | |
202 | \r | |
203 | /**\r | |
204 | This is the default constructor\r | |
205 | \r | |
206 | **/\r | |
207 | public Finish() {\r | |
208 | super();\r | |
209 | init();\r | |
210 | }\r | |
211 | \r | |
212 | /**\r | |
213 | This method initializes this\r | |
214 | \r | |
215 | **/\r | |
216 | private void init() {\r | |
217 | this.setSize(500, 390);\r | |
218 | \r | |
219 | this.setContentPane(getJContentPane());\r | |
220 | this.setTitle("Setup - Installing");\r | |
221 | this.centerWindow();\r | |
222 | this.getRootPane().setDefaultButton(jButtonFinish);\r | |
223 | switchFinish();\r | |
224 | }\r | |
225 | \r | |
226 | /**\r | |
227 | This method initializes jContentPane\r | |
228 | \r | |
229 | @return javax.swing.JPanel jContentPane\r | |
230 | \r | |
231 | **/\r | |
232 | private JPanel getJContentPane() {\r | |
233 | if (jContentPane == null) {\r | |
234 | jContentPane = new JPanel();\r | |
235 | jContentPane.setLayout(null);\r | |
236 | jContentPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));\r | |
237 | jContentPane.add(getJTextAreaTitle(), null);\r | |
238 | jContentPane.add(getJTextAreaContent(), null);\r | |
239 | jContentPane.add(getJPanel(), null);\r | |
240 | jContentPane.add(getJButtonCancel(), null);\r | |
241 | }\r | |
242 | return jContentPane;\r | |
243 | }\r | |
244 | \r | |
245 | /* (non-Javadoc)\r | |
246 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
247 | * \r | |
248 | * Override actionPerformed to listen all actions\r | |
249 | * \r | |
250 | */\r | |
251 | public void actionPerformed(ActionEvent arg0) {\r | |
252 | Object obj = arg0.getSource();\r | |
253 | \r | |
254 | if (obj == jButtonFinish) {\r | |
255 | this.dispose();\r | |
256 | System.exit(0);\r | |
257 | }\r | |
258 | }\r | |
259 | \r | |
260 | /**\r | |
261 | Change all message values to Finish contents.\r | |
262 | \r | |
263 | **/\r | |
264 | private void switchFinish() {\r | |
265 | this.setTitle("Setup - Finish");\r | |
266 | jTextAreaTitle.setText(" Congratulations");\r | |
267 | jTextAreaContent.setText(" Your workspace was installed!");\r | |
268 | jLabel.setText("The MDK package was installed successfully");\r | |
269 | jLabel1.setText("Now you can start the trip with EFI");\r | |
270 | jTextAreaComment.setText("Please add \"WORKSPACE=" + this.strInstallDir\r | |
271 | + "\" into your system environment variable");\r | |
272 | jButtonFinish.setEnabled(true);\r | |
273 | this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r | |
274 | jButtonFinish.setText("Finish");\r | |
275 | }\r | |
276 | \r | |
277 | // private void switchInstall() {\r | |
278 | // jTextAreaTitle.setText(" Installation is in process...");\r | |
279 | // jLabel.setText("The MDK package was being installed...");\r | |
280 | // jLabel1.setText("Just waiting for a second");\r | |
281 | // jButtonFinish.setEnabled(false);\r | |
282 | // jButtonFinish.setText("Finish");\r | |
283 | // }\r | |
284 | \r | |
285 | /* (non-Javadoc)\r | |
286 | * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)\r | |
287 | * \r | |
288 | * Override windowClosing to exit directly\r | |
289 | * \r | |
290 | */\r | |
291 | public void windowClosing(WindowEvent arg0) {\r | |
292 | this.dispose();\r | |
293 | System.exit(0);\r | |
294 | }\r | |
295 | }\r |