View | Details | Raw Unified | Return to bug 55202
Collapse All | Expand All

(-)src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java (-5 / +22 lines)
Lines 21-26 Link Here
21
import java.awt.GridBagLayout;
21
import java.awt.GridBagLayout;
22
import java.awt.Insets;
22
import java.awt.Insets;
23
import java.beans.BeanInfo;
23
import java.beans.BeanInfo;
24
import java.beans.PropertyChangeListener;
24
import java.beans.PropertyDescriptor;
25
import java.beans.PropertyDescriptor;
25
import java.beans.PropertyEditor;
26
import java.beans.PropertyEditor;
26
import java.beans.PropertyEditorManager;
27
import java.beans.PropertyEditorManager;
Lines 203-208 Link Here
203
204
204
        // Obtain the propertyEditors:
205
        // Obtain the propertyEditors:
205
        editors = new PropertyEditor[descriptors.length];
206
        editors = new PropertyEditor[descriptors.length];
207
        int scriptLanguageIndex=0;
208
        int textAreaEditorIndex=0;
206
        for (int i = 0; i < descriptors.length; i++) { // Index is also used for accessing editors array
209
        for (int i = 0; i < descriptors.length; i++) { // Index is also used for accessing editors array
207
            PropertyDescriptor descriptor = descriptors[i];
210
            PropertyDescriptor descriptor = descriptors[i];
208
            String name = descriptor.getName();
211
            String name = descriptor.getName();
Lines 218-224 Link Here
218
            PropertyEditor propertyEditor;
221
            PropertyEditor propertyEditor;
219
            Object guiType = descriptor.getValue(GUITYPE);
222
            Object guiType = descriptor.getValue(GUITYPE);
220
            if (guiType instanceof TypeEditor) {
223
            if (guiType instanceof TypeEditor) {
221
                propertyEditor = ((TypeEditor) guiType).getInstance(descriptor);            
224
                propertyEditor = ((TypeEditor) guiType).getInstance(descriptor); 
222
            } else {
225
            } else {
223
                Class<?> editorClass = descriptor.getPropertyEditorClass();
226
                Class<?> editorClass = descriptor.getPropertyEditorClass();
224
                if (log.isDebugEnabled()) {
227
                if (log.isDebugEnabled()) {
Lines 267-272 Link Here
267
            {
270
            {
268
                ((TestBeanPropertyEditor)propertyEditor).setDescriptor(descriptor);
271
                ((TestBeanPropertyEditor)propertyEditor).setDescriptor(descriptor);
269
            }
272
            }
273
            
274
            if (propertyEditor instanceof TextAreaEditor)
275
            {
276
            	textAreaEditorIndex = i;
277
            }
270
            if (propertyEditor.getCustomEditor() instanceof JScrollPane) {
278
            if (propertyEditor.getCustomEditor() instanceof JScrollPane) {
271
                scrollerCount++;
279
                scrollerCount++;
272
            }
280
            }
Lines 275-283 Link Here
275
283
276
            // Initialize the editor with the provided default value or null:
284
            // Initialize the editor with the provided default value or null:
277
            setEditorValue(i, descriptor.getValue(DEFAULT));
285
            setEditorValue(i, descriptor.getValue(DEFAULT));
286
            
287
            if (name.equals("scriptLanguage")){
288
            	scriptLanguageIndex=i;
289
            }
278
290
279
        }
291
        }
280
292
        // In case of BSF and JSR elements i want to add textAreaEditor as a listener to scriptLanguage ComboBox.
293
        String beanName = this.beanInfo.getBeanDescriptor().getName();
294
        if (beanName.startsWith("BSF") || beanName.startsWith("JSR223")){
295
        		WrapperEditor we = (WrapperEditor) editors[scriptLanguageIndex];
296
        		TextAreaEditor tae = (TextAreaEditor) editors[textAreaEditorIndex];
297
        		we.addChangeListener(tae);
298
    	}
281
        // Obtain message formats:
299
        // Obtain message formats:
282
        propertyFieldLabelMessage = new MessageFormat(JMeterUtils.getResString("property_as_field_label")); //$NON-NLS-1$
300
        propertyFieldLabelMessage = new MessageFormat(JMeterUtils.getResString("property_as_field_label")); //$NON-NLS-1$
283
        propertyToolTipMessage = new MessageFormat(JMeterUtils.getResString("property_tool_tip")); //$NON-NLS-1$
301
        propertyToolTipMessage = new MessageFormat(JMeterUtils.getResString("property_tool_tip")); //$NON-NLS-1$
Lines 350-356 Link Here
350
                tags[j++] = additionalTag;
368
                tags[j++] = additionalTag;
351
            }
369
            }
352
        }
370
        }
353
371
        
354
        boolean notNull = notNull(descriptor);
372
        boolean notNull = notNull(descriptor);
355
        boolean notExpression = notExpression(descriptor);
373
        boolean notExpression = notExpression(descriptor);
356
        boolean notOther = notOther(descriptor);
374
        boolean notOther = notOther(descriptor);
Lines 363-369 Link Here
363
            e.setNoUndefined(notNull);
381
            e.setNoUndefined(notNull);
364
            e.setNoEdit(notExpression && notOther);
382
            e.setNoEdit(notExpression && notOther);
365
            e.setTags(tags);
383
            e.setTags(tags);
366
384
            
367
            guiEditor = e;
385
            guiEditor = e;
368
        }
386
        }
369
387
Lines 372-378 Link Here
372
                !notExpression, // acceptsExpressions
390
                !notExpression, // acceptsExpressions
373
                !notOther, // acceptsOther
391
                !notOther, // acceptsOther
374
                descriptor.getValue(DEFAULT));
392
                descriptor.getValue(DEFAULT));
375
376
        return wrapper;
393
        return wrapper;
377
    }
394
    }
378
395

Return to bug 55202