PDA

View Full Version : [FIXED] cancelEdit does not take preProcessValue into consideration



thatone
23 Mar 2009, 1:26 PM
I recently came across a ClassCastException when a cancelEdit is executed. When I traced the code, I found the problem in here:


protected void cancelEdit(boolean remainVisible) {
if (editing) {
setValue(startValue);
if (!remainVisible) {
hide();
}
}
}

If my CellEditor overrides pre/post ProcessValue() methods, then cancelEdit would throw ClassCastException because startValue is a "unconverted" value.

The following is the excerpt code from startEdit(Element el, Object value) around line 382-383.

startValue = value;
field.setValue(preProcessValue(value));

The fix for this bug can either be:

1) fix CellEditor.startEdit() to


startValue = preProcessValue(value)

2) CellEditor.cancelEdit() to

setValue(preProcessValue(startValue));

3) CellEditor.setValue() to

field.setValue(preProcessValue(startValue));

sven
1 Apr 2009, 9:38 AM
Fixed in SVN.

version 1 for GXT 2.0

and version 2 for GXT 1.2