First time here? Check out the FAQ!
Hello, at the moment, I am setting up a screen in the java owner, I wanted to call a specific zul file when starting the .java file, does anyone know how to do this? zk 9.0.0
public MyPage2(Page page) {
request = (HttpServletRequest) page.getDesktop().getExecution().getNativeRequest();
session = (HttpSession) Executions.getCurrent().getDesktop().getSession().getNativeSession();
contexto = page.getDesktop().getExecution().getContextPath();
usuarioService = new UsuarioService();
logsis = request.getParameter("logsis") != null ? Boolean.parseBoolean(request.getParameter("logsis")) : true;
if (request.getParameter("codAudit") != null) {
usuarioService.setIdLogon(request.getParameter("codAudit"));
usuarioService.setIdUsuario(request.getParameter("usuario"));
if (usuarioService.isLogado()) {
if (this.validaLogin(Integer.parseInt(usuarioService.getIdUsuario())))
return;
}
}
page.removeComponents();
initComponentes();
page.setTitle(Config.INSTITUICAO);
page.setAttribute("cacheable", false);
org.zkoss.zul.Window body = new org.zkoss.zul.Window();
org.zkoss.zul.Window w = new org.zkoss.zul.Window();
body.setSclass("window_body");
body.setClosable(false);
body.setWidth("100%");
body.setHeight("100%");
body.setStyle("background: #0066A5 url('images/login/bg_login.png') no-repeat bottom left;");
w.setTitle(Config.INSTITUICAO);
w.setBorder("normal");
w.setWidth("320px");
w.setShadow(false);
w.doOverlapped();
w.setSclass("window_login");
btn.setLabel("Entrar");
btn.setId("Entrar");
btn.addEventListener(Events.ON_CLICK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
if (Events.ON_CLICK.equals(event.getName())) {
String id = event.getTarget().getId().toLowerCase();
if ("entrar".equals(id))
validaLogin();
}
}
});
tx[1].setType("password");
tx[1].addEventListener(Events.ON_OK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
validaLogin();
}
});
sistema = request.getParameter("sistema") != null ? Integer.parseInt(request.getParameter("sistema")) : null;
Vbox hb = new Vbox();
hb.appendChild(new Hr());
hb.appendChild(lb[0]);
hb.appendChild(tx[0]);
hb.appendChild(lb[1]);
hb.appendChild(tx[1]);
w.appendChild(hb);
Separator sp = new Separator();
sp.setHeight("10px");
w.appendChild(sp);
Div dv = new Div();
dv.setStyle("text-align:right");
dv.appendChild(btn);
w.appendChild(dv);
w.setParent(body);
w.setPosition("center");
body.setPage(page);
tx[0].focus();
}
It looks like you want to create components bases on a zul, you can do this like Executions.createComponents("/foo/my.zul", parent, arg);
Please read https://www.zkoss.org/wiki/ZKDeveloper%27sReference/UIComposing/ZUML/LoadZUMLinJava for details.
Asked: 2020-02-27 22:21:25 +0800
Seen: 8 times
Last updated: Mar 02 '20