KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > common > method > impl > MethodCustomizerPanel


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.common.method.impl;
21
22 import java.awt.event.ActionEvent JavaDoc;
23 import java.awt.event.ActionListener JavaDoc;
24 import java.beans.PropertyChangeListener JavaDoc;
25 import java.util.Collections JavaDoc;
26 import java.util.List JavaDoc;
27 import java.util.Set JavaDoc;
28 import javax.lang.model.element.Modifier;
29 import javax.swing.event.DocumentEvent JavaDoc;
30 import javax.swing.event.DocumentListener JavaDoc;
31 import org.netbeans.modules.j2ee.common.method.MethodModel;
32
33 /**
34  *
35  * @author Martin Adamek
36  */

37 public final class MethodCustomizerPanel extends javax.swing.JPanel JavaDoc {
38     
39     public static final String JavaDoc NAME = "name";
40     public static final String JavaDoc RETURN_TYPE = "returnType";
41     public static final String JavaDoc INTERFACES = "interfaces";
42     
43     // immutable method prototype
44
private final MethodModel methodModel;
45     private final ParametersPanel parametersPanel;
46     private final boolean hasInterfaces;
47     
48     private MethodCustomizerPanel(
49             MethodModel methodModel,
50             boolean hasLocal,
51             boolean hasRemote,
52             boolean selectLocal,
53             boolean selectRemote,
54             boolean hasReturnType,
55             String JavaDoc ejbql,
56             boolean hasFinderCardinality,
57             boolean hasExceptions,
58             boolean hasInterfaces) {
59         initComponents();
60         
61         this.methodModel = methodModel;
62         this.hasInterfaces = hasInterfaces;
63         
64         nameTextField.setText(methodModel.getName());
65         returnTypeTextField.setText(methodModel.getReturnType());
66         
67         localCheckBox.setEnabled(hasLocal);
68         remoteCheckBox.setEnabled(hasRemote);
69         localCheckBox.setSelected(selectLocal);
70         remoteCheckBox.setSelected(selectRemote);
71         
72         if (!hasReturnType) {
73             disableReturnType();
74         }
75         if (ejbql == null) {
76             ejbqlPanel.setVisible(false);
77         } else {
78             ejbqlTextArea.setText(ejbql);
79         }
80         cardinalityPanel.setVisible(hasFinderCardinality);
81         exceptionsPanel.setVisible(hasExceptions);
82         interfacesPanel.setVisible(hasInterfaces);
83         
84         parametersPanel = new ParametersPanel(methodModel.getParameters());
85         parametersContainerPanel.add(parametersPanel);
86         
87         // listeners
88
nameTextField.getDocument().addDocumentListener(new SimpleListener(NAME));
89         returnTypeTextField.getDocument().addDocumentListener(new SimpleListener(RETURN_TYPE));
90         SimpleListener interfacesListener = new SimpleListener(INTERFACES);
91         localCheckBox.addActionListener(interfacesListener);
92         remoteCheckBox.addActionListener(interfacesListener);
93     }
94     
95     public static MethodCustomizerPanel create(MethodModel methodModel, boolean hasLocal, boolean hasRemote, boolean selectLocal, boolean selectRemote,
96             boolean hasReturnType, String JavaDoc ejbql, boolean hasFinderCardinality, boolean hasExceptions, boolean hasInterfaces) {
97         return new MethodCustomizerPanel(methodModel, hasLocal, hasRemote, selectLocal, selectRemote,
98                 hasReturnType, ejbql, hasFinderCardinality, hasExceptions, hasInterfaces);
99     }
100
101     @Override JavaDoc
102     public void addPropertyChangeListener(PropertyChangeListener JavaDoc listener) {
103     super.addPropertyChangeListener(listener);
104          // first validation before any real event is send
105
firePropertyChange(NAME, null, null);
106         firePropertyChange(RETURN_TYPE, null, null);
107         firePropertyChange(INTERFACES, null, null);
108     }
109     
110     /** This method is called from within the constructor to
111      * initialize the form.
112      * WARNING: Do NOT modify this code. The content of this method is
113      * always regenerated by the Form Editor.
114      */

115     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
116
private void initComponents() {
117
118         finderCardinalityButtonGroup = new javax.swing.ButtonGroup JavaDoc();
119         exceptionAndParameterPane = new javax.swing.JTabbedPane JavaDoc();
120         parametersContainerPanel = new javax.swing.JPanel JavaDoc();
121         exceptionsPanel = new javax.swing.JPanel JavaDoc();
122         errorTextField = new javax.swing.JTextField JavaDoc();
123         returnTypeLabel = new javax.swing.JLabel JavaDoc();
124         returnTypeTextField = new javax.swing.JTextField JavaDoc();
125         nameTextField = new javax.swing.JTextField JavaDoc();
126         jLabel1 = new javax.swing.JLabel JavaDoc();
127         methodLabel = new javax.swing.JLabel JavaDoc();
128         methodSeparator = new javax.swing.JSeparator JavaDoc();
129         interfacesPanel = new javax.swing.JPanel JavaDoc();
130         interfaceLabel = new javax.swing.JLabel JavaDoc();
131         remoteCheckBox = new javax.swing.JCheckBox JavaDoc();
132         localCheckBox = new javax.swing.JCheckBox JavaDoc();
133         cardinalityPanel = new javax.swing.JPanel JavaDoc();
134         cardinalityLabel = new javax.swing.JLabel JavaDoc();
135         oneRadioButton = new javax.swing.JRadioButton JavaDoc();
136         manyRadioButton = new javax.swing.JRadioButton JavaDoc();
137         ejbqlPanel = new javax.swing.JPanel JavaDoc();
138         ejbqlLabel = new javax.swing.JLabel JavaDoc();
139         ejbqlScrollPane = new javax.swing.JScrollPane JavaDoc();
140         ejbqlTextArea = new javax.swing.JTextArea JavaDoc();
141
142         parametersContainerPanel.setLayout(new java.awt.BorderLayout JavaDoc());
143         exceptionAndParameterPane.addTab(org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.parametersContainerPanel.TabConstraints.tabTitle"), parametersContainerPanel); // NOI18N
144

145         org.jdesktop.layout.GroupLayout exceptionsPanelLayout = new org.jdesktop.layout.GroupLayout(exceptionsPanel);
146         exceptionsPanel.setLayout(exceptionsPanelLayout);
147         exceptionsPanelLayout.setHorizontalGroup(
148             exceptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
149             .add(0, 412, Short.MAX_VALUE)
150         );
151         exceptionsPanelLayout.setVerticalGroup(
152             exceptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
153             .add(0, 122, Short.MAX_VALUE)
154         );
155
156         exceptionAndParameterPane.addTab(org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.exceptionsPanel.TabConstraints.tabTitle"), exceptionsPanel); // NOI18N
157

158         errorTextField.setEditable(false);
159         errorTextField.setText(org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.errorTextField.text")); // NOI18N
160
errorTextField.setBorder(null);
161
162         returnTypeLabel.setLabelFor(returnTypeTextField);
163         org.openide.awt.Mnemonics.setLocalizedText(returnTypeLabel, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.returnTypeLabel.text")); // NOI18N
164

165         returnTypeTextField.setText(org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.returnTypeTextField.text")); // NOI18N
166

167         nameTextField.setText(org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.nameTextField.text")); // NOI18N
168

169         jLabel1.setLabelFor(nameTextField);
170         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.jLabel1.text")); // NOI18N
171

172         org.openide.awt.Mnemonics.setLocalizedText(methodLabel, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.methodLabel.text")); // NOI18N
173

174         org.openide.awt.Mnemonics.setLocalizedText(interfaceLabel, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.interfaceLabel.text")); // NOI18N
175

176         org.openide.awt.Mnemonics.setLocalizedText(remoteCheckBox, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.remoteCheckBox.text")); // NOI18N
177
remoteCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
178         remoteCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
179
180         org.openide.awt.Mnemonics.setLocalizedText(localCheckBox, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.localCheckBox.text")); // NOI18N
181
localCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
182         localCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
183
184         org.jdesktop.layout.GroupLayout interfacesPanelLayout = new org.jdesktop.layout.GroupLayout(interfacesPanel);
185         interfacesPanel.setLayout(interfacesPanelLayout);
186         interfacesPanelLayout.setHorizontalGroup(
187             interfacesPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
188             .add(interfacesPanelLayout.createSequentialGroup()
189                 .add(interfaceLabel)
190                 .add(24, 24, 24)
191                 .add(remoteCheckBox)
192                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
193                 .add(localCheckBox)
194                 .addContainerGap(174, Short.MAX_VALUE))
195         );
196         interfacesPanelLayout.setVerticalGroup(
197             interfacesPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
198             .add(interfacesPanelLayout.createSequentialGroup()
199                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
200                 .add(interfacesPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
201                     .add(interfaceLabel)
202                     .add(remoteCheckBox)
203                     .add(localCheckBox)))
204         );
205
206         org.openide.awt.Mnemonics.setLocalizedText(cardinalityLabel, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.cardinalityLabel.text")); // NOI18N
207

208         finderCardinalityButtonGroup.add(oneRadioButton);
209         org.openide.awt.Mnemonics.setLocalizedText(oneRadioButton, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.oneRadioButton.text")); // NOI18N
210
oneRadioButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
211         oneRadioButton.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
212
213         finderCardinalityButtonGroup.add(manyRadioButton);
214         org.openide.awt.Mnemonics.setLocalizedText(manyRadioButton, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.manyRadioButton.text")); // NOI18N
215
manyRadioButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
216         manyRadioButton.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
217
218         org.jdesktop.layout.GroupLayout cardinalityPanelLayout = new org.jdesktop.layout.GroupLayout(cardinalityPanel);
219         cardinalityPanel.setLayout(cardinalityPanelLayout);
220         cardinalityPanelLayout.setHorizontalGroup(
221             cardinalityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
222             .add(cardinalityPanelLayout.createSequentialGroup()
223                 .add(cardinalityLabel)
224                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
225                 .add(oneRadioButton)
226                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
227                 .add(manyRadioButton)
228                 .addContainerGap(194, Short.MAX_VALUE))
229         );
230         cardinalityPanelLayout.setVerticalGroup(
231             cardinalityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
232             .add(cardinalityPanelLayout.createSequentialGroup()
233                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
234                 .add(cardinalityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
235                     .add(cardinalityLabel)
236                     .add(oneRadioButton)
237                     .add(manyRadioButton)))
238         );
239
240         org.openide.awt.Mnemonics.setLocalizedText(ejbqlLabel, org.openide.util.NbBundle.getMessage(MethodCustomizerPanel.class, "MethodCustomizerPanel.ejbqlLabel.text")); // NOI18N
241

242         ejbqlScrollPane.setBorder(null);
243
244         ejbqlTextArea.setColumns(20);
245         ejbqlTextArea.setRows(5);
246         ejbqlTextArea.setBorder(javax.swing.BorderFactory.createEtchedBorder());
247         ejbqlScrollPane.setViewportView(ejbqlTextArea);
248
249         org.jdesktop.layout.GroupLayout ejbqlPanelLayout = new org.jdesktop.layout.GroupLayout(ejbqlPanel);
250         ejbqlPanel.setLayout(ejbqlPanelLayout);
251         ejbqlPanelLayout.setHorizontalGroup(
252             ejbqlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
253             .add(ejbqlPanelLayout.createSequentialGroup()
254                 .add(ejbqlLabel)
255                 .addContainerGap(377, Short.MAX_VALUE))
256             .add(ejbqlScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE)
257         );
258         ejbqlPanelLayout.setVerticalGroup(
259             ejbqlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
260             .add(ejbqlPanelLayout.createSequentialGroup()
261                 .addContainerGap()
262                 .add(ejbqlLabel)
263                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
264                 .add(ejbqlScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))
265         );
266
267         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
268         this.setLayout(layout);
269         layout.setHorizontalGroup(
270             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
271             .add(layout.createSequentialGroup()
272                 .addContainerGap()
273                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
274                     .add(org.jdesktop.layout.GroupLayout.TRAILING, exceptionAndParameterPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE)
275                     .add(layout.createSequentialGroup()
276                         .add(methodLabel)
277                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
278                         .add(methodSeparator, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 358, Short.MAX_VALUE))
279                     .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
280                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
281                             .add(jLabel1)
282                             .add(returnTypeLabel))
283                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
284                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
285                             .add(nameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
286                             .add(returnTypeTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)))
287                     .add(ejbqlPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
288                     .add(cardinalityPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
289                     .add(interfacesPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
290                     .add(errorTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE))
291                 .addContainerGap())
292         );
293         layout.setVerticalGroup(
294             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
295             .add(layout.createSequentialGroup()
296                 .addContainerGap()
297                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
298                     .add(methodLabel)
299                     .add(methodSeparator, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
300                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
301                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
302                     .add(nameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
303                     .add(jLabel1))
304                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
305                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
306                     .add(returnTypeLabel)
307                     .add(returnTypeTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
308                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
309                 .add(exceptionAndParameterPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE)
310                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
311                 .add(interfacesPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
312                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
313                 .add(cardinalityPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
314                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
315                 .add(ejbqlPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
316                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
317                 .add(errorTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
318         );
319     }// </editor-fold>//GEN-END:initComponents
320

321     
322     // Variables declaration - do not modify//GEN-BEGIN:variables
323
private javax.swing.JLabel JavaDoc cardinalityLabel;
324     private javax.swing.JPanel JavaDoc cardinalityPanel;
325     private javax.swing.JLabel JavaDoc ejbqlLabel;
326     private javax.swing.JPanel JavaDoc ejbqlPanel;
327     private javax.swing.JScrollPane JavaDoc ejbqlScrollPane;
328     private javax.swing.JTextArea JavaDoc ejbqlTextArea;
329     private javax.swing.JTextField JavaDoc errorTextField;
330     private javax.swing.JTabbedPane JavaDoc exceptionAndParameterPane;
331     private javax.swing.JPanel JavaDoc exceptionsPanel;
332     private javax.swing.ButtonGroup JavaDoc finderCardinalityButtonGroup;
333     private javax.swing.JLabel JavaDoc interfaceLabel;
334     private javax.swing.JPanel JavaDoc interfacesPanel;
335     private javax.swing.JLabel JavaDoc jLabel1;
336     private javax.swing.JCheckBox JavaDoc localCheckBox;
337     private javax.swing.JRadioButton JavaDoc manyRadioButton;
338     private javax.swing.JLabel JavaDoc methodLabel;
339     private javax.swing.JSeparator JavaDoc methodSeparator;
340     private javax.swing.JTextField JavaDoc nameTextField;
341     private javax.swing.JRadioButton JavaDoc oneRadioButton;
342     private javax.swing.JPanel JavaDoc parametersContainerPanel;
343     private javax.swing.JCheckBox JavaDoc remoteCheckBox;
344     private javax.swing.JLabel JavaDoc returnTypeLabel;
345     private javax.swing.JTextField JavaDoc returnTypeTextField;
346     // End of variables declaration//GEN-END:variables
347

348     public void setError(String JavaDoc message) {
349         errorTextField.setText(message);
350     }
351     
352     public String JavaDoc getMethodName() {
353             return nameTextField.getText().trim();
354     }
355     
356     public String JavaDoc getReturnType() {
357         return returnTypeTextField.getText().trim();
358     }
359
360     public List JavaDoc<MethodModel.Variable> getParameters() {
361         return parametersPanel.getParameters();
362     }
363     
364     public List JavaDoc<String JavaDoc> getExceptions() {
365         return Collections.<String JavaDoc>emptyList();
366     }
367     
368     public Set JavaDoc<Modifier> getModifiers() {
369         // not changing?
370
return methodModel.getModifiers();
371     }
372     
373     public String JavaDoc getMethodBody() {
374         // not changing?
375
return methodModel.getBody();
376     }
377     
378     public boolean supportsInterfacesChecking() {
379         return hasInterfaces;
380     }
381     
382     public boolean hasLocal() {
383         return localCheckBox.isEnabled() & localCheckBox.isSelected();
384     }
385     
386     public boolean hasRemote() {
387         return remoteCheckBox.isEnabled() && remoteCheckBox.isSelected();
388     }
389     
390     private void disableReturnType() {
391         returnTypeLabel.setVisible(false);
392         returnTypeTextField.setVisible(false);
393     }
394     
395     /**
396      * Listener on text fields.
397      * Fires change event for specified property of this JPanel,
398      * old and new value of event is null.
399      * After receiving event, client can get property value by
400      * calling {@link #getProperty(String)}
401      */

402     private class SimpleListener implements DocumentListener JavaDoc, ActionListener JavaDoc {
403         
404         private final String JavaDoc propertyName;
405         
406         public SimpleListener(String JavaDoc propertyName) {
407             this.propertyName = propertyName;
408         }
409         
410         public void insertUpdate(DocumentEvent JavaDoc documentEvent) { fire(); }
411         
412         public void removeUpdate(DocumentEvent JavaDoc documentEvent) { fire(); }
413         
414         public void changedUpdate(DocumentEvent JavaDoc documentEvent) {}
415         
416         public void actionPerformed(ActionEvent JavaDoc actionEvent) { fire(); }
417
418         private void fire() {
419             firePropertyChange(propertyName, null, null);
420         }
421         
422     }
423     
424 }
425
Popular Tags