SV: Quick fix for the dreaded org.hibernate.LazyInitializationException with WicketTester
After about 5 minutes of omfg not that error again, I think I found a quick hack to avoid org.hibernate.LazyInitializationException with WicketTester. I've checked everywhere on the lists but didn't find a similar solution, so apologies if someone else already posted this. There may also be a better way to do it. I thought the medicine against LazyInitializationException was spring-hibernate's OpenSessionInViewFilter, where you leave to the filter to open and close the session at the beginning and end of the request? - Tor Iver - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Quick fix for the dreaded org.hibernate.LazyInitializationException with WicketTester
Yes this works when running the program in the Application Server environment. For JUnit testing (outside of the AS), I ran into this problem. Is there maybe a better way to maybe wrap the OSIV Filter around Unit Tests? On Tue, Feb 16, 2010 at 9:07 AM, Wilhelmsen Tor Iver toriv...@arrive.nowrote: I thought the medicine against LazyInitializationException was spring-hibernate's OpenSessionInViewFilter, where you leave to the filter to open and close the session at the beginning and end of the request? - Tor Iver - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Quick fix for the dreaded org.hibernate.LazyInitializationException with WicketTester
all you have to do is start a transaction before each unit test and roll it back after. spring has base unit tests and test runners that do this for you... -igor On Tue, Feb 16, 2010 at 12:13 AM, Leon Nieuwoudt leon.nieuwo...@gmail.com wrote: Yes this works when running the program in the Application Server environment. For JUnit testing (outside of the AS), I ran into this problem. Is there maybe a better way to maybe wrap the OSIV Filter around Unit Tests? On Tue, Feb 16, 2010 at 9:07 AM, Wilhelmsen Tor Iver toriv...@arrive.nowrote: I thought the medicine against LazyInitializationException was spring-hibernate's OpenSessionInViewFilter, where you leave to the filter to open and close the session at the beginning and end of the request? - Tor Iver - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
FormComponents and feedback messages inside a listview
Hello List, I have ran a couple of times whilst developing some pages using wicket into the following issue. The page will contain a Form, containing a ListView of FormComponents The FormComponents are created within the ListView with a feedback panel attached to each of em. The feedback panels are attached to the FormComponents using a ComponentFeedbackMessageFilter. On submit, validation fails for some FormComponents, and the feedback messages are generated ok, but are nevered rendered due to the original FormComponent not being found. This is understandable as they are created inside the ListView so when wicket tries to find the reporter of the feedback message, it does not find it anymore, new FormComponents were created. So the solution to this is to create them outside the listview so they dont get regenerated on each rendering. I was wondering if this is the correct way to handle such a situation, or should I be using a different approach to not fall into this? Kind regards, Wim.
Re: Quick fix for the dreaded org.hibernate.LazyInitializationException with WicketTester
Hi Igor Glad to hear there's another way. I'm already using the Spring JUnit runner, like this: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class UserTest extends . { @Test public void testCRUD() { // Code... } } This what I tried: * Adding @Transactional over testCRUD() out of desperation * Subclassing the base tester from AbstractTransactionalDataSourceSpringContextTests, according to the docs this will automatically begin a transaction and rollback. It also looks like it's for JUnit 3.x. The above didn't work though, so I tried the attach()/detach() route to emulate OSIV which worked fine. I therefore assume I'm missing something. On Tue, Feb 16, 2010 at 9:18 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: all you have to do is start a transaction before each unit test and roll it back after. spring has base unit tests and test runners that do this for you...
Re: wicket Google maps integration
look for the contract of ClickListener.onClick http://fisheye3.atlassian.com/browse/wicket-stuff/trunk/wicketstuff-core/gmap2-parent/gmap2/src/main/java/wicket/contrib/gmap/event/ClickListener.java?r=#l65 An Overlay was clicked, so glatLng is null. mf 2010/2/16 Josh Kamau joshnet2...@gmail.com Team;; Whats wrong with this code? The map is being displayed properly and when i click on it, a new marker is added and the infoWindow is shown. when i click on the info window, i get the below error. package org.at.example; import org.apache.wicket.PageParameters; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import wicket.contrib.gmap.GMap2; import wicket.contrib.gmap.api.GControl; import wicket.contrib.gmap.api.GEvent; import wicket.contrib.gmap.api.GEventHandler; import wicket.contrib.gmap.api.GLatLng; import wicket.contrib.gmap.api.GMarker; import wicket.contrib.gmap.api.GMarkerOptions; import wicket.contrib.gmap.api.GOverlay; import wicket.contrib.gmap.event.ClickListener; import wicket.contrib.gmap.event.InfoWindowCloseListener; import wicket.contrib.gmap.event.InfoWindowOpenListener; /** * Homepage */ public class HomePage extends WebPage { private static final long serialVersionUID = 1L; /** * Constructor that is invoked when page is invoked without a session. * * @param parameters *Page parameters */ public HomePage(final PageParameters parameters) { final GMap2 gmap = new GMap2( gmap, ABQI5IYWHbtyKMSxjbiygH-jRxQqloa41_x1QYpvvO_ao_uBs0dQxxQQyhzR9MXmD-ENkRmQIOig-WC-iw); gmap.addControl(GControl.GMapTypeControl); gmap.addControl(GControl.GLargeMapControl); gmap.setOutputMarkupId(true); gmap.setScrollWheelZoomEnabled(true); gmap.add(new ClickListener() { @Override protected void onClick(AjaxRequestTarget target, GLatLng glatLng, GOverlay overlay) { // GMarkerOptions gmo = new GMarkerOptions(); // gmo.draggable(true); // gmo.bouncy(true); if (!(overlay instanceof GMarker)) {//This section was added to stop the same error from occouring when the marker is clicked. GMarker gm = new GMarker(glatLng); gmap.getInfoWindow().open(glatLng, new Label(Hello, Hi , am here)); gmap.addOverlay(gm); } } }); add(gmap); } } Error: ERROR - RequestCycle - java.lang.NullPointerException at wicket.contrib.gmap.api.GInfoWindow.getJSopen(GInfoWindow.java:162) at wicket.contrib.gmap.api.GInfoWindow.open(GInfoWindow.java:115) at wicket.contrib.gmap.api.GInfoWindow.open(GInfoWindow.java:91) at org.at.example.HomePage$1.onClick(HomePage.java:56) at wicket.contrib.gmap.event.ClickListener.onEvent(ClickListener.java:61) at wicket.contrib.gmap.event.GEventListenerBehavior.respond(GEventListenerBehavior.java:58) at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:119) 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:1428) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at
Re: FormComponents and feedback messages inside a listview
http://cwiki.apache.org/WICKET/listview-and-other-repeaters.html#ListViewandotherrepeaters-Usingformcomponentsinarepeater Wim Vandenhaute wrote: Hello List, I have ran a couple of times whilst developing some pages using wicket into the following issue. The page will contain a Form, containing a ListView of FormComponents The FormComponents are created within the ListView with a feedback panel attached to each of em. The feedback panels are attached to the FormComponents using a ComponentFeedbackMessageFilter. On submit, validation fails for some FormComponents, and the feedback messages are generated ok, but are nevered rendered due to the original FormComponent not being found. This is understandable as they are created inside the ListView so when wicket tries to find the reporter of the feedback message, it does not find it anymore, new FormComponents were created. So the solution to this is to create them outside the listview so they dont get regenerated on each rendering. I was wondering if this is the correct way to handle such a situation, or should I be using a different approach to not fall into this? Kind regards, Wim. -- View this message in context: http://old.nabble.com/FormComponents-and-feedback-messages-inside-a-listview-tp27604968p27606028.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Re: Re: jdbc
Thank you all guys! I just do it with Map. Especially thanks to Leo.Erlandsson! 2010/2/15 leo.erlands...@tyringe.com: Should be no different when using JDBC than using it when using Domain Objects. Check out Wicket Phonebook Example that uses FilterToolbar: http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-phonebook Source Code Example: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/phonebook/src/main/java/wicket/contrib/phonebook/web/page/ListContactsPage.java Thank you! I just discovered this sample: http://www.brettdutton.com/blog/?p=4 What i can do.. if i want to use FilterToolbar with DataTable? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FormComponents and feedback messages inside a listview
Thanks! On Tue, Feb 16, 2010 at 11:11 AM, svenmeier s...@meiers.net wrote: http://cwiki.apache.org/WICKET/listview-and-other-repeaters.html#ListViewandotherrepeaters-Usingformcomponentsinarepeater Wim Vandenhaute wrote: Hello List, I have ran a couple of times whilst developing some pages using wicket into the following issue. The page will contain a Form, containing a ListView of FormComponents The FormComponents are created within the ListView with a feedback panel attached to each of em. The feedback panels are attached to the FormComponents using a ComponentFeedbackMessageFilter. On submit, validation fails for some FormComponents, and the feedback messages are generated ok, but are nevered rendered due to the original FormComponent not being found. This is understandable as they are created inside the ListView so when wicket tries to find the reporter of the feedback message, it does not find it anymore, new FormComponents were created. So the solution to this is to create them outside the listview so they dont get regenerated on each rendering. I was wondering if this is the correct way to handle such a situation, or should I be using a different approach to not fall into this? Kind regards, Wim. -- View this message in context: http://old.nabble.com/FormComponents-and-feedback-messages-inside-a-listview-tp27604968p27606028.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Delegate a Modelchange to the child components. Or using a ModalWindow for displaying different Models of a specific Type.
Ohkay.. i've found a solution.. but i thinks not simple.. or wicket-like i think... but its the only way to pass the new model to the known propertyModel =/ now iam doing this in UserEdit.java @Override protected void onModelChanged() { final IModelUser _model = (IModelUser) this.getDefaultModel(); visitChildren(new IVisitorComponent() { @Override public Object component(Component component) { PropertyModelUser cpm = ((PropertyModelUser)component.getDefaultModel()); PropertyModelUser newCpm = new PropertyModelUser(_model.getObject(), cpm.getPropertyExpression()); //cpm.setObject(_model.getObject()); component.setDefaultModel(newCpm); component.modelChanging(); return component; } }); } its to dirty i think.. or isn't it? Thanks for any Help in Advance! Martin U wrote: Its not easy to find the right topic, but i will try to explain my problem as best as i can. I want to display an user-detail View (User is an BusinessObject in my Application) inside a specific Modal window. So at the rendering of the Site i place an empty or dummy UserObject inside my UserEdit-Panel and later if the user choose one specific user from a Table i want to replace this dummy-Model with the clicked-User-Model. public class UserEdit extends Panel { /** * @param id * @param model */ private IModelUser model; CompoundPropertyModelUser cpm; public UserEdit(String id, IModelUser _model) { super(id, _model); this.model = _model; init(); } private void init(){ cpm = new CompoundPropertyModelUser(this.getDefaultModelObject()); this.add(new TextField(lastname, cpm.bind(lastName)) ); } } I dont know if its the right choice to use a cpm ... but i think its the proper way right? The UserEdit is the content of my ModalWindow implementation so i bore up the show method with a new Model-Parameter to delegate them to the Inside Content... (inside ModelOverlay.class) public void show(final AjaxRequestTarget target, IModelT model) { if (shown == false) { getContent().setVisible(true); getContent().setDefaultModel(model); // - my new Line ;o) target.addComponent(this); target.appendJavascript(getWindowOpenJavascript()); shown = true; } } The Model inside UserEdit is changed. But how can i archieve that the lastname-Textfield now displays the Value of getLastName() from the new, submitted Model? In my opinion i tried everything... tried to override the onModelChange-Event and tryed to set the new Model with an Visitor of every childfield... but than i lost my expression from the CPM and only pages.adminuserpage$u...@17eea10is shown inside the Textfield. Thanks for any help. Am i totally lost.. or am i on the right way and few steps before the solution? I hope you understand my problem... if not so tell me and i will try to explain it in another way or even better... Apologise my english, its not my mothers tongue! - Martin -- View this message in context: http://old.nabble.com/Delegate-a-Modelchange-to-the-child-components.-Or-using-a--ModalWindow-for-displaying-different-Models-of-a-specific-Type.-tp27604201p27606240.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket Google maps integration
Thanks alot It worked. On Tue, Feb 16, 2010 at 12:20 PM, Martin Funk mafulaf...@googlemail.comwrote: look for the contract of ClickListener.onClick http://fisheye3.atlassian.com/browse/wicket-stuff/trunk/wicketstuff-core/gmap2-parent/gmap2/src/main/java/wicket/contrib/gmap/event/ClickListener.java?r=#l65 An Overlay was clicked, so glatLng is null. mf 2010/2/16 Josh Kamau joshnet2...@gmail.com Team;; Whats wrong with this code? The map is being displayed properly and when i click on it, a new marker is added and the infoWindow is shown. when i click on the info window, i get the below error. package org.at.example; import org.apache.wicket.PageParameters; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import wicket.contrib.gmap.GMap2; import wicket.contrib.gmap.api.GControl; import wicket.contrib.gmap.api.GEvent; import wicket.contrib.gmap.api.GEventHandler; import wicket.contrib.gmap.api.GLatLng; import wicket.contrib.gmap.api.GMarker; import wicket.contrib.gmap.api.GMarkerOptions; import wicket.contrib.gmap.api.GOverlay; import wicket.contrib.gmap.event.ClickListener; import wicket.contrib.gmap.event.InfoWindowCloseListener; import wicket.contrib.gmap.event.InfoWindowOpenListener; /** * Homepage */ public class HomePage extends WebPage { private static final long serialVersionUID = 1L; /** * Constructor that is invoked when page is invoked without a session. * * @param parameters *Page parameters */ public HomePage(final PageParameters parameters) { final GMap2 gmap = new GMap2( gmap, ABQI5IYWHbtyKMSxjbiygH-jRxQqloa41_x1QYpvvO_ao_uBs0dQxxQQyhzR9MXmD-ENkRmQIOig-WC-iw); gmap.addControl(GControl.GMapTypeControl); gmap.addControl(GControl.GLargeMapControl); gmap.setOutputMarkupId(true); gmap.setScrollWheelZoomEnabled(true); gmap.add(new ClickListener() { @Override protected void onClick(AjaxRequestTarget target, GLatLng glatLng, GOverlay overlay) { // GMarkerOptions gmo = new GMarkerOptions(); // gmo.draggable(true); // gmo.bouncy(true); if (!(overlay instanceof GMarker)) {//This section was added to stop the same error from occouring when the marker is clicked. GMarker gm = new GMarker(glatLng); gmap.getInfoWindow().open(glatLng, new Label(Hello, Hi , am here)); gmap.addOverlay(gm); } } }); add(gmap); } } Error: ERROR - RequestCycle - java.lang.NullPointerException at wicket.contrib.gmap.api.GInfoWindow.getJSopen(GInfoWindow.java:162) at wicket.contrib.gmap.api.GInfoWindow.open(GInfoWindow.java:115) at wicket.contrib.gmap.api.GInfoWindow.open(GInfoWindow.java:91) at org.at.example.HomePage$1.onClick(HomePage.java:56) at wicket.contrib.gmap.event.ClickListener.onEvent(ClickListener.java:61) at wicket.contrib.gmap.event.GEventListenerBehavior.respond(GEventListenerBehavior.java:58) at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:119) 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:1428) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) at
Re: Quick fix for the dreaded org.hibernate.LazyInitializationException with WicketTester
Just an update, the quick hack failed completely when testing on an XP system, but it worked perfectly on Ubuntu. Any links or example on getting Spring/Hibernate/WicketTester/JUnit4 to work will be appreciated. lmgtfy will also suffice ;) On Tue, Feb 16, 2010 at 9:57 AM, Leon Nieuwoudt leon.nieuwo...@gmail.comwrote: Hi Igor Glad to hear there's another way. I'm already using the Spring JUnit runner, like this: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class UserTest extends . { @Test public void testCRUD() { // Code... } } This what I tried: * Adding @Transactional over testCRUD() out of desperation * Subclassing the base tester from AbstractTransactionalDataSourceSpringContextTests, according to the docs this will automatically begin a transaction and rollback. It also looks like it's for JUnit 3.x. The above didn't work though, so I tried the attach()/detach() route to emulate OSIV which worked fine. I therefore assume I'm missing something. On Tue, Feb 16, 2010 at 9:18 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: all you have to do is start a transaction before each unit test and roll it back after. spring has base unit tests and test runners that do this for you...
Re: Delegate a Modelchange to the child components. Or using a ModalWindow for displaying different Models of a specific Type.
Oh my God.. its so easy ... _ public class UserEdit extends Panel { /** * @param id * @param model */ public UserEdit(String id, CompoundPropertyModelUser _model) { super(id, _model); this.add(new TextField(lastname, _model.bind(lastName))); this.add(new TextField(firstname, _model.bind(firstName)) ); this.add(new TextField(department, _model.bind(department)) ); } } and in ModalWindow.show public void show(final AjaxRequestTarget target, IModelT model) { if (shown == false) { getContent().setVisible(true); getContent().setDefaultModelObject(model.getObject()); //- magic line target.addComponent(this); target.appendJavascript(getWindowOpenJavascript()); shown = true; } } Damn! MattyDE wrote: Ohkay.. i've found a solution.. but i thinks not simple.. or wicket-like i think... but its the only way to pass the new model to the known propertyModel =/ now iam doing this in UserEdit.java @Override protected void onModelChanged() { final IModelUser _model = (IModelUser) this.getDefaultModel(); visitChildren(new IVisitorComponent() { @Override public Object component(Component component) { PropertyModelUser cpm = ((PropertyModelUser)component.getDefaultModel()); PropertyModelUser newCpm = new PropertyModelUser(_model.getObject(), cpm.getPropertyExpression()); //cpm.setObject(_model.getObject()); component.setDefaultModel(newCpm); component.modelChanging(); return component; } }); } its to dirty i think.. or isn't it? Thanks for any Help in Advance! Martin U wrote: Its not easy to find the right topic, but i will try to explain my problem as best as i can. I want to display an user-detail View (User is an BusinessObject in my Application) inside a specific Modal window. So at the rendering of the Site i place an empty or dummy UserObject inside my UserEdit-Panel and later if the user choose one specific user from a Table i want to replace this dummy-Model with the clicked-User-Model. public class UserEdit extends Panel { /** * @param id * @param model */ private IModelUser model; CompoundPropertyModelUser cpm; public UserEdit(String id, IModelUser _model) { super(id, _model); this.model = _model; init(); } private void init(){ cpm = new CompoundPropertyModelUser(this.getDefaultModelObject()); this.add(new TextField(lastname, cpm.bind(lastName)) ); } } I dont know if its the right choice to use a cpm ... but i think its the proper way right? The UserEdit is the content of my ModalWindow implementation so i bore up the show method with a new Model-Parameter to delegate them to the Inside Content... (inside ModelOverlay.class) public void show(final AjaxRequestTarget target, IModelT model) { if (shown == false) { getContent().setVisible(true); getContent().setDefaultModel(model); // - my new Line ;o) target.addComponent(this); target.appendJavascript(getWindowOpenJavascript()); shown = true; } } The Model inside UserEdit is changed. But how can i archieve that the lastname-Textfield now displays the Value of getLastName() from the new, submitted Model? In my opinion i tried everything... tried to override the onModelChange-Event and tryed to set the new Model with an Visitor of every childfield... but than i lost my expression from the CPM and only pages.adminuserpage$u...@17eea10is shown inside the Textfield. Thanks for any help. Am i totally lost.. or am i on the right way and few steps before the solution? I hope you understand my problem... if not so tell me and i will try to explain it in another way or even better... Apologise my english, its not my mothers tongue! - Martin -- View this message in context: http://old.nabble.com/Delegate-a-Modelchange-to-the-child-components.-Or-using-a--ModalWindow-for-displaying-different-Models-of-a-specific-Type.-tp27604201p27607064.html Sent from the Wicket - User mailing list archive at Nabble.com.
RE: problem with RestartResponseException in 1.4.6
it works thanks From: igor.vaynb...@gmail.com Date: Sun, 14 Feb 2010 21:04:41 -0800 Subject: Re: problem with RestartResponseException in 1.4.6 To: users@wicket.apache.org try with latest snapshot -igor On Sun, Feb 14, 2010 at 5:02 PM, Vadim Tesis vad...@hotmail.com wrote: all, i moved from 1.4.5 to 1.4.6 and started getting a problem with RestartResponseException. on a page that displays an item and has url something like http://localhost/item/38 there's an AjaxFallbackLink for a user to take an action. when the link gets clicked, if the user is not logged in it yet, it throws new RestartResponseException(SignInPage.class, params_) but SignInPage never loads. looks like the problem is that url generated in this case is http://localhost/item/signin/... instead of http://localhost/signin/... (as it was in 1.4.5) both item and signin pages are bookmarkable with MixedParamHybridUrlCodingStrategy can it be related to changes done to fix http://issues.apache.org/jira/browse/WICKET-2312? is there a workaround? Thanks, Vadim _ Hotmail: Free, trusted and rich email service. http://clk.atdmt.com/GBL/go/201469228/direct/01/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org _ Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. http://clk.atdmt.com/GBL/go/201469229/direct/01/
Re: Integrating Hibernate Validator with Wicket
Hi I integrated Hibernate Validator given in Wicket stuff with my application I am getting this error org.hibernate.PropertyValueException: not-null property references a null or transient value: Any ideas? Thanks P Carlos Vara wrote: Hi, if you prefer to use JSR 303 Bean Validation (it's very similar to Hibernate Validator, in fact, it is the reference implementation), I made a blog post about how to integrate it with Wicket: http://carinae.net/2009/12/integration-of-jsr-303-bean-validation-standard-and-wicket-1-4/ On Mon, Jan 4, 2010 at 11:28 AM, ayman elwany aymanelw...@gmail.com wrote: thanks Martin for the link , I used it but I had a problem; public class CarPage extends WebPage { * ..* * ..* UserModel user= ((LoginSession)getSession()).getUserBean(); * ..* *..* * ..* private void fillPersonalInfoComponents(Form personalForm) { * ..* * .. * PropertyModel fullnamepropertyModel =new PropertyModelString(user, fullNameValue); fullName = new TextField(fullName, fullnamepropertyModel); personalForm.add(fullName); //System.out.println(Model = +fullnamepropertyModel.getChainedModel().getClass().getName()); fullName.add(new HibernateValidatorString(fullnamepropertyModel, fullNameValue)); } } And the user model is public class UserModel implements Serializable { /** * */ private static final long serialVersionUID = 1011452297289823651L; * ..* * ..* * ..* @NotNull @NotEmpty private String fullNameValue; * ..* * ..* * ..* } but it always fails and gives me that my model is null . but the strange behaviour that when I changed HibernateValidator constructor *from* public HibernateValidator(I*Model entityModel*, String property) { this.property = property; if (entityModel != null) hibernateValidator = new ClassValidator(*entityModel.getObject().getClass()* ); } *TO* public HibernateValidator(*Object bean, *String property) { this.property = property; //if (entityModel != null) hibernateValidator = new ClassValidator(*bean.getClass()*); } and did this fullName.add(new HibernateValidatorString(user, fullNameValue)); the validation worked *fine *!!! so is there is any problem in the propertymodel with hibernate validator??? On Mon, Jan 4, 2010 at 8:37 AM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: http://42lines.net/content/integrating-hibernate-validator-and-wicket 2010/1/4 ayman elwany aymanelw...@gmail.com: Hi, Is there any common practice to integrate wicket with hibernate validator ? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/Integrating-Hibernate-Validator-with-Wicket-tp27009326p27607538.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jdbc
Hej, 2010/2/11 Giambalvo, Christian christian.giamba...@excelsisnet.com: http://cwiki.apache.org/WICKET/simple-sortable-datatable-example.html Unrelated to the original posters question, but: The sort method used in this sample does not work correctly. It gets a sublist and sorts the sublist instead of sorting the base data and getting the sublist from the sorted data. It doesn't show in the sample because no paging is used and the base data is already sorted. Hej då Hauke Ingmar - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: best way to detect session termination
I studied the classes HttpSessionBindingListener and AbstractHttpSessionStore as you noted, but I think I'll still have no link between the SessionId from the HTTPSession and my own Session. Maybe I'm missing something or I don't see the wood among all the trees as we say in Germany... Andreas -Original Message- From: Eelco Hillenius [mailto:eelco.hillen...@gmail.com] Sent: Monday, February 15, 2010 7:08 PM To: sam.lued...@t-online.de Cc: users@wicket.apache.org Subject: Re: best way to detect session termination You could use a HttpSessionBindingListener like Wicket does internally (see AbstractHttpSessionStore). Or as a hack store references to the session objects in the session listener. That's the easy fix, but doesn't scale if you need session replication (unless maybe you use e.g. Terracotta). Eelco On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: Hi Eelco, thanks for the hint. Now I can detect the end of a session. Unfortunately I can't access my own wicket session in that sessionDestroyed() method in order to get the info about the connected user. I've got ther error message java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle. Do you know how I can achieve this? Andreas -Original Message- From: Eelco Hillenius [mailto:eelco.hillen...@gmail.com] Sent: Saturday, February 13, 2010 7:02 PM To: users@wicket.apache.org; sam.lued...@t-online.de Subject: Re: best way to detect session termination http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7 Eelco On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: I would like to detect the termination of the session to set the lastAccesTime in the user profile. This should also happen if the session times out. I read in archive about a HttpSessionListener that should do the trick. Unfortunately I can't find a place to install it. Thanks Andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: best way to detect session termination
can't you simply do that in webapplication.sessiondestroy(String sessionid), you can store the sessionid when user logs in and on sessiondestroyed ,search the user by this sessionid , and change whatever in user object and then persist it.. On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke sam.lued...@t-online.dewrote: I studied the classes HttpSessionBindingListener and AbstractHttpSessionStore as you noted, but I think I'll still have no link between the SessionId from the HTTPSession and my own Session. Maybe I'm missing something or I don't see the wood among all the trees as we say in Germany... Andreas -Original Message- From: Eelco Hillenius [mailto:eelco.hillen...@gmail.com] Sent: Monday, February 15, 2010 7:08 PM To: sam.lued...@t-online.de Cc: users@wicket.apache.org Subject: Re: best way to detect session termination You could use a HttpSessionBindingListener like Wicket does internally (see AbstractHttpSessionStore). Or as a hack store references to the session objects in the session listener. That's the easy fix, but doesn't scale if you need session replication (unless maybe you use e.g. Terracotta). Eelco On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: Hi Eelco, thanks for the hint. Now I can detect the end of a session. Unfortunately I can't access my own wicket session in that sessionDestroyed() method in order to get the info about the connected user. I've got ther error message java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle. Do you know how I can achieve this? Andreas -Original Message- From: Eelco Hillenius [mailto:eelco.hillen...@gmail.com] Sent: Saturday, February 13, 2010 7:02 PM To: users@wicket.apache.org; sam.lued...@t-online.de Subject: Re: best way to detect session termination http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7 Eelco On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: I would like to detect the termination of the session to set the lastAccesTime in the user profile. This should also happen if the session times out. I read in archive about a HttpSessionListener that should do the trick. Unfortunately I can't find a place to install it. Thanks Andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- regards, Vineet Semwal
Re: best way to detect session termination
i think i didn't use my words correctly :( with you can store the sessionid when user logs in i mean persist user object with sessionid when the user signed in ... On Tue, Feb 16, 2010 at 6:45 PM, vineet semwal vineetsemwal1...@gmail.comwrote: can't you simply do that in webapplication.sessiondestroy(String sessionid), you can store the sessionid when user logs in and on sessiondestroyed ,search the user by this sessionid , and change whatever in user object and then persist it.. On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke sam.lued...@t-online.dewrote: I studied the classes HttpSessionBindingListener and AbstractHttpSessionStore as you noted, but I think I'll still have no link between the SessionId from the HTTPSession and my own Session. Maybe I'm missing something or I don't see the wood among all the trees as we say in Germany... Andreas -Original Message- From: Eelco Hillenius [mailto:eelco.hillen...@gmail.com] Sent: Monday, February 15, 2010 7:08 PM To: sam.lued...@t-online.de Cc: users@wicket.apache.org Subject: Re: best way to detect session termination You could use a HttpSessionBindingListener like Wicket does internally (see AbstractHttpSessionStore). Or as a hack store references to the session objects in the session listener. That's the easy fix, but doesn't scale if you need session replication (unless maybe you use e.g. Terracotta). Eelco On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: Hi Eelco, thanks for the hint. Now I can detect the end of a session. Unfortunately I can't access my own wicket session in that sessionDestroyed() method in order to get the info about the connected user. I've got ther error message java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle. Do you know how I can achieve this? Andreas -Original Message- From: Eelco Hillenius [mailto:eelco.hillen...@gmail.com] Sent: Saturday, February 13, 2010 7:02 PM To: users@wicket.apache.org; sam.lued...@t-online.de Subject: Re: best way to detect session termination http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7 Eelco On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: I would like to detect the termination of the session to set the lastAccesTime in the user profile. This should also happen if the session times out. I read in archive about a HttpSessionListener that should do the trick. Unfortunately I can't find a place to install it. Thanks Andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- regards, Vineet Semwal -- regards, Vineet Semwal
Re: best way to detect session termination
You can maintain a map somewhere on your own to do that. On Tue, Feb 16, 2010 at 7:53 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: I studied the classes HttpSessionBindingListener and AbstractHttpSessionStore as you noted, but I think I'll still have no link between the SessionId from the HTTPSession and my own Session. Maybe I'm missing something or I don't see the wood among all the trees as we say in Germany... Andreas -Original Message- From: Eelco Hillenius [mailto:eelco.hillen...@gmail.com] Sent: Monday, February 15, 2010 7:08 PM To: sam.lued...@t-online.de Cc: users@wicket.apache.org Subject: Re: best way to detect session termination You could use a HttpSessionBindingListener like Wicket does internally (see AbstractHttpSessionStore). Or as a hack store references to the session objects in the session listener. That's the easy fix, but doesn't scale if you need session replication (unless maybe you use e.g. Terracotta). Eelco On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: Hi Eelco, thanks for the hint. Now I can detect the end of a session. Unfortunately I can't access my own wicket session in that sessionDestroyed() method in order to get the info about the connected user. I've got ther error message java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle. Do you know how I can achieve this? Andreas -Original Message- From: Eelco Hillenius [mailto:eelco.hillen...@gmail.com] Sent: Saturday, February 13, 2010 7:02 PM To: users@wicket.apache.org; sam.lued...@t-online.de Subject: Re: best way to detect session termination http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7 Eelco On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke sam.lued...@t-online.de wrote: I would like to detect the termination of the session to set the lastAccesTime in the user profile. This should also happen if the session times out. I read in archive about a HttpSessionListener that should do the trick. Unfortunately I can't find a place to install it. Thanks Andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Problem with simple layout using Border.
I have problem with Border. When i open Lesson2 page, i get nothing. System.out.println(mb); show: [MarkupContainer [Component id = border]]. Anybody help? Sources below. MainBorder.java: public class MainBorder extends Border { public MainBorder(String id) { super(id); add(new AjaxLink(lesson0){ @Override public void onClick(AjaxRequestTarget target) { setResponsePage(Lesson0.class); } }); add(new AjaxLink(lesson1){ @Override public void onClick(AjaxRequestTarget target) { setResponsePage(Lesson1.class); } }); } } MainBorder.html: wicket:border div style=background-color: silver; padding: 5px; a href=# wicket:id=lesson0Lesson1/anbsp;|nbsp; a href=# wicket:id=lesson1Lesson2/anbsp;|nbsp; /div wicket:body/ /wicket:border BasePage.java: public class BasePage extends WebPage { protected MainBorder mb; public BasePage() { mb = new MainBorder(border); add(mb); } } BasePage.html: [empty] Lesson2.java: public class Lesson2 extends BasePage { public Lesson2() { System.out.println(mb); mb.add(add(new Label(label,content...))); } } Lesson2.html: div wicket:id=border span wicket:id=labelcontent/span /div -- Greeting, marioosh - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket and javascript
igor.vaynberg wrote: allow your component to implement IHeaderContributor and output both your base js and string js from the renderhread() method -igor du u have a code-example(link oder something like that) for this way of solving my prob? i tried several times to do it, but i always got the same result... the script, which was generated dynamically was rendered into the head before the ressource-implementation, instead of behind that block of code. -- View this message in context: http://old.nabble.com/wicket-and-javascript-tp27590908p27608918.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Selenium Testing - Ajax Loads
the path in repeaters is never stable, it depends on a lot of factors and is hard to predict. i think what may be a good way to deal with it is to use an IComponentInstantiationListener to add a behavior to Item subclasses to output their index in some attribute. install this listener only during test time or simply make it output nothing if not during the test. Interesting I'll look into it.. Is there really any reason why not to just always have the listener there. Seems like there would be little overhead in doing this... But I am curious, if this can be done then why couldn't the wicket page also be made stable using the same technique? 2) I have issues with timing which is typical, and most people call waitForPageToLoad which works fine for normal http requests, but if It is an ajax request I'm waiting for, then I have to implement a waitForContition. Is there a wicket convention I could use here? i.e. how can I know that a wicket ajax call has completed? there are global ajax callbacks that are invoked when an ajax request completes. you can search this list for what they are. i imagine you can write a bit of javascript to hook into those and implement waitForCondition. I'm actually using the window.wicketGlobalPreCallHandler and window.wicketGlobalPostCallHandler in my code already. Do you think it would be safe to use those? I.E. preHander sets a boolean isWaitingOnAjax and postHander unsets it? Then I can do a waitForConition(!isWaitingOnAjax) yeah, that sounds like a good starting point. -igor when you get all this working maybe you can create a wiki page about it to help users who will have the same questions in the future. Sounds good... -igor Thanks, D/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket and javascript
If you're rendering JS that shouldn't be executed until the page is loaded, call this method in your renderHead method: http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/markup/html/IHeaderResponse.html#renderOnDomReadyJavascript%28java.lang.String%29 -- Jeremy Thomerson http://www.wickettraining.com On Tue, Feb 16, 2010 at 8:12 AM, exceptionist bad.ad...@arcor.de wrote: igor.vaynberg wrote: allow your component to implement IHeaderContributor and output both your base js and string js from the renderhread() method -igor du u have a code-example(link oder something like that) for this way of solving my prob? i tried several times to do it, but i always got the same result... the script, which was generated dynamically was rendered into the head before the ressource-implementation, instead of behind that block of code. -- View this message in context: http://old.nabble.com/wicket-and-javascript-tp27590908p27608918.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: @SpringBean injection expensive - a bug?
Any updates on this issue? Will there be a fix? Igor Vaynberg igor.vaynb...@gmail.com 02/10/2010 06:15 PM Please respond to users@wicket.apache.org To users@wicket.apache.org cc Subject Re: @SpringBean injection expensive - a bug? create a jira issue and a quickstart. thanks. -igor On Tue, Feb 9, 2010 at 11:34 AM, Nikita Tovstoles nikita.tovsto...@gmail.com wrote: Wicket's SpringWebApplication is deprecated and the javadoc advocates using @SpringBean to inject dependencies at component level. However, that appears to be an expensive proposition: I have a listView component that renders a (new) ExternalLink subclass per item. That subclass uses a service (a singleton spring bean) injected via @SpringBean like so: @SpringBean private MyService service; YourKit tells me that when the page is being rendered, 47%(!) of cpu time is being spent constructing the subclass, specifically, repeatedly calling: org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(ListableBeanFactory, Class) The above is getting called with vigor from SpringBeanLocator.hashCode() -- getBeanName() -- getBeanNameOfClass(). HashCode() is likely getting called most often by AnnotProxyFieldValueFactory.cache during look-ups - which I am guessing isn't intentional. Looks like a bug, no? If the above is a bug indeed, is the workaround to always specify a 'name' with @SpringBean? Thoughts? -nikita +-++-+ | Name | Time (ms)| Own Time (ms) | +-++-+ | +---com.castanealabs.gui.component.search.CategoryDataViewPanel$1.populateItem(Item) | 5,430 100 % | 50 | || || | | +---com.castanealabs.gui.component.search.ProductImageCell.init(String, SiteId, IModel) | 2,680 49 % | 20 | || | || | || +---com.castanealabs.gui.embedded.ExternalSiteProductInfoLink.init(String, SiteId, IModel) | 2,660 49 % | 0 | || | || | || +---com.castanealabs.gui.embedded.ExternalSiteProductInfoLink.init(String, SiteId, IModel, IModel) | 2,660 49 % | 0 | || | || | || +---com.castanealabs.gui.embedded.TargetedExternalLink.init(String, IModel, IModel, String) | 2,570 47 % | 0 | || | | || | || | +---org.apache.wicket.markup.html.link.ExternalLink.init(String, IModel, IModel) | 2,570 47 % | 0 | || | | || | || | +---org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(ListableBeanFactory, Class) | 2,570 47 % | 0 | || | | || | || | +---org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(Class) | 2,570 47 % | 0 | || | | || | || | +---org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(Class) | 2,570 47 % | 10 | || | | || | || | +---org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(Class, boolean, boolean)| 2,560 47 % | 0 | || | | || | || | +---org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(String, RootBeanDefinition)| 2,460 45 % | 10 | || | | | || | || | | +---org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(String, RootBeanDefinition,
RE: How to ajax update a component without triggered ajaxrequesttarget
Martin, I think possibly what you want is AjaxRequestTarget.get(): AjaxRequestTarget target = AjaxRequestTarget.get(); if (target != null) { //...then this is an ajax request, not a static one target.addComponent(myComponent); } This gives you the ajax request target which is bound to the current request cycle, if the request was generated by wicket's ajax mechanism. There is no target if the request was not generated by ajax (so there is nothing for you to add components to, but the whole page should be repainted anyway). RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: Martin Asenov [mailto:mase...@velti.com] Sent: Monday, February 15, 2010 10:38 AM To: users@wicket.apache.org Subject: How to ajax update a component without triggered ajaxrequesttarget Hello guys! How can I update a component without having AjaxRequestTarget triggered from a button or a link? I tried this: myComponent.renderComponent(); new AjaxRequestTarget(getPage()).addComponent(myComponent) myComponent has output markup id set to true both didn't work for me... Thanks in advance for your help! Regards, Martin This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind MSE to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problem with simple layout using Border.
mb.add(add(new Label(label,content...))); why are there two adds there? -igor On Tue, Feb 16, 2010 at 6:06 AM, marioosh.net marioosh@gmail.com wrote: I have problem with Border. When i open Lesson2 page, i get nothing. System.out.println(mb); show: [MarkupContainer [Component id = border]]. Anybody help? Sources below. MainBorder.java: public class MainBorder extends Border { public MainBorder(String id) { super(id); add(new AjaxLink(lesson0){ �...@override public void onClick(AjaxRequestTarget target) { setResponsePage(Lesson0.class); } }); add(new AjaxLink(lesson1){ �...@override public void onClick(AjaxRequestTarget target) { setResponsePage(Lesson1.class); } }); } } MainBorder.html: wicket:border div style=background-color: silver; padding: 5px; a href=# wicket:id=lesson0Lesson1/anbsp;|nbsp; a href=# wicket:id=lesson1Lesson2/anbsp;|nbsp; /div wicket:body/ /wicket:border BasePage.java: public class BasePage extends WebPage { protected MainBorder mb; public BasePage() { mb = new MainBorder(border); add(mb); } } BasePage.html: [empty] Lesson2.java: public class Lesson2 extends BasePage { public Lesson2() { System.out.println(mb); mb.add(add(new Label(label,content...))); } } Lesson2.html: div wicket:id=border span wicket:id=labelcontent/span /div -- Greeting, marioosh - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Custom url generation
Dear friends in code, how would it be possible to make wicket work in a scenario like this: Standard generation of urls: http://www.mysite.com/site/user1/home http://www.mysite.com/site/user1/gallery http://www.mysite.com/site/user1/shop Virtual host aware generation of url: http://www.user1domain.com/home http://www.user1domain.com/gallery http://www.user1domain.com/shop I do know how to setup Apache to do url rewriting, I do not know, however, how to make Wicket generate such urls. Pages are mounted with IndexedHybridUrlCodingStrategy, I have tried to look into this strategy's encode() method, but I could not find how should I change the behaviour, as this method returns only the part after host www.mysite.com. I will be grateful for any kick that will direct me the right way. Thank you very much. Regards Vitek - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Selenium Testing - Ajax Loads
how would you do that exactly? -igor On Tue, Feb 16, 2010 at 7:26 AM, Douglas Ferguson doug...@douglasferguson.us wrote: the path in repeaters is never stable, it depends on a lot of factors and is hard to predict. i think what may be a good way to deal with it is to use an IComponentInstantiationListener to add a behavior to Item subclasses to output their index in some attribute. install this listener only during test time or simply make it output nothing if not during the test. Interesting I'll look into it.. Is there really any reason why not to just always have the listener there. Seems like there would be little overhead in doing this... But I am curious, if this can be done then why couldn't the wicket page also be made stable using the same technique? 2) I have issues with timing which is typical, and most people call waitForPageToLoad which works fine for normal http requests, but if It is an ajax request I'm waiting for, then I have to implement a waitForContition. Is there a wicket convention I could use here? i.e. how can I know that a wicket ajax call has completed? there are global ajax callbacks that are invoked when an ajax request completes. you can search this list for what they are. i imagine you can write a bit of javascript to hook into those and implement waitForCondition. I'm actually using the window.wicketGlobalPreCallHandler and window.wicketGlobalPostCallHandler in my code already. Do you think it would be safe to use those? I.E. preHander sets a boolean isWaitingOnAjax and postHander unsets it? Then I can do a waitForConition(!isWaitingOnAjax) yeah, that sounds like a good starting point. -igor when you get all this working maybe you can create a wiki page about it to help users who will have the same questions in the future. Sounds good... -igor Thanks, D/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Model for ResourceLink
Hi, I need to update ResourceLink when pagination is changed. How is it possible to pass model to a ResourceLink? I'm using wicket 1.3.6, but I think it should be also the same for other releases. Thank you
Problems with FileUpload (on GAE) - how to avoid DiskFileItem?
Hello, I trying to implement a file upload for my wicket application, which should be deployed on Google App Engine (GAE). Since GAE does not allow to spawn new threads, I cannot make use of DiskFileItem due to its use of FileCleaner. The problem is that a DiskFileItem gets instantiated in the MultipartServletWebRequest, which results in an AccessControlException even before the submit method is called (which would allow to parse the request by hand) Thus, I would like to ask if anyone has a hint how to deal with that problem and avoid the instantiation of DiskFileItem? Thanks a lot in advance, andr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problems with FileUpload (on GAE) - how to avoid DiskFileItem?
MultipartServletWebRequest has a constructor that allows you to pass in your own fileitemfactory WebRequest has a newMultipartWebRequest that you can override to create a multipartservletwebrequest with your own fileitemfactory... -igor On Tue, Feb 16, 2010 at 10:21 AM, A. Maza andr.m...@gmail.com wrote: Hello, I trying to implement a file upload for my wicket application, which should be deployed on Google App Engine (GAE). Since GAE does not allow to spawn new threads, I cannot make use of DiskFileItem due to its use of FileCleaner. The problem is that a DiskFileItem gets instantiated in the MultipartServletWebRequest, which results in an AccessControlException even before the submit method is called (which would allow to parse the request by hand) Thus, I would like to ask if anyone has a hint how to deal with that problem and avoid the instantiation of DiskFileItem? Thanks a lot in advance, andr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jdbc
Hej, 2010/2/16 Hauke Ingmar Schmidt haukeing...@gmail.com: 2010/2/11 Giambalvo, Christian christian.giamba...@excelsisnet.com: http://cwiki.apache.org/WICKET/simple-sortable-datatable-example.html Unrelated to the original posters question, but: The sort method used in this sample does not work correctly. It gets a sublist and sorts the sublist instead of sorting the base data and getting the sublist from the sorted data. It doesn't show in the sample because no paging is used and the base data is already sorted. Fixed. And I generified the example. Hej då Hauke Ingmar - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problems with FileUpload (on GAE) - how to avoid DiskFileItem?
Thanks for that quick response, igor. I created now a very basic and (bad ,-) implementation of FileItemFactory, does not write to disk and doesn't spawn threads. With respect to using common-fileupload on GAE, I read about fileupload's new Streaming API. However, I have currently no clue how to integrate it with Wicket. Do you have any hints for that? thanks, andr On Tue, Feb 16, 2010 at 7:51 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: MultipartServletWebRequest has a constructor that allows you to pass in your own fileitemfactory WebRequest has a newMultipartWebRequest that you can override to create a multipartservletwebrequest with your own fileitemfactory... -igor On Tue, Feb 16, 2010 at 10:21 AM, A. Maza andr.m...@gmail.com wrote: Hello, I trying to implement a file upload for my wicket application, which should be deployed on Google App Engine (GAE). Since GAE does not allow to spawn new threads, I cannot make use of DiskFileItem due to its use of FileCleaner. The problem is that a DiskFileItem gets instantiated in the MultipartServletWebRequest, which results in an AccessControlException even before the submit method is called (which would allow to parse the request by hand) Thus, I would like to ask if anyone has a hint how to deal with that problem and avoid the instantiation of DiskFileItem? Thanks a lot in advance, andr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problems with FileUpload (on GAE) - how to avoid DiskFileItem?
noep, haven't looked at that stuff in a while. -igor On Tuesday, February 16, 2010, Andreas Maza andr.m...@gmail.com wrote: Thanks for that quick response, igor. I created now a very basic and (bad ,-) implementation of FileItemFactory, does not write to disk and doesn't spawn threads. With respect to using common-fileupload on GAE, I read about fileupload's new Streaming API. However, I have currently no clue how to integrate it with Wicket. Do you have any hints for that? thanks, andr On Tue, Feb 16, 2010 at 7:51 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: MultipartServletWebRequest has a constructor that allows you to pass in your own fileitemfactory WebRequest has a newMultipartWebRequest that you can override to create a multipartservletwebrequest with your own fileitemfactory... -igor On Tue, Feb 16, 2010 at 10:21 AM, A. Maza andr.m...@gmail.com wrote: Hello, I trying to implement a file upload for my wicket application, which should be deployed on Google App Engine (GAE). Since GAE does not allow to spawn new threads, I cannot make use of DiskFileItem due to its use of FileCleaner. The problem is that a DiskFileItem gets instantiated in the MultipartServletWebRequest, which results in an AccessControlException even before the submit method is called (which would allow to parse the request by hand) Thus, I would like to ask if anyone has a hint how to deal with that problem and avoid the instantiation of DiskFileItem? Thanks a lot in advance, andr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problems with FileUpload (on GAE) - how to avoid DiskFileItem?
There is one already done. Someone post it in the official GAE mail list. Try to look for it. I will try too. NM On Tue, Feb 16, 2010 at 6:00 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: noep, haven't looked at that stuff in a while. -igor On Tuesday, February 16, 2010, Andreas Maza andr.m...@gmail.com wrote: Thanks for that quick response, igor. I created now a very basic and (bad ,-) implementation of FileItemFactory, does not write to disk and doesn't spawn threads. With respect to using common-fileupload on GAE, I read about fileupload's new Streaming API. However, I have currently no clue how to integrate it with Wicket. Do you have any hints for that? thanks, andr On Tue, Feb 16, 2010 at 7:51 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: MultipartServletWebRequest has a constructor that allows you to pass in your own fileitemfactory WebRequest has a newMultipartWebRequest that you can override to create a multipartservletwebrequest with your own fileitemfactory... -igor On Tue, Feb 16, 2010 at 10:21 AM, A. Maza andr.m...@gmail.com wrote: Hello, I trying to implement a file upload for my wicket application, which should be deployed on Google App Engine (GAE). Since GAE does not allow to spawn new threads, I cannot make use of DiskFileItem due to its use of FileCleaner. The problem is that a DiskFileItem gets instantiated in the MultipartServletWebRequest, which results in an AccessControlException even before the submit method is called (which would allow to parse the request by hand) Thus, I would like to ask if anyone has a hint how to deal with that problem and avoid the instantiation of DiskFileItem? Thanks a lot in advance, andr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Selenium Testing - Dealing with unstable wicket path
I'm using the following xpath wtih regex.. and this works.. xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d')][2] but this doesn't xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d_taskContainer_edit')][2] any idea why? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Selenium Testing - Dealing with unstable wicket path
Hi! Maybe you can generate the path from the actual path? http://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: I'm using the following xpath wtih regex.. and this works.. xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d')][2] but this doesn't xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d_taskContainer_edit')][2] any idea why? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Selenium Testing - Dealing with unstable wicket path
Hmm.. How would the example you sent apply to selenium tests? That seems like a unit test approach. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Tuesday, February 16, 2010 9:55 PM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! Maybe you can generate the path from the actual path? http://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: I'm using the following xpath wtih regex.. and this works.. xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d')][2] but this doesn't xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d_taskContainer_edit')][2] any idea why? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Selenium Testing - Ajax Loads
Igor, I have a decent solution and could put together a wiki page, just need to know where/how.. here's what I've got. Click and Wait for wicket: protected void clickAndWait(String wicketPath, long timeOut){ String callbackScript = if(!window.outstandingWicketCalls){ + window.outstandingWicketCalls = 0; + var oldWicketGlobalPreCallHandler = window.wicketGlobalPreCallHandler; + var oldWicketGlobalPostCallHandler = window.wicketGlobalPostCallHandler; + window.wicketGlobalPreCallHandler = function() { + window.outstandingWicketCalls++; + oldWicketGlobalPreCallHandler(); + }; + window.wicketGlobalPostCallHandler = function() { + oldWicketGlobalPostCallHandler(); + window.outstandingWicketCalls--; + }; + } + window.write(window.outstandingWicketCalls);; selenium.runScript(callbackScript); click(wicketPath); selenium.waitForCondition(selenium.browserbot.getCurrentWindow();window.outstandingWicketCalls===0, Duration.seconds(8).getMilliseconds() +); } Deal with unstable wicket paths protected String getDOMLocator(String xpathTagName, String wicketPath, int index){ String regex = _(\\d+|#)(_|$); Pattern repeaterWicketPathPatter = Pattern.compile(regex); Matcher matcher = repeaterWicketPathPatter.matcher(wicketPath); while(matcher.find()){ try{ if(index == -1){ index = Integer.parseInt(matcher.group(1)); } String xpathRegex = _[0-9]+; if(_.equals(matcher.group(2))){ xpathRegex = xpathRegex + _; } wicketPath = wicketPath.replace(matcher.group(), xpathRegex); }catch(NumberFormatException nfe){ fail(index is required for getDOMLocator, please pass it to the method or as the first numeric value in the wicketpath provide i.e. foo_bar_134_child_#_child2_#); } } StringWriter domLocator = new StringWriter(); domLocator.append(dom=); if(index 0){ domLocator.append(window.findElementByWicketPath('); domLocator.append(wicketPath); domLocator.append(', ); domLocator.append(String.valueOf(index-1)); domLocator.append();); }else { domLocator.append(window.$('[wicketpath=\\'); domLocator.append(wicketPath); domLocator.append(\\']').get(0);); } return domLocator.toString(); } Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Igor Vaynberg [igor.vaynb...@gmail.com] Sent: Tuesday, February 16, 2010 11:11 AM To: users@wicket.apache.org Subject: Re: Selenium Testing - Ajax Loads how would you do that exactly? -igor On Tue, Feb 16, 2010 at 7:26 AM, Douglas Ferguson doug...@douglasferguson.us wrote: the path in repeaters is never stable, it depends on a lot of factors and is hard to predict. i think what may be a good way to deal with it is to use an IComponentInstantiationListener to add a behavior to Item subclasses to output their index in some attribute. install this listener only during test time or simply make it output nothing if not during the test. Interesting I'll look into it.. Is there really any reason why not to just always have the listener there. Seems like there would be little overhead in doing this... But I am curious, if this can be done then why couldn't the wicket page also be made stable using the same technique? 2) I have issues with timing which is typical, and most people call waitForPageToLoad which works fine for normal http requests, but if It is an ajax
Re: How to change the style of navigator in PageableViewList
Hi where to add your code in my pagingnavigator to create custom navigator? This is my code. navigator = new PagingNavigator(navigator, dataView); dataView.setItemsPerPage(5); navigator.setVisible(false); addListViewPanel.add(navigator); pls reply me asap. trames wrote: Extend PagingNavigator. I made a custom one so I can use everywhere: It looks something like this First Prev 1 2 3 4 Next Last The active page will be in Red and italics. You can make it anything you want by changing the HTML and/or CSS. Hope it works for you. Java - CustomPagingNavigator.java import org.apache.wicket.markup.html.navigation.paging.PagingNavigator; import org.apache.wicket.markup.html.navigation.paging.IPageable; import org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider; public class CustomPagingNavigator extends PagingNavigator{ private static final long serialVersionUID = 1L; // First PagingNavigator constructor public CustomPagingNavigator (String id, IPageable pageable) { super(id, pageable); } // Second PagingNavigator constructor public CustomPagingNavigator (String id, IPageable pageable, IPagingLabelProvider labelProvider) { super(id, pageable, labelProvider); } } HTML - CustomPagingNavigator.html !-- This is a customization of the wicket component PagingNavigator.html It changes the following defaults is now First is now Last is now Prev is now Next You will also need to copy CustomPagingNavigator.css to the root of your web app and @include it in your main style sheet. See .css file -- html xmlns:wicket body wicket:panel First Prev # 1 Next Last /wicket:panel /body /html CSS - CustomPagingNavigator.css /* Copy this file to the root of the web app /* Use the following in the main style sheet to import these specs*/ /* @import url(CustomPagingNavigator.css);*/ /* Data Navigator*/ .navigator {color:red} .navigator a:link, a:visited, a:active {color:blue;text-decoration:none;} -- View this message in context: http://old.nabble.com/How-to-change-the-style-of-navigator-in-PageableViewList-tp14978321p27619447.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Selenium Testing - Dealing with unstable wicket path
Hi! You can run selenium tests with junit. http://www.junit.org/node/23 ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: Hmm.. How would the example you sent apply to selenium tests? That seems like a unit test approach. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Tuesday, February 16, 2010 9:55 PM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! Maybe you can generate the path from the actual path? http://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: I'm using the following xpath wtih regex.. and this works.. xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d')][2] but this doesn't xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d_taskContainer_edit')][2] any idea why? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Selenium Testing - Dealing with unstable wicket path
More: http://www.junit.org/node/23 2010/2/17 Martin Makundi martin.maku...@koodaripalvelut.com: Hi! You can run selenium tests with junit. http://www.junit.org/node/23 ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: Hmm.. How would the example you sent apply to selenium tests? That seems like a unit test approach. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Tuesday, February 16, 2010 9:55 PM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! Maybe you can generate the path from the actual path? http://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: I'm using the following xpath wtih regex.. and this works.. xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d')][2] but this doesn't xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d_taskContainer_edit')][2] any idea why? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Selenium Testing - Dealing with unstable wicket path
yeah.. but if you are running functional tests against packaged software then verifications will be happening outside of the applications's vm. the stuff you sent, depends on overloading application objects in order to make hem testable in memory. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Wednesday, February 17, 2010 12:11 AM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! You can run selenium tests with junit. http://www.junit.org/node/23 ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: Hmm.. How would the example you sent apply to selenium tests? That seems like a unit test approach. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Tuesday, February 16, 2010 9:55 PM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! Maybe you can generate the path from the actual path? http://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: I'm using the following xpath wtih regex.. and this works.. xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d')][2] but this doesn't xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d_taskContainer_edit')][2] any idea why? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Selenium Testing - Dealing with unstable wicket path
Hi! Yes. We have found that building testability and acceptance tests into the application is a good approach. Maybe it does not work for your situation. ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: yeah.. but if you are running functional tests against packaged software then verifications will be happening outside of the applications's vm. the stuff you sent, depends on overloading application objects in order to make hem testable in memory. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Wednesday, February 17, 2010 12:11 AM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! You can run selenium tests with junit. http://www.junit.org/node/23 ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: Hmm.. How would the example you sent apply to selenium tests? That seems like a unit test approach. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Tuesday, February 16, 2010 9:55 PM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! Maybe you can generate the path from the actual path? http://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: I'm using the following xpath wtih regex.. and this works.. xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d')][2] but this doesn't xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d_taskContainer_edit')][2] any idea why? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Selenium Testing - Ajax Loads
our wiki is here: http://cwiki.apache.org/WICKET register yourself an account and you should be good to go. -igor On Tue, Feb 16, 2010 at 9:43 PM, Douglas Ferguson doug...@douglasferguson.us wrote: Igor, I have a decent solution and could put together a wiki page, just need to know where/how.. here's what I've got. Click and Wait for wicket: protected void clickAndWait(String wicketPath, long timeOut){ String callbackScript = if(!window.outstandingWicketCalls){ + window.outstandingWicketCalls = 0; + var oldWicketGlobalPreCallHandler = window.wicketGlobalPreCallHandler; + var oldWicketGlobalPostCallHandler = window.wicketGlobalPostCallHandler; + window.wicketGlobalPreCallHandler = function() { + window.outstandingWicketCalls++; + oldWicketGlobalPreCallHandler(); + }; + window.wicketGlobalPostCallHandler = function() { + oldWicketGlobalPostCallHandler(); + window.outstandingWicketCalls--; + }; + } + window.write(window.outstandingWicketCalls);; selenium.runScript(callbackScript); click(wicketPath); selenium.waitForCondition(selenium.browserbot.getCurrentWindow();window.outstandingWicketCalls===0, Duration.seconds(8).getMilliseconds() +); } Deal with unstable wicket paths protected String getDOMLocator(String xpathTagName, String wicketPath, int index){ String regex = _(\\d+|#)(_|$); Pattern repeaterWicketPathPatter = Pattern.compile(regex); Matcher matcher = repeaterWicketPathPatter.matcher(wicketPath); while(matcher.find()){ try{ if(index == -1){ index = Integer.parseInt(matcher.group(1)); } String xpathRegex = _[0-9]+; if(_.equals(matcher.group(2))){ xpathRegex = xpathRegex + _; } wicketPath = wicketPath.replace(matcher.group(), xpathRegex); }catch(NumberFormatException nfe){ fail(index is required for getDOMLocator, please pass it to the method or as the first numeric value in the wicketpath provide i.e. foo_bar_134_child_#_child2_#); } } StringWriter domLocator = new StringWriter(); domLocator.append(dom=); if(index 0){ domLocator.append(window.findElementByWicketPath('); domLocator.append(wicketPath); domLocator.append(', ); domLocator.append(String.valueOf(index-1)); domLocator.append();); }else { domLocator.append(window.$('[wicketpath=\\'); domLocator.append(wicketPath); domLocator.append(\\']').get(0);); } return domLocator.toString(); } Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Igor Vaynberg [igor.vaynb...@gmail.com] Sent: Tuesday, February 16, 2010 11:11 AM To: users@wicket.apache.org Subject: Re: Selenium Testing - Ajax Loads how would you do that exactly? -igor On Tue, Feb 16, 2010 at 7:26 AM, Douglas Ferguson doug...@douglasferguson.us wrote: the path in repeaters is never stable, it depends on a lot of factors and is hard to predict. i think what may be a good way to deal with it is to use an IComponentInstantiationListener to add a behavior to Item subclasses to output their index in some attribute. install this listener only during test time or simply make it output nothing if not during the test. Interesting I'll look into it.. Is there really any reason why not to just always have the listener there. Seems like there would be little overhead in doing this... But I am curious, if this can be done then why couldn't the wicket page also be made stable using the same technique?
RE: Selenium Testing - Dealing with unstable wicket path
We have tons of unit tests and they are built in. But for selenium this would not work, how can a web browser inspect your runtime object to determine correctness? Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Wednesday, February 17, 2010 12:45 AM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! Yes. We have found that building testability and acceptance tests into the application is a good approach. Maybe it does not work for your situation. ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: yeah.. but if you are running functional tests against packaged software then verifications will be happening outside of the applications's vm. the stuff you sent, depends on overloading application objects in order to make hem testable in memory. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Wednesday, February 17, 2010 12:11 AM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! You can run selenium tests with junit. http://www.junit.org/node/23 ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: Hmm.. How would the example you sent apply to selenium tests? That seems like a unit test approach. Douglas Ferguson mobile: 512.293.7279 office/fax: 512.462.0408 skype: stillrecording aim: DaAmericanRuse - http://www.linkedin.com/in/douglasferguson http://www.myspace.com/douglasferguson http://www.douglasferguson.us/ http://www.distilleryrecords.com/ http://www.stillrecording.com/ Join my mailing list: distilleryrecords-subscr...@yahoogroups.com From: Martin Makundi [martin.maku...@koodaripalvelut.com] Sent: Tuesday, February 16, 2010 9:55 PM To: users@wicket.apache.org Subject: Re: Selenium Testing - Dealing with unstable wicket path Hi! Maybe you can generate the path from the actual path? http://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html ** Martin 2010/2/17 Douglas Ferguson doug...@douglasferguson.us: I'm using the following xpath wtih regex.. and this works.. xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d')][2] but this doesn't xpath=//*[fn:matches(@wicketpath,'taskListContainer_taskTable_taskList_\\d_taskContainer_edit')][2] any idea why? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org