KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbjarproject > 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.ejbjarproject.ui.customizer;
21
22 import org.openide.util.HelpCtx;
23 import org.openide.util.NbBundle;
24
25 /**
26  *
27  * @author Andrei Badea
28  */

29 public class CustomizerRun extends javax.swing.JPanel JavaDoc implements HelpCtx.Provider {
30     private Object JavaDoc initialJ2eeSpecVersion;
31
32     /** Creates new form CustomizerRun */
33     public CustomizerRun( EjbJarProjectProperties uiProperties ) {
34         initComponents();
35
36         jComboBoxJ2eePlatform.setModel (uiProperties.J2EE_SERVER_INSTANCE_MODEL );
37         jComboBoxJ2eeSpecVersion.setModel (uiProperties.J2EE_PLATFORM_MODEL );
38         
39         initialJ2eeSpecVersion = uiProperties.J2EE_PLATFORM_MODEL.getSelectedItem();
40     }
41     
42     private void checkJ2eePlatformSpecMatch() {
43         Object JavaDoc j2eePlatform = jComboBoxJ2eePlatform.getSelectedItem();
44         Object JavaDoc j2eeSpecVersion = jComboBoxJ2eeSpecVersion.getSelectedItem();
45         boolean match = true;
46         
47         if (j2eePlatform != null && j2eeSpecVersion != null)
48             match = J2eePlatformUiSupport.getJ2eePlatformAndSpecVersionMatch(j2eePlatform, j2eeSpecVersion);
49         
50         jLabelJ2eePlatformSpecMismatch.setText(match ? "" : NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Run_PlatformSpecMismatch_JLabel"));
51     }
52     
53     private void checkJ2eeSpecVersionChanged() {
54         boolean changed = !jComboBoxJ2eeSpecVersion.getSelectedItem().equals(initialJ2eeSpecVersion);
55         jLabelWarnDdChange.setText(changed ? NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Run_WardDdChange_JLabel") : "");
56     }
57     
58     public HelpCtx getHelpCtx() {
59         return new HelpCtx(CustomizerRun.class);
60     }
61     
62     /** This method is called from within the constructor to
63      * initialize the form.
64      * WARNING: Do NOT modify this code. The content of this method is
65      * always regenerated by the Form Editor.
66      */

67     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
68
private void initComponents() {
69         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
70
71         jLabelJ2eePlatform = new javax.swing.JLabel JavaDoc();
72         jComboBoxJ2eePlatform = new javax.swing.JComboBox JavaDoc();
73         jLabelJ2eeVersion = new javax.swing.JLabel JavaDoc();
74         jComboBoxJ2eeSpecVersion = new javax.swing.JComboBox JavaDoc();
75         jPanel1 = new javax.swing.JPanel JavaDoc();
76         jLabelJ2eePlatformSpecMismatch = new javax.swing.JLabel JavaDoc();
77         jLabelWarnDdChange = new javax.swing.JLabel JavaDoc();
78
79         setLayout(new java.awt.GridBagLayout JavaDoc());
80
81         jLabelJ2eePlatform.setLabelFor(jComboBoxJ2eePlatform);
82         org.openide.awt.Mnemonics.setLocalizedText(jLabelJ2eePlatform, org.openide.util.NbBundle.getBundle(CustomizerRun.class).getString("LBL_CustomizeRun_Run_Server_JLabel"));
83         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
84         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
85         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
86         add(jLabelJ2eePlatform, gridBagConstraints);
87
88         jComboBoxJ2eePlatform.addItemListener(new java.awt.event.ItemListener JavaDoc() {
89             public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
90                 jComboBoxJ2eePlatformItemStateChanged(evt);
91             }
92         });
93
94         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
95         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
96         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
97         gridBagConstraints.weightx = 1.0;
98         add(jComboBoxJ2eePlatform, gridBagConstraints);
99         jComboBoxJ2eePlatform.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(CustomizerRun.class).getString("AD_jComboBoxServer"));
100
101         jLabelJ2eeVersion.setLabelFor(jComboBoxJ2eeSpecVersion);
102         org.openide.awt.Mnemonics.setLocalizedText(jLabelJ2eeVersion, org.openide.util.NbBundle.getBundle(CustomizerRun.class).getString("LBL_CustomizeRun_Run_J2EEVersion_JLabel"));
103         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
104         gridBagConstraints.gridx = 0;
105         gridBagConstraints.gridy = 1;
106         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
107         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 12);
108         add(jLabelJ2eeVersion, gridBagConstraints);
109
110         jComboBoxJ2eeSpecVersion.setEnabled(false);
111         jComboBoxJ2eeSpecVersion.addItemListener(new java.awt.event.ItemListener JavaDoc() {
112             public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
113                 jComboBoxJ2eeSpecVersionItemStateChanged(evt);
114             }
115         });
116
117         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
118         gridBagConstraints.gridx = 1;
119         gridBagConstraints.gridy = 1;
120         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
121         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
122         add(jComboBoxJ2eeSpecVersion, gridBagConstraints);
123
124         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
125         gridBagConstraints.gridx = 0;
126         gridBagConstraints.gridy = 2;
127         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
128         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
129         gridBagConstraints.weightx = 1.0;
130         gridBagConstraints.weighty = 1.0;
131         add(jPanel1, gridBagConstraints);
132
133         jLabelJ2eePlatformSpecMismatch.setForeground(new java.awt.Color JavaDoc(89, 71, 191));
134         org.openide.awt.Mnemonics.setLocalizedText(jLabelJ2eePlatformSpecMismatch, " ");
135         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
136         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
137         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
138         gridBagConstraints.weightx = 1.0;
139         add(jLabelJ2eePlatformSpecMismatch, gridBagConstraints);
140
141         jLabelWarnDdChange.setForeground(new java.awt.Color JavaDoc(89, 71, 191));
142         org.openide.awt.Mnemonics.setLocalizedText(jLabelWarnDdChange, " ");
143         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
144         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
145         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
146         gridBagConstraints.weightx = 1.0;
147         add(jLabelWarnDdChange, gridBagConstraints);
148
149     }// </editor-fold>//GEN-END:initComponents
150

151     private void jComboBoxJ2eeSpecVersionItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_jComboBoxJ2eeSpecVersionItemStateChanged
152
//checkJ2eePlatformSpecMatch();
153
checkJ2eeSpecVersionChanged();
154     }//GEN-LAST:event_jComboBoxJ2eeSpecVersionItemStateChanged
155

156     private void jComboBoxJ2eePlatformItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_jComboBoxJ2eePlatformItemStateChanged
157
//checkJ2eePlatformSpecMatch();
158
}//GEN-LAST:event_jComboBoxJ2eePlatformItemStateChanged
159

160     
161     // Variables declaration - do not modify//GEN-BEGIN:variables
162
private javax.swing.JComboBox JavaDoc jComboBoxJ2eePlatform;
163     private javax.swing.JComboBox JavaDoc jComboBoxJ2eeSpecVersion;
164     private javax.swing.JLabel JavaDoc jLabelJ2eePlatform;
165     private javax.swing.JLabel JavaDoc jLabelJ2eePlatformSpecMismatch;
166     private javax.swing.JLabel JavaDoc jLabelJ2eeVersion;
167     private javax.swing.JLabel JavaDoc jLabelWarnDdChange;
168     private javax.swing.JPanel JavaDoc jPanel1;
169     // End of variables declaration//GEN-END:variables
170

171 }
172
Popular Tags