Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1418

Selectbox: Changing selection after changing a new model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.1
    • 6.0.2, 6.5.0
    • Components

      We have a situation where some Java code is changing a model in a Selectbox (because some other value changed).
      After doing this, we then set a selection on the new model [using model.setSelection() ].
      This work most of the time.
      However:
      1) if something had already been selected in previous model; (e.g. the 3rd element in the list) and,
      2) if the new model has less elements that the element that was previously selected (e.g. new model has 2 elements)
      we get an error. [See stack-trace below]

      at java.util.ArrayList.rangeCheck(Unknown Source)
      at java.util.ArrayList.get(Unknown Source)
      at org.zkoss.zul.ListModelList.getElementAt(ListModelList.java:150)
      at org.zkoss.zul.Selectbox.doSelectionChanged(Selectbox.java:239)
      at org.zkoss.zul.Selectbox.access$000(Selectbox.java:50)
      at org.zkoss.zul.Selectbox$1.onChange(Selectbox.java:221)
      at org.zkoss.zul.AbstractListModel.fireEvent(AbstractListModel.java:61)
      at org.zkoss.zul.ListModelList.fireSelectionEvent(ListModelList.java:423)
      at org.zkoss.zul.AbstractListModel.setSelection(AbstractListModel.java:95)
      at com.visioninfo.zk.ui.LookupSelectbox.buildListbox(LookupSelectbox.java:468)
      at com.visioninfo.zk.ui.LookupSelectbox.parentKeysChanged(LookupSelectbox.java:731)
      at com.visioninfo.zk.ui.LookupSelectbox.handleSelectCascade(LookupSelectbox.java:715)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.visioninfo.ui.EventListenerWrapper.invokeListenerMethod(EventListenerWrapper.java:456)
      at com.visioninfo.ui.EventListenerWrapper.invokeUnderlyingListener(EventListenerWrapper.java:352)
      at com.visioninfo.ui.EventListenerWrapper.onEvent(EventListenerWrapper.java:322)
      at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2736)
      at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2707)
      at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2648)
      at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
      at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1702)
      at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1487)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1204)
      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:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:159)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.visioninfo.web.GlobalFilter.doFilter(GlobalFilter.java:134)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:202)
      at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:175)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
      at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
      at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
      at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
      at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:123)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:168)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      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:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

            vincentjian vincentjian
            darius darius
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: