You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by me...@apache.org on 2001/01/16 20:21:43 UTC
cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer PropertiesPropertyEditor.java StringArrayPropertyEditor.java StringPropertyEditor.java
metasim 01/01/16 11:21:43
Modified: src/antidote/org/apache/tools/ant/gui/customizer
PropertiesPropertyEditor.java
StringArrayPropertyEditor.java
StringPropertyEditor.java
Log:
Changed semantics of initializing with a null value. Now a default value is created.
Revision Changes Path
1.4 +7 -3 jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java
Index: PropertiesPropertyEditor.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PropertiesPropertyEditor.java 2001/01/03 14:18:21 1.3
+++ PropertiesPropertyEditor.java 2001/01/16 19:21:42 1.4
@@ -63,7 +63,7 @@
/**
* Custom property editor for the Properties class.
*
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @author Simeon Fitch
*/
public class PropertiesPropertyEditor extends AbstractPropertyEditor {
@@ -114,7 +114,7 @@
* current value.
*/
public String getJavaInitializationString() {
- return getAsText();
+ return "new Properties()";
}
/**
@@ -128,7 +128,11 @@
* modified value.
*/
public void setValue(Object value) {
- if(value != null && !(value instanceof Properties)) {
+ if(value == null) {
+ value = new Properties();
+ }
+
+ if(!(value instanceof Properties)) {
throw new IllegalArgumentException(
value.getClass().getName() + " is not of type Properties.");
}
1.5 +4 -1 jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java
Index: StringArrayPropertyEditor.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StringArrayPropertyEditor.java 2001/01/03 14:18:21 1.4
+++ StringArrayPropertyEditor.java 2001/01/16 19:21:42 1.5
@@ -61,7 +61,7 @@
/**
* Custom property editor for String arrays.
*
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @author Simeon Fitch
*/
public class StringArrayPropertyEditor extends AbstractPropertyEditor {
@@ -114,6 +114,9 @@
* modified value.
*/
public void setValue(Object value) {
+ if(value == null) {
+ value = new String[0];
+ }
if(!(value instanceof String[])) {
throw new IllegalArgumentException(
"Value must be of type String[].");
1.5 +5 -4 jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java
Index: StringPropertyEditor.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StringPropertyEditor.java 2001/01/03 14:18:21 1.4
+++ StringPropertyEditor.java 2001/01/16 19:21:42 1.5
@@ -60,7 +60,7 @@
/**
* Custom property editor for string types.
*
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @author Simeon Fitch
*/
public class StringPropertyEditor extends AbstractPropertyEditor {
@@ -119,6 +119,10 @@
* modified value.
*/
public void setValue(Object value) {
+ if(value == null) {
+ value = "";
+ }
+
Object old = _widget.getText();
_widget.setText(String.valueOf(value));
}
@@ -129,9 +133,6 @@
* object type such as "java.lang.Integer". */
public Object getValue() {
String retval = _widget.getText();
- if(retval != null && retval.length() == 0) {
- retval = null;
- }
return retval;
}