Merge df7dd0313999

This commit is contained in:
Heng Sin Low 2013-03-21 14:05:15 +08:00
commit 659edb3d55
3 changed files with 42 additions and 19 deletions

View File

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

View File

@ -35,6 +35,7 @@ import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs; import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.FeedbackManager; import org.adempiere.webui.util.FeedbackManager;
import org.compiere.Adempiere; import org.compiere.Adempiere;
@ -70,7 +71,7 @@ public class AboutWindow extends Window implements EventListener<Event> {
/** /**
* *
*/ */
private static final long serialVersionUID = -2600883713422452076L; private static final long serialVersionUID = 6573804051552633150L;
private Checkbox bErrorsOnly; private Checkbox bErrorsOnly;
private Listbox logTable; private Listbox logTable;
@ -479,7 +480,10 @@ public class AboutWindow extends Window implements EventListener<Event> {
private void downloadAdempiereLogFile() { private void downloadAdempiereLogFile() {
String path = Ini.getAdempiereHome() + File.separator + "log"; String path = Ini.getAdempiereHome() + File.separator + "log";
FolderBrowser fileBrowser = new FolderBrowser(path, false); final FolderBrowser fileBrowser = new FolderBrowser(path, false);
fileBrowser.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
String selected = fileBrowser.getPath(); String selected = fileBrowser.getPath();
if (selected != null && selected.trim().length() > 0) { if (selected != null && selected.trim().length() > 0) {
File file = new File(selected); File file = new File(selected);
@ -492,6 +496,8 @@ public class AboutWindow extends Window implements EventListener<Event> {
} }
} }
} }
});
}
private void downloadLog() { private void downloadLog() {
String log = CLogErrorBuffer.get(true).getErrorInfo(Env.getCtx(), bErrorsOnly.isChecked()); String log = CLogErrorBuffer.get(true).getErrorInfo(Env.getCtx(), bErrorsOnly.isChecked());

View File

@ -136,6 +136,7 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
status.setStyle("margin-top:10px;"); status.setStyle("margin-top:10px;");
textBox.addEventListener(Events.ON_CHANGE, this); textBox.addEventListener(Events.ON_CHANGE, this);
if (editor != null)
editor.addEventListener(Events.ON_CHANGE, this); editor.addEventListener(Events.ON_CHANGE, this);
} }