]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / ui / IDialog.java
CommitLineData
a13899c5 1/** @file\r
2 \r
3 The file is used to override Dialog to provides customized interfaces \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
16package org.tianocore.frameworkwizard.common.ui;\r
17\r
18import java.awt.Dimension;\r
19import java.awt.Toolkit;\r
20import java.awt.event.ActionEvent;\r
21import java.awt.event.ActionListener;\r
22\r
23import javax.swing.JDialog;\r
24\r
25import org.tianocore.frameworkwizard.common.DataType;\r
3b7a9058 26import org.tianocore.frameworkwizard.common.Tools;\r
a13899c5 27\r
28/**\r
29 The class is used to override Dialog to provides customized interfaces\r
30 It extends JDialog implements ActionListener\r
31 \r
32\r
33 \r
34 **/\r
35public class IDialog extends JDialog implements ActionListener {\r
36 ///\r
37 /// Define class Serial Version UID\r
38 ///\r
39 private static final long serialVersionUID = -7692623863358631984L;\r
40 //\r
41 //Define class members\r
42 //\r
43 private boolean isEdited = false;\r
44 \r
45 public int returnType = DataType.RETURN_TYPE_CANCEL;\r
46\r
47 public void actionPerformed(ActionEvent arg0) {\r
48 // TODO Auto-generated method stub\r
49\r
50 }\r
51\r
52 /**\r
53 Main class, used for test\r
54 \r
55 @param args\r
56 \r
57 **/\r
58 public static void main(String[] args) {\r
59 IDialog id = new IDialog();\r
60 id.setVisible(true);\r
61 }\r
62\r
63 /**\r
64 This is the default constructor\r
65 **/\r
66 public IDialog() {\r
67 super();\r
68 initialize();\r
69 }\r
70\r
a13899c5 71 /**\r
72 This is the override constructor\r
73 \r
74 @param parentFrame The parent frame which open the dialog\r
75 @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog\r
76 **/\r
77 public IDialog(IFrame parentFrame, boolean modal) {\r
78 super(parentFrame, modal);\r
79 initialize();\r
80 }\r
8f9acbd7 81 \r
82 /**\r
83 This is the override constructor\r
84 \r
85 @param parentFrame The parent frame which open the dialog\r
86 @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog\r
87 **/\r
88 public IDialog(IDialog parentFrame, boolean modal) {\r
89 super(parentFrame, modal);\r
90 initialize();\r
91 }\r
a13899c5 92\r
93 /**\r
94 This method initializes this\r
95 \r
96 **/\r
97 private void initialize() {\r
98 this.setResizable(false);\r
99 }\r
100\r
101 /**\r
102 Start the dialog at the center of screen\r
103 \r
104 @param intWidth The width of the dialog\r
105 @param intHeight The height of the dialog\r
106 \r
107 **/\r
108 protected void centerWindow(int intWidth, int intHeight) {\r
109 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();\r
110 this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);\r
111 }\r
112\r
113 /**\r
114 Start the dialog at the center of screen\r
115 \r
116 **/\r
117 protected void centerWindow() {\r
118 centerWindow(this.getSize().width, this.getSize().height);\r
119 }\r
120\r
121 /**\r
122 Get if the dialog has been edited\r
123 \r
124 @retval true - The dialog has been edited\r
125 @retval false - The dialog hasn't been edited\r
126 \r
127 **/\r
128 public boolean isEdited() {\r
129 return isEdited;\r
130 }\r
131\r
132 /**\r
133 Set if the dialog has been edited\r
134 \r
135 @param isEdited The input data which identify if the dialog has been edited\r
136 \r
137 **/\r
138 public void setEdited(boolean isEdited) {\r
139 this.isEdited = isEdited;\r
140 }\r
141\r
142 /**\r
143 Check the input data is empty or not\r
144 \r
145 @param strValue The input data which need be checked\r
146 \r
147 @retval true - The input data is empty\r
148 @retval fals - The input data is not empty\r
149 \r
150 **/\r
151 public boolean isEmpty(String strValue) {\r
3b7a9058 152 return Tools.isEmpty(strValue);\r
a13899c5 153 }\r
154 \r
155 /**\r
156 Display the dialog\r
157 \r
158 **/\r
159 public int showDialog() {\r
160 this.setVisible(true);\r
161 return returnType;\r
162 }\r
163}\r