Re: wicket-event added twice problem
html 2008/8/28 Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> > The other component, did you write the reference to wicket-event in html or > via and header contributer..? > > > Tomasz Prus wrote: > >> I have inluded gmap component which adds wicket-event and i have other >> component with: >> >> > >> src="/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"> >> >>Wicket.Event.add(window, "domready", function() { >>var gallery = new iCarousel("gallery_content", { >>idPrevious: "gallery_previous", >>idNext: "gallery_next", >>idToggle: "undefined", >>item: { >>klass: "gallery_item", >>size: 284 >>}, >>animation: { >>type: "fadeNscroll", >>duration: 600, >>amount: 1 >>} >>}); >>var i = 0; >>while($("thumb" + i) != false) { >> $("thumb" + i).addEvent("click", function(event){ new >> Event(event).stop(); gallery.goTo(this.id.replace(/thumb/,'')); }); >> i++; >>} >> }); >> >> >> and i think that wicket event object is recreated. Please give me some >> advise? >> >> 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> >> >> >> >>> In which Wicket version should be filtered? >>> >>> >>> 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> >>> >>> >>> >>>> Heh :) Lightbox, not livebox >>>> >>>> 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> >>>> >>>> Wicket 1.3.4 >>>> >>>> >>>>> When i add livebox JS script and google maps then livebox doesn't work >>>>> properly because wicket-event is added twice. >>>>> >>>>> 2008/8/27 Matej Knopp <[EMAIL PROTECTED]> >>>>> >>>>> What wicket version? This should be filtered by wicket. >>>>> >>>>> >>>>>> -Matej >>>>>> >>>>>> On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael >>>>>> <[EMAIL PROTECTED]> wrote: >>>>>> >>>>>> >>>>>>> show us some code..:) >>>>>>> >>>>>>> Tomasz Prus wrote: >>>>>>> >>>>>>> >>>>>>>> Hi >>>>>>>> >>>>>>>> I have problem because wicket-event.js is added twice and couse >>>>>>>> >>>>>>>> >>>>>>> error. >>>>>> >>>>>> >>>>>>> (each >>>>>>>> component with wicket-event.js adds it) >>>>>>>> >>>>>>>> Please help, how can i add it only one? >>>>>>>> >>>>>>>> Similar problem is with css files >>>>>>>> >>>>>>>> Best regards, >>>>>>>> Tomek >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> -- >>>>>>> -Wicket for love >>>>>>> >>>>>>> Nino Martinez Wael >>>>>>> Java Specialist @ Jayway DK >>>>>>> http://www.jayway.dk >>>>>>> +45 2936 7684 >>>>>>> >>>>>>> >>>>>>> - >>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> - >>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >> >> > > -- > -Wicket for love > > Nino Martinez Wael > Java Specialist @ Jayway DK > http://www.jayway.dk > +45 2936 7684 > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: wicket-event added twice problem
I have inluded gmap component which adds wicket-event and i have other component with: Wicket.Event.add(window, "domready", function() { var gallery = new iCarousel("gallery_content", { idPrevious: "gallery_previous", idNext: "gallery_next", idToggle: "undefined", item: { klass: "gallery_item", size: 284 }, animation: { type: "fadeNscroll", duration: 600, amount: 1 } }); var i = 0; while($("thumb" + i) != false) { $("thumb" + i).addEvent("click", function(event){ new Event(event).stop(); gallery.goTo(this.id.replace(/thumb/,'')); }); i++; } }); and i think that wicket event object is recreated. Please give me some advise? 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> > In which Wicket version should be filtered? > > > 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> > >> Heh :) Lightbox, not livebox >> >> 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> >> >> Wicket 1.3.4 >>> >>> When i add livebox JS script and google maps then livebox doesn't work >>> properly because wicket-event is added twice. >>> >>> 2008/8/27 Matej Knopp <[EMAIL PROTECTED]> >>> >>> What wicket version? This should be filtered by wicket. >>>> >>>> -Matej >>>> >>>> On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael >>>> <[EMAIL PROTECTED]> wrote: >>>> > show us some code..:) >>>> > >>>> > Tomasz Prus wrote: >>>> >> >>>> >> Hi >>>> >> >>>> >> I have problem because wicket-event.js is added twice and couse >>>> error. >>>> >> (each >>>> >> component with wicket-event.js adds it) >>>> >> >>>> >> Please help, how can i add it only one? >>>> >> >>>> >> Similar problem is with css files >>>> >> >>>> >> Best regards, >>>> >> Tomek >>>> >> >>>> >> >>>> > >>>> > -- >>>> > -Wicket for love >>>> > >>>> > Nino Martinez Wael >>>> > Java Specialist @ Jayway DK >>>> > http://www.jayway.dk >>>> > +45 2936 7684 >>>> > >>>> > >>>> > - >>>> > To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> > For additional commands, e-mail: [EMAIL PROTECTED] >>>> > >>>> > >>>> >>>> - >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >>> >> >
Re: wicket-event added twice problem
In which Wicket version should be filtered? 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> > Heh :) Lightbox, not livebox > > 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> > > Wicket 1.3.4 >> >> When i add livebox JS script and google maps then livebox doesn't work >> properly because wicket-event is added twice. >> >> 2008/8/27 Matej Knopp <[EMAIL PROTECTED]> >> >> What wicket version? This should be filtered by wicket. >>> >>> -Matej >>> >>> On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael >>> <[EMAIL PROTECTED]> wrote: >>> > show us some code..:) >>> > >>> > Tomasz Prus wrote: >>> >> >>> >> Hi >>> >> >>> >> I have problem because wicket-event.js is added twice and couse error. >>> >> (each >>> >> component with wicket-event.js adds it) >>> >> >>> >> Please help, how can i add it only one? >>> >> >>> >> Similar problem is with css files >>> >> >>> >> Best regards, >>> >> Tomek >>> >> >>> >> >>> > >>> > -- >>> > -Wicket for love >>> > >>> > Nino Martinez Wael >>> > Java Specialist @ Jayway DK >>> > http://www.jayway.dk >>> > +45 2936 7684 >>> > >>> > >>> > - >>> > To unsubscribe, e-mail: [EMAIL PROTECTED] >>> > For additional commands, e-mail: [EMAIL PROTECTED] >>> > >>> > >>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >
Re: wicket-event added twice problem
Heh :) Lightbox, not livebox 2008/8/28 Tomasz Prus <[EMAIL PROTECTED]> > Wicket 1.3.4 > > When i add livebox JS script and google maps then livebox doesn't work > properly because wicket-event is added twice. > > 2008/8/27 Matej Knopp <[EMAIL PROTECTED]> > > What wicket version? This should be filtered by wicket. >> >> -Matej >> >> On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael >> <[EMAIL PROTECTED]> wrote: >> > show us some code..:) >> > >> > Tomasz Prus wrote: >> >> >> >> Hi >> >> >> >> I have problem because wicket-event.js is added twice and couse error. >> >> (each >> >> component with wicket-event.js adds it) >> >> >> >> Please help, how can i add it only one? >> >> >> >> Similar problem is with css files >> >> >> >> Best regards, >> >> Tomek >> >> >> >> >> > >> > -- >> > -Wicket for love >> > >> > Nino Martinez Wael >> > Java Specialist @ Jayway DK >> > http://www.jayway.dk >> > +45 2936 7684 >> > >> > >> > - >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >
Re: wicket-event added twice problem
Wicket 1.3.4 When i add livebox JS script and google maps then livebox doesn't work properly because wicket-event is added twice. 2008/8/27 Matej Knopp <[EMAIL PROTECTED]> > What wicket version? This should be filtered by wicket. > > -Matej > > On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael > <[EMAIL PROTECTED]> wrote: > > show us some code..:) > > > > Tomasz Prus wrote: > >> > >> Hi > >> > >> I have problem because wicket-event.js is added twice and couse error. > >> (each > >> component with wicket-event.js adds it) > >> > >> Please help, how can i add it only one? > >> > >> Similar problem is with css files > >> > >> Best regards, > >> Tomek > >> > >> > > > > -- > > -Wicket for love > > > > Nino Martinez Wael > > Java Specialist @ Jayway DK > > http://www.jayway.dk > > +45 2936 7684 > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
wicket-event added twice problem
Hi I have problem because wicket-event.js is added twice and couse error. (each component with wicket-event.js adds it) Please help, how can i add it only one? Similar problem is with css files Best regards, Tomek
Error in test when use Include
Hi, when i included javascript: add(new Include("analytics", "js/analytics_" + getLocale().getLanguage() + ".js")); i have these javascript files in folder src/main/webapp/js and i copied it also to src/test/webapp/js it works in application but test for this page throws error: 4547 [main] ERROR org.apache.wicket.RequestCycle - Unable to read resource as String org.apache.wicket.WicketRuntimeException: Unable to read resource as String at org.apache.wicket.util.resource.AbstractResourceStream.asString(AbstractResourceStream.java:81) at org.apache.wicket.markup.html.include.Include.importUrl(Include.java:258) at org.apache.wicket.markup.html.include.Include.importAbsoluteUrl(Include.java:240) at org.apache.wicket.markup.html.include.Include.importRelativeUrl(Include.java:226) at org.apache.wicket.markup.html.include.Include.importAsString(Include.java:150) at org.apache.wicket.markup.html.include.Include.onComponentTagBody(Include.java:164) at org.apache.wicket.Component.renderComponent(Component.java:2471) at org.apache.wicket.markup.html.WebComponent.onRender(WebComponent.java:60) at org.apache.wicket.Component.render(Component.java:2308) at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1297) at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1427) at org.apache.wicket.Page.onRender(Page.java:1460) at org.apache.wicket.Component.render(Component.java:2308) at org.apache.wicket.Page.renderPage(Page.java:906) at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:231) at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1330) at org.apache.wicket.RequestCycle.request(RequestCycle.java:539) at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:361) at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:346) at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:289) at pl.mainseek.car.wicket.CommonWebPageTest.testDisplay(CommonWebPageTest.java:9) 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 org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.apache.wicket.util.resource.ResourceStreamNotFoundException: Resource http://localhost/MockCarPartsApplication/js/analytics_pl.js could not be opened at org.apache.wicket.util.resource.UrlResourceStream.getInputStream(UrlResourceStream.java:200) at org.apache.wicket.util.resource.AbstractResourceStream.asString(AbstractResourceStream.java:67) ... 45 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unkno
Re: strange links
What is the reason? Why it is useful for website and why there is no option to disable it? 2008/6/6 Matej Knopp <[EMAIL PROTECTED]>: > The "dots" are there for a reason. Wicket generates relative URLs. > > -Matej > > On Fri, Jun 6, 2008 at 8:44 AM, Tomasz Prus <[EMAIL PROTECTED]> wrote: > > I have links like this > > > > > > > > in page source. My boss wants i remove these dots. > > > > Can anyone help me ? > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
strange links
I have links like this in page source. My boss wants i remove these dots. Can anyone help me ?
Re: how can ..
hey, can you help me ?!!! 2008/5/23 Tomasz Prus <[EMAIL PROTECTED]>: > What strategy should i use to achive such url: > http://isport.eu/en/premier-league/liverpool-fc/news-19-2008-0.html ? > > 2008/5/23 Jonas <[EMAIL PROTECTED]>: > > Have you looked in the wiki? >> http://cwiki.apache.org/WICKET/reference-library.html >> This might be what you're looking for: >> http://cwiki.apache.org/WICKET/seo-search-engine-optimization.html >> >> >> On Fri, May 23, 2008 at 9:46 AM, Tomasz Prus <[EMAIL PROTECTED]> wrote: >> > My boss wants such urls >> > >> > 2008/5/23 Tomasz Prus <[EMAIL PROTECTED]>: >> > >> >> Do You know SEO optimized urls like >> >> http://www.nabble.com/Page-reload-after-file-upload-td15869570.html ? >> >> >> >> 2008/5/23 Thomas Mäder <[EMAIL PROTECTED]>: >> >> >> >> What are you trying to achieve? Why do you need a text url instead of a >> >>> link >> >>> to a page? >> >>> >> >>> Thomas >> >>> >> >>> On Fri, May 23, 2008 at 9:07 AM, Tomasz Prus <[EMAIL PROTECTED]> >> wrote: >> >>> >> >>> > How can i prepare url like this: ../London/9.html >> >>> > >> >>> > I need that city and advertNumber parameters be always at the end of >> >>> url. >> >>> > >> >>> > Can You help me? >> >>> > >> >>> > >> - >> >>> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> >>> > For additional commands, e-mail: [EMAIL PROTECTED] >> >>> > >> >>> > >> >>> >> >> >> >> >> > >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >
Re: how can ..
What strategy should i use to achive such url: http://isport.eu/en/premier-league/liverpool-fc/news-19-2008-0.html ? 2008/5/23 Jonas <[EMAIL PROTECTED]>: > Have you looked in the wiki? > http://cwiki.apache.org/WICKET/reference-library.html > This might be what you're looking for: > http://cwiki.apache.org/WICKET/seo-search-engine-optimization.html > > > On Fri, May 23, 2008 at 9:46 AM, Tomasz Prus <[EMAIL PROTECTED]> wrote: > > My boss wants such urls > > > > 2008/5/23 Tomasz Prus <[EMAIL PROTECTED]>: > > > >> Do You know SEO optimized urls like > >> http://www.nabble.com/Page-reload-after-file-upload-td15869570.html ? > >> > >> 2008/5/23 Thomas Mäder <[EMAIL PROTECTED]>: > >> > >> What are you trying to achieve? Why do you need a text url instead of a > >>> link > >>> to a page? > >>> > >>> Thomas > >>> > >>> On Fri, May 23, 2008 at 9:07 AM, Tomasz Prus <[EMAIL PROTECTED]> > wrote: > >>> > >>> > How can i prepare url like this: ../London/9.html > >>> > > >>> > I need that city and advertNumber parameters be always at the end of > >>> url. > >>> > > >>> > Can You help me? > >>> > > >>> > - > >>> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >>> > For additional commands, e-mail: [EMAIL PROTECTED] > >>> > > >>> > > >>> > >> > >> > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: how can ..
My boss wants such urls 2008/5/23 Tomasz Prus <[EMAIL PROTECTED]>: > Do You know SEO optimized urls like > http://www.nabble.com/Page-reload-after-file-upload-td15869570.html ? > > 2008/5/23 Thomas Mäder <[EMAIL PROTECTED]>: > > What are you trying to achieve? Why do you need a text url instead of a >> link >> to a page? >> >> Thomas >> >> On Fri, May 23, 2008 at 9:07 AM, Tomasz Prus <[EMAIL PROTECTED]> wrote: >> >> > How can i prepare url like this: ../London/9.html >> > >> > I need that city and advertNumber parameters be always at the end of >> url. >> > >> > Can You help me? >> > >> > - >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >
Re: how can ..
Do You know SEO optimized urls like http://www.nabble.com/Page-reload-after-file-upload-td15869570.html ? 2008/5/23 Thomas Mäder <[EMAIL PROTECTED]>: > What are you trying to achieve? Why do you need a text url instead of a > link > to a page? > > Thomas > > On Fri, May 23, 2008 at 9:07 AM, Tomasz Prus <[EMAIL PROTECTED]> wrote: > > > How can i prepare url like this: ../London/9.html > > > > I need that city and advertNumber parameters be always at the end of url. > > > > Can You help me? > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > >
how can ..
How can i prepare url like this: ../London/9.html I need that city and advertNumber parameters be always at the end of url. Can You help me? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OpenSessionInView and LazyInitializationException
I had such configuration: http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";> contextConfigLocation /WEB-INF/carpartswebsite-servlet.xml org.springframework.web.context.ContextLoaderListener carpartswebsite org.springframework.web.servlet.DispatcherServlet 1 wicket org.apache.wicket.protocol.http.WicketServlet applicationFactoryClassName org.apache.wicket.spring.SpringWebApplicationFactory 1 wicket /* XFireSOAPServlet org.codehaus.xfire.spring.XFireSpringServlet 1 XFireSOAPServlet /services/* OpenSessionInViewFilter pl.mainseek.car.commons.CarPartsOpenSessionInViewFilter OpenSessionInViewFilter /* index.jsp index.html .. and this was working, but when i've changed servlet mapping to filter mapping: http://java.sun.com/xml/ns/j2ee"; xmlns:xsi=" http://www.w3.org/TR/xmlschema-1/"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4"> contextConfigLocation /WEB-INF/carpartswebsite-servlet.xml org.springframework.web.context.ContextLoaderListener WicketFilter org.apache.wicket.protocol.http.WicketFilter applicationFactoryClassName org.apache.wicket.spring.SpringWebApplicationFactory applicationBean wicketApplication WicketFilter /* REQUEST ERROR 404 /404 XFireSOAPServlet org.codehaus.xfire.spring.XFireSpringServlet 1 XFireSOAPServlet /services/* OpenSessionInViewFilter pl.mainseek.car.commons.CarPartsOpenSessionInViewFilter OpenSessionInViewFilter /* index.jsp index.html .. it doesn't work. I get the org.hibernate.LazyInitializationException. Please, help me !!! :)
AjaxLink doesn't work for Wicket 1.3.3 ?
I have AjaxLink which works good in Wicket 1.3.2 but doens't work whe i change version to 1.3.3. package pl.mainseek.car.wicket.components; import java.util.Arrays; import java.util.List; import org.apache.wicket.PageParameters; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.markup.html.form.RequiredTextField; import org.apache.wicket.markup.html.form.StatelessForm; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.Model; import org.apache.wicket.spring.injection.annot.SpringBean; import pl.mainseek.car.dao.CarsDAO; import pl.mainseek.car.entities.CarModel; import pl.mainseek.car.entities.CarPart.Condition; import pl.mainseek.car.wicket.CommonWebPage; import pl.mainseek.car.wicket.models.SearchCarPartsModel; import pl.mainseek.car.wicket.pages.AdvertismentsList; import pl.mainseek.forum.wicket.pages.ForumList; public class SearchPanel extends Panel { public static final String FORUM_OPTION = "forum"; public static final String ADS_OPTION = "ads"; @SpringBean private CarsDAO carsDAO; //keys private static final String ADVANCED_SEARCH_BUTTON_KEY = "advanced.search.button"; //wicket:ids public static final String SEARCH_FORM = "search_form"; public static final String CONDITION = "condition"; public static final String CAR_MODEL = "carModel"; public static final String CAR_MARK = "carMark"; public static final String QUERY = "query"; public static final String ADVANCED_SEARCH = "advanced_search"; public static final String SEARCH_BUTTON = "search_button"; public static final String SEARCH_WHERE = "searchWhere"; private final DropDownChoice searchWhereDDC, carMarkDDC, carModelDDC, conditionDDC; private final RequiredTextField queryField; private final String[] searchWhereKeys = new String[] {ADS_OPTION, FORUM_OPTION}; //model private SearchCarPartsModel carPartsModel; public SearchPanel(String id, SearchCarPartsModel model) { super(id); this.carPartsModel = model; final Form searchForm = new StatelessForm(SEARCH_FORM, new CompoundPropertyModel(carPartsModel)) { @Override protected void onSubmit() { super.onSubmit(); setRedirect(true); PageParameters pageParameters = new PageParameters(); pageParameters.add("query", carPartsModel.getQuery()); if(carPartsModel.getCarModel() != null) { pageParameters.add("carModel", String.valueOf(carPartsModel.getCarModel().getId())); } else if(carPartsModel.getCarMark() != null) { pageParameters.add("carMark", String.valueOf(carPartsModel.getCarMark().getId())); } if(carPartsModel.getSearchWhere().equals(ADS_OPTION)) { if(carPartsModel.getCondition() != null) { pageParameters.add("condition", carPartsModel.getCondition().toString().toLowerCase()); } setResponsePage(AdvertismentsList.class, pageParameters); } else if(carPartsModel.getSearchWhere().equals(FORUM_OPTION)) { setResponsePage(ForumList.class, pageParameters); } } }; searchForm.setOutputMarkupId(true); queryField = new RequiredTextField(QUERY); searchWhereDDC = getSearchWhereDDC(searchForm); conditionDDC = getConditionDDC(searchForm); List carModels = carsDAO.getCarModels(carPartsModel.getCarMark()); carModelDDC = getCarModelDDC(carModels); carMarkDDC = getCarMarkDDC(carModels); carMarkDDC.setVisible(false); carModelDDC.setVisible(false); conditionDDC.setVisible(false); searchForm.add(queryField); searchForm.add(searchWhereDDC); searchForm.add(conditionDDC); searchForm.add(carMarkDDC); searchForm.add(carModelDDC); final AjaxLink advancedSearch = new AjaxLink(ADVANCED_SEARCH) { @Override public void onClick(AjaxRequestTarget target) { carMarkDDC.setVisible(!carMarkDDC.isVisible()); carModelDDC.setVisible(!carModelDDC.isVisible()); conditionDDC.setVisible(!carModelDDC.isVisible()); if(carMarkDDC.isVisible()){ carMarkDDC.setChoices(carsDAO.getAllCarMarks()); } target.addComponent(searchForm); } }; searchForm.add(advancedSearch); searc
Re: I have an error when try to test submit using FormTester
Thank You very many :) I overide method newRequestCycleProcessor in my MockApplication and submit works now for me: @Override protected IRequestCycleProcessor newRequestCycleProcessor() { IRequestCycleProcessor newRequestCycleProcessor = super.newRequestCycleProcessor(); return new UrlCompressingWebRequestProcessor() { @Override protected IRequestTarget resolveListenerInterfaceTarget(final RequestCycle requestCycle, final Page page, final String componentPath, String interfaceName, final RequestParameters requestParameters) { String pageRelativeComponentPath = Strings.afterFirstPathComponent(componentPath, Component.PATH_SEPARATOR); Component component = null; if (page instanceof WebPage && !"IResourceListener".equals(interfaceName)) { //ComponentAndInterface cai = ((WebPage)page).getUrlCompressor().getComponentAndInterfaceForUID(pageRelativeComponentPath); UrlCompressor.ComponentAndInterface cai = null; if (cai != null) { interfaceName = cai.getInterfaceName(); component = cai.getComponent(); } } requestParameters.setInterfaceName(interfaceName); if (interfaceName.equals(IRedirectListener.INTERFACE.getName())) { return new RedirectPageRequestTarget(page); } else if (interfaceName.equals(INewBrowserWindowListener.INTERFACE.getName())) { return INewBrowserWindowListener.INTERFACE.newRequestTarget(page, page, INewBrowserWindowListener.INTERFACE, requestParameters); } else { // Get the listener interface we need to call final RequestListenerInterface listener = RequestListenerInterface .forName(interfaceName); if (listener == null) { throw new WicketRuntimeException( "Attempt to access unknown request listener interface " + interfaceName); } // Get component if (component == null) { if (Strings.isEmpty(pageRelativeComponentPath)) { component = page; } else { component = page.get(pageRelativeComponentPath); } } if (component == null) { // still null? that's not right throw new WicketRuntimeException("cannot resolve component with path '" + pageRelativeComponentPath + "', listener " + listener + " on page " + page); } if (!component.isEnableAllowed()) { throw new UnauthorizedActionException(component, Component.ENABLE); } // Ask the request listener interface object to create a request // target return listener.newRequestTarget(page, component, listener, requestParameters); } } }; }
Re: I have an error when try to test submit using FormTester
Can You give mi more details how remove the UrlCompressingWebRequestProcessor because i don't have any idea? >
I have an error when try to test submit using FormTester
I have test and formTester.submit(); throws an error: java.lang.NumberFormatException: For input string: "p:form" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at org.apache.wicket.protocol.http.request.urlcompressing.UrlCompressor.getComponentAndInterfaceForUID(UrlCompressor.java:122) at org.apache.wicket.protocol.http.request.urlcompressing.UrlCompressingWebRequestProcessor.resolveListenerInterfaceTarget(UrlCompressingWebRequestProcessor.java:79) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:461) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1224) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331) at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:401) at org.apache.wicket.util.tester.FormTester.submit(FormTester.java:617) at pl.mainseek.forum.wicket.components.AddQuestionPanelTest.testSubmit(AddQuestionPanelTest.java:48) 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 org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Sources: public class AddQuestionPanelTest extends AbstractWebPageContext { private static final String FORM_PATH = DummyPageWithAddQuestionPanel.PANEL_NAME + ":" + AddQuestionPanel.FORM_NAME; private FakeForumService forumService; @Before public void setUp() throws Exception { super.setUp(); forumService = MockFactory.makeMock(FakeForumService.class); getMockContext().putBean("forumService", forumService); } @Test public void testCreate() { getTester().startPage(DummyPageWithAddQuestionPanel.class); getTester().assertRenderedPage(DummyPageWithAddQuestionPanel.class); getTester().assertNoErrorMessage(); getTester().assertComponent(DummyPageWithAddQuestionPanel.PANEL_NAME, Panel.class); getTester().assertComponent(FORM_PATH, Form.class); getTester().assertComponent(FORM_PATH + ":" + AddQuestionPanel.SUBJECT, RequiredTextField.class); getTester().assertComponent(FORM_PATH + ":" + AddQuestionPanel.BODY, TextArea.class); } @Test public void testSubmit() { getTester().startPage(DummyPageWithAddQuestionPanel.class); FormTester formTester = getTester().newFormTester(FORM_PATH); formTester.setValue(AddQuestionPanel.SUBJECT, "s"); formTester.setValue(AddQuestionPanel.BODY, "b"); getTester().debugComponentTrees(); formTester.submit(); } } public class AddQuestionPanel extends Panel { public static final String ADD_QUESTION_BUTTON = "addQuestionButton"; public static final String SUBJECT = "subject"; public static final String BODY = "body"; public static final String FORM_NAME = "form"; private Message message; public AddQuestionPanel(String id, final User user, final MessageService forumService) { super(id); message = new Message("", "", user);