0

ZK 6 MVVM Server Side pagging, ui accesing ghost data

asked 2012-04-26 22:13:30 +0800

moyacuba gravatar image moyacuba
6

My app implemnts a server side paggin using zk6, mvvm pattern, spring-jdbc, oracle, but the problem resides in the ui engine fails (not failing... it never get executed due I did monitor with breakpoint and the error is show up but the method is never executed) to execute the binding from the paging control ... so the listbox ui fails to acess the model showing an error related to access a member on a null referenced domain object...

The error is not consistent... I mean sometimes I can use the pagging just fine... then ctrl+f5 and the error show up... it is always in the paging action... never on the first print... some time it fails on 1->2 paging action but works on 2->3... without any rule... just random ... it is like a bad joke...

I did add a breakpoint in all methods in the vm bean... and the error show up when the engine does not call the setActivePage setter method...

another weird issue is the error seems to be related to the ui accesing the "columns" property on a "null" reference of the "DatosCol" domain object... but the <listitem visible="@load(!empty rowitem.columns)" ... should stop that... shouldn't it? I did also tried <listitem visible="@load(!empty rowitem)" and it fails too...

The error log:


GRAVE: >>org.zkoss.zel.PropertyNotFoundException: Propiedad 'columns' no hallada en el tipo eme.aplicaciones.emear.domain.DatoCol
>>	at org.zkoss.zel.BeanELResolver$BeanProperties.get(BeanELResolver.java:258)
>>	at org.zkoss.zel.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:209)
>>	at org.zkoss.zel.BeanELResolver.property(BeanELResolver.java:368)
>>	at org.zkoss.zel.BeanELResolver.getValue(BeanELResolver.java:85)
>>	at org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
>>	at org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
>>	at org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:71)
>>	at org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:64)
>>	at org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:179)
>>	at org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
>>	at org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40)
>>	at org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:44)
>>	at org.zkoss.bind.impl.LoadChildrenBindingImpl.load(LoadChildrenBindingImpl.java:44)
>>	at org.zkoss.bind.impl.BinderImpl.loadOnPropertyChange(BinderImpl.java:342)
>>	at org.zkoss.bind.impl.BinderImpl.access$100(BinderImpl.java:92)
>>	at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:228)
>>	at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145)
>>	at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2741)
>>	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2712)
>>	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2653)
>>	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
>>	at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1699)
>>	at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1484)
>>	at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1201)
>>	at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:558)
>>	at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:456)
>>	at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:464)
>>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
>>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>>	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>>	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
>>	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>>	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>>	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>>	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>>	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
>>	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>>	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
>>	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:279)
>>	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
>>	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
>>	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>	at java.lang.Thread.run(Thread.java:662)


The zul file:


<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<borderlayout
	id="vReportBrowser"
	apply="org.zkoss.bind.BindComposer"
	viewModel="@id('vm1') @init(bReportBrowserVM)"
>
	<west collapsible="true" open="false" splittable="true" flex="true" width="25%">
		<vbox>
			<label value="Filtros" />
		</vbox>
	</west>
	<center>
		<borderlayout>
			<north border="none">
				<toolbar>
					<toolbarbutton label="Exportar a PDF"/>
					<toolbarbutton label="Exportar a Excel"/>
					<toolbarbutton label="Exportar a Word"/>
				</toolbar>
			</north>
			<center border="none"> 
				<listbox model="@bind(vm1.datos)" height="465" visible="@load(!empty vm1.datos)">
					<listhead children="@bind(vm1.columnas) @template('listheadercolumna')">
						<template name="listheadercolumna" var="citem">
							<listheader label="@bind(citem.label)" sort="none" />
						</template>
					</listhead>
					<template name="model" var="rowitem">
						<listitem visible="@load(!empty rowitem.columns)" children="@bind(rowitem.columns) @template('listvaluesdatos')">
							<template name="listvaluesdatos" var="ditem">
								<listcell label="@bind(ditem.valor)" />
							</template>
						</listitem>
					</template>
				</listbox>
			</center>
			<south border="none">
				<paging pageSize="@load(vm1.pageSize)" totalSize="@load(vm1.totalSize)" activePage="@bind(vm1.activePage)"/>
			</south>
		</borderlayout>
	</center>
</borderlayout>


the bReportBrowserVM bean code:


@Component("bReportBrowserVM")
@Scope("prototype")
public class ReportBrowserVM {

	@Autowired
	private ColumnaService columnaService;

	@Autowired
	private DatoService datosService;

	private Reporte reporteAbierto;
	private List<Columna> columnas;
	private List<Dato> datos; // added in an attempt to avoid the garbage collector but the error remains
	private Integer activePage = 0;
	private Integer pageSize = 16;

	@NotifyChange({"reporteAbierto","columnas", "activePage", "totalSize", "datos"})
	@GlobalCommand
	public void openReporte(@BindingParam("reporte") Reporte reporte) {
		this.reporteAbierto = reporte;
		this.columnas = columnaService.getListColumna(reporteAbierto);
		this.activePage = 0;
	}

	public Integer getTotalSize() {
		return (reporteAbierto==null?null:datosService.getListDatoTotalSize(reporteAbierto, columnas));
	}

	@NotifyChange({"activePage", "datos"})
	public void setActivePage(Integer activePage) {
		this.activePage = activePage;
	}
	
	public List<Dato> getDatos() {
		List<Dato> nxtDatos =(reporteAbierto==null?null:datosService.getListDatoPaginado(reporteAbierto, columnas, activePage, pageSize)); 
		datos = nxtDatos;
		return datos;
	}

	// remaining autogenerated setters and getters methods

}



Thanks for your help in advance...

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-09-17 16:29:49 +0800

crime001 gravatar image crime001
3

@VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class)
@Component("bReportBrowserVM")
@Scope("prototype")
public class ReportBrowserVM {

@WireVariable("ColumnaService")
private ColumnaService columnaService;

@WireVariable("DatoService")
private DatoService datosService;
.......
.......
}


Try this. Bye

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-04-26 22:13:30 +0800

Seen: 256 times

Last updated: Sep 17 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More