]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
Retiring the ANT/JAVA build and removing the older EDK II packages that required...
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / ui / ModuleProtocols.java
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
deleted file mode 100644 (file)
index 61c5dd8..0000000
+++ /dev/null
@@ -1,515 +0,0 @@
-/** @file\r
\r
- The file is used to create, update Protocol of MSA/MBD file\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
-\r
-package org.tianocore.frameworkwizard.module.ui;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ComponentEvent;\r
-import java.awt.event.MouseEvent;\r
-import java.util.Vector;\r
-\r
-import javax.swing.JButton;\r
-import javax.swing.JPanel;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JTable;\r
-import javax.swing.ListSelectionModel;\r
-import javax.swing.event.ListSelectionEvent;\r
-\r
-import org.tianocore.ProtocolNotifyUsage;\r
-import org.tianocore.ProtocolUsage;\r
-import org.tianocore.ProtocolsDocument;\r
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
-import org.tianocore.ProtocolsDocument.Protocols;\r
-import org.tianocore.ProtocolsDocument.Protocols.Protocol;\r
-import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;\r
-import org.tianocore.frameworkwizard.common.DataType;\r
-import org.tianocore.frameworkwizard.common.EnumerationData;\r
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;\r
-import org.tianocore.frameworkwizard.common.Log;\r
-import org.tianocore.frameworkwizard.common.Tools;\r
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;\r
-import org.tianocore.frameworkwizard.common.ui.IFrame;\r
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;\r
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;\r
-import org.tianocore.frameworkwizard.module.ui.dialog.ProtocolsDlg;\r
-\r
-/**\r
- The class is used to create, update Protocol of MSA/MBD file\r
- It extends IInternalFrame\r
\r
-\r
-\r
- **/\r
-public class ModuleProtocols extends IInternalFrame {\r
-\r
-    ///\r
-    /// Define class Serial Version UID\r
-    ///\r
-    private static final long serialVersionUID = -9084913640747858848L;\r
-\r
-    //\r
-    //Define class members\r
-    //\r
-    private JPanel jContentPane = null;\r
-\r
-    private JButton jButtonAdd = null;\r
-\r
-    private JButton jButtonRemove = null;\r
-\r
-    private JButton jButtonUpdate = null;\r
-\r
-    private JScrollPane jScrollPane = null;\r
-\r
-    private JScrollPane jScrollPaneTable = null;\r
-\r
-    private JTable jTable = null;\r
-\r
-    //\r
-    // Not used by UI\r
-    //\r
-    private OpeningModuleType omt = null;\r
-\r
-    private ModuleSurfaceArea msa = null;\r
-\r
-    private ProtocolsDocument.Protocols protocols = null;\r
-\r
-    private ProtocolsIdentification id = null;\r
-\r
-    private ProtocolsVector vid = new ProtocolsVector();\r
-\r
-    private EnumerationData ed = new EnumerationData();\r
-\r
-    private IDefaultTableModel model = null;\r
-\r
-    private int selectedRow = -1;\r
-    \r
-    private IFrame parentFrame = null;\r
-\r
-    /**\r
-     This method initializes jButtonAdd \r
-     \r
-     @return javax.swing.JButton jButtonAdd\r
-     \r
-     **/\r
-    private JButton getJButtonAdd() {\r
-        if (jButtonAdd == null) {\r
-            jButtonAdd = new JButton();\r
-            jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));\r
-            jButtonAdd.setText("Add");\r
-            jButtonAdd.addActionListener(this);\r
-            jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));\r
-        }\r
-        return jButtonAdd;\r
-    }\r
-\r
-    /**\r
-     This method initializes jButtonRemove \r
-     \r
-     @return javax.swing.JButton jButtonRemove\r
-     \r
-     **/\r
-    private JButton getJButtonRemove() {\r
-        if (jButtonRemove == null) {\r
-            jButtonRemove = new JButton();\r
-            jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));\r
-            jButtonRemove.setText("Remove");\r
-            jButtonRemove.addActionListener(this);\r
-            jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));\r
-        }\r
-        return jButtonRemove;\r
-    }\r
-\r
-    /**\r
-     This method initializes jButtonUpdate \r
-     \r
-     @return javax.swing.JButton jButtonUpdate\r
-     \r
-     **/\r
-    private JButton getJButtonUpdate() {\r
-        if (jButtonUpdate == null) {\r
-            jButtonUpdate = new JButton();\r
-            jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));\r
-            jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));\r
-            jButtonUpdate.setText("Edit");\r
-            jButtonUpdate.addActionListener(this);\r
-        }\r
-        return jButtonUpdate;\r
-    }\r
-\r
-    /**\r
-     This method initializes jScrollPane  \r
-     \r
-     @return javax.swing.JScrollPane  \r
-     */\r
-    private JScrollPane getJScrollPane() {\r
-        if (jScrollPane == null) {\r
-            jScrollPane = new JScrollPane();\r
-            jScrollPane.setViewportView(getJContentPane());\r
-        }\r
-        return jScrollPane;\r
-    }\r
-\r
-    /**\r
-     This method initializes jScrollPaneTable    \r
-     \r
-     @return javax.swing.JScrollPane \r
-     **/\r
-    private JScrollPane getJScrollPaneTable() {\r
-        if (jScrollPaneTable == null) {\r
-            jScrollPaneTable = new JScrollPane();\r
-            jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));\r
-            jScrollPaneTable.setPreferredSize(new Dimension(470, 420));\r
-            jScrollPaneTable.setViewportView(getJTable());\r
-        }\r
-        return jScrollPaneTable;\r
-    }\r
-\r
-    /**\r
-     This method initializes jTable  \r
-     \r
-     @return javax.swing.JTable  \r
-     **/\r
-    private JTable getJTable() {\r
-        if (jTable == null) {\r
-            jTable = new JTable();\r
-            model = new IDefaultTableModel();\r
-            jTable = new JTable(model);\r
-            jTable.setRowHeight(20);\r
-\r
-            model.addColumn("Guid C_Name");\r
-            model.addColumn("Type");\r
-            model.addColumn("Usage");\r
-\r
-            jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);\r
-            jTable.getSelectionModel().addListSelectionListener(this);\r
-            jTable.getModel().addTableModelListener(this);\r
-            jTable.addMouseListener(this);\r
-        }\r
-        return jTable;\r
-    }\r
-\r
-    public static void main(String[] args) {\r
-\r
-    }\r
-\r
-    /**\r
-     This method initializes this\r
-     \r
-     **/\r
-    private void init() {\r
-        this.setSize(500, 515);\r
-        this.setContentPane(getJScrollPane());\r
-        this.setTitle("Protocols");\r
-    }\r
-\r
-    /**\r
-     This method initializes this\r
-     Fill values to all fields if these values are not empty\r
-     \r
-     @param inPackageDependencies\r
-\r
-     **/\r
-    private void init(Protocols inProtocols) {\r
-        init();\r
-        this.protocols = inProtocols;\r
-\r
-        if (this.protocols != null) {\r
-            if (this.protocols.getProtocolList().size() > 0) {\r
-                for (int index = 0; index < this.protocols.getProtocolList().size(); index++) {\r
-                    String arg0 = protocols.getProtocolList().get(index).getProtocolCName();\r
-                    String arg1 = ed.getVProtocolType().get(0);\r
-                    String arg2 = null;\r
-                    if (protocols.getProtocolList().get(index).getUsage() != null) {\r
-                        arg2 = protocols.getProtocolList().get(index).getUsage().toString();\r
-                    }\r
-\r
-                    String arg3 = protocols.getProtocolList().get(index).getFeatureFlag();\r
-                    Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolList().get(index)\r
-                                                                             .getSupArchList());\r
-                    String arg5 = protocols.getProtocolList().get(index).getHelpText();\r
-                    id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
-                    vid.addProtocols(id);\r
-                }\r
-            }\r
-            if (this.protocols.getProtocolNotifyList().size() > 0) {\r
-                for (int index = 0; index < this.protocols.getProtocolNotifyList().size(); index++) {\r
-                    String arg0 = protocols.getProtocolNotifyList().get(index).getProtocolNotifyCName();\r
-                    String arg1 = ed.getVProtocolType().get(1);\r
-                    String arg2 = null;\r
-                    if (protocols.getProtocolNotifyList().get(index).getUsage() != null) {\r
-                        arg2 = protocols.getProtocolNotifyList().get(index).getUsage().toString();\r
-                    }\r
-\r
-                    String arg3 = protocols.getProtocolNotifyList().get(index).getFeatureFlag();\r
-                    Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolNotifyList().get(index)\r
-                                                                             .getSupArchList());\r
-                    String arg5 = protocols.getProtocolNotifyList().get(index).getHelpText();\r
-                    id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
-                    vid.addProtocols(id);\r
-                }\r
-            }\r
-        }\r
-        showTable();\r
-    }\r
-\r
-    /**\r
-     This is the default constructor\r
-     \r
-     **/\r
-    public ModuleProtocols() {\r
-        super();\r
-        init();\r
-        this.setVisible(true);\r
-    }\r
-\r
-    /**\r
-     This is the override edit constructor\r
-     \r
-     @param inProtocol The input data of ProtocolsDocument.Protocols\r
-     \r
-     **/\r
-    public ModuleProtocols(OpeningModuleType inOmt, IFrame iFrame) {\r
-        super();\r
-        this.omt = inOmt;\r
-        this.msa = omt.getXmlMsa();\r
-        this.parentFrame = iFrame;\r
-        init(msa.getProtocols());\r
-        this.setVisible(true);\r
-    }\r
-\r
-    /**\r
-     This method initializes jContentPane\r
-     \r
-     @return javax.swing.JPanel jContentPane\r
-     \r
-     **/\r
-    private JPanel getJContentPane() {\r
-        if (jContentPane == null) {\r
-            jContentPane = new JPanel();\r
-            jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));\r
-\r
-            jContentPane.add(getJButtonAdd(), null);\r
-            jContentPane.add(getJButtonRemove(), null);\r
-            jContentPane.add(getJButtonUpdate(), null);\r
-            jContentPane.add(getJScrollPaneTable(), null);\r
-        }\r
-        return jContentPane;\r
-    }\r
-\r
-    private void showEdit(int index) {\r
-        ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), this.parentFrame, omt.getId());\r
-        int result = dlg.showDialog();\r
-        if (result == DataType.RETURN_TYPE_OK) {\r
-            if (index == -1) {\r
-                this.vid.addProtocols(dlg.getId());\r
-            } else {\r
-                this.vid.setProtocols(dlg.getId(), index);\r
-            }\r
-            this.showTable();\r
-            this.save();\r
-            dlg.dispose();\r
-        }\r
-        if (result == DataType.RETURN_TYPE_CANCEL) {\r
-            dlg.dispose();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Clear all table rows\r
-     \r
-     **/\r
-    private void clearAll() {\r
-        if (model != null) {\r
-            for (int index = model.getRowCount() - 1; index >= 0; index--) {\r
-                model.removeRow(index);\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     Read content of vector and put then into table\r
-     \r
-     **/\r
-    private void showTable() {\r
-        clearAll();\r
-\r
-        if (vid.size() > 0) {\r
-            for (int index = 0; index < vid.size(); index++) {\r
-                model.addRow(vid.toStringVector(index));\r
-            }\r
-        }\r
-        this.jTable.repaint();\r
-        this.jTable.updateUI();\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
-     */\r
-    public void actionPerformed(ActionEvent arg0) {\r
-        if (arg0.getSource() == jButtonAdd) {\r
-            showEdit(-1);\r
-        }\r
-        if (arg0.getSource() == jButtonUpdate) {\r
-            if (this.selectedRow < 0) {\r
-                Log.wrn("Update Protocols", "Please select one record first.");\r
-                return;\r
-            }\r
-            showEdit(selectedRow);\r
-        }\r
-\r
-        if (arg0.getSource() == jButtonRemove) {\r
-            if (jTable.isEditing()) {\r
-                jTable.getCellEditor().stopCellEditing();\r
-            }\r
-            \r
-            int selectedRows[] = this.jTable.getSelectedRows();\r
-            \r
-            if (selectedRows != null) {\r
-                for (int index = selectedRows.length - 1; index > -1; index--) {\r
-                    this.model.removeRow(selectedRows[index]);\r
-                    this.vid.removeProtocols(selectedRows[index]);\r
-                }\r
-                selectedRow = -1;\r
-                this.save();\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     Save all components of Protocols\r
-     if exists protocols, set the value directly\r
-     if not exists protocols, new an instance first\r
-     \r
-     **/\r
-    public void save() {\r
-        try {\r
-            int count = this.vid.size();\r
-\r
-            this.protocols = Protocols.Factory.newInstance();\r
-            if (count > 0) {\r
-                for (int index = 0; index < count; index++) {\r
-                    if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(0))) {\r
-                        Protocol p = Protocol.Factory.newInstance();\r
-                        if (!isEmpty(vid.getProtocols(index).getName())) {\r
-                            p.setProtocolCName(vid.getProtocols(index).getName());\r
-                        }\r
-                        if (!isEmpty(vid.getProtocols(index).getUsage())) {\r
-                            p.setUsage(ProtocolUsage.Enum.forString(vid.getProtocols(index).getUsage()));\r
-                        }\r
-                        if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {\r
-                            p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());\r
-                        }\r
-                        if (vid.getProtocols(index).getSupArchList() != null\r
-                            && vid.getProtocols(index).getSupArchList().size() > 0) {\r
-                            p.setSupArchList(vid.getProtocols(index).getSupArchList());\r
-                        }\r
-                        if (!isEmpty(vid.getProtocols(index).getHelp())) {\r
-                            p.setHelpText(vid.getProtocols(index).getHelp());\r
-                        }\r
-                        this.protocols.addNewProtocol();\r
-                        this.protocols.setProtocolArray(protocols.getProtocolList().size() - 1, p);\r
-                    }\r
-                    if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(1))) {\r
-                        ProtocolNotify p = ProtocolNotify.Factory.newInstance();\r
-                        if (!isEmpty(vid.getProtocols(index).getName())) {\r
-                            p.setProtocolNotifyCName(vid.getProtocols(index).getName());\r
-                        }\r
-                        if (!isEmpty(vid.getProtocols(index).getUsage())) {\r
-                            p.setUsage(ProtocolNotifyUsage.Enum.forString(vid.getProtocols(index).getUsage()));\r
-                        }\r
-                        if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {\r
-                            p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());\r
-                        }\r
-                        if (vid.getProtocols(index).getSupArchList() != null\r
-                            && vid.getProtocols(index).getSupArchList().size() > 0) {\r
-                            p.setSupArchList(vid.getProtocols(index).getSupArchList());\r
-                        }\r
-                        if (!isEmpty(vid.getProtocols(index).getHelp())) {\r
-                            p.setHelpText(vid.getProtocols(index).getHelp());\r
-                        }\r
-                        this.protocols.addNewProtocolNotify();\r
-                        this.protocols.setProtocolNotifyArray(protocols.getProtocolNotifyList().size() - 1, p);\r
-                    }\r
-                }\r
-            }\r
-\r
-            this.msa.setProtocols(protocols);\r
-            this.omt.setSaved(false);\r
-        } catch (Exception e) {\r
-            Log.wrn("Update Protocols", e.getMessage());\r
-            Log.err("Update Protocols", e.getMessage());\r
-        }\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)\r
-     *\r
-     */\r
-    public void valueChanged(ListSelectionEvent arg0) {\r
-        if (arg0.getValueIsAdjusting()) {\r
-            return;\r
-        }\r
-        ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();\r
-        if (lsm.isSelectionEmpty()) {\r
-            return;\r
-        } else {\r
-            selectedRow = lsm.getMinSelectionIndex();\r
-        }\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
-     *\r
-     */\r
-    public void mouseClicked(MouseEvent arg0) {\r
-        if (arg0.getClickCount() == 2) {\r
-            if (this.selectedRow < 0) {\r
-                return;\r
-            } else {\r
-                showEdit(selectedRow);\r
-            }\r
-        }\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)\r
-     * \r
-     * Override componentResized to resize all components when frame's size is changed\r
-     */\r
-    public void componentResized(ComponentEvent arg0) {\r
-        int intCurrentWidth = this.getJContentPane().getWidth();\r
-        int intCurrentHeight = this.getJContentPane().getHeight();\r
-        int intPreferredWidth = this.getJContentPane().getPreferredSize().width;\r
-        int intPreferredHeight = this.getJContentPane().getPreferredSize().height;\r
-\r
-        Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,\r
-                              intPreferredHeight);\r
-        Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,\r
-                                intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,\r
-                                DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);\r
-        Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,\r
-                                intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,\r
-                                DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);\r
-        Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,\r
-                                intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,\r
-                                DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);\r
-    }\r
-}\r