+++ /dev/null
-/** @file\r
- \r
- The file is used to show a new file chooser dialog\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-package org.tianocore.frameworkwizard;\r
-\r
-import java.awt.event.ActionEvent;\r
-\r
-import javax.swing.ButtonGroup;\r
-import javax.swing.JPanel;\r
-import javax.swing.JButton;\r
-import javax.swing.JRadioButton;\r
-\r
-import org.tianocore.frameworkwizard.common.DataType;\r
-import org.tianocore.frameworkwizard.common.ui.IDialog;\r
-import org.tianocore.frameworkwizard.common.ui.IFrame;\r
-\r
-public class NewFileChooser extends IDialog {\r
-\r
- /**\r
- Define class members\r
- \r
- **/\r
- private static final long serialVersionUID = -3657926400683618281L;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JButton jButtonNext = null;\r
-\r
- private JButton jButtonCancel = null;\r
-\r
- private JRadioButton jRadioButtonModule = null;\r
-\r
- private JRadioButton jRadioButtonPackage = null;\r
-\r
- private JRadioButton jRadioButtonPlatform = null;\r
-\r
- private JRadioButton jRadioButtonBuildXml = null;\r
-\r
- private final ButtonGroup buttonGroup = new ButtonGroup();\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public NewFileChooser() {\r
- super();\r
- init();\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- \r
- **/\r
- public NewFileChooser(IFrame parentFrame, boolean modal) {\r
- super(parentFrame, modal);\r
- init();\r
- }\r
-\r
- /**\r
- * This method initializes jButtonOk \r
- * \r
- * @return javax.swing.JButton \r
- */\r
- private JButton getJButtonOk() {\r
- if (jButtonNext == null) {\r
- jButtonNext = new JButton();\r
- jButtonNext.setBounds(new java.awt.Rectangle(90, 150, 80, 20));\r
- jButtonNext.setText("Next");\r
- jButtonNext.addActionListener(this);\r
- }\r
- return jButtonNext;\r
- }\r
-\r
- /**\r
- * This method initializes jButtonCancel \r
- * \r
- * @return javax.swing.JButton \r
- */\r
- private JButton getJButtonCancel() {\r
- if (jButtonCancel == null) {\r
- jButtonCancel = new JButton();\r
- jButtonCancel.setBounds(new java.awt.Rectangle(180, 150, 80, 20));\r
- jButtonCancel.setText("Cancel");\r
- jButtonCancel.addActionListener(this);\r
- }\r
- return jButtonCancel;\r
- }\r
-\r
- /**\r
- * This method initializes jRadioButtonModule \r
- * \r
- * @return javax.swing.JRadioButton \r
- */\r
- private JRadioButton getJRadioButtonModule() {\r
- if (jRadioButtonModule == null) {\r
- jRadioButtonModule = new JRadioButton();\r
- jRadioButtonModule.setText(DataType.MODULE_SURFACE_AREA);\r
- jRadioButtonModule.setBounds(new java.awt.Rectangle(20, 20, 240, 20));\r
- jRadioButtonModule.setSelected(true);\r
- }\r
- return jRadioButtonModule;\r
- }\r
-\r
- /**\r
- * This method initializes jRadioButtonPackage \r
- * \r
- * @return javax.swing.JRadioButton \r
- */\r
- private JRadioButton getJRadioButtonPackage() {\r
- if (jRadioButtonPackage == null) {\r
- jRadioButtonPackage = new JRadioButton();\r
- jRadioButtonPackage.setText(DataType.PACKAGE_SURFACE_AREA);\r
- jRadioButtonPackage.setBounds(new java.awt.Rectangle(20, 50, 240, 20));\r
- }\r
- return jRadioButtonPackage;\r
- }\r
-\r
- /**\r
- * This method initializes jRadioButtonPlatform \r
- * \r
- * @return javax.swing.JRadioButton \r
- */\r
- private JRadioButton getJRadioButtonPlatform() {\r
- if (jRadioButtonPlatform == null) {\r
- jRadioButtonPlatform = new JRadioButton();\r
- jRadioButtonPlatform.setText(DataType.PLATFORM_SURFACE_AREA);\r
- jRadioButtonPlatform.setBounds(new java.awt.Rectangle(20, 80, 240, 20));\r
- }\r
- return jRadioButtonPlatform;\r
- }\r
-\r
- /**\r
- * This method initializes jRadioButtonBuildXml \r
- * \r
- * @return javax.swing.JRadioButton \r
- */\r
- private JRadioButton getJRadioButtonBuildXml() {\r
- if (jRadioButtonBuildXml == null) {\r
- jRadioButtonBuildXml = new JRadioButton();\r
- jRadioButtonBuildXml.setText(DataType.ANT_BUILD_FILE);\r
- jRadioButtonBuildXml.setBounds(new java.awt.Rectangle(20, 110, 240, 20));\r
- jRadioButtonBuildXml.setVisible(false);\r
- }\r
- return jRadioButtonBuildXml;\r
- }\r
-\r
- /**\r
- * @param args\r
- */\r
- public static void main(String[] args) {\r
- NewFileChooser nfc = new NewFileChooser();\r
- nfc.setVisible(true);\r
- }\r
-\r
- /**\r
- * This method initializes this\r
- * \r
- * @return void\r
- */\r
- private void init() {\r
- this.setSize(310, 220);\r
- this.setContentPane(getJContentPane());\r
- this.setTitle("Select New File Type");\r
- this.centerWindow();\r
- }\r
-\r
- /**\r
- * This method initializes jContentPane\r
- * \r
- * @return javax.swing.JPanel\r
- */\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.add(getJButtonOk(), null);\r
- jContentPane.add(getJButtonCancel(), null);\r
- jContentPane.add(getJRadioButtonModule(), null);\r
- jContentPane.add(getJRadioButtonPackage(), null);\r
- jContentPane.add(getJRadioButtonPlatform(), null);\r
- jContentPane.add(getJRadioButtonBuildXml(), null);\r
- buttonGroup.add(this.getJRadioButtonModule());\r
- buttonGroup.add(this.getJRadioButtonPackage());\r
- buttonGroup.add(this.getJRadioButtonPlatform());\r
- buttonGroup.add(this.getJRadioButtonBuildXml());\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
- * \r
- * Override actionPerformed to listen all actions\r
- */\r
- public void actionPerformed(ActionEvent arg0) {\r
- if (arg0.getSource() == jButtonCancel) {\r
- this.setVisible(false);\r
- returnType = DataType.RETURN_TYPE_CANCEL;\r
- }\r
-\r
- if (arg0.getSource() == jButtonNext) {\r
- this.setVisible(false);\r
- if (this.jRadioButtonModule.isSelected()) {\r
- returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;\r
- }\r
- if (this.jRadioButtonPackage.isSelected()) {\r
- returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;\r
- }\r
- if (this.jRadioButtonPlatform.isSelected()) {\r
- returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;\r
- }\r
- if (this.jRadioButtonBuildXml.isSelected()) {\r
- returnType = DataType.RETURN_TYPE_BUILD_XML;\r
- }\r
- }\r
- }\r
-}\r