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