KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbcore > ejb > wizard > entity > EntityEJBWizardPanel


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.entity;
21
22 import java.awt.event.ActionEvent JavaDoc;
23 import java.awt.event.ActionListener JavaDoc;
24 import javax.swing.SwingUtilities JavaDoc;
25 import javax.swing.event.ChangeListener JavaDoc;
26 import javax.swing.event.DocumentEvent JavaDoc;
27 import javax.swing.event.DocumentListener JavaDoc;
28 //import org.netbeans.modules.j2ee.common.FQNSearch;
29

30 /**
31  *
32  * @author ChrisWebster
33  * @author Martin Adamek
34  */

35 public class EntityEJBWizardPanel extends javax.swing.JPanel JavaDoc {
36
37     private final ChangeListener JavaDoc listener;
38
39     /** Creates new form EntityEJBWizardPanel */
40     public EntityEJBWizardPanel(ChangeListener JavaDoc changeListener) {
41         this.listener = changeListener;
42         initComponents();
43
44         localCheckBox.addActionListener(new ActionListener JavaDoc() {
45             public void actionPerformed(ActionEvent JavaDoc actionEvent) {
46                 listener.stateChanged(null);
47             }
48         });
49
50         remoteCheckBox.addActionListener(new ActionListener JavaDoc() {
51             public void actionPerformed(ActionEvent JavaDoc actionEvent) {
52                 listener.stateChanged(null);
53             }
54         });
55
56         primaryKeyTextField.getDocument().addDocumentListener(new DocumentListener JavaDoc() {
57             public void changedUpdate(DocumentEvent JavaDoc documentEvent) {
58                 listener.stateChanged(null);
59             }
60             public void insertUpdate(DocumentEvent JavaDoc documentEvent) {
61                 listener.stateChanged(null);
62             }
63             public void removeUpdate(DocumentEvent JavaDoc documentEvent) {
64                 listener.stateChanged(null);
65             }
66         });
67         
68         //TODO: RETOUCHE
69
jButton1.setVisible(false);
70         
71     }
72     
73     public boolean isCMP() {
74         return cmpButton.isSelected();
75     }
76     
77     /** This method is called from within the constructor to
78      * initialize the form.
79      * WARNING: Do NOT modify this code. The content of this method is
80      * always regenerated by the Form Editor.
81      */

82     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
83
private void initComponents() {
84         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
85
86         persistenceGroup = new javax.swing.ButtonGroup JavaDoc();
87         persistenceTypeLabel = new javax.swing.JLabel JavaDoc();
88         cmpButton = new javax.swing.JRadioButton JavaDoc();
89         bmpButton = new javax.swing.JRadioButton JavaDoc();
90         createInterfaceLabel = new javax.swing.JLabel JavaDoc();
91         remoteCheckBox = new javax.swing.JCheckBox JavaDoc();
92         localCheckBox = new javax.swing.JCheckBox JavaDoc();
93         jLabel1 = new javax.swing.JLabel JavaDoc();
94         primaryKeyTextField = new javax.swing.JTextField JavaDoc();
95         jButton1 = new javax.swing.JButton JavaDoc();
96
97         setLayout(new java.awt.GridBagLayout JavaDoc());
98
99         org.openide.awt.Mnemonics.setLocalizedText(persistenceTypeLabel, org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_PersistenceType")); // NOI18N
100
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
101         gridBagConstraints.gridy = 1;
102         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
103         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
104         add(persistenceTypeLabel, gridBagConstraints);
105
106         persistenceGroup.add(cmpButton);
107         cmpButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Container").charAt(0));
108         cmpButton.setSelected(true);
109         cmpButton.setText(org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Container")); // NOI18N
110
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
111         gridBagConstraints.gridy = 2;
112         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
113         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
114         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
115         gridBagConstraints.weightx = 1.0;
116         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 15, 0, 0);
117         add(cmpButton, gridBagConstraints);
118         java.util.ResourceBundle JavaDoc bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle"); // NOI18N
119
cmpButton.getAccessibleContext().setAccessibleName(bundle.getString("LBL_Container")); // NOI18N
120
cmpButton.getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_Container")); // NOI18N
121

122         persistenceGroup.add(bmpButton);
123         bmpButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Bean").charAt(0));
124         bmpButton.setText(org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Bean")); // NOI18N
125
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
126         gridBagConstraints.gridy = 3;
127         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
128         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
129         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
130         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 15, 0, 0);
131         add(bmpButton, gridBagConstraints);
132         bmpButton.getAccessibleContext().setAccessibleName(bundle.getString("LBL_Bean")); // NOI18N
133
bmpButton.getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_Bean")); // NOI18N
134

135         org.openide.awt.Mnemonics.setLocalizedText(createInterfaceLabel, org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Interface")); // NOI18N
136
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
137         gridBagConstraints.gridy = 4;
138         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
139         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
140         gridBagConstraints.insets = new java.awt.Insets JavaDoc(15, 0, 0, 0);
141         add(createInterfaceLabel, gridBagConstraints);
142
143         remoteCheckBox.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Remote").charAt(0));
144         remoteCheckBox.setText(org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Remote")); // NOI18N
145
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
146         gridBagConstraints.gridy = 5;
147         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
148         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
149         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
150         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 15, 0, 0);
151         add(remoteCheckBox, gridBagConstraints);
152         remoteCheckBox.getAccessibleContext().setAccessibleName(bundle.getString("LBL_Remote")); // NOI18N
153
remoteCheckBox.getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_Remote")); // NOI18N
154

155         localCheckBox.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Local").charAt(0));
156         localCheckBox.setSelected(true);
157         localCheckBox.setText(org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Local")); // NOI18N
158
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
159         gridBagConstraints.gridy = 6;
160         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
161         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
162         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
163         gridBagConstraints.weightx = 1.0;
164         gridBagConstraints.weighty = 1.0;
165         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 15, 0, 0);
166         add(localCheckBox, gridBagConstraints);
167         localCheckBox.getAccessibleContext().setAccessibleName(bundle.getString("LBL_Local")); // NOI18N
168
localCheckBox.getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_Local")); // NOI18N
169

170         jLabel1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_PrimaryKey").charAt(0));
171         jLabel1.setLabelFor(primaryKeyTextField);
172         jLabel1.setText(org.openide.util.NbBundle.getBundle(EntityEJBWizardPanel.class).getString("LBL_PrimaryKeyClass")); // NOI18N
173
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
174         gridBagConstraints.gridy = 0;
175         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
176         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 8, 8);
177         add(jLabel1, gridBagConstraints);
178
179         primaryKeyTextField.setText("java.lang.Long");
180         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
181         gridBagConstraints.gridx = 1;
182         gridBagConstraints.gridy = 0;
183         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
184         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
185         gridBagConstraints.weightx = 1.0;
186         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 8, 8);
187         add(primaryKeyTextField, gridBagConstraints);
188         primaryKeyTextField.getAccessibleContext().setAccessibleName(bundle.getString("ACS_PrimaryKeyField")); // NOI18N
189
primaryKeyTextField.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_PrimaryKeyField")); // NOI18N
190

191         jButton1.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Browse").charAt(0));
192         jButton1.setText("...");
193         jButton1.addActionListener(new java.awt.event.ActionListener JavaDoc() {
194             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
195                 jButton1ActionPerformed(evt);
196             }
197         });
198         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
199         gridBagConstraints.gridx = 2;
200         gridBagConstraints.gridy = 0;
201         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 8, 0);
202         add(jButton1, gridBagConstraints);
203         jButton1.getAccessibleContext().setAccessibleName(bundle.getString("ACS_BrowsePK")); // NOI18N
204
jButton1.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_BrowsePK")); // NOI18N
205
}// </editor-fold>//GEN-END:initComponents
206

