1 19 20 package org.netbeans.modules.j2ee.ejbcore.ejb.wizard.session; 21 22 import java.awt.event.ActionEvent ; 23 import java.awt.event.ActionListener ; 24 import javax.swing.event.ChangeListener ; 25 26 31 public class SessionEJBWizardPanel extends javax.swing.JPanel { 32 33 private final ChangeListener listener; 34 35 36 public SessionEJBWizardPanel(ChangeListener changeListener) { 37 this.listener = changeListener; 38 initComponents(); 39 40 localCheckBox.addActionListener(new ActionListener () { 41 public void actionPerformed(ActionEvent actionEvent) { 42 listener.stateChanged(null); 43 } 44 }); 45 46 remoteCheckBox.addActionListener(new ActionListener () { 47 public void actionPerformed(ActionEvent actionEvent) { 48 listener.stateChanged(null); 49 } 50 }); 51 52 } 53 54 59 private void initComponents() { 61 java.awt.GridBagConstraints gridBagConstraints; 62 63 sessionStateButtons = new javax.swing.ButtonGroup (); 64 sessionTypeLabel = new javax.swing.JLabel (); 65 statelessButton = new javax.swing.JRadioButton (); 66 statefulButton = new javax.swing.JRadioButton (); 67 interfaceLabel = new javax.swing.JLabel (); 68 remoteCheckBox = new javax.swing.JCheckBox (); 69 localCheckBox = new javax.swing.JCheckBox (); 70 71 setLayout(new java.awt.GridBagLayout ()); 72 73 org.openide.awt.Mnemonics.setLocalizedText(sessionTypeLabel, org.openide.util.NbBundle.getMessage(SessionEJBWizardPanel.class, "LBL_SessionType")); 74 gridBagConstraints = new java.awt.GridBagConstraints (); 75 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 76 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 77 add(sessionTypeLabel, gridBagConstraints); 78 79 sessionStateButtons.add(statelessButton); 80 statelessButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("MN_Stateless").charAt(0)); 81 statelessButton.setSelected(true); 82 statelessButton.setText(org.openide.util.NbBundle.getMessage(SessionEJBWizardPanel.class, "LBL_Stateless")); 83 gridBagConstraints = new java.awt.GridBagConstraints (); 84 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 85 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 86 gridBagConstraints.insets = new java.awt.Insets (0, 15, 0, 0); 87 add(statelessButton, gridBagConstraints); 88 statelessButton.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("LBL_Stateless")); 89 statelessButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("LBL_Stateless")); 90 91 sessionStateButtons.add(statefulButton); 92 statefulButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("MN_Stateful").charAt(0)); 93 statefulButton.setText(org.openide.util.NbBundle.getMessage(SessionEJBWizardPanel.class, "LBL_Stateful")); 94 gridBagConstraints = new java.awt.GridBagConstraints (); 95 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 96 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 97 gridBagConstraints.insets = new java.awt.Insets (0, 15, 0, 0); 98 add(statefulButton, gridBagConstraints); 99 statefulButton.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("LBL_Stateful")); 100 statefulButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("LBL_Stateful")); 101 102 org.openide.awt.Mnemonics.setLocalizedText(interfaceLabel, org.openide.util.NbBundle.getMessage(SessionEJBWizardPanel.class, "LBL_Interface")); 103 gridBagConstraints = new java.awt.GridBagConstraints (); 104 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 105 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 106 gridBagConstraints.insets = new java.awt.Insets (15, 0, 0, 0); 107 add(interfaceLabel, gridBagConstraints); 108 109 remoteCheckBox.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("MN_Remote").charAt(0)); 110 remoteCheckBox.setText(org.openide.util.NbBundle.getMessage(SessionEJBWizardPanel.class, "LBL_Remote")); 111 gridBagConstraints = new java.awt.GridBagConstraints (); 112 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 113 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 114 gridBagConstraints.insets = new java.awt.Insets (0, 15, 0, 0); 115 add(remoteCheckBox, gridBagConstraints); 116 remoteCheckBox.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("LBL_Remote")); 117 remoteCheckBox.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("LBL_Remote")); 118 119 localCheckBox.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("MN_Local").charAt(0)); 120 localCheckBox.setSelected(true); 121 localCheckBox.setText(org.openide.util.NbBundle.getMessage(SessionEJBWizardPanel.class, "LBL_Local")); 122 gridBagConstraints = new java.awt.GridBagConstraints (); 123 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 124 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 125 gridBagConstraints.weightx = 1.0; 126 gridBagConstraints.weighty = 1.0; 127 gridBagConstraints.insets = new java.awt.Insets (0, 15, 0, 0); 128 add(localCheckBox, gridBagConstraints); 129 localCheckBox.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("LBL_Local")); 130 localCheckBox.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/Bundle").getString("LBL_Local")); 131 132 } 134 135 private javax.swing.JLabel interfaceLabel; 137 private javax.swing.JCheckBox localCheckBox; 138 private javax.swing.JCheckBox remoteCheckBox; 139 private javax.swing.ButtonGroup sessionStateButtons; 140 private javax.swing.JLabel sessionTypeLabel; 141 private javax.swing.JRadioButton statefulButton; 142 private javax.swing.JRadioButton statelessButton; 143 145 public boolean isStateless() { 146 return statelessButton.isSelected(); 147 } 148 149 public boolean isRemote() { 150 return remoteCheckBox.isSelected(); 151 } 152 153 public boolean isLocal() { 154 return localCheckBox.isSelected(); 155 } 156 } 157 | Popular Tags |