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

UI samples BOrderlayout problem

techvts
25 Jan 2010 03:07:31 GMT
25 Jan 2010 03:07:31 GMT

I had used borderlayout from UI samples i am calling country.zul in borderlayout.zul.my country.zul is created by using form builder when i run country.zul individual it loads whole country list properly but when list is loaded from borderlayout.zul's country's link the country.zul is loaded but only one row of particular page is displayed instead of dispalying all items.but we give particular country name to search that row is displayed i can't understand why whole list is not displayed in borderlayout.zul

plz help

samchuang
31 Jan 2010 03:18:18 GMT
31 Jan 2010 03:18:18 GMT

Hi

Could you try to link to country.zul to try if it load correctly?

techvts
3 Feb 2010 23:24:37 GMT
3 Feb 2010 23:24:37 GMT

I had tried all the ways. i don't understand where the problem is? can list box paging can affect the display of list data?
or when we call country;s link it is called in content Div of borderlayout.zul page so the parent component of country.zul is changed so that may be problem
so what should i do.

techvts
3 Feb 2010 23:40:11 GMT
3 Feb 2010 23:40:11 GMT

here is source code
borderlayout.zul

<zk>
	<window id="main" width="100%" height="100%" apply="zkadsmine.borderlayout.BorderLayoutComposer">
		<borderlayout>
			<north size="70px">
				<div>
					<html><![CDATA[
						<h2 style="color:#0C7A9A;margin-left:10px">Border Layout Sample</h2>
						
					]]></html>
				</div>
			</north>
			<west size="200px" splittable="true" flex="true" collapsible="true" title="Functions"> 
				<listbox id="menuListbox" />	
			</west>
			<center flex="true">
				<div id="contentDiv">
					
				</div>
			</center>
			
			<south size="20px">
				<hbox pack="center" width="100%">
					<html><![CDATA[
						<span style="color:#0C7A9A"> VTSZK </span>
					]]></html>
				</hbox>
			</south>
		</borderlayout>
	</window>
</zk>


BorderLayoutComposer.jaa

public class BorderLayoutComposer extends GenericForwardComposer{

ListModelList menuModel = new ListModelList();
Listbox menuListbox;
MenuNodeSelectListener listener = new MenuNodeSelectListener();
MenuNodeItemRenderer renderer = new MenuNodeItemRenderer();
Div contentDiv;


public BorderLayoutComposer(){
menuModel.add(new MenuNode("Country","country.zul"));


}


public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
menuListbox.setModel(menuModel);
menuListbox.setItemRenderer(renderer);
menuListbox.addEventListener(Events.ON_SELECT,listener);
}

class MenuNode {
String label;
String link;
public MenuNode(String label,String link){
this.label = label;
this.link = link;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
}

class MenuNodeItemRenderer implements ListitemRenderer{

public void render(Listitem item, Object data) throws Exception {
MenuNode node = (MenuNode)data;
//item.setImage("icon-24x24.png");
item.setLabel(node.getLabel());
item.setValue(node);
}
}

class MenuNodeSelectListener implements EventListener{

public void onEvent(Event event) throws Exception {
Listitem item = menuListbox.getSelectedItem();
System.out.println("ITEM :"+item.getValue());
System.out.println("content Div chidren:"+contentDiv.getChildren());
contentDiv.getChildren().clear();


//contentDiv.getAttributes(COMPONENT_SCOPE);
//contentDiv.getAttributed(REQUEST_SCOPE);
if(item!=null){
MenuNode node = (MenuNode)item.getValue();
Executions.createComponents(node.getLink(),contentDiv,null);

}


}

}}


country.zul

<?xml version="1.0" encoding="UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="countryWin" width="100%" height="100%" ctrlKeys="#up#down">
<borderlayout>
<north size="60px">
<borderlayout>
<center border="none" style="background-color:#B1CBD5">
<html><![CDATA[<h2 style="color:#0C7A9A;margin-left:10px">country List Management</h2>]]></html></center>
<east border="none" style="background-color:#B1CBD5">
<toolbarbutton src="img/zkpowered_s.png" href="http://www.zkoss.org"/></east>
</borderlayout>
</north>


<west size="640px" splittable="true" flex="true">
<borderlayout id="beanSummary"><!-- ******************** Extra Control ******************** -->
<north border="none" visible="@{countryController.supportExtra}">
<div>
<hbox visible="@{countryController.supportFilter}">Filter:
<textbox id="beanSearch" value="@{countryController.filter}"/>
<button id="countryQuery" label="Query"/>
</hbox>
<paging id="countryPaging" totalSize="@{countryModel.totalSize}"
visible="@{countryController.supportPaging}"/>
</div>
</north>
<center border="none" flex="true"><!-- ******************** List View of Table ******************** -->
<listbox id="countryDataListView" multiple="false" model="@{countryModel.all}"
selectedItem="@{countryModel.selected}" style="border:none">
<listhead sizable="true"><!-- ******************** Generated By Bean Field Def ******************** -->
<listheader id="country_idHeader" label="Country_id" />
<listheader id="country_nameHeader" label="Country_name" />

</listhead>
<listitem self="@{each=zx1}"><!-- ******************** Generated By Bean Field Def ******************** -->
<listcell label="@{zx1.country_id}"/>
<listcell label="@{zx1.country_name}"/>

</listitem>
</listbox>
</center>
</borderlayout>
</west>
<center>
<div id="countryDetail">
<!-- ******************** view mode ******************** -->
<div id="beanView" visible="@{countryController.viewMode}" width="100%">
<grid width="100%" >
<columns>
<column align="right" width="108px"/>
<column align="left"/>
</columns>
<rows><!-- ******************** Generated By Field Def ******************** -->
<row>Country_id :<label value="@{countryModel.selected.country_id}"/></row>
<row>Country_name :<label value="@{countryModel.selected.country_name}"/></row>

</rows>
</grid>
<separator/>
<div align="right">
<hbox>
<button id="countryCreate" label="New"/>
<button id="countryUpdate" label="Edit" disabled="@{countryController.notSelected,load-when='countryDataListView.onSelect'}"/>
<button id="countryDelete" label="Delete" disabled="@{countryController.notSelected,load-when='countryDataListView.onSelect'}"/>
</hbox>
</div>
</div>

<!-- ******************** edit mode ******************** -->
<div id="countryEdit" visible="@{countryController.editMode}">
<grid width="100%" fixedLayout="true">
<columns>
<column align="right" width="108px"/>
<column align="left"/>
</columns>
<rows><!-- ******************** Generated By Field Def ******************** -->
<row>Country_id :<intbox id="country_id" value="@{countryModel.selected.country_id,save-when=none,access=load}" disabled="true" /></row>
<row>Country_name :<textbox id="country_name" value="@{countryModel.selected.country_name,save-when=none}"/></row>

</rows>
</grid>
<separator/>
<div align="right">
<hbox>
<button id="countrySave" label="Save"/>
<button id="countryCancel" label="Cancel"/>
</hbox>
</div>
</div>
</div>
</center>
</borderlayout>
</window>
</zk>


plz help .
do u need screen shot plz give u r email id

samchuang
4 Feb 2010 04:32:18 GMT
4 Feb 2010 04:32:18 GMT

Hi

in your country.zul, I don't see where does countryController come from ?

you could check the small talks, it talks about how to use data binding
ListModel and Databinding Enhanced Combobox

CPons
4 Feb 2010 16:31:32 GMT
4 Feb 2010 16:31:32 GMT

Anyone has solved this issue? I have the same problem using Borderlayout and a ZUL file created with form builder.

Thanks in advance for your help.