Quantcast

Problem with wiquery Slider in a ListView

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem with wiquery Slider in a ListView

odin568
Hi,
I'm planning to do the following:

I get Infos from a JSONserver which tells me how much sliders I need, saves the values, etc. Works fine, not more is needed here. Every Slider is an Element in a ListView. (Works)

Now I want to add a ListView and in it create a slider and save the value. So at the end I i.e. have 4 Sliders generated from my ListView. (Works)

Later, I want to read the Values after clicking a Submit button.

Now my Problem: I see the Sliders, but when I touch one, I get the following Error:

Root cause:

java.lang.IllegalArgumentException: component cannot be null
at org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:342)
at probe.webclient.pages.expert.ExpertPanel$1$1.respond(ExpertPanel.java:61)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:302)
at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:157)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
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:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
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:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)




Here is my Code - It's mostly the official example, just packed into a Listview...

                add(new ListView<VirtualAttributes>("sliderlist", sliderlist) {
                        private static final long serialVersionUID = 1L;
                       
                        private AbstractDefaultAjaxBehavior sliderBehavior;
                        private int sliderValue;
                        private Label sliderLabel;
                        private Slider slider;
                       
                        @Override
            protected void populateItem(ListItem<VirtualAttributes> item) {
                                final VirtualAttributes s = item.getModelObject();
                               
                                sliderValue = 0;
                                sliderBehavior = new AbstractDefaultAjaxBehavior() {
                                        private static final long serialVersionUID = 1L;
                                        @Override
                                        protected void respond(AjaxRequestTarget target) {
                                                sliderValue = Integer.parseInt(this.getComponent().getRequest().getParameter("sliderValue"));
                                                target.addComponent(sliderLabel);
                                                s.setValue(sliderValue/100);
                                        }
                                };
                                item.add(sliderBehavior);
                                slider = new Slider("slider", 0, 100);
                                slider.setChangeEvent(
                                                new DefaultJsScopeUiEvent(
                                                                "wicketAjaxGet('" + sliderBehavior.getCallbackUrl(true)
                                                                + "&sliderValue='+" + Slider.UI_VALUE
                                                                + ", null,null, function() {return true;})"));
                                item.add(slider);


                                Label sliderLabel = new Label("sliderLabel", new PropertyModel(this, "sliderValue"));
                                sliderLabel.setOutputMarkupPlaceholderTag(true);
                                item.add(sliderLabel);
            }
        });
Loading...