-
FEATURED COMPONENTS
First time here? Check out the FAQ!
In the controller class I'm adding a new component to the mainWindow like that:
Executions.createComponents("/includes/menu.zul", mainWindow, null);
And menu.zul is added to the bottom of my window exactly like I want.
Now the problem: I want one of the methods in the same controller class to be able to detach or remove menu.zul component. I can't call detach() method directly because I don't know that object's name or ID. Any ideas please?
Can you keep a reference to the menu object in your composer? Like a class field?
public class MyComposer extends GenericForwardComposer{ Component menu; public void doAfterCompose(Component comp){ this.menu = Executions.createComponents("/includes/menu.zul", mainWindow, null); } private void removeMenu(){ if (this.menu != null){ menu.detach(); mainWindow.invalidate(); //force mainWindow to readraw } } } /code]
Asked: 2012-04-05 02:02:02 +0800
Seen: 162 times
Last updated: Apr 05 '12