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-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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.
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
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.
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;
}
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 )editHere you go
Asked: 2013-01-16 08:52:02 +0800
Seen: 291 times
Last updated: Feb 09 '13
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 )editAny update from ZK Team ?
Senthilchettyin ( 2013-01-17 18:43:43 +0800 )editAny help from ZK Team ?
Senthilchettyin ( 2013-01-24 05:39:31 +0800 )editCan Paowang's answer help you?
hawk ( 2013-01-25 06:11:58 +0800 )editThank 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