]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java
57f3b4e2dcfdad6a6760a46b8f56dc7795c359ed
3 The file is used to override Dialog 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
.frameworkwizard
.common
.ui
;
18 import java
.awt
.Dimension
;
19 import java
.awt
.Toolkit
;
20 import java
.awt
.event
.ActionEvent
;
21 import java
.awt
.event
.ActionListener
;
23 import javax
.swing
.JDialog
;
25 import org
.tianocore
.frameworkwizard
.common
.DataType
;
28 The class is used to override Dialog to provides customized interfaces
29 It extends JDialog implements ActionListener
34 public class IDialog
extends JDialog
implements ActionListener
{
36 /// Define class Serial Version UID
38 private static final long serialVersionUID
= -7692623863358631984L;
40 //Define class members
42 private boolean isEdited
= false;
44 public int returnType
= DataType
.RETURN_TYPE_CANCEL
;
46 public void actionPerformed(ActionEvent arg0
) {
47 // TODO Auto-generated method stub
52 Main class, used for test
57 public static void main(String
[] args
) {
58 IDialog id
= new IDialog();
63 This is the default constructor
71 * This is the override constructor
74 This is the override constructor
76 @param parentFrame The parent frame which open the dialog
77 @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog
79 public IDialog(IFrame parentFrame
, boolean modal
) {
80 super(parentFrame
, modal
);
85 This method initializes this
88 private void initialize() {
89 this.setResizable(false);
93 Start the dialog at the center of screen
95 @param intWidth The width of the dialog
96 @param intHeight The height of the dialog
99 protected void centerWindow(int intWidth
, int intHeight
) {
100 Dimension d
= Toolkit
.getDefaultToolkit().getScreenSize();
101 this.setLocation((d
.width
- intWidth
) / 2, (d
.height
- intHeight
) / 2);
105 Start the dialog at the center of screen
108 protected void centerWindow() {
109 centerWindow(this.getSize().width
, this.getSize().height
);
113 Get if the dialog has been edited
115 @retval true - The dialog has been edited
116 @retval false - The dialog hasn't been edited
119 public boolean isEdited() {
124 Set if the dialog has been edited
126 @param isEdited The input data which identify if the dialog has been edited
129 public void setEdited(boolean isEdited
) {
130 this.isEdited
= isEdited
;
134 Check the input data is empty or not
136 @param strValue The input data which need be checked
138 @retval true - The input data is empty
139 @retval fals - The input data is not empty
142 public boolean isEmpty(String strValue
) {
143 if (strValue
.length() > 0) {
153 public int showDialog() {
154 this.setVisible(true);