How close "father" window after creating "child" window

asked 2014-02-18 16:26:40 +0800

lramella gravatar image lramella
4 2

Hi, in my first form I ask login/password; after I create my "root" window with menu.

private Window winLogin;


Window rootWin = (Window)Executions.createComponents("menu.zul",winLogin,null);

After this code the login.zul is not unloaded/detached

Then, I tried in menu.java in @Init function to "unload" login.zul

Window win = (Window)getFellow("Login"); --> ERROR
Window win = (Window)getFellow("login"); --> ERROR
Window win = (Window)getFellow("login.zul"); --> ERROR

I tried also with

Window win2 = (Window)getParent(); --> ERROR

It is probably just a stupid question but, how I can do?

Thanks Luca

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-02-18 20:46:06 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9

updated 2014-02-19 07:24:52 +0800

If you just need to go to another page you can use sendRedirect if the father window isn't a popup.


If its already a "popup" that has to create a new popup and close that specific popup you can do the following :

  • Create a globalCommand in your main window that will create the new zul(uri from the args of global-command).
  • In the popup, call the global command and give in the args the 'menu.zul' with.
  • Close your popup (maybe this.detach won't work, better use is 'winLogin.detach();')

Hope this helped.

Greetz chill

link publish delete flag offensive edit

answered 2014-02-23 16:49:44 +0800

lramella gravatar image lramella
4 2

Thanks chili, I reply late because I'm "new" to the forum....

I do some errors in my code:

1) @Wire("Login") --> @Wire("#Login")

2) login.java

gDesktop.setAttribute("winLogin", winLogin);            
Window menuWin = (Window)Executions.createComponents("menu.zul",null,null);

3) menu.java

public void afterCompose(@ContextParam(ContextType.VIEW) Component view)
    Selectors.wireComponents(view, this, false);


Window win = (Window) desktop.getAttribute("winLogin");

This is ok for me.

Thanks for your help


link publish delete flag offensive edit


Hey Luca, I'm more used to the mvvm approach so I didn't see your faults :). Can it be that you sometimes mix the 2? @Init is mvvm I gues and the doAfterCompose are more mvc. (also strange you do afterCompose or it must be mvvm with @Init annotation).

chillworld ( 2014-02-23 20:09:20 +0800 )edit

If you do mvvm don't use the @wire, this only works when you do special tricks you actually don't want to do. Greetz chill.

chillworld ( 2014-02-23 20:10:38 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2014-02-18 16:26:40 +0800

Seen: 28 times

Last updated: Feb 23 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More