BF [3058780] WNumberEditor allow only BigDecimal
https://sourceforge.net/tracker/?func=detail&aid=3058780&group_id=176962&atid=955896 Fix problem reported at http://sourceforge.net/support/tracker.php?aid=3168968
This commit is contained in:
parent
8375af90ac
commit
2dd881d020
|
@ -133,19 +133,24 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
|
|||
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()) || Events.ON_OK.equalsIgnoreCase(event.getName()))
|
||||
{
|
||||
Object newValue = getComponent().getValue();
|
||||
if (oldValue == null && newValue == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (displayType == DisplayType.Integer) {
|
||||
if (newValue != null && newValue instanceof BigDecimal) {
|
||||
newValue = new Integer(((BigDecimal)newValue).intValue());
|
||||
}
|
||||
if (oldValue != null && oldValue instanceof BigDecimal) {
|
||||
oldValue = new Integer(((BigDecimal)oldValue).intValue());
|
||||
}
|
||||
}
|
||||
|
||||
BigDecimal bd = new BigDecimal(newValue.toString());
|
||||
if (displayType == DisplayType.Integer)
|
||||
newValue = new Integer(bd.intValue());
|
||||
else
|
||||
newValue = bd;
|
||||
if (oldValue != null && newValue != null && oldValue.equals(newValue))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (oldValue == null && newValue == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
|
||||
super.fireValueChange(changeEvent);
|
||||
oldValue = newValue;
|
||||
|
|
Loading…
Reference in New Issue