java.util.Properties as Form Model
Hey, I'm trying to create a form with a CompoundPropertyModel to fill a java.util.Properties object dynamically. FormProperties form = new Form(form, new CompoundPropertyModel(properties)); form.add(new TextFieldString(host)); form.add(new TextFieldString(port)); This works correct when I start from an empty java.util.Properties object. If I have an existing java.util.Properties object (with filled data) and I remove the value in the html page, I want the key-value pair to be deleted from the Properties object. With my current implementation I get a stacktrace (because it tries to write a null value in the java.util.Properties object) java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:432) at org.apache.wicket.core.util.lang.PropertyResolver$MapGetSet.setValue(PropertyResolver.java:803) at org.apache.wicket.core.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(PropertyResolver.java:644) at org.apache.wicket.core.util.lang.PropertyResolver.setValue(PropertyResolver.java:144) Has anybody have an idea how best to create this behaviour? Thanks in advance for your help!
Re: java.util.Properties as Form Model
This indeed solves the trick. I'm not sure this is a bug, since the propertyresolver is a general system and Hashtable is just an exception to normal javabean rules. On Fri, Oct 18, 2013 at 2:01 PM, Marios Skounakis msc...@gmail.com wrote: An idea is to wrap the Properties object in a class of your own implementing Map as follows: class MyProps implements MapString, String { Properties props; public void put(String key, String value) { if (value == null) props.remove(key); else props.put(key, value); } This does sound like a bug in PropertyResolver as it should probably test whether the Map is a Hashtable and call remove() since Hashtable is documented to throw an NPE when put() is called with a null value. On Fri, Oct 18, 2013 at 1:55 PM, Andy Van Den Heuvel andy.vandenheu...@gmail.com wrote: Hey, I'm trying to create a form with a CompoundPropertyModel to fill a java.util.Properties object dynamically. FormProperties form = new Form(form, new CompoundPropertyModel(properties)); form.add(new TextFieldString(host)); form.add(new TextFieldString(port)); This works correct when I start from an empty java.util.Properties object. If I have an existing java.util.Properties object (with filled data) and I remove the value in the html page, I want the key-value pair to be deleted from the Properties object. With my current implementation I get a stacktrace (because it tries to write a null value in the java.util.Properties object) java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:432) at org.apache.wicket.core.util.lang.PropertyResolver$MapGetSet.setValue(PropertyResolver.java:803) at org.apache.wicket.core.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(PropertyResolver.java:644) at org.apache.wicket.core.util.lang.PropertyResolver.setValue(PropertyResolver.java:144) Has anybody have an idea how best to create this behaviour? Thanks in advance for your help!
dynamic form (with list + add/remove)
Hey, I was looking for a good example for creating a dynamic form with a list and add/remove functionality. I looked at the ListView, but this article from Martijn's blog tells to use a RepeatingView http://wicketinaction.com/2008/10/building-a-listeditor-form-component/ this article is from 2008. Is this still the prefered way to do this? Or are there other good examples?
Unknown tag name with Wicket namespace: 'panel'
I get an exception and it's not very clear to me what I'm doing wrong. This is the exception: Last cause: Unknown tag name with Wicket namespace: 'panel'. Might be you haven't installed the appropriate resolver? 'wicket:panel' (line 3, column 2) I'm trying to override the markupSourcingStrategy because i want this class to have it's own html file. Anybody an idea? I use wicket-core 6.7.0. This is my java file: public class ExtBookMarkablePageLinkT extends BookmarkablePageLinkT { private final Component label; public C extends Page ExtBookMarkablePageLink(String id, ClassC pageClass) { this(id, pageClass, new PageParameters()); } public C extends Page ExtBookMarkablePageLink(String id, ClassC pageClass, final PageParameters parameters) { super(id, pageClass, parameters); add(label = newLabel(label)); } protected Component newLabel(final String markupId) { return new Label(markupId, new ModelString()).setRenderBodyOnly(true); } @Override protected IMarkupSourcingStrategy newMarkupSourcingStrategy() { return new PanelMarkupSourcingStrategy(true); } public ExtBookMarkablePageLinkT setLabel(IModel? label) { this.label.setDefaultModel(label); return this; } } and this my html file: !doctype html html xmlns:wicket=http://wicket.apache.org; wicket:panel span wicket:id=label/span /wicket:panel /html
Re: Unknown tag name with Wicket namespace: 'panel'
The html is right next to the javacode. I understand that Link does not normally have a panel, but i want to have one. This code is actually copied from wicket-bootstrap. https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/master/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/button/BootstrapBookmarkablePageLink.java And this works just fine on my pc :) On Mon, May 13, 2013 at 11:09 PM, vineet semwal vineetsemwa...@gmail.comwrote: hi martin, that static block need not be copied to make it work,since it's a static block, it will get executed when the Panel class gets loaded, the Panel class will get loaded by PanelMarkupSourcingStrategy itself since it's referring a constant of panel . yes but i agree not a very nice code flow so should be improved ,i always used to think they are doing this in a very weird way :-) On Tue, May 14, 2013 at 1:48 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Mon, May 13, 2013 at 10:02 PM, Paul Bors p...@bors.ws wrote: Get rid of your newMarkupSourcingStrategy() override and place the HTML right next to the Java source code and you'll be fine. This will not work because usually Link component has no its own markup file. See Panel.java. It has: static { // register wicket:panel WicketTagIdentifier.registerWellKnownTagName(PANEL); } Just add this to your class and it should work. I think this is a bug in Wicket though - this piece of code should be executed by PanelMarkupSourcingStrategy, not by Panel itself. Feel free to file a bug report. If you do not like the default location of the HTML next to your Java classes, then read Chapter 4 of the Wicket user guide you can get for free from wicket's website at: http://wicket.apache.org/learn/books/ ~ Thank you, Paul Bors -Original Message- From: Andy Van Den Heuvel [mailto:andy.vandenheu...@gmail.com] Sent: Monday, May 13, 2013 2:04 PM To: users@wicket.apache.org Subject: Unknown tag name with Wicket namespace: 'panel' I get an exception and it's not very clear to me what I'm doing wrong. This is the exception: Last cause: Unknown tag name with Wicket namespace: 'panel'. Might be you haven't installed the appropriate resolver? 'wicket:panel' (line 3, column 2) I'm trying to override the markupSourcingStrategy because i want this class to have it's own html file. Anybody an idea? I use wicket-core 6.7.0. This is my java file: public class ExtBookMarkablePageLinkT extends BookmarkablePageLinkT { private final Component label; public C extends Page ExtBookMarkablePageLink(String id, ClassC pageClass) { this(id, pageClass, new PageParameters()); } public C extends Page ExtBookMarkablePageLink(String id, ClassC pageClass, final PageParameters parameters) { super(id, pageClass, parameters); add(label = newLabel(label)); } protected Component newLabel(final String markupId) { return new Label(markupId, new ModelString()).setRenderBodyOnly(true); } @Override protected IMarkupSourcingStrategy newMarkupSourcingStrategy() { return new PanelMarkupSourcingStrategy(true); } public ExtBookMarkablePageLinkT setLabel(IModel? label) { this.label.setDefaultModel(label); return this; } } and this my html file: !doctype html html xmlns:wicket=http://wicket.apache.org; wicket:panel span wicket:id=label/span /wicket:panel /html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov Wicket Training Consulting http://jWeekend.com http://jweekend.com/ -- regards, Vineet Semwal
Re: documentation
Projects like Springframework use docbook. It's really nice, You put all documentation in xml files which are in the scm and when you release it, you have documentation per release. On Wed, Jan 23, 2013 at 12:26 PM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, On Wed, Jan 23, 2013 at 12:36 PM, Philippe Demaison ph.demai...@gmail.comwrote: If I had your knowledge and more time (project manager), I wish I could help. Many people have said this... But I know exactly what you mean about the missing reference. I have an idea to start writing a reference guide that will explain the topics I'm most acquaint with. I'll use http://sphinx-doc.org/ because it supports an easy way to embed code snippets from other Maven modules - wicket-examples. So the code examples will evolve with the framework. Stay tuned! Best regards Philippe 2013/1/22 Thies Edeling th...@rrm.net Wicket is open source, if you feel that the documentation is lacking - feel free to contribute. On Jan 22, 2013 5:54 PM, Philippe Demaison ph.demai...@gmail.com wrote: Hi Ondra and Kees, Are you kidding ? Are you saying that I need to - read a book released in 2009 covering wicket 1.3 ? - read http://www.wicket-library.com/wicket-examples/index.html (for which wicket version ? ) - read the Wicket Cookbook - read the migration from 1.x to 1.5 https://cwiki.apache.org/WICKET/migration-to-wicket-15.html - read the migration from 1.5 to 1.6 https://cwiki.apache.org/WICKET/migration-to-wicket-60.html to understand what are the Wicket's benefits and write a POC ? Are you saying that I need to google to read the best practices ? You know that framework adoption is linked to good documentation. Not only of course (quality are community are equally important) but documentation is essential. For example, I find these documentations much more appealing http://www.playframework.org/documentation/2.0.4/Home http://tapestry.apache.org/documentation.html https://developers.google.com/web-toolkit/doc/latest/DevGuide http://www.springsource.org/spring-framework#documentation Don't you ? Philippe 2013/1/22 Ondrej Zizka ozi...@redhat.com Hi Phillipe, you're right, the documentation deserves improvements. I would recommend you to start with the Wicket in Action book. That will give you the basic concepts of Wicket. Then continue with the examples from http://www.wicket-library.com/** wicket-examples/index.html http://www.wicket-library.com/wicket-examples/index.html. That will enforce what you learned in the book, and show more tricks. Then go through the Wicket Cookbook. That is a collection of solutions and best practices for common tasks. Then skim through https://cwiki.apache.org/** WICKET/migration-to-wicket-15.**html https://cwiki.apache.org/WICKET/migration-to-wicket-15.html and https://cwiki.apache.org/**WICKET/migration-to-wicket-60.**html https://cwiki.apache.org/WICKET/migration-to-wicket-60.html. It is quite easy to create non-ajax websites. I only have dificulties once it gets to Ajax. In such cases, this mailing list is very useful, and also stackoverflow and the multitude of blogs. Not sure what are your other options, but e.g. I prefer Wicket over JSF. Even big JSF fans claim that JSF is marginally better. And last thing, I would recommend to try Wicket in combination with JBoss AS 7, which made my development quick and easy - redeployment in 3 seconds, restart in 5 seconds, CDI, JPA and JAAS at hand, the Infinispan cache, easy management, ... my2c, Ondra On 01/22/2013 11:24 AM, Philippe Demaison wrote: Hi All, As Gabor Friedrich from the FAO, we are in my company, L'Oreal, comparing different web frameworks. Apache Wicket may be the best framework, may be usefull for my company, I don't know. I don't know because there is no clear documentation for a good evaluation. In fact the documentation is not good. The documentation is not up to date, not to say obsolete, not well organized and definitely not sexy. Sorry to being rude, I know this is difficult to do, but this is a major drawback when company and people evaluate Wicket. Some articles are for 1.4 or 1.5, not many for 6 Some articles are redundant. I am sure the folowing structure could be improved : https://cwiki.apache.org/**WICKET/framework-**documentation.html https://cwiki.apache.org/WICKET/framework-documentation.htmlis https://cwiki.apache.org/**WICKET/index.html https://cwiki.apache.org/WICKET/index.html
Re: wicket 6 form example?
Thanks, I will try it out On Mon, Jan 7, 2013 at 12:55 PM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, I think https://code.google.com/p/londonwicket/downloads/detail?name=LondonWicket-FormsWithFlair.pdfcan=2q=shows an example for this. It is also based on Wicket 1.3 but this area is not different in Wicket 6. jQuery is just a detail about internals. The Java APIs are still the same. All you need is AjaxFormComponentUpdatingBehavior (AFCUB) attached to the FormComponent and a FeedbackPanel(s) which will be updated in AFCUB's onSubmit() and onError() methods. On Mon, Jan 7, 2013 at 1:30 PM, Andy Van Den Heuvel andy.vandenheu...@gmail.com wrote: I'm new to Wicket and I'm searching for good examples using wicket 6/jQuery based examples for forms. Basically I need to create a form with inline ajax validation. I mean: when I leave a textfield only this textfield is validated via ajax and feedback is inline for that textfield only. I've read Wicket In Action, but this is 1.3 code. Is there a good github project or something that focuses on the Wicket 6 stuff? -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/