Showing posts with label ZK Calling Another ZUL. Show all posts
Showing posts with label ZK Calling Another ZUL. Show all posts

ZK Passing Parameter between two files using MVVM–Part 2

Overview

This is the first series of articles about Passing parameter between two zul files using MVVM Design pattern.This article will focus on the how to pass values from the parent window to child window opened in modal mode.

ZK Passing Parameter between two files using MVVM–Part 1

Overview

This is the first series of articles about Passing parameter between two zul files using MVVM Design pattern.This article will focus on the how to pass values from the parent window to child window opened in modal mode.

ZK Passing Parameter between two files using MVC - Part 5.

Overview

This is the fifth series of articles about Passing parameter between two zul files using MVC Design pattern.This article will focus on the How to return values from the child window (Modal) to the Calling Parent Window using sendevent.

ZK Passing Parameter between two files using MVC - Part 4.

Overview

This is the fourth series of articles about Passing parameter between two zul files using MVC Design pattern.This article will focus on the How to return values from the child window (Modal) to the Calling Parent Window.

ZK Passing Parameter between two files using MVC - Part 6

Overview

This is the sixth series of articles about Passing parameter between two zul files using MVC Design pattern.This article contains real world example for passing and returning values from the window.

ZK Passing Parameter between two files using MVC - Part 3.

Overview

This is the third of a series of articles about Passing parameter between two zul files using MVC Design pattern.This article will focus on the How to pass some arguments from one window to modal window.

ZK Passing Parameter between two files using MVC - Part 2.

Overview

This is the second of a series of articles about Passing parameter between two zul files using MVC Design pattern.This article will focus on the How to pass some arguments from one window to modal window. 

ZK Passing Parameter between two files using MVC - Part 1.

Overview

This is the first of a series of articles about Passing parameter between two zul files using MVC Design pattern.This article will focus on the How to pass some arguments from one window to modal window.

ZK Executions.createComponents

 

Example 1:

Using MVC, we will see how we can call another ZUL File and pass arguments to the ZUL File

image

Step : 1

Demo.Zul file

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal"
apply="myUI.DemoComposer">
<button id="Create" label="Show Window" onClick="" />
</window>
</zk>


 


Step : 2


DemoComposer.java


package myUI;
import java.util.HashMap;

import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.GenericForwardComposer;

public class DemoComposer extends GenericForwardComposer
{
public void onClick$Create(Event event)
{
final HashMap<String, Object> map = new HashMap<String, Object>();
map.put("fname", "senthil");
map.put("lname", "Nathan");
Executions.createComponents("Person.zul",null,map);
}
}


 


Step : 3


<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="win" width="420px" height="110px"
border="normal" minimizable="false" mode="modal" maximizable="false"
closable="true" action="show: slideDown;hide: slideUp">

<grid width="400px">
<rows>
<row>
First Name:
<textbox value="${arg.fname}" />
</row>
<row>
Last Name:
<textbox value="${arg.lname}" />
</row>
</rows>
</grid>
</window>
</zk>


Step : 4


image

ZK Calling Another ZUL File

Method 1


<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal">
New Content Here!
<button label="click me" href="../main/Practice.zul"/>
</window>
</zk>


Method 2


<zk>
  <window id="mainwin" border="normal" title="hello" xmlns:c="client">
 
  <button label="Practice">
          <attribute name="onClick">
            Executions.createComponents("../main/Practice.zul",mainwin,null);
          </attribute>
    </button>
  </window>
</z