IDEMPIERE-2050 Improvement to Menu Lookup. Fixed binding for enter key not working when header is hidden. Minor layout fix.

This commit is contained in:
Heng Sin Low 2014-07-11 13:14:13 +08:00
parent f48169f81e
commit ec8aa119f0
1 changed files with 22 additions and 18 deletions

View File

@ -14,6 +14,7 @@
package org.adempiere.webui.apps;
import org.adempiere.webui.component.Bandbox;
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;
@ -68,20 +69,16 @@ public class GlobalSearch extends Div implements EventListener<Event> {
bandbox.addEventListener(Events.ON_CTRL_KEY, this);
Bandpopup popup = new Bandpopup();
popup.setWidth("700px");
popup.setHeight("600px");
bandbox.appendChild(popup);
Hlayout hlayout = new Hlayout();
hlayout.setHflex("1");
popup.appendChild(hlayout);
menuController.create(hlayout);
Separator separator = new Separator();
separator.setHeight("100%");
separator.setBar(true);
separator.setHflex("0");
separator.setOrient("horizontal");
separator.setOrient("vertical");
hlayout.appendChild(separator);
docController.create(hlayout);
@ -89,8 +86,6 @@ public class GlobalSearch extends Div implements EventListener<Event> {
addEventListener(ON_CREATE_ECHO, this);
bandbox.addEventListener(ON_ENTER_KEY, this);
addEventListener(ON_POST_ENTER_KEY, this);
Events.echoEvent(ON_CREATE_ECHO, this, null);
}
@Override
@ -125,7 +120,7 @@ public class GlobalSearch extends Div implements EventListener<Event> {
StringBuilder script = new StringBuilder("jq('#")
.append(bandbox.getUuid())
.append("').bind('keydown', function(e) {var code=e.keyCode||e.which;console.log(code);if(code==13){")
.append("var widget=zk.Widget.$('#").append(bandbox.getUuid()).append("');")
.append("var widget=zk.Widget.$(this);")
.append("var event=new zk.Event(widget,'")
.append(ON_ENTER_KEY)
.append("',{},{toServer:true});")
@ -144,4 +139,13 @@ public class GlobalSearch extends Div implements EventListener<Event> {
}
}
}
/* (non-Javadoc)
* @see org.zkoss.zk.ui.AbstractComponent#onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)
*/
@Override
public void onPageAttached(Page newpage, Page oldpage) {
super.onPageAttached(newpage, oldpage);
Events.echoEvent(ON_CREATE_ECHO, this, null);
}
}