0

Creating a page from java code

asked 2009-09-17 00:03:44 +0800

lcmuniz2010 gravatar image lcmuniz2010
24

I have two pages: page1.zul and page2.zul.
Both pages has a class: Page1Window and Page2Window
On page1.zul I have a <include id="main"/> and I set the src on java code: main.setSrc("page2.zul").
My problem is: I want to obtain a reference to the page1 on the page2 to change the src of the include tag.
Anyone can help me?

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2009-09-17 00:35:32 +0800

james gravatar image james
255 2

I think if you are in page1 and want to get some information from your included page2 you could use getFellow()
ex: var = window.getFellow("include").getFellow("page2Win").getVariable("info");
or if in page2 and want info from page1 use getParent()
ex: info = page2Win.getParent().getParent().getParent().getVariable("var");

Also... session variables are possibilities.
As for the best solution, I'm not sure... but I hope that helps

link publish delete flag offensive edit

answered 2009-09-17 00:42:21 +0800

lcmuniz2010 gravatar image lcmuniz2010
24

updated 2009-09-17 00:42:52 +0800

.

link publish delete flag offensive edit

answered 2009-09-17 00:42:36 +0800

lcmuniz2010 gravatar image lcmuniz2010
24

No.On the page2 I do not have access to include. getFellows() only show components inside the page2...

link publish delete flag offensive edit

answered 2009-09-17 00:47:51 +0800

lcmuniz2010 gravatar image lcmuniz2010
24

Hei I found one solution! I dont know if is the best. but...
I change the include to <div id="main/> and on the java code of the page1 I used

Window w = (Window) Executions.createComponents("page2.zul", getFellow("main"), null);

To obtain the page1 on page2: getParent().getFellow("page1_id")

If anyone has another more efficient solution, please...

link publish delete flag offensive edit

answered 2009-09-17 01:06:39 +0800

lcmuniz2010 gravatar image lcmuniz2010
24

james, the getParent on the page2 return null. on page1 i have the <include src="page2.zul"> but getparent return null...

link publish delete flag offensive edit

answered 2009-09-17 06:43:43 +0800

Arsen gravatar image Arsen
384 5

There is another solution:
Page2Controller sends Event ON_USER to Page1Controller and Page1Controller handles this Event by changing src of its include component.

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: 2009-09-17 00:03:44 +0800

Seen: 183 times

Last updated: Sep 17 '09

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