KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbcore > ejb > wizard > session > SessionEJBWizardPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.ejbcore.ejb.wizard.session;
21
22 import java.awt.event.ActionEvent JavaDoc;
23 import java.awt.event.ActionListener JavaDoc;
24 import javax.swing.event.ChangeListener JavaDoc;
25
26 /**
27  *
28  * @author cwebster
29  * @author Martin Adamek
30  */

31 public class SessionEJBWizardPanel extends javax.swing.JPanel JavaDoc {
32
33     private final ChangeListener JavaDoc listener;
34
35     /** Creates new form SingleEJBWizardPanel */
36     public SessionEJBWizardPanel(ChangeListener JavaDoc changeListener) {
37         this.listener = changeListener;
38         initComponents();
39
40         localCheckBox.addActionListener(new ActionListener JavaDoc() {
41             public void actionPerformed(ActionEvent JavaDoc actionEvent) {
42                 listener.stateChanged(null);
43             }
44         });
45
46         remoteCheckBox.addActionListener(new ActionListener JavaDoc() {
47             public void actionPerformed(ActionEvent JavaDoc actionEvent) {
48                 listener.stateChanged(null);
49             }
50         });
51
52     }
53     
54     /** This method is called from within the constructor to
55      * initialize the form.
56      * WARNING: Do NOT modify this code. The content of this method is
57      * always regenerated by the Form Editor.
58      */

59     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
60
private void initComponents() {
61         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
62
63         sessionStateButtons = new javax.swing.ButtonGroup JavaDoc();
64         sessionTypeLabel = new javax.swing.JLabel JavaDoc();
65         statelessButton = new javax.swing.JRadioButton JavaDoc();
66         statefulButton = new javax.swing.JRadioButton JavaDoc();
67         interfaceLabel = new javax.swing.JLabel JavaDoc();
68         remoteCheckBox = new javax.swing.JCheckBox JavaDoc();
69         localCheckBox = new javax.swing.JCheckBox JavaDoc();
70
71         setLayout(new java.awt.GridBagLayout JavaDoc());
72
73         org.openide.awt.Mnemonics.setLocalizedText(sessionTypeLabel, org.openide.util.NbBundle.getMessage(SessionEJBWizardPanel.class, "LBL_SessionType"));
74         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc();
84         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
85         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
86         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc();
95         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
96         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
97         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc();
104         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
105         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
106         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc();
112         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
113         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
114         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc();
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 JavaDoc(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     }// </editor-fold>//GEN-END:initComponents
133

134     
135     // Variables declaration - do not modify//GEN-BEGIN:variables
136
private javax.swing.JLabel JavaDoc interfaceLabel;
137     private javax.swing.JCheckBox JavaDoc localCheckBox;
138     private javax.swing.JCheckBox JavaDoc remoteCheckBox;
139     private javax.swing.ButtonGroup JavaDoc sessionStateButtons;
140     private javax.swing.JLabel JavaDoc sessionTypeLabel;
141     private javax.swing.JRadioButton JavaDoc statefulButton;
142     private javax.swing.JRadioButton JavaDoc statelessButton;
143     // End of variables declaration//GEN-END:variables
144

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