207     private void jButton1ActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jButton1ActionPerformed
208
SwingUtilities.invokeLater (new Runnable JavaDoc() {
209             public void run() {
210                 //TODO: RETOUCHE FQNSearch
211
// FQNSearch.showFastOpen(primaryKeyTextField);
212
}
213         });
214     }//GEN-LAST:event_jButton1ActionPerformed
215

216     
217     // Variables declaration - do not modify//GEN-BEGIN:variables
218
private javax.swing.JRadioButton JavaDoc bmpButton;
219     private javax.swing.JRadioButton JavaDoc cmpButton;
220     private javax.swing.JLabel JavaDoc createInterfaceLabel;
221     private javax.swing.JButton JavaDoc jButton1;
222     private javax.swing.JLabel JavaDoc jLabel1;
223     private javax.swing.JCheckBox JavaDoc localCheckBox;
224     private javax.swing.ButtonGroup JavaDoc persistenceGroup;
225     private javax.swing.JLabel JavaDoc persistenceTypeLabel;
226     private javax.swing.JTextField JavaDoc primaryKeyTextField;
227     private javax.swing.JCheckBox JavaDoc remoteCheckBox;
228     // End of variables declaration//GEN-END:variables
229

230     public boolean isRemote() {
231         return remoteCheckBox.isSelected();
232     }
233
234     public boolean isLocal() {
235         return localCheckBox.isSelected();
236     }
237     
238     public String JavaDoc getPrimaryKeyClassName() {
239         return primaryKeyTextField.getText();
240     }
241     
242 }
243
Popular Tags