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