0

Executions.createComponent

asked 2010-06-02 11:26:25 +0800

dorr gravatar image dorr
126 4

I'm trying to load a .zul page from another page using a button and an onclick event. In the event method I'm executing Executions.createComponent and it does create the component. However, the problem is that it's appending it to the bottom of the original page. I want it to replace the original page. What am I missing?

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2010-06-02 12:36:32 +0800

vinhvo gravatar image vinhvo
369 3

If you want it to replace current page: I did like this

<?page title="NetMes" contentType="text/html;charset=UTF-8"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./maintainWin"?>
<zk>
	<include id="includeWin"></include>
	<window id="maintainWin"
		apply="fi.uwasa.netmes.zkossController.MaintainanceController"
		height="120%" style="padding-top:20px" >
	<button label="Click"
				id="btWorkInstruction" />
</window>

</zk>

Composer:

	public void onClick$btWorkInstruction(Event event){
		includeWin.setSrc("maintain/documents.zul");
		self.detach();
	}
	

If you want to pass parameter you can do:includeWin.setSrc("maintain/documents.zul?parameter=somethig¶meter2=something");

And in the created window:
String s=Executions.getCurrent().getParameter("parameter");

link publish delete flag offensive edit

answered 2010-06-02 12:37:22 +0800

vinhvo gravatar image vinhvo
369 3

Or better would be: Executions.sendredirect("anotherpage").

link publish delete flag offensive edit

answered 2010-06-02 13:17:09 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

The second parameter on createComponents() is the parent of the newly created component. Don't know how your layout is since you've shown no example of what you're doing, but the parent of the component that you want to replace is what you should send as the second parameter on createComponents(). Or, do as vinhvo said and call setSrc() on an include.

link publish delete flag offensive edit

answered 2010-06-02 16:23:37 +0800

dorr gravatar image dorr
126 4

Thanks, I figured it out. I did this little number:
<code>
//get an instance of the borderlayout defined in the zul-file
Borderlayout bl = (Borderlayout) this.page.getFellow("content");

//get an instance of the searched CENTER layout area
Center center = bl.getCenter();
center.setFlex(true);

//clear the center child comps
center.getChildren().clear();

//create the page and put it in the center layout area
Executions.createComponents(zulFilePathName, center, map);
</code>

It replaces the center portion of my layout with the new component.

link publish delete flag offensive edit

answered 2010-06-02 17:06:38 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

:-)

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2010-06-02 11:26:25 +0800

Seen: 2,011 times

Last updated: Jun 02 '10

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