211b9c3adbe366a5226cdde11e1c78d45753cdaa
3 The file is used to override Frame to provides customized interfaces
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
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.
16 package org
.tianocore
.packaging
.common
.ui
;
18 import java
.awt
.Dimension
;
19 import java
.awt
.Toolkit
;
20 import java
.awt
.event
.ActionEvent
;
21 import java
.awt
.event
.ActionListener
;
22 import java
.awt
.event
.WindowEvent
;
23 import java
.awt
.event
.WindowListener
;
25 import javax
.swing
.JFrame
;
28 The class is used to override Frame to provides customized interfaces
29 It extends JFrame implements ActionListener and WindowListener
31 @since CreateMdkPkg 1.0
34 public class IFrame
extends JFrame
implements ActionListener
, WindowListener
{
36 /// Define class Serial Version UID
38 private static final long serialVersionUID
= -3324138961029300427L;
41 // Define class members
43 private ExitConfirm ec
= null;
46 // To indicate the status while quit
47 // 0 - When setup (Default)
48 // 1 - Whne editing module
50 private int intExitType
= 0;
53 Main class, used for test
58 public static void main(String
[] args
) {
59 IFrame i
= new IFrame();
64 This is the default constructor
73 This method initializes this
76 public void initialize() {
77 this.setResizable(false);
78 this.setDefaultCloseOperation(JFrame
.DO_NOTHING_ON_CLOSE
);
79 this.addWindowListener(this);
83 Start the dialog at the center of screen
85 @param intWidth The width of the dialog
86 @param intHeight The height of the dialog
89 protected void centerWindow(int intWidth
, int intHeight
) {
90 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
91 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
95 Start the dialog at the center of screen
98 protected void centerWindow() {
99 centerWindow(this.getSize().width
, this.getSize().height
);
103 Set the exit window type
105 @param ExitType The input data of ExitType
108 protected void setExitType(int ExitType
) {
109 this.intExitType
= ExitType
;
113 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
115 * Override windowClosing to call this.onDisvisible()
118 public void windowClosing(WindowEvent arg0
) {
122 public void windowOpened(WindowEvent arg0
) {
123 // TODO Auto-generated method stub
127 public void windowClosed(WindowEvent arg0
) {
128 // TODO Auto-generated method stub
132 public void windowIconified(WindowEvent arg0
) {
133 // TODO Auto-generated method stub
137 public void windowDeiconified(WindowEvent arg0
) {
138 // TODO Auto-generated method stub
142 public void windowActivated(WindowEvent arg0
) {
143 // TODO Auto-generated method stub
147 public void windowDeactivated(WindowEvent arg0
) {
148 // TODO Auto-generated method stub
152 public void actionPerformed(ActionEvent arg0
) {
153 // TODO Auto-generated method stub
158 Define the actions when exit
161 public void onExit() {
162 ec
= new ExitConfirm(this, true);
164 //Show different warning message via different ExitType
166 switch (intExitType
) {
168 ec
.setSetupMessage();
171 ec
.setModuleMessage();
182 Define the actions when disvisible
185 public void onDisvisible() {
186 ec
= new ExitConfirm(this, true);
188 //Show different warning message via different ExitType
190 switch (intExitType
) {
192 ec
.setSetupMessage();
195 ec
.setModuleMessage();