1 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 29 public class CustomizerRun extends javax.swing.JPanel implements HelpCtx.Provider { 30 private Object initialJ2eeSpecVersion; 31 32 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 j2eePlatform = jComboBoxJ2eePlatform.getSelectedItem(); 44 Object 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 67 private void initComponents() { 69 java.awt.GridBagConstraints gridBagConstraints; 70 71 jLabelJ2eePlatform = new javax.swing.JLabel (); 72 jComboBoxJ2eePlatform = new javax.swing.JComboBox (); 73 jLabelJ2eeVersion = new javax.swing.JLabel (); 74 jComboBoxJ2eeSpecVersion = new javax.swing.JComboBox (); 75 jPanel1 = new javax.swing.JPanel (); 76 jLabelJ2eePlatformSpecMismatch = new javax.swing.JLabel (); 77 jLabelWarnDdChange = new javax.swing.JLabel (); 78 79 setLayout(new java.awt.GridBagLayout ()); 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 (); 84 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 85 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 12); 86 add(jLabelJ2eePlatform, gridBagConstraints); 87 88 jComboBoxJ2eePlatform.addItemListener(new java.awt.event.ItemListener () { 89 public void itemStateChanged(java.awt.event.ItemEvent evt) { 90 jComboBoxJ2eePlatformItemStateChanged(evt); 91 } 92 }); 93 94 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (); 104 gridBagConstraints.gridx = 0; 105 gridBagConstraints.gridy = 1; 106 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 107 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 12); 108 add(jLabelJ2eeVersion, gridBagConstraints); 109 110 jComboBoxJ2eeSpecVersion.setEnabled(false); 111 jComboBoxJ2eeSpecVersion.addItemListener(new java.awt.event.ItemListener () { 112 public void itemStateChanged(java.awt.event.ItemEvent evt) { 113 jComboBoxJ2eeSpecVersionItemStateChanged(evt); 114 } 115 }); 116 117 gridBagConstraints = new java.awt.GridBagConstraints (); 118 gridBagConstraints.gridx = 1; 119 gridBagConstraints.gridy = 1; 120 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 121 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 122 add(jComboBoxJ2eeSpecVersion, gridBagConstraints); 123 124 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (89, 71, 191)); 134 org.openide.awt.Mnemonics.setLocalizedText(jLabelJ2eePlatformSpecMismatch, " "); 135 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (89, 71, 191)); 142 org.openide.awt.Mnemonics.setLocalizedText(jLabelWarnDdChange, " "); 143 gridBagConstraints = new java.awt.GridBagConstraints (); 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 } 151 private void jComboBoxJ2eeSpecVersionItemStateChanged(java.awt.event.ItemEvent evt) { checkJ2eeSpecVersionChanged(); 154 } 156 private void jComboBoxJ2eePlatformItemStateChanged(java.awt.event.ItemEvent evt) { } 160 161 private javax.swing.JComboBox jComboBoxJ2eePlatform; 163 private javax.swing.JComboBox jComboBoxJ2eeSpecVersion; 164 private javax.swing.JLabel jLabelJ2eePlatform; 165 private javax.swing.JLabel jLabelJ2eePlatformSpecMismatch; 166 private javax.swing.JLabel jLabelJ2eeVersion; 167 private javax.swing.JLabel jLabelWarnDdChange; 168 private javax.swing.JPanel jPanel1; 169 171 } 172 | Popular Tags |