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