diff --git a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
index 541f452a1f..da9a7a33ca 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
+++ b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
@@ -48,7 +48,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
-
+
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java
index f966ed351b..a65f0c388c 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java
@@ -304,6 +304,12 @@ public final class LayoutUtils {
protected static void showWindowWithMask(Window window, ISupportMask mask){
mask.showMask();
mask.getMaskComponent().appendChild(window);
+
+ StringBuilder script = new StringBuilder("var w=zk.Widget.$('#");
+ script.append(mask.getMaskComponent().getUuid()).append("');");
+ script.append("var d=zk.Widget.$('#").append(window.getUuid()).append("');w.busy=d;");
+ Clients.response(new AuScript(script.toString()));
+
LayoutUtils.openOverlappedWindow(mask.getMaskComponent(), window, "middle_center");
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java
index 562e6f6a35..c1fea592d9 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java
@@ -723,6 +723,9 @@ public class ADWindowToolbar extends FToolbar implements EventListener
}
private void onCtrlKeyEvent(KeyEvent keyEvent) {
+ if (windowContent != null && windowContent.isBlock())
+ return;
+
ToolBarButton btn = null;
if (keyEvent.isAltKey() && !keyEvent.isCtrlKey() && !keyEvent.isShiftKey())
{
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
index 90591eff39..1fff788235 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
@@ -25,6 +25,7 @@ import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -3312,6 +3313,27 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
Clients.response(new AuScript(script.toString()));
}
+ /**
+ *
+ * @return true if window is block by mask or highlighted window
+ */
+ public boolean isBlock() {
+ if (mask != null && mask.getParent() != null) {
+ return true;
+ }
+ if (getComponent() != null && getComponent().getPage() != null) {
+ Collection roots = getComponent().getPage().getRoots();
+ for(Component comp : roots) {
+ if (comp instanceof org.zkoss.zul.Window) {
+ org.zkoss.zul.Window wnd = (org.zkoss.zul.Window) comp;
+ if (wnd.isVisible() && wnd.inHighlighted())
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
public void executeButtonProcess(final IProcessButton wButton,
final boolean startWOasking, final int table_ID, final int record_ID,
boolean isProcessMandatory) {
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java
index 0796c12da2..572fb065fc 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java
@@ -329,6 +329,9 @@ public class BreadCrumb extends Div implements EventListener {
if (windowContent != null && windowContent.getOpenQuickFormTabs().size() > 0)
return;
+ if (windowContent != null && windowContent.isBlock())
+ return;
+
KeyEvent keyEvent = (KeyEvent) event;
if (keyEvent.isAltKey()) {
if (keyEvent.getKeyCode() == KeyEvent.LEFT) {
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Combobox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Combobox.java
index a6c2121a6e..7ee9490343 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Combobox.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Combobox.java
@@ -20,9 +20,11 @@ package org.adempiere.webui.component;
import java.util.List;
import org.adempiere.webui.AdempiereIdGenerator;
+import org.adempiere.webui.LayoutUtils;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.IdSpace;
import org.zkoss.zk.ui.WrongValueException;
+import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Comboitem;
@@ -37,11 +39,24 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
public Combobox() {
super();
override();
+ init();
}
public Combobox(String value) throws WrongValueException {
super(value);
override();
+ init();
+ }
+
+ private void init() {
+ this.setCtrlKeys("^#down");
+ this.addEventListener(Events.ON_CTRL_KEY, e -> {
+ if (this.isEnabled() && LayoutUtils.isReallyVisible(this)) {
+ if (!isOpen())
+ this.setOpen(true);
+ e.stopPropagation();
+ }
+ });
}
private void override() {
@@ -172,4 +187,12 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
AuScript response = new AuScript(script);
Clients.response(response);
}
+
+ /**
+ * add widget listener to auto scroll selected item to view (i.e make visible)
+ */
+ public void addScrollSelectedIntoViewListener() {
+ String script = "var id='#'+this.uuid+'-pp .z-comboitem-selected';var selected=zk($(id));if(selected.jq.length==1)selected.scrollIntoView();";
+ setWidgetListener("onKeyUp", script);
+ }
}
\ No newline at end of file
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ProcessInfoDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ProcessInfoDialog.java
index 0c0bc3630d..4c9ef17d18 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ProcessInfoDialog.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ProcessInfoDialog.java
@@ -30,6 +30,7 @@ import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zhtml.Text;
import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
@@ -201,6 +202,11 @@ public class ProcessInfoDialog extends Window implements EventListener {
}
}
+ @Override
+ public void focus() {
+ btnOk.focus();
+ }
+
/**
* after run a process, call this function to show result in a dialog
* @param pi
@@ -211,12 +217,13 @@ public class ProcessInfoDialog extends Window implements EventListener {
*/
public static void showProcessInfo (ProcessInfo pi, int windowNo, final Component comp, boolean needFillLogFromDb) {
ProcessInfoDialog dialog = new ProcessInfoDialog(AEnv.getDialogHeader(Env.getCtx(), windowNo),AEnv.getDialogHeader(Env.getCtx(), windowNo), pi, needFillLogFromDb);
- final ISupportMask supportMask = LayoutUtils.showWindowWithMask(dialog, comp, LayoutUtils.OVERLAP_PARENT);;
+ final ISupportMask supportMask = LayoutUtils.showWindowWithMask(dialog, comp, LayoutUtils.OVERLAP_PARENT);
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
supportMask.hideMask();
}
- });
+ });
+ Executions.schedule(comp.getDesktop(), e -> dialog.btnOk.focus(), new Event("onPostShowProcessInfoDialog"));
}
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java
index 948ebf6023..fd0ecdc96a 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java
@@ -71,9 +71,7 @@ import org.zkoss.zk.ui.Page;
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.InputEvent;
import org.zkoss.zk.ui.sys.SessionCtrl;
-import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zk.ui.util.DesktopCleanup;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Menuitem;
@@ -199,12 +197,13 @@ ContextMenuListener, IZoomableEditor
{
ZKUpdateUtil.setWidth(getComponent(), "200px");
getComponent().setAutocomplete(true);
- getComponent().setAutodrop(true);
+ getComponent().setAutodrop(false);
+ getComponent().setInstantSelect(false);
getComponent().addEventListener(Events.ON_BLUR, this);
if (getComponent() instanceof EditorAutoComplete) {
;
} else {
- getComponent().addEventListener(Events.ON_CHANGING, this);
+ getComponent().addScrollSelectedIntoViewListener();
}
boolean zoom= false;
@@ -428,7 +427,7 @@ ContextMenuListener, IZoomableEditor
if (obj instanceof KeyNamePair)
{
KeyNamePair lookupKNPair = (KeyNamePair) obj;
- getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getKey());
+ getComponent().appendItem(lookupKNPair.getName().length()==0 ? " " : lookupKNPair.getName(), lookupKNPair.getKey());
if (!found && oldValue != null && oldValue instanceof Integer &&
lookupKNPair.getKey() == (Integer)oldValue)
{
@@ -438,7 +437,7 @@ ContextMenuListener, IZoomableEditor
else if (obj instanceof ValueNamePair)
{
ValueNamePair lookupKNPair = (ValueNamePair) obj;
- getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getValue());
+ getComponent().appendItem(lookupKNPair.getName().length()==0 ? " " : lookupKNPair.getName(), lookupKNPair.getValue());
if (!found && oldValue != null && lookupKNPair.getValue().equals(oldValue.toString()))
{
found = true;
@@ -447,7 +446,7 @@ ContextMenuListener, IZoomableEditor
else if (obj instanceof MLocator)
{
MLocator lookupKNPair = (MLocator) obj;
- getComponent().appendItem(lookupKNPair.getValue(), lookupKNPair.getM_Locator_ID());
+ getComponent().appendItem(lookupKNPair.getValue().length()==0 ? " " : lookupKNPair.getValue(), lookupKNPair.getM_Locator_ID());
if (!found && oldValue != null && lookupKNPair.getM_Locator_ID() == (Integer) oldValue)
{
found = true;
@@ -554,7 +553,7 @@ ContextMenuListener, IZoomableEditor
else
{
//on select not fire for empty label item
- if (item.getLabel().equals(""))
+ if (Util.isEmpty(item.getLabel(),true))
{
Object newValue = getValue();
if (isValueChange(newValue)) {
@@ -571,8 +570,6 @@ ContextMenuListener, IZoomableEditor
}
}
}
- } else if (event.getName().equals(Events.ON_CHANGING)) {
- onChanging((InputEvent) event);
} else if (event.getName().equals("onPostSelect")) {
if (getComponent().isOpen()) {
getComponent().select();
@@ -582,24 +579,6 @@ ContextMenuListener, IZoomableEditor
}
}
- private void onChanging(InputEvent event) {
- String v = event.getValue();
- if (!Util.isEmpty(v)) {
- v = v.toLowerCase();
- int count = getComponent().getItemCount();
- for(int i = 0; i < count; i++) {
- Comboitem item = getComponent().getItemAtIndex(i);
- if(item.getLabel() != null && item.getLabel().toLowerCase().startsWith(v)) {
- Clients.scrollIntoView(item);
- break;
- }
- }
- } else if (getComponent().getItemCount() > 0) {
- Comboitem item = getComponent().getItemAtIndex(0);
- Clients.scrollIntoView(item);
- }
- }
-
private boolean isValueChange(Object newValue) {
return (oldValue == null && newValue != null) || (oldValue != null && newValue == null)
|| ((oldValue != null && newValue != null) && !oldValue.equals(newValue));
@@ -675,7 +654,7 @@ ContextMenuListener, IZoomableEditor
{
if (value instanceof Integer)
Record_ID = ((Integer)value).intValue();
- else if (value != null && "".compareTo(value.toString())!= 0)
+ else if (!Util.isEmpty(value.toString(),true))
Record_ID = Integer.parseInt(value.toString());
}
@@ -826,8 +805,7 @@ ContextMenuListener, IZoomableEditor
private WTableDirEditor editor;
private DesktopCleanup listener = null;
- protected EditorCombobox() {
-
+ protected EditorCombobox() {
}
@Override
@@ -885,7 +863,6 @@ ContextMenuListener, IZoomableEditor
private DesktopCleanup listener = null;
protected EditorAutoComplete() {
-
}
@Override
@@ -937,7 +914,7 @@ ContextMenuListener, IZoomableEditor
public void setValue(String value)
{
setText(value);
- if (Util.isEmpty(value)) {
+ if (Util.isEmpty(value,true)) {
refresh("");
}
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
index 051e4ffa20..3aa9865261 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
@@ -1194,7 +1194,7 @@ public class FindWindow extends Window implements EventListener, ValueCha
{
// 0 = Columns
ArrayList items = new ArrayList();
- items.add(new ValueNamePair("", ""));
+ items.add(new ValueNamePair("", " "));
for (int c = 0; c < m_findFields.length; c++)
{
GridField field = m_findFields[c];
@@ -1251,8 +1251,7 @@ public class FindWindow extends Window implements EventListener, ValueCha
}
listColumn.setModel(columnListModel);
if (!isFilterColumnList()) {
- String script = "var id='#'+this.uuid+'-pp .z-comboitem-selected';var selected=zk($(id));if(selected.jq.length==1)selected.scrollIntoView();";
- listColumn.setWidgetListener("onKeyUp", script);
+ listColumn.addScrollSelectedIntoViewListener();
}
Events.sendEvent("onInitRender", listColumn, null);
if(fields == null)
@@ -1459,7 +1458,8 @@ public class FindWindow extends Window implements EventListener, ValueCha
if (listbox.getId().equals(listColumn.getId()))
{
Comboitem column = listColumn.getSelectedItem();
- if (column != null && column.getValue().toString().length() > 0)
+ ValueNamePair selected = column.getValue();
+ if (column != null && selected.getValue().length() > 0)
{
addOperators(column, listOperator);
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/window.js b/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/window.js
index 02cb8a28ae..9be2901227 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/window.js
+++ b/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/window.js
@@ -17,7 +17,7 @@ zk.override(zk.Widget.prototype, "canActivate",
var wgt = this;
while (wgt) {
if (wgt.busy) {
- if (wgt.busy.className == 'zul.wnd.Window') {
+ if (wgt.busy.className) {
if (zUtl.isAncestor(wgt.busy, this)) {
return true;
} else {
@@ -29,7 +29,7 @@ zk.override(zk.Widget.prototype, "canActivate",
jq.focusOut();
}
return false;
- }
+ }
if (wgt.className == 'zul.wnd.Window') {
if (wgt.getMode() == 'overlapped') {
return true;