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