The file name editor value is not save if user doesn't press enter at the text box after selected file using the browse for file button.

This commit is contained in:
Heng Sin Low 2011-02-07 11:14:10 +08:00
parent e2fa0f1fc4
commit 6b37fe8be3
1 changed files with 18 additions and 9 deletions

View File

@ -95,22 +95,31 @@ public class WFilenameEditor extends WEditor
public void onEvent(Event event) public void onEvent(Event event)
{ {
String newValue = null;
if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
{ {
String newValue = getComponent().getText(); newValue = getComponent().getText();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
fireValueChange(changeEvent);
} }
else if (Events.ON_CLICK.equals(event.getName())) else if (Events.ON_CLICK.equals(event.getName()))
{ {
cmd_file(); cmd_file();
newValue = getComponent().getText();
} }
else
{
return;
}
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
fireValueChange(changeEvent);
} }
/** /**