The file directory editor value is not save if user doesn't press enter at the text box after selected folder using the browse for directory button.
This commit is contained in:
parent
a9f8888564
commit
e2fa0f1fc4
|
@ -31,6 +31,7 @@ public class WFileDirectoryEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final CLogger log = CLogger.getCLogger(WFileDirectoryEditor.class);
|
private static final CLogger log = CLogger.getCLogger(WFileDirectoryEditor.class);
|
||||||
|
|
||||||
private String oldValue;
|
private String oldValue;
|
||||||
|
@ -87,22 +88,29 @@ public class WFileDirectoryEditor 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,6 +121,7 @@ public class WFileDirectoryEditor extends WEditor
|
||||||
FolderBrowser directoryDialog = new FolderBrowser(true);
|
FolderBrowser directoryDialog = new FolderBrowser(true);
|
||||||
String directory = directoryDialog.getPath();
|
String directory = directoryDialog.getPath();
|
||||||
getComponent().setText(directory);
|
getComponent().setText(directory);
|
||||||
|
getComponent().getTextbox().focus();
|
||||||
} // cmd_file
|
} // cmd_file
|
||||||
|
|
||||||
public String[] getEvents()
|
public String[] getEvents()
|
||||||
|
|
Loading…
Reference in New Issue