ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

Multiple view models in same page

tlacerda
18 Dec 2011 17:26:29 GMT
18 Dec 2011 17:26:29 GMT

Hi folks!

I have one view model that i want to reuse in a master/detail page.
Is there any way to make the master viewmodel notify (or change directly) one property of the detail viewmodel?

Thanks in advance!
Best Regards

Thiago Lacerda

tlacerda
2 Jan 2012 14:13:55 GMT
2 Jan 2012 14:13:55 GMT

Nobody?

mixgho
3 Jan 2012 09:50:11 GMT
3 Jan 2012 09:50:11 GMT

You can send events from one Window to another or pass arguments via Executions.getCurrent().setAttribute(name, value) when navigating to the new page

tlacerda
3 Jan 2012 18:32:12 GMT
3 Jan 2012 18:32:12 GMT

Can you please send me a example? Wow can i sent this event via ajax?

xcom
3 Jan 2012 19:02:10 GMT
3 Jan 2012 19:02:10 GMT

Window A call Window B

you send argument pass for window A to Windo B

in controller Window A

public void btnPassWinB$onClick(Event event){
     HashMap<String,object> mapArg=new HasMap();
     mapArg.put("myObject",youObject);
     Executions.createCompnents("ruta/windowB.zul",null,mapArg)
      
}

in Controller window B

public void doAfterCompose(Component comp)throws Exception{
           map=(map<String,Object>)Excution.getCurrent().getDesktop();
           myModel=map.get("myObject",youObject)
          map.clear.
}


otherwise

separate and create you model

.
you model send a Window B

.........................
myListbox.setModel(myModel);
map.put("youModel",myModel);
......................

in controller B

MyModel modelList=map.get("youModel")
modelList.add().....modelList.delete().....model.getIndexSelected()................................

otherwise

integrate spring and model pass argument facade spring.

you objet spring
springObject.get("myModel");
en you xml
<bean id="myModel" class="youPackageModel" .......>
en you Window B
spring.getBean("myModel"......)......

otherwise

create singleton y pass model a clase singleton.

many ways in order to update its model

espero que te sirva.

Eric Rosas Lizama