From d4fe22d6b827f0b8e6273f4248c3db9865ed5068 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 Mar 2013 09:30:55 -0500 Subject: [PATCH 1/3] IDEMPIERE-749 NPE when you open Editor from a not editable field --- .../src/org/adempiere/webui/window/WTextEditorDialog.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WTextEditorDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WTextEditorDialog.java index 1999bd8492..48b058eb76 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WTextEditorDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WTextEditorDialog.java @@ -136,7 +136,8 @@ public class WTextEditorDialog extends Window implements EventListener{ status.setStyle("margin-top:10px;"); textBox.addEventListener(Events.ON_CHANGE, this); - editor.addEventListener(Events.ON_CHANGE, this); + if (editor != null) + editor.addEventListener(Events.ON_CHANGE, this); } tabbox.addEventListener(Events.ON_SELECT, this); From 2bc43e3b6dc6d7cb467f8cdb5f05828e2a2baa37 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 Mar 2013 13:42:31 -0500 Subject: [PATCH 2/3] IDEMPIERE-782 iDempiere log button on About window not working --- .../adempiere/webui/window/AboutWindow.java | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java index 327576f397..9a16309162 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java @@ -35,6 +35,7 @@ import org.adempiere.webui.component.Tabpanels; import org.adempiere.webui.component.Tabs; import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.Window; +import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.FeedbackManager; import org.compiere.Adempiere; @@ -68,9 +69,9 @@ import org.zkoss.zul.Vbox; */ public class AboutWindow extends Window implements EventListener { /** - * + * */ - private static final long serialVersionUID = -2600883713422452076L; + private static final long serialVersionUID = 6573804051552633150L; private Checkbox bErrorsOnly; private Listbox logTable; @@ -479,18 +480,23 @@ public class AboutWindow extends Window implements EventListener { private void downloadAdempiereLogFile() { String path = Ini.getAdempiereHome() + File.separator + "log"; - FolderBrowser fileBrowser = new FolderBrowser(path, false); - String selected = fileBrowser.getPath(); - if (selected != null && selected.trim().length() > 0) { - File file = new File(selected); - if (file.exists() && file.isFile() && file.canRead()) { - try { - AMedia media = new AMedia(file, "text/plain", null); - Filedownload.save(media); - } catch (FileNotFoundException e) { + final FolderBrowser fileBrowser = new FolderBrowser(path, false); + fileBrowser.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + String selected = fileBrowser.getPath(); + if (selected != null && selected.trim().length() > 0) { + File file = new File(selected); + if (file.exists() && file.isFile() && file.canRead()) { + try { + AMedia media = new AMedia(file, "text/plain", null); + Filedownload.save(media); + } catch (FileNotFoundException e) { + } + } } } - } + }); } private void downloadLog() { From 1075d048d9c5bf1f3ab4e3754880249d2e7c0996 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 Mar 2013 13:43:12 -0500 Subject: [PATCH 3/3] IDEMPIERE-781 Column of type FilePath not working --- .../webui/editor/WFileDirectoryEditor.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFileDirectoryEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFileDirectoryEditor.java index dc9738d4bb..831425b897 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFileDirectoryEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFileDirectoryEditor.java @@ -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); - String directory = directoryDialog.getPath(); - getComponent().setText(directory); - getComponent().getTextbox().focus(); + final FolderBrowser directoryDialog = new FolderBrowser(true); + directoryDialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { + @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()