KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > earproject > ui > customizer > CustomizerRun


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.earproject.ui.customizer;
21
22 import java.awt.event.ActionEvent JavaDoc;
23 import java.awt.event.ActionListener JavaDoc;
24 import java.util.Arrays JavaDoc;
25 import java.util.Collection JavaDoc;
26 import java.util.LinkedHashSet JavaDoc;
27 import java.util.Map JavaDoc;
28 import java.util.TreeMap JavaDoc;
29 import javax.swing.JPanel JavaDoc;
30 import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
31 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
32 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
33 import org.netbeans.modules.j2ee.earproject.ProjectEar;
34 import org.openide.util.HelpCtx;
35 import org.openide.util.NbBundle;
36
37 public final class CustomizerRun extends JPanel JavaDoc implements ArchiveCustomizerPanel, HelpCtx.Provider {
38     
39     // Helper for storing properties
40
private final VisualPropertySupport vps;
41     // VisualPropertySupport currently does not support more combo boxes when
42
// item values differ from their display texts - see #53893
43
private final VisualPropertySupport vps1;
44     //private VisualArchiveIncludesSupport vws;
45
// private final ProjectEar wm;
46

47     private String JavaDoc[] serverInstanceIDs;
48     private String JavaDoc[] serverNames;
49     
50     /** Whether this panel was already initialized. */
51     private boolean initialized;
52     
53     private final EarProjectProperties earProperties;
54     
55     public CustomizerRun(final EarProjectProperties earProperties, final ProjectEar wm) {
56         this.earProperties = earProperties;
57         initComponents();
58         this.getAccessibleContext().setAccessibleDescription(
59                 NbBundle.getMessage(CustomizerRun.class, "ACS_CustomizeRun_A11YDesc")); // NOI18N
60
// vws = new VisualArchiveIncludesSupport( earProperties.getProject(),
61
// this.wm = wm;
62
vps = new VisualPropertySupport(earProperties);
63         vps1 = new VisualPropertySupport(earProperties);
64         clientModuleUriCombo.addActionListener(new ActionListener JavaDoc() {
65             public void actionPerformed(ActionEvent JavaDoc e) {
66                 updateEnabled();
67             }
68         });
69         updateEnabled();
70         String JavaDoc j2eeVersion = earProperties.getProject().getJ2eePlatformVersion();
71         if (J2eeModule.JAVA_EE_5.equals(j2eeVersion)) {
72             jTextFieldVersion.setText(EarProjectProperties.JAVA_EE_SPEC_50_LABEL);
73         } else if (J2eeModule.J2EE_14.equals(j2eeVersion)) {
74             jTextFieldVersion.setText(EarProjectProperties.J2EE_SPEC_14_LABEL);
75         }
76     }
77     
78     private void updateEnabled() {
79         boolean displayInBrowser = jCheckBoxDisplayBrowser.isSelected();
80         boolean isWebUri = earProperties.isWebUri((String JavaDoc) clientModuleUriCombo.getSelectedItem());
81         jTextFieldRelativeURL.setEnabled(displayInBrowser && isWebUri);
82         jLabelContextPathDesc.setEnabled(displayInBrowser && isWebUri);
83         jLabelRelativeURL.setEnabled(displayInBrowser && isWebUri);
84         jTextMainClass.setEnabled(!isWebUri);
85         jTextArgs.setEnabled(!isWebUri);
86         jTextVMOptions.setEnabled(!isWebUri);
87         jLabelMainClass.setEnabled(!isWebUri);
88         jLabelArgs.setEnabled(!isWebUri);
89         jLabelVMOptions.setEnabled(!isWebUri);
90         jLabelVMOptionsExample.setEnabled(!isWebUri);
91     }
92     
93     public void initValues() {
94         if (initialized) {
95             return;
96         }
97         initServerInstances();
98         
99         vps.register(jCheckBoxDisplayBrowser, EarProjectProperties.DISPLAY_BROWSER);
100         vps.register(jTextFieldRelativeURL, EarProjectProperties.LAUNCH_URL_RELATIVE);
101         vps.register(jComboBoxServer, serverNames, serverInstanceIDs, EarProjectProperties.J2EE_SERVER_INSTANCE);
102         
103         vps.register(jTextMainClass, EarProjectProperties.APPCLIENT_MAIN_CLASS);
104         vps.register(jTextArgs, EarProjectProperties.APPCLIENT_ARGS);
105         vps.register(jTextVMOptions, EarProjectProperties.APPCLIENT_JVM_OPTIONS);
106         
107 // EarProjectProperties.PropertyDescriptor.Saver contextPathSaver = new EarProjectProperties.PropertyDescriptor.Saver() {
108
// public void save(WebProjectProperties.PropertyInfo propertyInfo) {
109
// final String serverInstId = (String) earProperties.get(EarProjectProperties.J2EE_SERVER_INSTANCE);
110
// final String path = (String) propertyInfo.getValue();
111
// final String oldValue = (String) propertyInfo.getOldValue();
112
// if(path != null && !path.equals(oldValue)) {
113
// wm.setContextPath(serverInstId, path);
114
// }
115
// }
116
// };
117
// if (earProperties.get(EarProjectProperties.CLIENT_MODULE_URI) == null) {
118
// EarProjectProperties.PropertyDescriptor propertyDescriptor = new EarProjectProperties.PropertyDescriptor(
119
// EarProjectProperties.CLIENT_MODULE_URI, null, EarProjectProperties.STRING_PARSER, contextPathSaver);
120
// final String contextPath = wm.getContextPath();
121
// EarProjectProperties.PropertyInfo propertyInfo =
122
// earProperties.new PropertyInfo(propertyDescriptor, contextPath, contextPath);
123
// earProperties.initProperty(WebProjectProperties.CLIENT_MODULE_URI, propertyInfo);
124
// }
125

126         String JavaDoc[] displayUris = getDisplayUris();
127         vps1.register(clientModuleUriCombo, displayUris, getUris(displayUris),
128                 EarProjectProperties.CLIENT_MODULE_URI);
129         
130         jTextFieldRelativeURL.setEditable(jCheckBoxDisplayBrowser.isSelected());
131         initialized = true;
132     }
133     
134     private String JavaDoc[] getDisplayUris() {
135         Collection JavaDoc<String JavaDoc> uris = new LinkedHashSet JavaDoc<String JavaDoc>();
136         uris.addAll(Arrays.asList(earProperties.getWebUris()));
137         uris.addAll(Arrays.asList(earProperties.getAppClientUris()));
138         return uris.toArray(new String JavaDoc[uris.size()]);
139     }
140     
141     private String JavaDoc[] getUris(final String JavaDoc[] displayUris) {
142         String JavaDoc appClient = (String JavaDoc) earProperties.get(earProperties.APPLICATION_CLIENT);
143         String JavaDoc[] uris = new String JavaDoc[displayUris.length];
144         for (int i = 0; i < uris.length; i++) {
145             if (earProperties.isWebUri(displayUris[i])) {
146                 uris[i] = displayUris[i];
147             } else if (earProperties.isAppClientUri(displayUris[i])) {
148                 if (displayUris[i].equals(appClient)) {
149                     uris[i] = earProperties.getClientModuleUriForAppClient();
150                 } else {
151                     uris[i] = displayUris[i];
152                 }
153             } else {
154                 assert false : "Nor web module neither application client: " + displayUris[i]; // NOI18N
155
}
156         }
157         return uris;
158     }
159     
160     private int getLongestVersionLength() {
161         return Math.max(
162                 EarProjectProperties.JAVA_EE_SPEC_50_LABEL.length(),
163                 EarProjectProperties.J2EE_SPEC_14_LABEL.length());
164     }
165     
166     /** This method is called from within the constructor to
167      * initialize the form.
168      * WARNING: Do NOT modify this code. The content of this method is
169      * always regenerated by the Form Editor.
170      */

171     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
172
private void initComponents() {
173         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
174
175         jLabelContextPath = new javax.swing.JLabel JavaDoc();
176         jLabelServer = new javax.swing.JLabel JavaDoc();
177         jComboBoxServer = new javax.swing.JComboBox JavaDoc();
178         jCheckBoxDisplayBrowser = new javax.swing.JCheckBox JavaDoc();
179         clientModuleUriCombo = new javax.swing.JComboBox JavaDoc();
180         webInfoPanel = new javax.swing.JPanel JavaDoc();
181         jLabelContextPathDesc = new javax.swing.JLabel JavaDoc();
182         jLabelRelativeURL = new javax.swing.JLabel JavaDoc();
183         jTextFieldRelativeURL = new javax.swing.JTextField JavaDoc();
184         clientInfoPanel = new javax.swing.JPanel JavaDoc();
185         jLabelVMOptionsExample = new javax.swing.JLabel JavaDoc();
186         jTextVMOptions = new javax.swing.JTextField JavaDoc();
187         jLabelVMOptions = new javax.swing.JLabel JavaDoc();
188         jLabelArgs = new javax.swing.JLabel JavaDoc();
189         jLabelMainClass = new javax.swing.JLabel JavaDoc();
190         jTextMainClass = new javax.swing.JTextField JavaDoc();
191         jTextArgs = new javax.swing.JTextField JavaDoc();
192         filler = new javax.swing.JLabel JavaDoc();
193         jLabelVersion = new javax.swing.JLabel JavaDoc();
194         jTextFieldVersion = new javax.swing.JTextField JavaDoc();
195
196         setLayout(new java.awt.GridBagLayout JavaDoc());
197
198         jLabelContextPath.setLabelFor(clientModuleUriCombo);
199         org.openide.awt.Mnemonics.setLocalizedText(jLabelContextPath, NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_ClientModuleURI_JLabel"));
200         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
201         gridBagConstraints.gridx = 0;
202         gridBagConstraints.gridy = 0;
203         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
204         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
205         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
206         add(jLabelContextPath, gridBagConstraints);
207
208         jLabelServer.setLabelFor(jComboBoxServer);
209         org.openide.awt.Mnemonics.setLocalizedText(jLabelServer, NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Server_JLabel"));
210         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
211         gridBagConstraints.gridx = 0;
212         gridBagConstraints.gridy = 1;
213         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
214         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
215         add(jLabelServer, gridBagConstraints);
216
217         jComboBoxServer.addActionListener(new java.awt.event.ActionListener JavaDoc() {
218             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
219                 jComboBoxServerActionPerformed(evt);
220             }
221         });
222
223         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
224         gridBagConstraints.gridx = 1;
225         gridBagConstraints.gridy = 1;
226         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
227         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
228         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
229         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 0, 0);
230         add(jComboBoxServer, gridBagConstraints);
231         jComboBoxServer.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerRun.class, "ACS_CustomizeRun_Server_A11YDesc"));
232
233         jCheckBoxDisplayBrowser.setSelected(true);
234         org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxDisplayBrowser, NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_DisplayBrowser_JCheckBox"));
235         jCheckBoxDisplayBrowser.addActionListener(new java.awt.event.ActionListener JavaDoc() {
236             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
237                 jCheckBoxDisplayBrowserActionPerformed(evt);
238             }
239         });
240
241         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
242         gridBagConstraints.gridx = 0;
243         gridBagConstraints.gridy = 3;
244         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
245         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
246         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
247         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 0, 0, 0);
248         add(jCheckBoxDisplayBrowser, gridBagConstraints);
249         jCheckBoxDisplayBrowser.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerRun.class, "ACS_CustomizeRun_DisplayBrowser_A11YDesc"));
250
251         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
252         gridBagConstraints.gridx = 1;
253         gridBagConstraints.gridy = 0;
254         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
255         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
256         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 6, 0);
257         add(clientModuleUriCombo, gridBagConstraints);
258
259         webInfoPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
260
261         webInfoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(CustomizerRun.class, "LBL_WebModInfo")));
262         org.openide.awt.Mnemonics.setLocalizedText(jLabelContextPathDesc, NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_ContextPathDesc_JLabel"));
263         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
264         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
265         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
266         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 12, 0);
267         webInfoPanel.add(jLabelContextPathDesc, gridBagConstraints);
268
269         jLabelRelativeURL.setLabelFor(jTextFieldRelativeURL);
270         org.openide.awt.Mnemonics.setLocalizedText(jLabelRelativeURL, NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_RelativeURL_JLabel"));
271         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
272         gridBagConstraints.gridx = 0;
273         gridBagConstraints.gridy = 1;
274         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
275         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
276         webInfoPanel.add(jLabelRelativeURL, gridBagConstraints);
277
278         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
279         gridBagConstraints.gridx = 1;
280         gridBagConstraints.gridy = 1;
281         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
282         gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
283         gridBagConstraints.weightx = 1.0;
284         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 0);
285         webInfoPanel.add(jTextFieldRelativeURL, gridBagConstraints);
286         jTextFieldRelativeURL.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerRun.class, "ACS_CustomizeRun_RelativeURL_A11YDesc"));
287
288         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
289         gridBagConstraints.gridx = 0;
290         gridBagConstraints.gridy = 4;
291         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
292         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
293         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 0, 0, 0);
294         add(webInfoPanel, gridBagConstraints);
295
296         clientInfoPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
297
298         clientInfoPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(CustomizerRun.class, "LBL_ClientInfo")));
299         org.openide.awt.Mnemonics.setLocalizedText(jLabelVMOptionsExample, org.openide.util.NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Run_VM_Options_Example"));
300         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
301         gridBagConstraints.gridx = 1;
302         gridBagConstraints.gridy = 3;
303         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
304         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
305         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
306         gridBagConstraints.weighty = 1.0;
307         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 0, 0);
308         clientInfoPanel.add(jLabelVMOptionsExample, gridBagConstraints);
309
310         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
311         gridBagConstraints.gridx = 1;
312         gridBagConstraints.gridy = 2;
313         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
314         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
315         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
316         gridBagConstraints.weightx = 1.0;
317         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 0);
318         clientInfoPanel.add(jTextVMOptions, gridBagConstraints);
319
320         jLabelVMOptions.setLabelFor(jTextVMOptions);
321         org.openide.awt.Mnemonics.setLocalizedText(jLabelVMOptions, org.openide.util.NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Run_VM_Options"));
322         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
323         gridBagConstraints.gridx = 0;
324         gridBagConstraints.gridy = 2;
325         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
326         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
327         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
328         clientInfoPanel.add(jLabelVMOptions, gridBagConstraints);
329
330         jLabelArgs.setLabelFor(jTextArgs);
331         org.openide.awt.Mnemonics.setLocalizedText(jLabelArgs, org.openide.util.NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Run_Args_JLabel"));
332         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
333         gridBagConstraints.gridx = 0;
334         gridBagConstraints.gridy = 1;
335         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
336         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
337         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
338         clientInfoPanel.add(jLabelArgs, gridBagConstraints);
339
340         jLabelMainClass.setLabelFor(jTextMainClass);
341         org.openide.awt.Mnemonics.setLocalizedText(jLabelMainClass, org.openide.util.NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Run_MainClass_JLabel"));
342         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
343         gridBagConstraints.gridx = 0;
344         gridBagConstraints.gridy = 0;
345         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
346         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
347         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
348         clientInfoPanel.add(jLabelMainClass, gridBagConstraints);
349
350         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
351         gridBagConstraints.gridx = 1;
352         gridBagConstraints.gridy = 0;
353         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
354         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
355         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
356         gridBagConstraints.weightx = 1.0;
357         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 0);
358         clientInfoPanel.add(jTextMainClass, gridBagConstraints);
359
360         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
361         gridBagConstraints.gridx = 1;
362         gridBagConstraints.gridy = 1;
363         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
364         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
365         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
366         gridBagConstraints.weightx = 1.0;
367         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 0);
368         clientInfoPanel.add(jTextArgs, gridBagConstraints);
369
370         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
371         gridBagConstraints.gridx = 0;
372         gridBagConstraints.gridy = 5;
373         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
374         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
375         gridBagConstraints.weightx = 1.0;
376         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 0, 0, 0);
377         add(clientInfoPanel, gridBagConstraints);
378
379         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
380         gridBagConstraints.gridx = 0;
381         gridBagConstraints.gridy = 6;
382         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
383         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
384         gridBagConstraints.weighty = 1.0;
385         add(filler, gridBagConstraints);
386
387         jLabelVersion.setLabelFor(jTextFieldVersion);
388         org.openide.awt.Mnemonics.setLocalizedText(jLabelVersion, org.openide.util.NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Version_JLabel"));
389         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
390         gridBagConstraints.gridx = 0;
391         gridBagConstraints.gridy = 2;
392         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
393         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
394         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 6, 0);
395         add(jLabelVersion, gridBagConstraints);
396
397         jTextFieldVersion.setColumns(getLongestVersionLength());
398         jTextFieldVersion.setEditable(false);
399         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
400         gridBagConstraints.gridx = 1;
401         gridBagConstraints.gridy = 2;
402         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
403         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
404         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 12, 6, 0);
405         add(jTextFieldVersion, gridBagConstraints);
406
407     }// </editor-fold>//GEN-END:initComponents
408

