Problem in Sending value from one controller to other
19 Jul 2011 04:16:33 GMT
21 Jul 2011 12:36:07 GMT
21 Jul 2011 12:36:07 GMT
Hi Chaitu405,
you can try set/get attribute on session or application scope,
or try Event queue
ZK - Open Source Ajax Java Framework
How to get value from one controller to Other without Window Id (onCreate will not fire without ID).I have fired forward Event for the Oncreate Event of the Window in doBeforeCompose method.
But listmodel methods are getting executed before onCreateEvent how can i solve this issue .
Below are my Zul and Controller Files
<?xml version="1.0" encoding="UTF-8"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<window apply="${opportunityListCtrl}" height = "auto">
<listbox model="${opportunityListCtrl}"
itemRenderer="${itemRenderer}" vflex="true"
tooltiptext="${c:l('listbox.tooltiptext')}" width="100%"
height="100%">
<listhead sizable="true">
<listheader label="${c:l('listheader_ProdCode.label')}" sort="auto"
width="40%" />
<listheader label="${c:l('listheader_LeadGenerated.label')}" sort="auto"
width="10%" />
<listheader label="${c:l('listheader_SystemGenerated.label')}" sort="auto"
width="10%" />
<listheader label="${c:l('listheader_RecordStatus.label')}" sort="auto"
width="20%" />
<listheader label="${c:l('listheader_RecordType.label')}" sort="auto"
width="20%" />
</listhead>
</listbox>
</window>
</zk>
Controller
public class OpportunityListCtrl extends GFCBaseListCtrl<Opportunity> implements
Serializable, ListModel,ComposerExt {
public void doBeforeComposeChildren(Component comp) throws Exception {
super.doBeforeComposeChildren(comp);
Window win = (Window)comp;
ComponentsCtrl.applyForward(win, "onCreate=onCreateWindow");
}
/**
* This method is forwarded from the listboxes item renderer. <br>
* see: com.pennant.webui.masters.opportunity.model.
* OpportunityListModelItemRenderer.java <br>
*
* @param event
* @throws Exception
*/
public void onCreateWindow(Event event) throws Exception {
logger.debug(event.toString());
final Map<String, Object> args = getCreationArgsMap(event);
if (args.containsKey("CustomerCIF")) {
setCustCif((String) args.get("CustomerCIF"));
}
}
public List<Opportunity> getAllCustomerCategory() {
if (allOpportunities == null) {
allOpportunities = OpportunityDAO.getAllOpportunities();
}
return allOpportunities;
}
public void setAllCustomerCategory(List<Opportunity> allOpportunities) {
this.allOpportunities = allOpportunities;
}
public void addListDataListener(ListDataListener arg0) {
// TODO Auto-generated method stub
}
@SuppressWarnings("null")
public Object getElementAt(int i) {
// TODO Auto-generated method stub
if (getAllCustomerCategory().size() > 0)
return getAllCustomerCategory().get(i);
else {
EmptyMeassage.add("No Opportunity Found For this Customer");
return EmptyMeassage;
}
// TODO Auto-generated method stub
}
public int getSize() {
// TODO Auto-generated method stub
if (getAllCustomerCategory().size() != 0) {
return getAllCustomerCategory().size();
} else {
return 1;
}
}
public void removeListDataListener(ListDataListener arg0) {
// TODO Auto-generated method stub
}
public String getCustCif() {
return custCif;
}
public void setCustCif(String custCif) {
this.custCif = custCif;
}
}