Make the AsString editor notice that things are the same when their string values match. Otherwise when we have a comma-separated array, when we lose focus, even if things match, we believe we don't match because an array's equals just compares pointers.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6242 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
package com.threerings.admin.client;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
@@ -110,5 +109,11 @@ public class AsStringFieldEditor extends FieldEditor
|
||||
_value.setText(StringUtil.toString(value, "", ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean valueMatches (Object dvalue)
|
||||
{
|
||||
return StringUtil.toString(dvalue).equals(StringUtil.toString(getValue()));
|
||||
}
|
||||
|
||||
protected JTextField _value;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
package com.threerings.admin.client;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@@ -128,7 +127,7 @@ public abstract class FieldEditor extends JPanel
|
||||
}
|
||||
|
||||
// submit an attribute changed event with the new value
|
||||
if (!Objects.equal(value, getValue())) {
|
||||
if (!valueMatches(value)) {
|
||||
_accessor.set(_field, value);
|
||||
}
|
||||
}
|
||||
@@ -151,7 +150,13 @@ public abstract class FieldEditor extends JPanel
|
||||
log.warning("Failed to parse display value " + e + ".");
|
||||
displayValue(getValue());
|
||||
}
|
||||
updateBorder(!Objects.equal(dvalue, getValue()));
|
||||
|
||||
updateBorder(!valueMatches(dvalue));
|
||||
}
|
||||
|
||||
protected boolean valueMatches (Object dvalue)
|
||||
{
|
||||
return Objects.equal(dvalue, getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user