1 19 20 package org.netbeans.modules.web.wizards; 21 22 import java.awt.Dimension ; 23 import org.openide.util.NbBundle; 24 import org.netbeans.modules.web.api.webmodule.WebModule; 25 26 30 public class ListenerVisualPanel extends javax.swing.JPanel { 31 32 36 private ListenerPanel wizardPanel; 37 38 public ListenerVisualPanel(ListenerPanel wizardPanel, String j2eeVersion) { 39 this.wizardPanel=wizardPanel; 40 initComponents(); 41 42 setName(NbBundle.getMessage(ListenerVisualPanel.class, "TITLE_listenerWizardPanel")); 44 55 getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ListenerVisualPanel.class, "A11Y_DESC_listenerPanel")); 57 jCheckBox1.getAccessibleContext().setAccessibleName(jCheckBox1.getText()); 58 cb1.getAccessibleContext().setAccessibleName(cb1.getText()); 59 cb2.getAccessibleContext().setAccessibleName(cb2.getText()); 60 cb3.getAccessibleContext().setAccessibleName(cb3.getText()); 61 cb4.getAccessibleContext().setAccessibleName(cb4.getText()); 62 63 if (WebModule.J2EE_13_LEVEL.equals(j2eeVersion)) { 65 cb5.setEnabled(false); 66 cb6.setEnabled(false); 67 } 68 } 69 70 75 private void initComponents() { 77 java.awt.GridBagConstraints gridBagConstraints; 78 79 jCheckBox1 = new javax.swing.JCheckBox (); 80 jPanel2 = new javax.swing.JPanel (); 81 labSelectionTitle = new javax.swing.JLabel (); 82 labDescription = new javax.swing.JLabel (); 83 jScrollPane1 = new javax.swing.JScrollPane (); 84 description = new javax.swing.JTextArea (); 85 jPanel3 = new javax.swing.JPanel (); 86 cb1 = new javax.swing.JCheckBox (); 87 cb2 = new javax.swing.JCheckBox (); 88 cb3 = new javax.swing.JCheckBox (); 89 cb4 = new javax.swing.JCheckBox (); 90 cb5 = new javax.swing.JCheckBox (); 91 cb6 = new javax.swing.JCheckBox (); 92 jPanel1 = new javax.swing.JPanel (); 93 94 setLayout(new java.awt.GridBagLayout ()); 95 96 setRequestFocusEnabled(false); 97 jCheckBox1.setMnemonic(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "LBL_addToDD_Mnem").charAt(0)); 98 jCheckBox1.setSelected(true); 99 jCheckBox1.setText(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "LBL_addtodd")); 100 jCheckBox1.setMargin(new java.awt.Insets (0, 2, 0, 2)); 101 gridBagConstraints = new java.awt.GridBagConstraints (); 102 gridBagConstraints.gridx = 0; 103 gridBagConstraints.gridy = 1; 104 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 105 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 106 gridBagConstraints.weightx = 1.0; 107 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 108 add(jCheckBox1, gridBagConstraints); 109 jCheckBox1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "A11Y_DESC_addListenerToDD")); 110 111 jPanel2.setLayout(new java.awt.GridBagLayout ()); 112 113 labSelectionTitle.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTL_listenerSelection")); 114 gridBagConstraints = new java.awt.GridBagConstraints (); 115 gridBagConstraints.gridx = 0; 116 gridBagConstraints.gridy = 0; 117 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 118 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 119 jPanel2.add(labSelectionTitle, gridBagConstraints); 120 121 labDescription.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "A11Y_Description_mnem").charAt(0)); 122 labDescription.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_description")); 123 gridBagConstraints = new java.awt.GridBagConstraints (); 124 gridBagConstraints.gridx = 1; 125 gridBagConstraints.gridy = 0; 126 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 127 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 128 gridBagConstraints.insets = new java.awt.Insets (0, 5, 0, 0); 129 jPanel2.add(labDescription, gridBagConstraints); 130 131 jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); 132 description.setEditable(false); 133 description.setLineWrap(true); 134 description.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextListener")); 135 description.setWrapStyleWord(true); 136 description.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); 137 description.setFocusable(false); 138 description.setOpaque(false); 139 jScrollPane1.setViewportView(description); 140 description.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_description")); 141 description.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "A11Y_DESC_Description")); 142 143 gridBagConstraints = new java.awt.GridBagConstraints (); 144 gridBagConstraints.gridx = 1; 145 gridBagConstraints.gridy = 1; 146 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 147 gridBagConstraints.weightx = 1.0; 148 gridBagConstraints.insets = new java.awt.Insets (0, 5, 0, 0); 149 jPanel2.add(jScrollPane1, gridBagConstraints); 150 151 jPanel3.setLayout(new java.awt.GridBagLayout ()); 152 153 jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color (0, 0, 0))); 154 cb1.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_ContextListener_Mnemonic").charAt(0)); 155 cb1.setSelected(true); 156 cb1.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_contextListener")); 157 cb1.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextListener")); 158 cb1.setMargin(new java.awt.Insets (0, 2, 0, 2)); 159 cb1.addChangeListener(new javax.swing.event.ChangeListener () { 160 public void stateChanged(javax.swing.event.ChangeEvent evt) { 161 cb1StateChanged(evt); 162 } 163 }); 164 cb1.addFocusListener(new java.awt.event.FocusAdapter () { 165 public void focusGained(java.awt.event.FocusEvent evt) { 166 cb1FocusGained(evt); 167 } 168 }); 169 170 gridBagConstraints = new java.awt.GridBagConstraints (); 171 gridBagConstraints.gridx = 0; 172 gridBagConstraints.gridy = 0; 173 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 174 jPanel3.add(cb1, gridBagConstraints); 175 cb1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_contextListener")); 176 cb1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextListener")); 177 178 cb2.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_ContextAttrListener_Mnemonic").charAt(0)); 179 cb2.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_contextAttrListener")); 180 cb2.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextAttrListener")); 181 cb2.setMargin(new java.awt.Insets (0, 2, 0, 2)); 182 cb2.addChangeListener(new javax.swing.event.ChangeListener () { 183 public void stateChanged(javax.swing.event.ChangeEvent evt) { 184 cb2StateChanged(evt); 185 } 186 }); 187 cb2.addFocusListener(new java.awt.event.FocusAdapter () { 188 public void focusGained(java.awt.event.FocusEvent evt) { 189 cb2FocusGained(evt); 190 } 191 }); 192 193 gridBagConstraints = new java.awt.GridBagConstraints (); 194 gridBagConstraints.gridx = 0; 195 gridBagConstraints.gridy = 1; 196 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 197 jPanel3.add(cb2, gridBagConstraints); 198 cb2.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_contextAttrListener")); 199 cb2.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextAttrListener")); 200 201 cb3.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_SessionListener_Mnemonic").charAt(0)); 202 cb3.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_sessionListener")); 203 cb3.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_sessionListener")); 204 cb3.setMargin(new java.awt.Insets (0, 2, 0, 2)); 205 cb3.addChangeListener(new javax.swing.event.ChangeListener () { 206 public void stateChanged(javax.swing.event.ChangeEvent evt) { 207 cb3StateChanged(evt); 208 } 209 }); 210 cb3.addFocusListener(new java.awt.event.FocusAdapter () { 211 public void focusGained(java.awt.event.FocusEvent evt) { 212 cb3FocusGained(evt); 213 } 214 }); 215 216 gridBagConstraints = new java.awt.GridBagConstraints (); 217 gridBagConstraints.gridx = 0; 218 gridBagConstraints.gridy = 2; 219 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 220 jPanel3.add(cb3, gridBagConstraints); 221 cb3.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_sessionListener")); 222 cb3.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_sessionListener")); 223 224 cb4.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_SessionAttrListener_Mnemonic").charAt(0)); 225 cb4.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_sessionAttrListener")); 226 cb4.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_sessionAttrListener")); 227 cb4.setMargin(new java.awt.Insets (0, 2, 0, 2)); 228 cb4.addChangeListener(new javax.swing.event.ChangeListener () { 229 public void stateChanged(javax.swing.event.ChangeEvent evt) { 230 cb4StateChanged(evt); 231 } 232 }); 233 cb4.addFocusListener(new java.awt.event.FocusAdapter () { 234 public void focusGained(java.awt.event.FocusEvent evt) { 235 cb4FocusGained(evt); 236 } 237 }); 238 239 gridBagConstraints = new java.awt.GridBagConstraints (); 240 gridBagConstraints.gridx = 0; 241 gridBagConstraints.gridy = 3; 242 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 243 jPanel3.add(cb4, gridBagConstraints); 244 cb4.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_sessionAttrListener")); 245 cb4.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_sessionAttrListener")); 246 247 cb5.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestListener_Mnemonic").charAt(0)); 248 cb5.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestListener")); 249 cb5.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_requestListener")); 250 cb5.setMargin(new java.awt.Insets (0, 2, 0, 2)); 251 cb5.addFocusListener(new java.awt.event.FocusAdapter () { 252 public void focusGained(java.awt.event.FocusEvent evt) { 253 cb5FocusGained(evt); 254 } 255 }); 256 cb5.addItemListener(new java.awt.event.ItemListener () { 257 public void itemStateChanged(java.awt.event.ItemEvent evt) { 258 cb5ItemStateChanged(evt); 259 } 260 }); 261 262 gridBagConstraints = new java.awt.GridBagConstraints (); 263 gridBagConstraints.gridx = 0; 264 gridBagConstraints.gridy = 4; 265 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 266 jPanel3.add(cb5, gridBagConstraints); 267 cb5.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestListener")); 268 cb5.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_requestListener")); 269 270 cb6.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestAttrListener_Mnemonic").charAt(0)); 271 cb6.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestAttrListener")); 272 cb6.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_requestAttrListener")); 273 cb6.setMargin(new java.awt.Insets (0, 2, 0, 2)); 274 cb6.addFocusListener(new java.awt.event.FocusAdapter () { 275 public void focusGained(java.awt.event.FocusEvent evt) { 276 cb6FocusGained(evt); 277 } 278 }); 279 cb6.addItemListener(new java.awt.event.ItemListener () { 280 public void itemStateChanged(java.awt.event.ItemEvent evt) { 281 cb6ItemStateChanged(evt); 282 } 283 }); 284 285 gridBagConstraints = new java.awt.GridBagConstraints (); 286 gridBagConstraints.gridx = 0; 287 gridBagConstraints.gridy = 5; 288 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 289 jPanel3.add(cb6, gridBagConstraints); 290 cb6.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestAttrListener")); 291 cb6.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_requestAttrListener")); 292 293 gridBagConstraints = new java.awt.GridBagConstraints (); 294 gridBagConstraints.gridx = 0; 295 gridBagConstraints.gridy = 1; 296 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 297 jPanel2.add(jPanel3, gridBagConstraints); 298 299 gridBagConstraints = new java.awt.GridBagConstraints (); 300 gridBagConstraints.gridx = 0; 301 gridBagConstraints.gridy = 0; 302 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 303 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 304 gridBagConstraints.weightx = 1.0; 305 add(jPanel2, gridBagConstraints); 306 307 gridBagConstraints = new java.awt.GridBagConstraints (); 308 gridBagConstraints.gridx = 0; 309 gridBagConstraints.gridy = 2; 310 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 311 gridBagConstraints.weighty = 1.0; 312 add(jPanel1, gridBagConstraints); 313 314 } 316 private void cb6ItemStateChanged(java.awt.event.ItemEvent evt) { wizardPanel.fireChangeEvent(); 319 } 321 private void cb5ItemStateChanged(java.awt.event.ItemEvent evt) { wizardPanel.fireChangeEvent(); 324 } 326 private void cb6FocusGained(java.awt.event.FocusEvent evt) { description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_requestAttrListener")); 329 } 331 private void cb5FocusGained(java.awt.event.FocusEvent evt) { description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_requestListener")); 334 } 336 private void cb4FocusGained(java.awt.event.FocusEvent evt) { description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_sessionAttrListener")); 339 } 341 private void cb3FocusGained(java.awt.event.FocusEvent evt) { description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_sessionListener")); 344 } 346 private void cb2FocusGained(java.awt.event.FocusEvent evt) { description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_contextAttrListener")); 349 } 351 private void cb1FocusGained(java.awt.event.FocusEvent evt) { description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_contextListener")); 354 } 356 private void cb3StateChanged(javax.swing.event.ChangeEvent evt) { wizardPanel.fireChangeEvent(); 359 } 361 private void cb2StateChanged(javax.swing.event.ChangeEvent evt) { wizardPanel.fireChangeEvent(); 364 } 366 private void cb1StateChanged(javax.swing.event.ChangeEvent evt) { wizardPanel.fireChangeEvent(); 369 } 371 private void cb4StateChanged(javax.swing.event.ChangeEvent evt) { wizardPanel.fireChangeEvent(); 374 } 376 private javax.swing.JCheckBox cb1; 378 private javax.swing.JCheckBox cb2; 379 private javax.swing.JCheckBox cb3; 380 private javax.swing.JCheckBox cb4; 381 private javax.swing.JCheckBox cb5; 382 private javax.swing.JCheckBox cb6; 383 private javax.swing.JTextArea description; 384 private javax.swing.JCheckBox jCheckBox1; 385 private javax.swing.JPanel jPanel1; 386 private javax.swing.JPanel jPanel2; 387 private javax.swing.JPanel jPanel3; 388 private javax.swing.JScrollPane jScrollPane1; 389 private javax.swing.JLabel labDescription; 390 private javax.swing.JLabel labSelectionTitle; 391 393 private static final long serialVersionUID = 8091384420711061719L; 394 395 boolean createElementInDD (){ 396 return jCheckBox1.isSelected(); 397 } 398 399 boolean isContextListener() {return cb1.isSelected();} 400 401 boolean isContextAttrListener() {return cb2.isSelected();} 402 403 boolean isSessionListener() {return cb3.isSelected();} 404 405 boolean isSessionAttrListener() {return cb4.isSelected();} 406 407 boolean isRequestListener() {return cb5.isSelected();} 408 409 boolean isRequestAttrListener() {return cb6.isSelected();} 410 } 411 | Popular Tags |