0

Passing Parameter between two zul files [closed]

asked 2013-01-16 08:52:02 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

updated 2013-01-16 08:54:17 +0800

Hi ZK Team

The above subject is very hot in ZK. But unfortunately there is no demo or small talk on this subject. My humble request is to create documentation/example for the following topic

Using MVVM -> Modal dialog

1. Zul a -> Attached to ViewModelA
2. In ViewModelA, make a call to Zul b -> attached to ViewModelB and call method should be modal (domodel).
3. Receive the argument in ViewModelB


Using MVVM -> embedded window

1. Zul a -> Attached to ViewModelA
2. In ViewModelA, make a call to Zul b -> attached to ViewModelB and call method should be embedded window
3. Receive the argument in ViewModelB


Using MVC-> Modal dialog

1. Zul a -> Attached to ContollerA
2. In ContollerA, make a call to Zul b -> attached to ContollerB and call method should be modal (domodel).
3. Receive the argument in ContollerB


Using MVC -> embedded window

1. Zul a -> Attached to ContollerA
2. In ContollerA, make a call to Zul b -> attached to ContollerB and call method should be embedded window
3. Receive the argument in ContollerB

If we have examples from ZK team, then it would be great.

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by Senthilchettyin
close date 2013-02-09 08:10:11

Comments

Hi, In your message: " In ViewModelA, make a call to Zul b -> attached to ViewModelB and call method should be embedded window" What do you mean by "call method should be embedded window"?

hawk ( 2013-01-17 06:00:00 +0800 )edit

Any update from ZK Team ?

Senthilchettyin ( 2013-01-17 18:43:43 +0800 )edit

Any help from ZK Team ?

Senthilchettyin ( 2013-01-24 05:39:31 +0800 )edit

Can Paowang's answer help you?

hawk ( 2013-01-25 06:11:58 +0800 )edit

Thank you. I am creating examples for all the above. Once i am done, i will post here. I kindly request you to validate later.

Senthilchettyin ( 2013-01-25 06:36:41 +0800 )edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2013-01-17 06:01:23 +0800

paowang gravatar image paowang
140 6

updated 2013-01-25 06:09:12 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

I found a demo similar to 3. and 4.: http://www.zkoss.org/zkdemo/gettingstarted/dialogpopup

And I can't find any official examples about 1. and 2. too.

But, there is a example in ZK Fiddle might similar to 1. : http://zkfiddle.org/sample/1mshmaq/11-File-Upload-and-communication-with-modal-window

Communication between Composer and ViewModel http://books.zkoss.org/wiki/ZK%20Developer's%20Reference/MVVM/Advance/Communication%20between%20ViewModel%20and%20Composer

link publish delete flag offensive edit
0

answered 2013-01-17 06:15:37 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Hi

What i mean embedded window ?

A window could be in one of five different modes: overlap, popup, modal, highlighted and embedded. The default mode is the embedded mode. You can change the mode by use of the doOverlapped, doPopup, doModal, doHighlighted, and doEmbedded methods,

All we know that further execution will be suspended until the user acknowledge the domodal window.

But in the case of doembedded, execution will not be stop. So in my example, i also need to know how to return some parameter after second zul is closed.

link publish delete flag offensive edit
0

answered 2013-01-25 09:23:41 +0800

gquintana gravatar image gquintana
33 3

When using MVC's composers:

In AComposer:

Map<String,Object> args=new HashMap<String, Object>();
args.put("BArgument1", 1);
args.put("BArgument2", 2);
Window window=Executions.createComponents("BView.zul", parent, args);
window.doModal();

In BComposer

public void doAfterCompose(Window comp) throws Exception {
    super.doAfterCompose(comp);
    final Execution execution = Executions.getCurrent();
    int argument1=execution.getArg().get("BArgument1");
    int argument2=execution.getArg().get("BArgument2");
    // Do something with arguments
}

Personnally, I prefer introducing a static method in BComposer to initialize arguments:

public static Windows createWindow(Component parent, int arg1, int arg2) {
    Map<String,Object> args=new HashMap<String, Object>();
    args.put("BArgument1", arg1);
    args.put("BArgument2", arg2);
    Window window=Executions.createComponents("BView.zul", parent, args);
    return window;
}
link publish delete flag offensive edit

Comments

When this createWindow will be called ? what is pros and cons of getting in doaftercompose and in createwindow ?

Senthilchettyin ( 2013-01-25 10:34:18 +0800 )edit

createWindow will be called in AComposer (or any other Composer opening the B window). createWindow is used to load the Zul file and build component tree. doAfterCompose is called when Zul file is loaded and component tree built.

gquintana ( 2013-01-27 20:31:53 +0800 )edit
0

answered 2013-02-09 08:09:35 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Here you go

link publish delete flag offensive edit

Question tools

Follow

RSS

Stats

Asked: 2013-01-16 08:52:02 +0800

Seen: 291 times

Last updated: Feb 09 '13

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