Re: triggering post of a form, from client side
thanks for your quick replay . so the situation as it is now is : i have managed to call the forms submit by the following java script : StringBuffer config = new StringBuffer(); int i = ns.getAutoRefreshSecsConversation(); config.append(script language=\JavaScript\); config.append(function onLoad() { getValue(); + ( i0 ? :setTimeout(\onRefresh();\,+i*1000+); )+ }); config.append(function onRefresh(){); config.append(document.getElementById('hiddenVar').value = document.getElementById('textString').value;); config.append(var button = document.getElementById(' + submit.getMarkupId() + '); + window.location = button.click(); } ); config.append(function getValue() {); config.append(document.getElementById('textString').value = document.getElementById('hiddenVar').value; }); config.append(/script); add(new StringHeaderContributor(config.toString())); BUT... the result i get it the fire fox is this : i get the data posted to the server side correctly BUT im as well redirected to the link- http://localhost:6789/neustar/undefined and i get HTTP Status 404 - /neustar/undefined what do i do now how ? why does that happen instead of the normal behavior of submit button like clicking it in the browser?! Regards., jwcarman wrote: You may want to look at AjaxFormSubmitBehavior. If you can't use that directly, the code might give you an idea of how to write your Javascript to do form submissions manually. On Wed, Nov 26, 2008 at 6:27 AM, dshapi [EMAIL PROTECTED]wrote: hi, I need to trigger the post of a form - from the client side with java script , but all the solutions that i have found don't work with wicket. i have tried document.forms['commentForm'].submit(); in script - doesn't work. (when commentForm is the name of the form that is generated in the mark up of the wicket ). i all sow tried to trigger the submit button that is in the form but .click() doesn't work, i have managed only to trigger Links with window.location = link.href; any ideas ? -- View this message in context: http://www.nabble.com/triggering-post-of-a-form%2C-from-client-side-tp20699113p20699113.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/triggering-post-of-a-form%2C-from-client-side-tp20699113p20756255.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [VOTE] End of Life wicket-contrib-gmap?
[X] - YES, please create a branch in the Wicket Stuff repo just for abandoned projects and move wicket-contrib-gmap into that branch. -- View this message in context: http://www.nabble.com/-VOTE--End-of-Life-wicket-contrib-gmap--tp20726039p20758844.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [discuss] Organizing Wicket Stuff / Regular Release Schedule?
Great work! Its really looking good! Two more suggestions: 1. Add the maven-jetty-plugin the the root pom. It would be nice if 'mvn jetty:run' works for all the examples. 2. Remove all eclipse projects (.project .classpath) from svn and add the 'maven-eclipse-plugin' to the root project. I can make patches for these changes if you like... but i'm not totally clear on the etiquette for wicketstuff. Is someone (you?) allowed to apply a patch that affects build for many projects? ryan On Nov 30, 2008, at 1:16 AM, Jeremy Thomerson wrote: PS - Good suggestion - this was included. Take a look at: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core -- Jeremy Thomerson http://www.wickettraining.com On Tue, Nov 25, 2008 at 4:32 PM, Ryan McKinley [EMAIL PROTECTED] wrote: I don't know if this has already been discussed, but another part of the cleanup that would be nice is to group the main project and the example project into a folder with a common parent pom. For example, I find the layout of: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/inmethod-grid/ much easier to use/maintain then the apparent standard of /wicketstuff-project /wicketstuff-project-example https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-push/ https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-push-examples/ one key thing about this change is that mvn eclipse:eclipse makes the example project depend on the core project perhaps this could be added to the 'organize' task? ryan - 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: [discuss] Organizing Wicket Stuff / Regular Release Schedule?
I agree with both of those. I'm not real sure either regarding the etiquette - that's been my dilemna throughout. That's the reason I started so many vote threads. I think both of those things would be acceptable, though. A common build setup was the goal of this. I'd like to also see us use a common version of many standard libraries at some point (commons, logging etc), but I don't think it's critical right this moment. At least they're all against a common Wicket version. If you supply a patch, I'll apply it. Or you can just do it if you want. You would be making sure each folder also had svn:ignore for .classpath, .project and target folder? Jeremy Thomerson http://www.wickettraining.com -- sent from a wireless device -Original Message- From: Ryan McKinley [EMAIL PROTECTED] Sent: Sunday, November 30, 2008 10:33 AM To: users@wicket.apache.org Subject: Re: [discuss] Organizing Wicket Stuff / Regular Release Schedule? Great work! Its really looking good! Two more suggestions: 1. Add the maven-jetty-plugin the the root pom. It would be nice if 'mvn jetty:run' works for all the examples. 2. Remove all eclipse projects (.project .classpath) from svn and add the 'maven-eclipse-plugin' to the root project. I can make patches for these changes if you like... but i'm not totally clear on the etiquette for wicketstuff. Is someone (you?) allowed to apply a patch that affects build for many projects? ryan On Nov 30, 2008, at 1:16 AM, Jeremy Thomerson wrote: PS - Good suggestion - this was included. Take a look at: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core -- Jeremy Thomerson http://www.wickettraining.com On Tue, Nov 25, 2008 at 4:32 PM, Ryan McKinley [EMAIL PROTECTED] wrote: I don't know if this has already been discussed, but another part of the cleanup that would be nice is to group the main project and the example project into a folder with a common parent pom. For example, I find the layout of: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/inmethod-grid/ much easier to use/maintain then the apparent standard of /wicketstuff-project /wicketstuff-project-example https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-push/ https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-push-examples/ one key thing about this change is that mvn eclipse:eclipse makes the example project depend on the core project perhaps this could be added to the 'organize' task? ryan - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [discuss] Organizing Wicket Stuff / Regular Release Schedule?
Check: http://wicketstuff.org/jira/browse/WSYUI-6 (YUI seemed like the best option... no 'core' project exists) This also adds a logging implementation so the tinymce-examples runs with jetty:run I don't have commit access on wicketstuff, so I can't directly apply the patch :) As for svn:ignore on the .classpath and .project... I think you need to first go through and delete the files, then add them to the ignore list. thanks! ryan On Nov 30, 2008, at 11:54 AM, Jeremy Thomerson wrote: I agree with both of those. I'm not real sure either regarding the etiquette - that's been my dilemna throughout. That's the reason I started so many vote threads. I think both of those things would be acceptable, though. A common build setup was the goal of this. I'd like to also see us use a common version of many standard libraries at some point (commons, logging etc), but I don't think it's critical right this moment. At least they're all against a common Wicket version. If you supply a patch, I'll apply it. Or you can just do it if you want. You would be making sure each folder also had svn:ignore for .classpath, .project and target folder? Jeremy Thomerson http://www.wickettraining.com -- sent from a wireless device -Original Message- From: Ryan McKinley [EMAIL PROTECTED] Sent: Sunday, November 30, 2008 10:33 AM To: users@wicket.apache.org Subject: Re: [discuss] Organizing Wicket Stuff / Regular Release Schedule? Great work! Its really looking good! Two more suggestions: 1. Add the maven-jetty-plugin the the root pom. It would be nice if 'mvn jetty:run' works for all the examples. 2. Remove all eclipse projects (.project .classpath) from svn and add the 'maven-eclipse-plugin' to the root project. I can make patches for these changes if you like... but i'm not totally clear on the etiquette for wicketstuff. Is someone (you?) allowed to apply a patch that affects build for many projects? ryan On Nov 30, 2008, at 1:16 AM, Jeremy Thomerson wrote: PS - Good suggestion - this was included. Take a look at: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core -- Jeremy Thomerson http://www.wickettraining.com On Tue, Nov 25, 2008 at 4:32 PM, Ryan McKinley [EMAIL PROTECTED] wrote: I don't know if this has already been discussed, but another part of the cleanup that would be nice is to group the main project and the example project into a folder with a common parent pom. For example, I find the layout of: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/inmethod-grid/ much easier to use/maintain then the apparent standard of /wicketstuff-project /wicketstuff-project-example https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-push/ https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-push-examples/ one key thing about this change is that mvn eclipse:eclipse makes the example project depend on the core project perhaps this could be added to the 'organize' task? ryan - 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] - 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]
YUI uploader?
Anyone tried using wicket with the YUI uploader? http://developer.yahoo.com/yui/uploader/ http://developer.yahoo.com/yui/examples/uploader/uploader-advanced-queue_clean.html This uses a flash object to select files and post them -- all the progress is handled on the client side rather then passing ajax info back from the server. The one bit that is non-obvious on how to integrate the script is that the javascript takes an upload url as its parameter: uploader.uploadAll(http://www.yswfblog.com/upload/upload_simple.php;, POST, null, Filedata); http://developer.yahoo.com/yui/docs/YAHOO.widget.Uploader.html If you select multiple files, this could be called multiple times -- you can also upload multiple files simultaneously. Any thoughts on how to handle this in wicket? The only solutions I can think of are not very wickety (add a servlet and then put stuff directly in the Session) Thanks for any pointers! ryan
Re: [VOTE] Consistent naming for Wicket Stuff projects
El jue, 27-11-2008 a las 15:54 -0600, Jeremy Thomerson escribió: I am beginning the WS reorg as noted in previous emails. You can monitor progress here: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/ As we move projects into the wicketstuff-core, I would like to see us rename them consistently, getting rid of the prepended wicket-contrib- or wicketstuff-. This would mean that when we release WicketStuff 1.4 (when Wicket 1.4 is released) that if you are using that project, you would need to update your POM to the new name. Please vote: [X] - YES - I would like consistent naming [ ] - NO (convincing reason) PS - I feel like I'm starting a lot of vote threads - should I not be? Any suggestions? I would like to efficiently get this reorg done, but I am leery of just moving other people's projects around and making changes without permission. Feelings / thoughts? Keep on the good work, Jeremy ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with detaching elements
Hello, I'm writing an web application using Spring, Wicket and Hibernate. It's the first time I use this technologies, so forgive me if my question is trivial. In my application i have a many to one relationship between Hotel and Room. On admin panel I'd like to have possibility to edit Hotel data - including modifying data of rooms that belong to this hotel. Unfortunately, when i try to save modified hotel, only it's data are changed - rooms stay they were before modification. And when i try to delete a room, i get an exception that says i try to delete detached entity (java.lang.IllegalArgumentException: Removing a detached instance pl.molejnik.hotbookings.model.Room#1). I've spent whole day looking for solutions for this, but I failed... I'd be very grateful if anyone could tell me what i am doing wrong. Here are relevant fragments of my code: Room.java: @ManyToOne(targetEntity = Hotel.class) @JoinColumn(name = Hotel_id) private Hotel hotel; Hotel.java @OneToMany(mappedBy = hotel, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }) private ListRoom rooms; DomainObjectModel public class DomainObjectModelT extends DomainObject extends LoadableDetachableModel { @SpringBean private IHotelbookingsService service; private final ClassT type; private final Long id; public DomainObjectModel(ClassT type, Long id) { InjectorHolder.getInjector().inject(this); this.type = type; this.id = id; } @SuppressWarnings(unchecked) public DomainObjectModel(T domainObject) { super(domainObject); InjectorHolder.getInjector().inject(this); this.type = (ClassT) domainObject.getClass(); this.id = domainObject.getId(); } @Override protected Object load() { return service.load(type, id); } } EditHotelPanel.java public class EditHotelPanel extends Panel { private IModel model; private Form form; PageableListView rooms; @SpringBean IHotelbookingsService service; public EditHotelPanel(String id, Long hotelId) { super(id); this.setOutputMarkupId(true); model = new CompoundPropertyModel(new DomainObjectModelHotel(Hotel.class, hotelId)); setModel(model); form = new Form(form); form.setOutputMarkupId(true); form.add(new TextField(name)); form.add(new TextField(numberOfStars)); form.add(new TextField(address.city)); rooms = new PageableListView(rooms, ((Hotel)model.getObject()).getRooms(), 10) { @Override protected void populateItem(ListItem item) { DomainObjectModelRoom m = new DomainObjectModelRoom((Room) item.getModelObject()); final Room r = (Room) m.getObject(); item.add(new TextField(costPerNight, new PropertyModel(r, costPerNight))); item.add(new TextField(numberOfBeds, new PropertyModel(r, numberOfBeds))); item.add(new CheckBox(ensuite, new PropertyModel(r, ensuite))); item.add(new Link(deleteRoom){ @Override public void onClick() { service.removeRoom(r); } }); } }; form.add(rooms); SubmitLink save = new SubmitLink(saveButton) { @Override public void onSubmit() { Hotel h = (Hotel)model.getObject(); service.saveHotel(h); setResponsePage(Index.class); } }; form.add(save); add(form); } } EditHotelPanel.html html xmlns:wicket body wicket:panel form wicket:id=form Nazwa: input type=text wicket:id=name/ br/ Liczba gwiazdek: input type=text wicket:id=numberOfStars/ br/ Miasto: input type=text wicket:id=address.city/ br/ div Pokoje: br/
Re: [VOTE] Consistent naming for Wicket Stuff projects
[X] - YES - I would like consistent naming On Sun, Nov 30, 2008 at 2:28 PM, Martin Grigorov [EMAIL PROTECTED]wrote: El jue, 27-11-2008 a las 15:54 -0600, Jeremy Thomerson escribió: I am beginning the WS reorg as noted in previous emails. You can monitor progress here: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/ As we move projects into the wicketstuff-core, I would like to see us rename them consistently, getting rid of the prepended wicket-contrib- or wicketstuff-. This would mean that when we release WicketStuff 1.4 (when Wicket 1.4 is released) that if you are using that project, you would need to update your POM to the new name. Please vote: [X] - YES - I would like consistent naming [ ] - NO (convincing reason) PS - I feel like I'm starting a lot of vote threads - should I not be? Any suggestions? I would like to efficiently get this reorg done, but I am leery of just moving other people's projects around and making changes without permission. Feelings / thoughts? Keep on the good work, Jeremy ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with detaching elements
go to wicketinaction.com and search for smart entity model also read the wiki page called models, especially detachable models secton. -igor On Sun, Nov 30, 2008 at 2:40 PM, blekit [EMAIL PROTECTED] wrote: Hello, I'm writing an web application using Spring, Wicket and Hibernate. It's the first time I use this technologies, so forgive me if my question is trivial. In my application i have a many to one relationship between Hotel and Room. On admin panel I'd like to have possibility to edit Hotel data - including modifying data of rooms that belong to this hotel. Unfortunately, when i try to save modified hotel, only it's data are changed - rooms stay they were before modification. And when i try to delete a room, i get an exception that says i try to delete detached entity (java.lang.IllegalArgumentException: Removing a detached instance pl.molejnik.hotbookings.model.Room#1). I've spent whole day looking for solutions for this, but I failed... I'd be very grateful if anyone could tell me what i am doing wrong. Here are relevant fragments of my code: Room.java: @ManyToOne(targetEntity = Hotel.class) @JoinColumn(name = Hotel_id) private Hotel hotel; Hotel.java @OneToMany(mappedBy = hotel, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }) private ListRoom rooms; DomainObjectModel public class DomainObjectModelT extends DomainObject extends LoadableDetachableModel { @SpringBean private IHotelbookingsService service; private final ClassT type; private final Long id; public DomainObjectModel(ClassT type, Long id) { InjectorHolder.getInjector().inject(this); this.type = type; this.id = id; } @SuppressWarnings(unchecked) public DomainObjectModel(T domainObject) { super(domainObject); InjectorHolder.getInjector().inject(this); this.type = (ClassT) domainObject.getClass(); this.id = domainObject.getId(); } @Override protected Object load() { return service.load(type, id); } } EditHotelPanel.java public class EditHotelPanel extends Panel { private IModel model; private Form form; PageableListView rooms; @SpringBean IHotelbookingsService service; public EditHotelPanel(String id, Long hotelId) { super(id); this.setOutputMarkupId(true); model = new CompoundPropertyModel(new DomainObjectModelHotel(Hotel.class, hotelId)); setModel(model); form = new Form(form); form.setOutputMarkupId(true); form.add(new TextField(name)); form.add(new TextField(numberOfStars)); form.add(new TextField(address.city)); rooms = new PageableListView(rooms, ((Hotel)model.getObject()).getRooms(), 10) { @Override protected void populateItem(ListItem item) { DomainObjectModelRoom m = new DomainObjectModelRoom((Room) item.getModelObject()); final Room r = (Room) m.getObject(); item.add(new TextField(costPerNight, new PropertyModel(r, costPerNight))); item.add(new TextField(numberOfBeds, new PropertyModel(r, numberOfBeds))); item.add(new CheckBox(ensuite, new PropertyModel(r, ensuite))); item.add(new Link(deleteRoom){ @Override public void onClick() { service.removeRoom(r); } }); } }; form.add(rooms); SubmitLink save = new SubmitLink(saveButton) { @Override public void onSubmit() { Hotel h = (Hotel)model.getObject(); service.saveHotel(h); setResponsePage(Index.class); } }; form.add(save); add(form); } } EditHotelPanel.html html xmlns:wicket body wicket:panel form wicket:id=form Nazwa: input type=text wicket:id=name/ br/ Liczba gwiazdek: input type=text
Re: Problem with detaching elements
Hello, thanks for link to the article - it was very interesting. However, I still don't see clear connection between this case and my problem - I use my own DomainObjectModel which extends LoadableDetachableModel (and after reading once more the section about them i still can't see any mistakes in mine usage of them - maybe i need some sleep after all). I think i noticed where the problem lies, but still I don't have any clue how to fix it. The hotel's data including rooms list are loaded correctly and rendered on the first time. But when i submit the form, only hotel's direct data (name, address, etc.) are updated. I discovered, that the list of rooms i use as a model for my PageableListView is probably detached immidiately after render and the changes made on her aren't propagated to hotel when i persist it. Still, as I said before, I don't know why it happens and I'd be very grateful for some more explicite answer. Thanks in advance. Best regards, Michał Olejnik PS. If you need some more code to help me let me know and i'll paste it igor.vaynberg wrote: go to wicketinaction.com and search for smart entity model also read the wiki page called models, especially detachable models secton. -igor On Sun, Nov 30, 2008 at 2:40 PM, blekit [EMAIL PROTECTED] wrote: Hello, I'm writing an web application using Spring, Wicket and Hibernate. It's the first time I use this technologies, so forgive me if my question is trivial. In my application i have a many to one relationship between Hotel and Room. On admin panel I'd like to have possibility to edit Hotel data - including modifying data of rooms that belong to this hotel. Unfortunately, when i try to save modified hotel, only it's data are changed - rooms stay they were before modification. And when i try to delete a room, i get an exception that says i try to delete detached entity (java.lang.IllegalArgumentException: Removing a detached instance pl.molejnik.hotbookings.model.Room#1). I've spent whole day looking for solutions for this, but I failed... I'd be very grateful if anyone could tell me what i am doing wrong. Here are relevant fragments of my code: Room.java: @ManyToOne(targetEntity = Hotel.class) @JoinColumn(name = Hotel_id) private Hotel hotel; Hotel.java @OneToMany(mappedBy = hotel, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }) private ListRoom rooms; DomainObjectModel public class DomainObjectModelT extends DomainObject extends LoadableDetachableModel { @SpringBean private IHotelbookingsService service; private final ClassT type; private final Long id; public DomainObjectModel(ClassT type, Long id) { InjectorHolder.getInjector().inject(this); this.type = type; this.id = id; } @SuppressWarnings(unchecked) public DomainObjectModel(T domainObject) { super(domainObject); InjectorHolder.getInjector().inject(this); this.type = (ClassT) domainObject.getClass(); this.id = domainObject.getId(); } @Override protected Object load() { return service.load(type, id); } } EditHotelPanel.java public class EditHotelPanel extends Panel { private IModel model; private Form form; PageableListView rooms; @SpringBean IHotelbookingsService service; public EditHotelPanel(String id, Long hotelId) { super(id); this.setOutputMarkupId(true); model = new CompoundPropertyModel(new DomainObjectModelHotel(Hotel.class, hotelId)); setModel(model); form = new Form(form); form.setOutputMarkupId(true); form.add(new TextField(name)); form.add(new TextField(numberOfStars)); form.add(new TextField(address.city)); rooms = new PageableListView(rooms, ((Hotel)model.getObject()).getRooms(), 10) { @Override protected void populateItem(ListItem item) { DomainObjectModelRoom m = new DomainObjectModelRoom((Room) item.getModelObject()); final Room r = (Room) m.getObject(); item.add(new TextField(costPerNight, new PropertyModel(r, costPerNight))); item.add(new TextField(numberOfBeds, new PropertyModel(r, numberOfBeds))); item.add(new CheckBox(ensuite, new PropertyModel(r, ensuite)));
GridView and PagingNavigator - issue in page navigation
Hi, I am using GridView and PagingNavigator to render a series of podcast elements in my database. I am using wickets 1.3.5 with Hibernate and Tomcat. The first page renders fine but in trying to navigate using the Paging Navigator - It looks like the state is lost and I get the following error INFO [http-8080-1] (RequestListenerInterface.java:278) - registered listener interface [RequestListenerInterface name=INewBrowserWindowListener, method=public abstract void org.apache.wicket.markup.html.INewBrowserWindowListener.onNewBrowserWindow()] INFO [http-8080-1] (PodcastDataProvider.java:64) - PodcastDataProvider: Category:null, Num of entries:0 INFO [http-8080-1] (RequestListenerInterface.java:174) - component not enabled or visible; ignoring call. Component: [MarkupContainer [Component id = pageLink]] INFO [http-8080-1] (PodcastDataProvider.java:64) - PodcastDataProvider: Category:null, Num of entries:0 INFO [http-8080-1] (PodcastDataProvider.java:41) - Iterator - first:0, count:0 Here is my code - pretty much from the wickets grid example - public GridPanel(String id, String category){ super(id); log.info(GridPanel - Category: + category); add(new Label(CategoryLabel, category)); IDataProvider dataProvider = new PodcastDataProvider(category); GridView gridView = new GridView(rows, dataProvider){ protected void populateItem(Item item) { final PodcastTbl podTbl = (PodcastTbl)item.getModelObject(); item.add(new Label(PodcastPanel, podId)); } protected void populateEmptyItem(Item item) { item.add(new Label(PodcastPanel, *empty*)); } }; gridView.setRows(4); gridView.setColumns(3); add(gridView); add(new PagingNavigator(navigator, gridView)); ---html ===- div class=grid span wicket:id=navigator[dataview navigator]/span table cellspacing=0 cellpadding=2 tr wicket:id=rows td wicket:id=colsspan wicket:id=PodcastPanel[Podcast Id]/span/td /tr /table /div -- Appreciate any pointers. thx, Ed _ Color coding for safety: Windows Live Hotmail alerts you to suspicious email. http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_safety_112008
Re: Problem with detaching elements
final Room r = (Room) m.getObject(); item.add(new TextField(costPerNight, new PropertyModel(r, costPerNight))); there you are binding your model directly to the object thus keeping a reference, instead new propertymodel(m, costPerNight); -igor On Sun, Nov 30, 2008 at 3:51 PM, blekit [EMAIL PROTECTED] wrote: Hello, thanks for link to the article - it was very interesting. However, I still don't see clear connection between this case and my problem - I use my own DomainObjectModel which extends LoadableDetachableModel (and after reading once more the section about them i still can't see any mistakes in mine usage of them - maybe i need some sleep after all). I think i noticed where the problem lies, but still I don't have any clue how to fix it. The hotel's data including rooms list are loaded correctly and rendered on the first time. But when i submit the form, only hotel's direct data (name, address, etc.) are updated. I discovered, that the list of rooms i use as a model for my PageableListView is probably detached immidiately after render and the changes made on her aren't propagated to hotel when i persist it. Still, as I said before, I don't know why it happens and I'd be very grateful for some more explicite answer. Thanks in advance. Best regards, Michał Olejnik PS. If you need some more code to help me let me know and i'll paste it igor.vaynberg wrote: go to wicketinaction.com and search for smart entity model also read the wiki page called models, especially detachable models secton. -igor On Sun, Nov 30, 2008 at 2:40 PM, blekit [EMAIL PROTECTED] wrote: Hello, I'm writing an web application using Spring, Wicket and Hibernate. It's the first time I use this technologies, so forgive me if my question is trivial. In my application i have a many to one relationship between Hotel and Room. On admin panel I'd like to have possibility to edit Hotel data - including modifying data of rooms that belong to this hotel. Unfortunately, when i try to save modified hotel, only it's data are changed - rooms stay they were before modification. And when i try to delete a room, i get an exception that says i try to delete detached entity (java.lang.IllegalArgumentException: Removing a detached instance pl.molejnik.hotbookings.model.Room#1). I've spent whole day looking for solutions for this, but I failed... I'd be very grateful if anyone could tell me what i am doing wrong. Here are relevant fragments of my code: Room.java: @ManyToOne(targetEntity = Hotel.class) @JoinColumn(name = Hotel_id) private Hotel hotel; Hotel.java @OneToMany(mappedBy = hotel, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }) private ListRoom rooms; DomainObjectModel public class DomainObjectModelT extends DomainObject extends LoadableDetachableModel { @SpringBean private IHotelbookingsService service; private final ClassT type; private final Long id; public DomainObjectModel(ClassT type, Long id) { InjectorHolder.getInjector().inject(this); this.type = type; this.id = id; } @SuppressWarnings(unchecked) public DomainObjectModel(T domainObject) { super(domainObject); InjectorHolder.getInjector().inject(this); this.type = (ClassT) domainObject.getClass(); this.id = domainObject.getId(); } @Override protected Object load() { return service.load(type, id); } } EditHotelPanel.java public class EditHotelPanel extends Panel { private IModel model; private Form form; PageableListView rooms; @SpringBean IHotelbookingsService service; public EditHotelPanel(String id, Long hotelId) { super(id); this.setOutputMarkupId(true); model = new CompoundPropertyModel(new DomainObjectModelHotel(Hotel.class, hotelId)); setModel(model); form = new Form(form); form.setOutputMarkupId(true); form.add(new TextField(name)); form.add(new TextField(numberOfStars)); form.add(new TextField(address.city)); rooms = new PageableListView(rooms, ((Hotel)model.getObject()).getRooms(), 10) { @Override protected void populateItem(ListItem item) { DomainObjectModelRoom m = new DomainObjectModelRoom((Room) item.getModelObject()); final Room r = (Room) m.getObject(); item.add(new TextField(costPerNight,
Re: Problem with detaching elements
Well, that of course worked - as I wrote earlier I'm very grateful. Thank you very much for your help once again. igor.vaynberg wrote: final Room r = (Room) m.getObject(); item.add(new TextField(costPerNight, new PropertyModel(r, costPerNight))); there you are binding your model directly to the object thus keeping a reference, instead new propertymodel(m, costPerNight); -igor On Sun, Nov 30, 2008 at 3:51 PM, blekit [EMAIL PROTECTED] wrote: Hello, thanks for link to the article - it was very interesting. However, I still don't see clear connection between this case and my problem - I use my own DomainObjectModel which extends LoadableDetachableModel (and after reading once more the section about them i still can't see any mistakes in mine usage of them - maybe i need some sleep after all). I think i noticed where the problem lies, but still I don't have any clue how to fix it. The hotel's data including rooms list are loaded correctly and rendered on the first time. But when i submit the form, only hotel's direct data (name, address, etc.) are updated. I discovered, that the list of rooms i use as a model for my PageableListView is probably detached immidiately after render and the changes made on her aren't propagated to hotel when i persist it. Still, as I said before, I don't know why it happens and I'd be very grateful for some more explicite answer. Thanks in advance. Best regards, Michał Olejnik PS. If you need some more code to help me let me know and i'll paste it igor.vaynberg wrote: go to wicketinaction.com and search for smart entity model also read the wiki page called models, especially detachable models secton. -igor On Sun, Nov 30, 2008 at 2:40 PM, blekit [EMAIL PROTECTED] wrote: Hello, I'm writing an web application using Spring, Wicket and Hibernate. It's the first time I use this technologies, so forgive me if my question is trivial. In my application i have a many to one relationship between Hotel and Room. On admin panel I'd like to have possibility to edit Hotel data - including modifying data of rooms that belong to this hotel. Unfortunately, when i try to save modified hotel, only it's data are changed - rooms stay they were before modification. And when i try to delete a room, i get an exception that says i try to delete detached entity (java.lang.IllegalArgumentException: Removing a detached instance pl.molejnik.hotbookings.model.Room#1). I've spent whole day looking for solutions for this, but I failed... I'd be very grateful if anyone could tell me what i am doing wrong. Here are relevant fragments of my code: Room.java: @ManyToOne(targetEntity = Hotel.class) @JoinColumn(name = Hotel_id) private Hotel hotel; Hotel.java @OneToMany(mappedBy = hotel, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }) private ListRoom rooms; DomainObjectModel public class DomainObjectModelT extends DomainObject extends LoadableDetachableModel { @SpringBean private IHotelbookingsService service; private final ClassT type; private final Long id; public DomainObjectModel(ClassT type, Long id) { InjectorHolder.getInjector().inject(this); this.type = type; this.id = id; } @SuppressWarnings(unchecked) public DomainObjectModel(T domainObject) { super(domainObject); InjectorHolder.getInjector().inject(this); this.type = (ClassT) domainObject.getClass(); this.id = domainObject.getId(); } @Override protected Object load() { return service.load(type, id); } } EditHotelPanel.java public class EditHotelPanel extends Panel { private IModel model; private Form form; PageableListView rooms; @SpringBean IHotelbookingsService service; public EditHotelPanel(String id, Long hotelId) { super(id); this.setOutputMarkupId(true); model = new CompoundPropertyModel(new DomainObjectModelHotel(Hotel.class, hotelId)); setModel(model); form = new Form(form); form.setOutputMarkupId(true); form.add(new TextField(name)); form.add(new TextField(numberOfStars)); form.add(new TextField(address.city)); rooms = new PageableListView(rooms, ((Hotel)model.getObject()).getRooms(), 10) { @Override protected void populateItem(ListItem item) { DomainObjectModelRoom m = new DomainObjectModelRoom((Room)
Re: Bug of Wicket when iterate the form using iterator()?
MarkupContainer's children field is declared as an Object and can refer to a ChildList - which is a List, hopefully (until it's genericised) of Components, an Object[] - again, hopefully of Components, a Component - ie a single child, or, even a ComponentSourceEntry - a bare-bones representation of only the essentials of a Component from which it can be reconstructed. I assume MarkupContainer's implementation was refactored (_from_ something much more straight-forward) as an optimisation, in particular related to serialisation, with the argument probably along the lines of: it is common for a MarkupContainer to have just a single child, so we don't want the luggage of a List in those cases etc ... All this can make MarkupContainer pretty fragile, easy to accidentally break. If the optimisation argument is really strong enough (I expect it must have been at the time and may still be), at the very least, all the messy operations on children could be encapsulated in a class (perhaps called FunkyChildren, possibly as an inner class if it necessarily needs access to its owning MarkupContainer instance's guts and is never used outside this context) that exposes only friendly methods like set(int index,Component child) and remove(Component child) etc ... Apart from simplifying MarkupContainer, the above design would also have the benefit of making it possible to address the problem in hand (with the illegal runtime array cast), mend what's broken and test this funky, edge-case(?) behaviour without having to interfere with MarkupContainer. And, if there's a simpler/better/more efficient FunkyChildren possible for 1.5 just plug in the new implementation. Importantly, as this an internal change (internal to MarkupContainer), there will be no API break (neither within Wicket nor in the public API). Regards - Cemal http://www.jWeekend.co.uk http://jWeekend.co.uk Matej Knopp-2 wrote: this sorted = Arrays.asList((Component[])children); doesn't look right. I think it should have been (Object[])children although a type check would be appropriate. -Matej On Fri, Nov 28, 2008 at 7:30 PM, jWeekend [EMAIL PROTECTED] wrote: Not quite. String[] bO = (String[])(new Object[]{yes,we,can}); compiles but fails at run time. Regards - Cemal http://www.jWeekend.co.uk http://jWeekend.co.uk Valentine2008 wrote: It will bring the compilation error when trying to cast arrays in Java. So you mean it is a bug in Wicket? Timo Rantalaiho wrote: On Thu, 27 Nov 2008, Valentine2008 wrote: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache .wicket.Component; at org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478) . The code on line 478 of MarkupContainer.java is: sorted = Arrays.asList((Component[])children); Is it a bug of Wicket? No, I think it's a limitation of Java. You cannnot cast arrays. Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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] -- View this message in context: http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20764684.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bug of Wicket when iterate the form using iterator()?
The only problem right now is the cast to Component[]. The fix is easy, just change it to Object[]. The optimization makes a lot of sense and there is reason why it can't really be simple. -Matej On Mon, Dec 1, 2008 at 2:29 AM, jWeekend [EMAIL PROTECTED] wrote: MarkupContainer's children field is declared as an Object and can refer to a ChildList - which is a List, hopefully (until it's genericised) of Components, an Object[] - again, hopefully of Components, a Component - ie a single child, or, even a ComponentSourceEntry - a bare-bones representation of only the essentials of a Component from which it can be reconstructed. I assume MarkupContainer's implementation was refactored (_from_ something much more straight-forward) as an optimisation, in particular related to serialisation, with the argument probably along the lines of: it is common for a MarkupContainer to have just a single child, so we don't want the luggage of a List in those cases etc ... All this can make MarkupContainer pretty fragile, easy to accidentally break. If the optimisation argument is really strong enough (I expect it must have been at the time and may still be), at the very least, all the messy operations on children could be encapsulated in a class (perhaps called FunkyChildren, possibly as an inner class if it necessarily needs access to its owning MarkupContainer instance's guts and is never used outside this context) that exposes only friendly methods like set(int index,Component child) and remove(Component child) etc ... Apart from simplifying MarkupContainer, the above design would also have the benefit of making it possible to address the problem in hand (with the illegal runtime array cast), mend what's broken and test this funky, edge-case(?) behaviour without having to interfere with MarkupContainer. And, if there's a simpler/better/more efficient FunkyChildren possible for 1.5 just plug in the new implementation. Importantly, as this an internal change (internal to MarkupContainer), there will be no API break (neither within Wicket nor in the public API). Regards - Cemal http://www.jWeekend.co.uk http://jWeekend.co.uk Matej Knopp-2 wrote: this sorted = Arrays.asList((Component[])children); doesn't look right. I think it should have been (Object[])children although a type check would be appropriate. -Matej On Fri, Nov 28, 2008 at 7:30 PM, jWeekend [EMAIL PROTECTED] wrote: Not quite. String[] bO = (String[])(new Object[]{yes,we,can}); compiles but fails at run time. Regards - Cemal http://www.jWeekend.co.uk http://jWeekend.co.uk Valentine2008 wrote: It will bring the compilation error when trying to cast arrays in Java. So you mean it is a bug in Wicket? Timo Rantalaiho wrote: On Thu, 27 Nov 2008, Valentine2008 wrote: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache .wicket.Component; at org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478) . The code on line 478 of MarkupContainer.java is: sorted = Arrays.asList((Component[])children); Is it a bug of Wicket? No, I think it's a limitation of Java. You cannnot cast arrays. Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20738179.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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] -- View this message in context: http://www.nabble.com/Bug-of-Wicket-1.3.4-when-iterate-the-form-using-iterator%28Comparator%29--tp20723903p20764684.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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]
inmethod-grid generics?
Hi- Is there any interest in making inmethod grid generic? I have a half-way implementation that makes IDataSourceT -- it does not make IQueryResult generic though. Is there anywhere to attach patches for inmethod-grid? I don't see anything on: http://wicketstuff.org/jira/secure/Dashboard.jspa thanks! ryan