409     private void jComboBoxServerActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jComboBoxServerActionPerformed
410
// if (jComboBoxServer.getSelectedIndex() == -1 || !initialized)
411
// return;
412
// String newCtxPath = null ; // wm.getContextPath(serverInstanceIDs [jComboBoxServer.getSelectedIndex ()]);
413
}//GEN-LAST:event_jComboBoxServerActionPerformed
414

415     private void jCheckBoxDisplayBrowserActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jCheckBoxDisplayBrowserActionPerformed
416
updateEnabled();
417     }//GEN-LAST:event_jCheckBoxDisplayBrowserActionPerformed
418

419     // Variables declaration - do not modify//GEN-BEGIN:variables
420
private javax.swing.JPanel JavaDoc clientInfoPanel;
421     private javax.swing.JComboBox JavaDoc clientModuleUriCombo;
422     private javax.swing.JLabel JavaDoc filler;
423     private javax.swing.JCheckBox JavaDoc jCheckBoxDisplayBrowser;
424     private javax.swing.JComboBox JavaDoc jComboBoxServer;
425     private javax.swing.JLabel JavaDoc jLabelArgs;
426     private javax.swing.JLabel JavaDoc jLabelContextPath;
427     private javax.swing.JLabel JavaDoc jLabelContextPathDesc;
428     private javax.swing.JLabel JavaDoc jLabelMainClass;
429     private javax.swing.JLabel JavaDoc jLabelRelativeURL;
430     private javax.swing.JLabel JavaDoc jLabelServer;
431     private javax.swing.JLabel JavaDoc jLabelVMOptions;
432     private javax.swing.JLabel JavaDoc jLabelVMOptionsExample;
433     private javax.swing.JLabel JavaDoc jLabelVersion;
434     private javax.swing.JTextField JavaDoc jTextArgs;
435     private javax.swing.JTextField JavaDoc jTextFieldRelativeURL;
436     private javax.swing.JTextField JavaDoc jTextFieldVersion;
437     private javax.swing.JTextField JavaDoc jTextMainClass;
438     private javax.swing.JTextField JavaDoc jTextVMOptions;
439     private javax.swing.JPanel JavaDoc webInfoPanel;
440     // End of variables declaration//GEN-END:variables
441

