IDEMPIERE-611 Zk: number editor popup auto close immediately.

This commit is contained in:
Heng Sin Low 2013-02-13 20:35:29 +08:00
parent 394b719779
commit 96630a54fc
1 changed files with 3 additions and 16 deletions

View File

@ -24,9 +24,7 @@ import java.text.ParseException;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.Page; 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.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Decimalbox; import org.zkoss.zul.Decimalbox;
@ -90,20 +88,9 @@ public class NumberBox extends Div
btn.setImage("/images/Calculator10.png"); btn.setImage("/images/Calculator10.png");
btn.setTabindex(-1); btn.setTabindex(-1);
btn.setHflex("0"); btn.setHflex("0");
btn.addEventListener(Events.ON_CLICK, new EventListener<Event>() { btn.setWidgetListener("onClick", "try{var id=this.getPopup(); zk.Widget.$(id.substring(5, id.length - 1)).focus_(100);" +
@Override "} catch(error) {}");
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); LayoutUtils.addSclass("editor-button", btn);
hlayout.appendChild(btn); hlayout.appendChild(btn);