]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java
change table column positions in tables of FrameworkModules and horizontal scrollbar...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / NewFileChooser.java
CommitLineData
a13899c5 1/** @file\r
2 \r
3 The file is used to show a new file chooser dialog\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
15package org.tianocore.frameworkwizard;\r
16\r
17import java.awt.event.ActionEvent;\r
18\r
19import javax.swing.ButtonGroup;\r
20import javax.swing.JPanel;\r
21import javax.swing.JButton;\r
22import javax.swing.JRadioButton;\r
23\r
24import org.tianocore.frameworkwizard.common.DataType;\r
25import org.tianocore.frameworkwizard.common.ui.IDialog;\r
26import org.tianocore.frameworkwizard.common.ui.IFrame;\r
27\r
28public class NewFileChooser extends IDialog {\r
29\r
30 /**\r
31 Define class members\r
32 \r
33 **/\r
34 private static final long serialVersionUID = -3657926400683618281L;\r
35\r
36 private JPanel jContentPane = null;\r
37\r
38 private JButton jButtonNext = null;\r
39\r
40 private JButton jButtonCancel = null;\r
41\r
42 private JRadioButton jRadioButtonModule = null;\r
43\r
44 private JRadioButton jRadioButtonPackage = null;\r
45\r
46 private JRadioButton jRadioButtonPlatform = null;\r
47\r
48 private JRadioButton jRadioButtonBuildXml = null;\r
49\r
50 private final ButtonGroup buttonGroup = new ButtonGroup();\r
51\r
52 /**\r
53 This is the default constructor\r
54 \r
55 **/\r
56 public NewFileChooser() {\r
57 super();\r
58 init();\r
59 }\r
60\r
61 /**\r
62 This is the default constructor\r
63 \r
64 **/\r
65 public NewFileChooser(IFrame parentFrame, boolean modal) {\r
66 super(parentFrame, modal);\r
67 init();\r
68 }\r
69\r
70 /**\r
71 * This method initializes jButtonOk \r
72 * \r
73 * @return javax.swing.JButton \r
74 */\r
75 private JButton getJButtonOk() {\r
76 if (jButtonNext == null) {\r
77 jButtonNext = new JButton();\r
78 jButtonNext.setBounds(new java.awt.Rectangle(90, 150, 80, 20));\r
79 jButtonNext.setText("Next");\r
80 jButtonNext.addActionListener(this);\r
81 }\r
82 return jButtonNext;\r
83 }\r
84\r
85 /**\r
86 * This method initializes jButtonCancel \r
87 * \r
88 * @return javax.swing.JButton \r
89 */\r
90 private JButton getJButtonCancel() {\r
91 if (jButtonCancel == null) {\r
92 jButtonCancel = new JButton();\r
93 jButtonCancel.setBounds(new java.awt.Rectangle(180, 150, 80, 20));\r
94 jButtonCancel.setText("Cancel");\r
95 jButtonCancel.addActionListener(this);\r
96 }\r
97 return jButtonCancel;\r
98 }\r
99\r
100 /**\r
101 * This method initializes jRadioButtonModule \r
102 * \r
103 * @return javax.swing.JRadioButton \r
104 */\r
105 private JRadioButton getJRadioButtonModule() {\r
106 if (jRadioButtonModule == null) {\r
107 jRadioButtonModule = new JRadioButton();\r
108 jRadioButtonModule.setText(DataType.MODULE_SURFACE_AREA);\r
109 jRadioButtonModule.setBounds(new java.awt.Rectangle(20, 20, 240, 20));\r
110 jRadioButtonModule.setSelected(true);\r
111 }\r
112 return jRadioButtonModule;\r
113 }\r
114\r
115 /**\r
116 * This method initializes jRadioButtonPackage \r
117 * \r
118 * @return javax.swing.JRadioButton \r
119 */\r
120 private JRadioButton getJRadioButtonPackage() {\r
121 if (jRadioButtonPackage == null) {\r
122 jRadioButtonPackage = new JRadioButton();\r
123 jRadioButtonPackage.setText(DataType.PACKAGE_SURFACE_AREA);\r
124 jRadioButtonPackage.setBounds(new java.awt.Rectangle(20, 50, 240, 20));\r
125 }\r
126 return jRadioButtonPackage;\r
127 }\r
128\r
129 /**\r
130 * This method initializes jRadioButtonPlatform \r
131 * \r
132 * @return javax.swing.JRadioButton \r
133 */\r
134 private JRadioButton getJRadioButtonPlatform() {\r
135 if (jRadioButtonPlatform == null) {\r
136 jRadioButtonPlatform = new JRadioButton();\r
8f4f211c 137 jRadioButtonPlatform.setText(DataType.PLATFORM_SURFACE_AREA);\r
a13899c5 138 jRadioButtonPlatform.setBounds(new java.awt.Rectangle(20, 80, 240, 20));\r
139 }\r
140 return jRadioButtonPlatform;\r
141 }\r
142\r
143 /**\r
144 * This method initializes jRadioButtonBuildXml \r
145 * \r
146 * @return javax.swing.JRadioButton \r
147 */\r
148 private JRadioButton getJRadioButtonBuildXml() {\r
149 if (jRadioButtonBuildXml == null) {\r
150 jRadioButtonBuildXml = new JRadioButton();\r
151 jRadioButtonBuildXml.setText(DataType.ANT_BUILD_FILE);\r
152 jRadioButtonBuildXml.setBounds(new java.awt.Rectangle(20, 110, 240, 20));\r
153 jRadioButtonBuildXml.setVisible(false);\r
154 }\r
155 return jRadioButtonBuildXml;\r
156 }\r
157\r
158 /**\r
159 * @param args\r
160 */\r
161 public static void main(String[] args) {\r
162 NewFileChooser nfc = new NewFileChooser();\r
163 nfc.setVisible(true);\r
164 }\r
165\r
166 /**\r
167 * This method initializes this\r
168 * \r
169 * @return void\r
170 */\r
171 private void init() {\r
172 this.setSize(310, 220);\r
173 this.setContentPane(getJContentPane());\r
8f4f211c 174 this.setTitle("Select New File Type");\r
a13899c5 175 this.centerWindow();\r
176 }\r
177\r
178 /**\r
179 * This method initializes jContentPane\r
180 * \r
181 * @return javax.swing.JPanel\r
182 */\r
183 private JPanel getJContentPane() {\r
184 if (jContentPane == null) {\r
185 jContentPane = new JPanel();\r
186 jContentPane.setLayout(null);\r
187 jContentPane.add(getJButtonOk(), null);\r
188 jContentPane.add(getJButtonCancel(), null);\r
189 jContentPane.add(getJRadioButtonModule(), null);\r
190 jContentPane.add(getJRadioButtonPackage(), null);\r
191 jContentPane.add(getJRadioButtonPlatform(), null);\r
192 jContentPane.add(getJRadioButtonBuildXml(), null);\r
193 buttonGroup.add(this.getJRadioButtonModule());\r
194 buttonGroup.add(this.getJRadioButtonPackage());\r
195 buttonGroup.add(this.getJRadioButtonPlatform());\r
196 buttonGroup.add(this.getJRadioButtonBuildXml());\r
197 }\r
198 return jContentPane;\r
199 }\r
200\r
201 /* (non-Javadoc)\r
202 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
203 * \r
204 * Override actionPerformed to listen all actions\r
205 */\r
206 public void actionPerformed(ActionEvent arg0) {\r
207 if (arg0.getSource() == jButtonCancel) {\r
208 this.setVisible(false);\r
209 returnType = DataType.RETURN_TYPE_CANCEL;\r
210 }\r
211\r
212 if (arg0.getSource() == jButtonNext) {\r
213 this.setVisible(false);\r
214 if (this.jRadioButtonModule.isSelected()) {\r
215 returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;\r
216 }\r
217 if (this.jRadioButtonPackage.isSelected()) {\r
218 returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;\r
219 }\r
220 if (this.jRadioButtonPlatform.isSelected()) {\r
221 returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;\r
222 }\r
223 if (this.jRadioButtonBuildXml.isSelected()) {\r
224 returnType = DataType.RETURN_TYPE_BUILD_XML;\r
225 }\r
226 }\r
227 }\r
228}\r