X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fmodule%2Fui%2Fdialog%2FProtocolsDlg.java;h=894955188c274fc9f3ba9d183ec57d1818d8d044;hp=8b303dee0d7ce4f1c8cbc21a839abcda55c7452b;hb=a929458e6682db26d87d4ebe80150e13820d3e50;hpb=ccb063b1f27dcc84d67fa82592dd79b7e0be1e3f diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java index 8b303dee0d..894955188c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java @@ -48,461 +48,449 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class ProtocolsDlg extends IDialog implements ItemListener { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -9084913640747858848L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -9084913640747858848L; - // - // Define class members - // - private JPanel jContentPane = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JLabel jLabelC_Name = null; + private JLabel jLabelC_Name = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JTextField jTextFieldFeatureFlag = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelUsage = null; + private JLabel jLabelUsage = null; - private JComboBox jComboBoxUsage = null; + private JComboBox jComboBoxUsage = null; - private StarLabel jStarLabel1 = null; + private StarLabel jStarLabel1 = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel2 = null; - private StarLabel jStarLabel3 = null; + private StarLabel jStarLabel3 = null; - private JLabel jLabelProtocolType = null; + private JLabel jLabelProtocolType = null; - private JLabel jLabelArch = null; + private JLabel jLabelArch = null; - private JScrollPane jScrollPane = null; + private JScrollPane jScrollPane = null; - private JComboBox jComboBoxProtocolType = null; + private JComboBox jComboBoxProtocolType = null; - private JComboBox jComboBoxCName = null; + private JComboBox jComboBoxCName = null; - private JLabel jLabelHelpText = null; + private JLabel jLabelHelpText = null; - private JTextArea jTextAreaHelpText = null; + private JTextArea jTextAreaHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JScrollPane jScrollPaneHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonOk = null; + private JButton jButtonOk = null; - private JButton jButtonCancel = null; + private JButton jButtonCancel = null; - // - // Not used by UI - // - private ProtocolsIdentification id = null; + // + // Not used by UI + // + private ProtocolsIdentification id = null; + + private WorkspaceTools wt = new WorkspaceTools(); + + private EnumerationData ed = new EnumerationData(); + + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField jTextFieldFeatureFlag + * + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; + } - private WorkspaceTools wt = new WorkspaceTools(); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxProtocolUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
Protocol
ALWAYS_CONSUMEDModule always consumes the protocol
SOMETIMES_CONSUMESModule sometimes consumes the protocol
ALWAYS_PRODUCEDModule always produces the protocol
SOMETIMES_PRODUCEDModule sometimes produces the protocol
TO_STARTThe protocol is consumed by a Driver Binding protocol Start
function. The protocol is used in EFI 1.10 driver model
BY_STARTProtocol is produced by a Driver Binding protocol Start
function. The protocol is used in EFI 1.10 driver model
Protocol Notify
SOMETIMES_CONSUMEDModule will consume the protocol if it is produced.
Consumption is defined by executing the protocol notify
function.
"); + } + return jComboBoxUsage; + } - private EnumerationData ed = new EnumerationData(); + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; + } - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField jTextFieldFeatureFlag - * - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag - .setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag - .setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + /** + * This method initializes jComboBoxProtocolType + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxProtocolType() { + if (jComboBoxProtocolType == null) { + jComboBoxProtocolType = new JComboBox(); + jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxProtocolType.addItemListener(this); + jComboBoxProtocolType + .setToolTipText("Select Protocol Type
Protocol Notify is a register protocol notify mechanism."); + } + return jComboBoxProtocolType; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxProtocolUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage - .setToolTipText("" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "
Protocol
ALWAYS_CONSUMEDModule always consumes the protocol
SOMETIMES_CONSUMESModule sometimes consumes the protocol
ALWAYS_PRODUCEDModule always produces the protocol
SOMETIMES_PRODUCEDModule sometimes produces the protocol
TO_STARTThe protocol is consumed by a Driver Binding protocol Start
function. The protocol is used in EFI 1.10 driver model
BY_STARTProtocol is produced by a Driver Binding protocol Start
function. The protocol is used in EFI 1.10 driver model
Protocol Notify
SOMETIMES_CONSUMEDModule will consume the protocol if it is produced.
Consumption is defined by executing the protocol notify
function.
"); + + /** + * This method initializes jComboBoxCName + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxCName() { + if (jComboBoxCName == null) { + jComboBoxCName = new JComboBox(); + jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol"); + + } + return jComboBoxCName; } - return jComboBoxUsage; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jScrollPane; - } - - /** - * This method initializes jComboBoxProtocolType - * - * @return javax.swing.JComboBox - */ - private JComboBox getJComboBoxProtocolType() { - if (jComboBoxProtocolType == null) { - jComboBoxProtocolType = new JComboBox(); - jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxProtocolType.addItemListener(this); - jComboBoxProtocolType - .setToolTipText("Select Protocol Type
Protocol Notify is a register protocol notify mechanism."); + + /** + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jComboBoxProtocolType; - } - - /** - * This method initializes jComboBoxCName - * - * @return javax.swing.JComboBox - */ - private JComboBox getJComboBoxCName() { - if (jComboBoxCName == null) { - jComboBoxCName = new JComboBox(); - jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol"); + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jComboBoxCName; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText - .setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + public static void main(String[] args) { + } - return jScrollPaneHelpText; - } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 255); + this.setContentPane(getJScrollPane()); + this.setTitle("Protocols"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inProtocolsId + * + */ + private void init(ProtocolsIdentification inProtocolsId) { + init(); + this.id = inProtocolsId; + + if (this.id != null) { + this.jComboBoxCName.setSelectedItem(id.getName()); + this.jComboBoxProtocolType.setSelectedItem(id.getType()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 255); - this.setContentPane(getJScrollPane()); - this.setTitle("Protocols"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inProtocolsId - * - */ - private void init(ProtocolsIdentification inProtocolsId) { - init(); - this.id = inProtocolsId; - - if (this.id != null) { - this.jComboBoxCName.setSelectedItem(id.getName()); - this.jComboBoxProtocolType.setSelectedItem(id.getType()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This is the override edit constructor + * + * @param inProtocolsIdentification + * @param iFrame + * + */ + public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, IFrame iFrame) { + super(iFrame, true); + init(inProtocolsIdentification); } - } - - /** - * This is the override edit constructor - * - * @param inProtocolsIdentification - * @param iFrame - * - */ - public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, - IFrame iFrame) { - super(iFrame, true); - init(inProtocolsIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jComboBoxUsage.setEnabled(!isView); - this.jTextFieldFeatureFlag.setEnabled(!isView); + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jComboBoxUsage.setEnabled(!isView); + this.jTextFieldFeatureFlag.setEnabled(!isView); + } } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelProtocolType = new JLabel(); - jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - jLabelProtocolType.setText("Select Protocol Type"); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("Protocol Guid C Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(2, 60)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); - jLabelHelpText.setText("Help Text"); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelProtocolType, null); - jContentPane.add(getJComboBoxProtocolType(), null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJComboBoxCName(), null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxProtocolUsage(), null); - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelProtocolType = new JLabel(); + jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + jLabelProtocolType.setText("Select Protocol Type"); + + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelC_Name = new JLabel(); + jLabelC_Name.setText("Protocol Guid C Name"); + jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + + jStarLabel3 = new StarLabel(); + jStarLabel3.setLocation(new java.awt.Point(2, 60)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); + jLabelHelpText.setText("Help Text"); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelProtocolType, null); + jContentPane.add(getJComboBoxProtocolType(), null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelC_Name, null); + jContentPane.add(getJComboBoxCName(), null); + jContentPane.add(jStarLabel3, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxProtocolUsage(), null); + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - return jContentPane; - } - - /** - * This method initializes Usage type - * - */ - private void initFrame() { - Tools - .generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType()); - Tools.generateComboBoxByVector(jComboBoxCName, wt - .getAllProtocolDeclarationsFromWorkspace()); - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentProtocols(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * This method initializes Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType()); + Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllProtocolDeclarationsFromWorkspace()); + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage()); } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentProtocols(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check Name - // - if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { - if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem() - .toString())) { - Log.wrn("Update Protocols", - "Incorrect data type for Protocol/ProtocolNotify Name"); - return false; - } + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check Name + // + if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { + if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) { + Log.wrn("Update Protocols", "Incorrect data type for Protocol/ProtocolNotify Name"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Protocols", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Protocols", "Incorrect data type for Feature Flag"); - return false; - } + private ProtocolsIdentification getCurrentProtocols() { + String arg0 = this.jComboBoxCName.getSelectedItem().toString(); + String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString(); + String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); + + String arg3 = this.jTextFieldFeatureFlag.getText(); + Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); + String arg5 = this.jTextAreaHelpText.getText(); + id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); + return id; } - return true; - } - - private ProtocolsIdentification getCurrentProtocols() { - String arg0 = this.jComboBoxCName.getSelectedItem().toString(); - String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString(); - String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); - - String arg3 = this.jTextFieldFeatureFlag.getText(); - Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); - String arg5 = this.jTextAreaHelpText.getText(); - id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); - return id; - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) - * - * Reflesh the frame when selected item changed - * - */ - - public void itemStateChanged(ItemEvent arg0) { - if (arg0.getSource() == this.jComboBoxProtocolType - && arg0.getStateChange() == ItemEvent.SELECTED) { - if (this.jComboBoxProtocolType.getSelectedItem().toString().equals( - ed.getVProtocolType().get(0))) { - Tools.generateComboBoxByVector(this.jComboBoxUsage, ed - .getVProtocolUsage()); - } else { - Tools.generateComboBoxByVector(this.jComboBoxUsage, ed - .getVProtocolNotifyUsage()); - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) + * + * Reflesh the frame when selected item changed + * + */ + + public void itemStateChanged(ItemEvent arg0) { + if (arg0.getSource() == this.jComboBoxProtocolType && arg0.getStateChange() == ItemEvent.SELECTED) { + if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(ed.getVProtocolType().get(0))) { + Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolUsage()); + } else { + Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolNotifyUsage()); + } + } } - } - public ProtocolsIdentification getId() { - return id; - } + public ProtocolsIdentification getId() { + return id; + } - public void setId(ProtocolsIdentification id) { - this.id = id; - } + public void setId(ProtocolsIdentification id) { + this.id = id; + } }