| 1 19 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ui; 20 21 import javax.swing.SpinnerDateModel ; 22 import javax.swing.SpinnerModel ; 23 import org.netbeans.modules.j2ee.websphere6.dd.beans.WSWebExt; 24 import org.netbeans.modules.xml.multiview.*; 25 import org.netbeans.modules.xml.multiview.ui.*; 26 import org.netbeans.modules.xml.multiview.Error; 27 import org.netbeans.modules.j2ee.websphere6.dd.loaders.webext.*; 28 29 33 public class WSWebExtAttributesPanel extends SectionInnerPanel implements java.awt.event.ItemListener , javax.swing.event.ChangeListener { 34 35 WSWebExt webext; 36 WSWebExtDataObject dObj; 37 38 39 public WSWebExtAttributesPanel(SectionView view, WSWebExtDataObject dObj, WSWebExt webext) { 40 super(view); 41 this.dObj=dObj; 42 this.webext=webext; 43 initComponents(); 44 fileServingCheckBox.setSelected(webext.getFileServingEnabled()); 45 serveServletsCheckBox.setSelected(webext.getServeServletsByClassname()); 46 directoryBrowsingCheckBox.setSelected(webext.getDirectoryBrowsing()); 47 reloadIntervalCheckBox.setSelected(webext.getReload()); 48 SpinnerModel sm=new javax.swing.SpinnerNumberModel (0,0,600,1); 49 reloadIntervalSpinner.setModel(sm); 50 reloadIntervalSpinner.setValue(new Integer (webext.getReloadInterval())); 51 precompileJPSCheckBox.setSelected(webext.getPrecompileJSPs()); 52 autoRequestEncCheckBox.setSelected(webext.getAutoRequestEncoding()); 53 autoResponseEncCheckBox.setSelected(webext.getAutoResponseEncoding()); 54 autoLoadFiltersCheckBox.setSelected(webext.getAutoLoadFilters()); 55 additionalClassPathField.setText(webext.getAdditionalClassPath()); 56 defaultErrorPageField.setText(webext.getDefaultErrorPage()); 57 hrefField.setText(webext.getWebApplicationHref()); 58 nameField.setText(webext.getXmiId()); 59 60 fileServingCheckBox.addItemListener(this); 61 serveServletsCheckBox.addItemListener(this); 62 directoryBrowsingCheckBox.addItemListener(this); 63 reloadIntervalCheckBox.addItemListener(this); 64 precompileJPSCheckBox.addItemListener(this); 65 autoRequestEncCheckBox.addItemListener(this); 66 autoResponseEncCheckBox.addItemListener(this); 67 autoLoadFiltersCheckBox.addItemListener(this); 68 reloadIntervalSpinner.addChangeListener(this); 69 addModifier(additionalClassPathField); 70 addModifier(defaultErrorPageField); 71 addModifier(hrefField); 72 addModifier(nameField); 73 } 76 public void setValue(javax.swing.JComponent source,Object value) { 77 if (source==additionalClassPathField) { 78 webext.setAdditionalClassPath((String )value); 79 } else if (source==defaultErrorPageField) { 80 webext.setDefaultErrorPage((String )value); 81 } else if(source==hrefField) { 82 webext.setWebApplicationHref((String )value); 83 } 84 } 85 public void linkButtonPressed(Object ddBean, String ddProperty) { 86 } 87 88 public javax.swing.JComponent getErrorComponent(String errorId) { 89 return null; 92 } 93 public void stateChanged(javax.swing.event.ChangeEvent evt) { 94 webext.setReloadInterval(reloadIntervalSpinner.getValue().toString()); 95 dObj.modelUpdatedFromUI(); 96 } 97 98 public void itemStateChanged(java.awt.event.ItemEvent evt) { 99 dObj.setChangedFromUI(true); 101 webext.setPrecompileJSPs(precompileJPSCheckBox.isSelected()); 102 webext.setServeServletsByClassname(serveServletsCheckBox.isSelected()); 103 webext.setDirectoryBrowsing(directoryBrowsingCheckBox.isSelected()); 104 webext.setAutoRequestEncoding(autoRequestEncCheckBox.isSelected()); 105 webext.setAutoResponseEncoding(autoResponseEncCheckBox.isSelected()); 106 webext.setAutoLoadFilters(autoLoadFiltersCheckBox.isSelected()); 107 webext.setFileServingEnabled(fileServingCheckBox.isSelected()); 108 webext.setReload(reloadIntervalCheckBox.isSelected()); 109 webext.setReloadInterval(reloadIntervalSpinner.getValue().toString()); 110 dObj.modelUpdatedFromUI(); 111 dObj.setChangedFromUI(false); 112 } 113 114 116 117 protected void startUIChange() { 118 dObj.setChangedFromUI(true); 119 } 120 121 123 124 protected void endUIChange() { 125 dObj.modelUpdatedFromUI(); 126 dObj.setChangedFromUI(false); 127 } 128 129 134 private void initComponents() { 136 reloadIntervalCheckBox = new javax.swing.JCheckBox (); 137 reloadIntervalSpinner = new javax.swing.JSpinner (); 138 additionalClassPathLabel = new javax.swing.JLabel (); 139 additionalClassPathField = new javax.swing.JTextField (); 140 fileServingCheckBox = new javax.swing.JCheckBox (); 141 directoryBrowsingCheckBox = new javax.swing.JCheckBox (); 142 serveServletsCheckBox = new javax.swing.JCheckBox (); 143 precompileJPSCheckBox = new javax.swing.JCheckBox (); 144 autoRequestEncCheckBox = new javax.swing.JCheckBox (); 145 autoResponseEncCheckBox = new javax.swing.JCheckBox (); 146 jLabel1 = new javax.swing.JLabel (); 147 defaultErrorPageField = new javax.swing.JTextField (); 148 jLabel2 = new javax.swing.JLabel (); 149 hrefField = new javax.swing.JTextField (); 150 jLabel3 = new javax.swing.JLabel (); 151 nameField = new javax.swing.JTextField (); 152 autoLoadFiltersCheckBox = new javax.swing.JCheckBox (); 153 154 reloadIntervalCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_ReloadInterval")); 155 reloadIntervalCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 156 reloadIntervalCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 157 158 reloadIntervalSpinner.setFont(new java.awt.Font ("Courier", 0, 12)); 159 160 additionalClassPathLabel.setText("Additional Class Path:"); 161 162 fileServingCheckBox.setText("File Serving"); 163 fileServingCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 164 fileServingCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 165 166 directoryBrowsingCheckBox.setText("Directory Browsing"); 167 directoryBrowsingCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 168 directoryBrowsingCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 169 170 serveServletsCheckBox.setText("Serve Servlets by Classname"); 171 serveServletsCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 172 serveServletsCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 173 174 precompileJPSCheckBox.setText("Precompile JSPs"); 175 precompileJPSCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 176 precompileJPSCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 177 178 autoRequestEncCheckBox.setText("Auto Request Encoding"); 179 autoRequestEncCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 180 autoRequestEncCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 181 182 autoResponseEncCheckBox.setText("Auto Response Encoding"); 183 autoResponseEncCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 184 autoResponseEncCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 185 186 jLabel1.setText("Default Error Page:"); 187 188 jLabel2.setText("Name in Web.xml:"); 189 190 jLabel3.setText("Name:"); 191 192 autoLoadFiltersCheckBox.setText("Auto Load Filters"); 193 autoLoadFiltersCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 194 autoLoadFiltersCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 195 196 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 197 this.setLayout(layout); 198 layout.setHorizontalGroup( 199 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 200 .add(layout.createSequentialGroup() 201 .addContainerGap() 202 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 203 .add(serveServletsCheckBox) 204 .add(fileServingCheckBox) 205 .add(directoryBrowsingCheckBox) 206 .add(precompileJPSCheckBox) 207 .add(autoRequestEncCheckBox) 208 .add(autoResponseEncCheckBox) 209 .add(layout.createSequentialGroup() 210 .add(reloadIntervalCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 111, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 211 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 212 .add(reloadIntervalSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 213 .add(layout.createSequentialGroup() 214 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) 215 .add(jLabel1) 216 .add(additionalClassPathLabel) 217 .add(jLabel2) 218 .add(jLabel3)) 219 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 220 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 221 .add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE) 222 .add(hrefField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE) 223 .add(additionalClassPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE) 224 .add(org.jdesktop.layout.GroupLayout.TRAILING, defaultErrorPageField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE))) 225 .add(autoLoadFiltersCheckBox)) 226 .addContainerGap()) 227 ); 228 layout.setVerticalGroup( 229 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 230 .add(layout.createSequentialGroup() 231 .addContainerGap() 232 .add(fileServingCheckBox) 233 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 234 .add(serveServletsCheckBox) 235 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 236 .add(directoryBrowsingCheckBox) 237 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 238 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 239 .add(layout.createSequentialGroup() 240 .add(reloadIntervalCheckBox) 241 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 242 .add(precompileJPSCheckBox)) 243 .add(reloadIntervalSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 244 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 245 .add(autoRequestEncCheckBox) 246 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 247 .add(autoResponseEncCheckBox) 248 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 249 .add(autoLoadFiltersCheckBox) 250 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 251 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 252 .add(additionalClassPathLabel) 253 .add(additionalClassPathField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 254 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 255 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 256 .add(jLabel1) 257 .add(defaultErrorPageField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 258 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 259 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 260 .add(jLabel2) 261 .add(hrefField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 262 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 263 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 264 .add(jLabel3) 265 .add(nameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 266 .add(24, 24, 24)) 267 ); 268 } 270 271 private javax.swing.JTextField additionalClassPathField; 273 private javax.swing.JLabel additionalClassPathLabel; 274 private javax.swing.JCheckBox autoLoadFiltersCheckBox; 275 private javax.swing.JCheckBox autoRequestEncCheckBox; 276 private javax.swing.JCheckBox autoResponseEncCheckBox; 277 private javax.swing.JTextField defaultErrorPageField; 278 private javax.swing.JCheckBox directoryBrowsingCheckBox; 279 private javax.swing.JCheckBox fileServingCheckBox; 280 private javax.swing.JTextField hrefField; 281 private javax.swing.JLabel jLabel1; 282 private javax.swing.JLabel jLabel2; 283 private javax.swing.JLabel jLabel3; 284 private javax.swing.JTextField nameField; 285 private javax.swing.JCheckBox precompileJPSCheckBox; 286 private javax.swing.JCheckBox reloadIntervalCheckBox; 287 private javax.swing.JSpinner reloadIntervalSpinner; 288 private javax.swing.JCheckBox serveServletsCheckBox; 289 318 319 } 320 | Popular Tags |