IDEMPIERE-781 Column of type FilePath not working

This commit is contained in:
Carlos Ruiz 2013-03-20 13:43:12 -05:00
parent 2bc43e3b6d
commit 1075d048d9
1 changed files with 22 additions and 6 deletions

View File

@ -16,11 +16,13 @@ package org.adempiere.webui.editor;
import org.adempiere.webui.component.FilenameBox;
import org.adempiere.webui.component.FolderBrowser;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.theme.ThemeManager;
import org.compiere.model.GridField;
import org.compiere.util.CLogger;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
/**
@ -41,7 +43,6 @@ public class WFileDirectoryEditor extends WEditor
{
super(new FilenameBox(), gridField);
getComponent().setButtonImage(ThemeManager.getThemeResource("images/Open16.png"));
getComponent().addEventListener(Events.ON_CLICK, this);
getComponent().getButton().setUpload("false");
}
@ -98,7 +99,6 @@ public class WFileDirectoryEditor extends WEditor
else if (Events.ON_CLICK.equals(event.getName()))
{
cmd_file();
newValue = getComponent().getText();
}
else
{
@ -108,6 +108,16 @@ public class WFileDirectoryEditor extends WEditor
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
processNewValue(newValue);
}
protected void processNewValue(String newValue) {
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
@ -120,10 +130,16 @@ public class WFileDirectoryEditor extends WEditor
*/
private void cmd_file()
{
FolderBrowser directoryDialog = new FolderBrowser(true);
final FolderBrowser directoryDialog = new FolderBrowser(true);
directoryDialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
String directory = directoryDialog.getPath();
getComponent().setText(directory);
getComponent().getTextbox().focus();
processNewValue(getComponent().getText());
}
});
} // cmd_file
public String[] getEvents()