442     /** Help context where to find more about the paste type action.
443      * @return the help context for this action
444      */

445     public HelpCtx getHelpCtx() {
446         return new HelpCtx(CustomizerRun.class);
447     }
448     
449     private void initServerInstances() {
450         String JavaDoc j2eeSpec = (String JavaDoc)earProperties.get(EarProjectProperties.J2EE_PLATFORM);
451         String JavaDoc[] servInstIDs = Deployment.getDefault().getServerInstanceIDs();
452         Deployment deployment = Deployment.getDefault();
453         Map JavaDoc<String JavaDoc, String JavaDoc> servers = new TreeMap JavaDoc<String JavaDoc, String JavaDoc>();
454         for (int i = 0; i < servInstIDs.length; i++) {
455             String JavaDoc instanceID = servInstIDs[i];
456             J2eePlatform j2eePlat = deployment.getJ2eePlatform(instanceID);
457             String JavaDoc servInstDisplayName = Deployment.getDefault().getServerInstanceDisplayName(servInstIDs[i]);
458             if (servInstDisplayName != null
459                     && j2eePlat != null && j2eePlat.getSupportedModuleTypes().contains(J2eeModule.EAR)
460                     && j2eePlat.getSupportedSpecVersions(J2eeModule.EAR).contains(j2eeSpec)) {
461                 servers.put(servInstDisplayName, instanceID);
462             }
463         }
464         serverInstanceIDs = servers.values().toArray(new String JavaDoc[servers.size()]);
465         serverNames = servers.keySet().toArray(new String JavaDoc[servers.size()]);
466     }
467
468 }
469
Popular Tags