jsalvata 2004/01/03 17:44:11
Modified: src/core/org/apache/jmeter/testbeans/gui Tag:
testbeans_experimental_branch TestBeanGUI.java
TestElementEditor.java
Log:
Now that WrapperEditor can handled undefined (null) values,
we can initialize properties to that instead of getting the
default from an instance of the bean.
Revision Changes Path
No revision
No revision
1.1.2.3 +2 -37
jakarta-jmeter/src/core/org/apache/jmeter/testbeans/gui/Attic/TestBeanGUI.java
Index: TestBeanGUI.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testbeans/gui/Attic/TestBeanGUI.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- TestBeanGUI.java 1 Jan 2004 23:43:22 -0000 1.1.2.2
+++ TestBeanGUI.java 4 Jan 2004 01:44:11 -0000 1.1.2.3
@@ -67,8 +67,6 @@
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
-import java.lang.reflect.InvocationTargetException;
-
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -223,45 +221,12 @@
propertyEditor=
new WrapperEditor(propertyEditor, descriptors[i]);
- //propertyEditor.addPropertyChangeListener(this);
+ propertyEditor.setValue(null);
editors[i]= propertyEditor;
}
// Initialize the GUI:
init();
-
- // Initialize the property editors with the bean's default values:
- // TODO: remove this when the WrapperEditor will have support for "default
value".
- try
- {
- TestBean defaults= (TestBean)testBeanClass.newInstance();
- for (int i=0; i<descriptors.length; i++)
- {
- if (editors[i] == null) continue;
- editors[i].setValue(
- descriptors[i].getReadMethod().invoke(defaults, null));
- }
- }
- catch (InstantiationException e)
- {
- log.error("Can't initialize property editors.", e);
- throw new Error(e); // programming error: bail out.
- }
- catch (IllegalAccessException e)
- {
- log.error("Can't initialize property editors.", e);
- throw new Error(e); // programming error: bail out.
- }
- catch (IllegalArgumentException e)
- {
- log.error("Can't initialize property editors.", e);
- throw new Error(e); // programming error: bail out.
- }
- catch (InvocationTargetException e)
- {
- log.error("Can't initialize property editors.", e);
- throw new Error(e); // programming error: bail out.
- }
}
public String getStaticLabel() {
1.1.2.2 +6 -3
jakarta-jmeter/src/core/org/apache/jmeter/testbeans/gui/Attic/TestElementEditor.java
Index: TestElementEditor.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testbeans/gui/Attic/TestElementEditor.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- TestElementEditor.java 1 Jan 2004 23:44:51 -0000 1.1.2.1
+++ TestElementEditor.java 4 Jan 2004 01:44:11 -0000 1.1.2.2
@@ -106,8 +106,11 @@
* @see java.beans.PropertyEditor#setValue(java.lang.Object)
*/
public void setValue(Object value) {
- guiComponent.configure((TestElement)value);
- firePropertyChange();
+ if (value != null)
+ {
+ guiComponent.configure((TestElement)value);
+ firePropertyChange();
+ }
}
/* (non-Javadoc)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]