IDEMPIERE-611 Zk: number editor popup auto close immediately

This commit is contained in:
Heng Sin Low 2013-02-06 12:16:03 +08:00
parent 92dc282c1c
commit 11603bc4fe
1 changed files with 16 additions and 0 deletions

View File

@ -24,7 +24,9 @@ import java.text.ParseException;
import org.adempiere.webui.LayoutUtils;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.zkoss.zk.ui.HtmlBasedComponent;
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.zul.Decimalbox;
@ -88,6 +90,20 @@ public class NumberBox extends Div
btn.setImage("/images/Calculator10.png");
btn.setTabindex(-1);
btn.setHflex("0");
btn.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
if (btn.getPopup() != null) {
String uid = btn.getPopup();
if (uid.startsWith("uuid("))
uid = uid.substring(5, uid.length()-1);
HtmlBasedComponent comp = (HtmlBasedComponent) btn.getDesktop().getComponentByUuidIfAny(uid);
if (comp != null) {
comp.focus();
}
}
}
});
LayoutUtils.addSclass("editor-button", btn);
hlayout.appendChild(btn);