]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/ModuleEditor/src/org/tianocore/packaging/common/ui/IFrame.java
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 ModuleEditor 1.0
34 public class IFrame
extends JFrame
implements ActionListener
, WindowListener
{
37 /// Define class Serial Version UID
39 private static final long serialVersionUID
= -3324138961029300427L;
42 //Define class members
44 private ExitConfirm ec
= null;
47 // To indicate the status while quit
48 // 0 - When setup (Default)
49 // 1 - Whne editing module
51 private int intExitType
= 0;
54 Main class, used for test
59 public static void main(String
[] args
) {
60 IFrame i
= new IFrame();
65 This is the default constructor
74 This method initializes this
77 public void initialize() {
78 this.setResizable(false);
79 this.setDefaultCloseOperation(JFrame
.DO_NOTHING_ON_CLOSE
);
80 this.addWindowListener(this);
84 Start the dialog at the center of screen
86 @param intWidth The width of the dialog
87 @param intHeight The height of the dialog
90 protected void centerWindow(int intWidth
, int intHeight
) {
91 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
92 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
96 Start the dialog at the center of screen
99 protected void centerWindow() {
100 centerWindow(this.getSize().width
, this.getSize().height
);
104 Set the exit window type
106 @param ExitType The input data of ExitType
109 protected void setExitType(int ExitType
) {
110 this.intExitType
= ExitType
;
114 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
116 * Override windowClosing to call this.onDisvisible()
119 public void windowClosing(WindowEvent arg0
) {
123 public void windowOpened(WindowEvent arg0
) {
124 // TODO Auto-generated method stub
128 public void windowClosed(WindowEvent arg0
) {
129 // TODO Auto-generated method stub
133 public void windowIconified(WindowEvent arg0
) {
134 // TODO Auto-generated method stub
138 public void windowDeiconified(WindowEvent arg0
) {
139 // TODO Auto-generated method stub
143 public void windowActivated(WindowEvent arg0
) {
144 // TODO Auto-generated method stub
148 public void windowDeactivated(WindowEvent arg0
) {
149 // TODO Auto-generated method stub
153 public void actionPerformed(ActionEvent arg0
) {
154 // TODO Auto-generated method stub
159 Define the actions when exit
162 public void onExit() {
163 ec
= new ExitConfirm(this, true);
165 //Show different warning message via different ExitType
167 switch (intExitType
) {
169 ec
.setSetupMessage();
172 ec
.setModuleMessage();
183 Define the actions when disvisible
186 public void onDisvisible() {
187 ec
= new ExitConfirm(this, true);
189 //Show different warning message via different ExitType
191 switch (intExitType
) {
193 ec
.setSetupMessage();
196 ec
.setModuleMessage();