How to avoid code duplication on forms?

2009-05-08 Thread Christian Helmbold
Hello, Wicket uses input validation on the presentation layer. This leads often to code duplication and I'm looking for a way to avoid it. Example: I have a registration form where you fill in your first and last name, password and so on. Every field has its restrictions like max length or

Re: How to avoid code duplication on forms?

2009-05-08 Thread Igor Vaynberg
much simpler class UserEmailField extends TextField { public UserEmailField(String id, IModel model) { super(id, model); add(EmailAddressValidator.getInstance()) add(UniqueValidator.unique(SystemUser.class, email)); } } -igor On Thu, May 7, 2009 at 11:43 PM, Christian Helmbold

Eelco's wicket-contrib-navmenu revival? OR: Doing menus in Wicket...

2009-05-08 Thread ralf . eichinger
under wicketstuff for 1.2 I found the little project wicket-contrib-navmenu. I started to update it for Wicket 1.4-rc2. Does this make sense or is there a better way to create hierarchy-like menues? Eelco? I know there is a TabbedPanel component. But I somehow feel strange to implement my whole

Re: Eelco's wicket-contrib-navmenu revival? OR: Doing menus in Wicket...

2009-05-08 Thread Ralf Eichinger
Martijn Dashorst wrote: Wicket in Action does discuss menus: see page 185 (index entry: menu), though not multilevel menus. You are right, the easy way is described... Martijn Dashorst wrote: Just take a look at YUI-menu or some jquery plugin for menus. The reason for not continuing

Re: AjaxResponse with control characters is not validated

2009-05-08 Thread jensiator
done! igor.vaynberg wrote: open a jira issue and add a quickstart please. -igor On Thu, May 7, 2009 at 4:12 AM, Jens Alenius jens.alen...@megasol.se wrote: Hi. Found something that might be a wicket ajax bug. This code wont work in Firefox and we believe that its the Ajax xml

Re: Eelco's wicket-contrib-navmenu revival? OR: Doing menus in Wicket...

2009-05-08 Thread Martijn Dashorst
Wicket in Action does discuss menus: see page 185 (index entry: menu), though not multilevel menus. Just take a look at YUI-menu or some jquery plugin for menus. The reason for not continuing the menu component is that there are enough alternatives available for rendering a menu. And most folks

SV: Wicket SWFObject

2009-05-08 Thread Wilhelmsen Tor Iver
I just figured out that the deal is that SWFObject doesn't like to be set visible false on page load then visible true via Ajax. Any thoughts on how to get around this? Ajax in Wicket needs the page DOM to have an element with the id it is supposed to replace with the output of a (now

AW: How to avoid code duplication on forms?

2009-05-08 Thread Christian Helmbold
I think the difference between sub classing and static factory methods is a matter of taste in this case. If I have many fields, I'd need many classes for them. So I'd group them in a sub package. In the case of factory methods I'd group the methods to create fields in a class instead of a

Re: Spring Security's method security and Wicket

2009-05-08 Thread Kent Larsson
Hello, Reference for this post: http://forum.springsource.org/showthread.php?p=239559#post239559 (the related Spring Security thread) It actually seems my interpretation about how it might work was correct below (though my original interpretation was wrong, but let's not talk about that one ;-)

Re: How to avoid code duplication on forms?

2009-05-08 Thread Marc Nuri (GMail)
Hi. How about using varargs or a similar approach in your TextField: code public class ValidatedTextFieldT extends TextFieldT{ public ValidatedTextField(String id, final IModelT model, boolean required, AbstractValidator... validators) { super(id, model);

Re: How to avoid code duplication on forms?

2009-05-08 Thread Martin Makundi
TextField t = new ValidatedTextField(id, new Model(your Model), And remember to use Model.of(your Model) ** Martin http://tyoajanseuranta.blogit.fi/ Wicket työajanseuranta true, EmailAddressValidator.getInstance(), StringValidator.maximumLength(50));

RadioGroup with Boolean Model

2009-05-08 Thread Christoph Grün
Hello, I want to have a radio group that looks like this: How do I have to set the model of the Radio Group? Must this be a Boolean one and what is set with getObject and setObject methods? input name=radiogroup wicket:id=field1 type=radio id=radiogroup13-field114 value=radio10

Re: Spring Security's method security and Wicket

2009-05-08 Thread James Carman
You can check out my wicket-advanced application that I wrote for a talk I gave to our local Java users group. In there, I implemented a Spring Security-based implementation. Here's my session class:

Re: How to avoid code duplication on forms?

2009-05-08 Thread Gabriel Kastenbaum
If the fields (user/pwd) always go together on every pages, why not having having one root Panel (called MyPanel) knowing the fields , validation etc and several Panels that simply extends MyPanel ; avec each child has its own layouts. Best regards, Gabriel Kastenbaum http://blog.oxiane.com

Re: yui slider component does not work

2009-05-08 Thread Joshua Lim
Hi Christoph This was due to YuiHeaderContributor being moved to another package. I was doing some house keeping :p it should be fixed in /yui/ trunk now (no change in yui-examples). can you try again? Joshua 2009/5/5 Christoph Grün chris...@gmx.at Hello, I have downloaded the

AW: yui slider component does not work

2009-05-08 Thread Christoph Grün
Hi Joshua! Thanks a lot!! It works. Christoph -Ursprüngliche Nachricht- Von: Joshua Lim [mailto:lim.j...@gmail.com] Gesendet: Freitag, 08. Mai 2009 13:45 An: users@wicket.apache.org Betreff: Re: yui slider component does not work Hi Christoph This was due to YuiHeaderContributor

Re: AW: How to avoid code duplication on forms?

2009-05-08 Thread Jonathan Locke
the advantage to subclassing is that you're working better with the type system whereas static pulls you out of the object world and should be used with great caution. for example, subclassing enables more subclassing and therefore more reusability. static factory methods cannot be specialized.

Re: AW: How to avoid code duplication on forms?

2009-05-08 Thread Jonathan Locke
the advantage to subclassing is that you're working better with the type system whereas static pulls you out of the object world and should be used with great caution. for example, subclassing enables more subclassing and therefore more reusability. static factory methods cannot be specialized.

Re: AW: How to avoid code duplication on forms?

2009-05-08 Thread Jonathan Locke
uh that was: class EmailField extends TextField[Email] where the square brackets are angle brackets :) Christian Helmbold-2 wrote: I think the difference between sub classing and static factory methods is a matter of taste in this case. If I have many fields, I'd need many classes

AjaxTabbedPanel custom validation behaviour

2009-05-08 Thread Alfredo Aleandri
I'm using an AjaxTabbedPanel and I would like to obtain the following behaviours: 1) user input must be retained when switching tabs 2) tabs link should skip only the requireness validation but not all other validators so the user can switch from tab to tab if he doesn't insert bad input

Re: AjaxTabbedPanel custom validation behaviour

2009-05-08 Thread Igor Vaynberg
when used with forms it is a better idea to output the entire form and use javascript tabs. -igor On Fri, May 8, 2009 at 6:11 AM, Alfredo Aleandri alfredo.alean...@logobject.ch wrote: I'm using an AjaxTabbedPanel and I would like to obtain the following behaviours: 1) user input must be

Object without ID in LoadableDetachableModels

2009-05-08 Thread Christian Helmbold
Domain (or model) objects get their IDs from Hibernate on saving in my application. When I create a new LoadableDetachableModel with a fresh model object without an ID, the LoadableDetachableModel object contains no ID to load the model object from the DB on the next request. Because

Re: Object without ID in LoadableDetachableModels

2009-05-08 Thread James Carman
Can you switch to using UUIDs? That saved me a LOT of headaches! On Fri, May 8, 2009 at 11:21 AM, Christian Helmbold christian.helmb...@yahoo.de wrote: Domain (or model) objects get their IDs from Hibernate on saving in my application. When I create a new LoadableDetachableModel with a fresh

Re: best way to add tooltips in wicket

2009-05-08 Thread nino martinez wael
very strange i'll look into it soon, when I get the app thats gonna use it up to 1.4 2009/5/7 RoyBatty math...@afjochnick.net: Thanks Nino. A little bit more input on the Mootip performance bit, if you're interested. Basically, when we're using it it behaves quite differently from the mootip

Re: Object without ID in LoadableDetachableModels

2009-05-08 Thread Igor Vaynberg
http://wicketinaction.com/2008/09/building-a-smart-entitymodel/ -igor On Fri, May 8, 2009 at 8:21 AM, Christian Helmbold christian.helmb...@yahoo.de wrote: Domain (or model) objects get their IDs from Hibernate on saving in my application. When I create a new LoadableDetachableModel with a

60% waste

2009-05-08 Thread Martin Makundi
Hi! I use TDD: I spend 60% of my time type-checking and path-checking my wicketTests and components. I always have the wrong path and I must prinDocument and iterate to get it right Anybody have the same experience? How about introducing type-safety and path-safety/identity into component

Re: 60% waste

2009-05-08 Thread Martijn Dashorst
See jdave-wicket for better test support. Slated to come to you in Wicket 1.5 Martijn On Fri, May 8, 2009 at 5:48 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Hi! I use TDD: I spend 60% of my time type-checking and path-checking my wicketTests and components. I always have

Re: 60% waste

2009-05-08 Thread Andrea Aime
Martin Makundi ha scritto: Hi! I use TDD: I spend 60% of my time type-checking and path-checking my wicketTests and components. I always have the wrong path and I must prinDocument and iterate to get it right I don't know if this is of any help, but I've written the attached utility

Forms loading multiple times

2009-05-08 Thread Chris
I'm having a issue with forms loading multiple times.. This is really screwing up ChoiceRenderer. Has anyone else experienced this? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail:

Re: Forms loading multiple times

2009-05-08 Thread Igor Vaynberg
define loading -igor On Fri, May 8, 2009 at 9:34 AM, Chris ch...@carlsoncentral.com wrote: I'm having a issue with forms loading multiple times.. This is really screwing up ChoiceRenderer.  Has anyone else experienced this?

Re: 60% waste

2009-05-08 Thread Martin Makundi
I don't know if this is of any help, but I've written the attached utility class that, given a component, can print its containment structure, along with the eventual component classes and model values (toString-ed). Well... printDoc and wicket getDebugSettings().setOutputComponentPath(true);

Re: 60% waste

2009-05-08 Thread Igor Vaynberg
you should really use visitors for this kind of thing...something like this may work very well for you TestUtils.attachTestId(Component c, String id) { if (application.get().getconfigurationtype()!=production) { c.setmatadata(testkey, id); } } then in your code Form form=new Form(..);

Re: 60% waste

2009-05-08 Thread Igor Vaynberg
you can also create a test panel that contains just your form and test that instead of creating the entire complex page just to test the form. break your tests into small units and test in isolaton. your test harness panel can have a getter that gives you direct access the the form you are

Re: 60% waste

2009-05-08 Thread Per Lundholm
Well, strings all over the place, if I get what you mean. But I write the tests first and they define what the paths and ids should be and Wicket is really quick about discovering when the implementation doesn't follow spec (i.e. tests). Doing a small step at a time takes you there faster.

Re: 60% waste

2009-05-08 Thread Martin Makundi
you should really use visitors for this kind of thing...something like this may work very well for you I know that with more work I can make ... more work. What I am looking for is a solution that makes it possible to have intellisense while coding and compile-time type checking. Visitors etc.

Re: 60% waste

2009-05-08 Thread James Carman
Use an IDE plugin? On Fri, May 8, 2009 at 2:39 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: you should really use visitors for this kind of thing...something like this may work very well for you I know that with more work I can make ... more work. What I am looking for is a

Re: 60% waste

2009-05-08 Thread Martin Makundi
But I write the tests first and they define what the paths and ids should be and Wicket is really quick about discovering when the implementation doesn't follow spec (i.e. tests). I concentrate on coding.. sometimes I write the implementation, sometimes the tests, whichever goes faster until

Re: 60% waste

2009-05-08 Thread Martin Makundi
Use an IDE plugin? That's a hack, not a design. ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org

Re: 60% waste

2009-05-08 Thread Igor Vaynberg
so what you are saying is that adding one line of code to mark the component you want to test, and then being able to find that component easily in your test - independent of its place in hierarchy and without relying on strings - is more work? -igor On Fri, May 8, 2009 at 11:39 AM, Martin

Re: 60% waste

2009-05-08 Thread Igor Vaynberg
wicket component hierarchy is dynamic, so there is no predicting it at compile time. this is one of the most powerful features of wicket. -igor On Fri, May 8, 2009 at 11:39 AM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: you should really use visitors for this kind of

Re: 60% waste

2009-05-08 Thread James Carman
What about introducing an xpath-ish like expression API that could help you search for components within the hierarchy? On Fri, May 8, 2009 at 3:07 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: wicket component hierarchy is dynamic, so there is no predicting it at compile time. this is one

Re: 60% waste

2009-05-08 Thread Christopher L Merrill
Martin Makundi wrote: Use an IDE plugin? That's a hack, not a design. Wow...I'm new to this list, but I doubt you can expect much help with that attitude. I suggest you request a refund for your Wicket license and support subscription and go find a tool that better fits your needs. Oh,

Re: Stream/download files through portlet

2009-05-08 Thread Bruno Ledesma
Hello All! Im facing problems trying to Stream/download files through portlet. I also used DynamicWebResource and a Resource link to serve the Resource Data. On a simple Wicket application everything works fine, but when my war is deployed as a portlet into a Liferay 5 instance, it doesnt work.

Re: 60% waste

2009-05-08 Thread Andrea Aime
Martin Makundi ha scritto: I don't know if this is of any help, but I've written the attached utility class that, given a component, can print its containment structure, along with the eventual component classes and model values (toString-ed). Well... printDoc and wicket

Re: Stream/download files through portlet

2009-05-08 Thread Bruno Ledesma
Solved. Its a Liferay issue. http://issues.liferay.com/browse/LPS-1911 I was using portlet names and filter-mapping with a - char. I have to use the same string value for the portlet name and the filter-mapping stuff... without the - char, cause liferay (i dont have idea why) removes this

DropDownChoice ID's

2009-05-08 Thread Chris
List test = Arrays.asList(new String[] { A, B, C }); add(new DropDownChoice(test, test)); How can I make the Id's match the Values? There coming through as 1,2,3. I've tried custom ChoiceRenderer, but seem to be missing something. Any help is appreciated.

Re: Forms loading multiple times

2009-05-08 Thread Oblivian
I mean the DAO that populates my model, runs 2 times. Oblivian wrote: I'm having a issue with forms loading multiple times.. This is really screwing up ChoiceRenderer. Has anyone else experienced this? - To

Re: Forms loading multiple times

2009-05-08 Thread Igor Vaynberg
if you use a detachable model connected to your dao then it will call the dao every render. -igor On Fri, May 8, 2009 at 2:21 PM, Oblivian ch...@carlsoncentral.com wrote: I mean the DAO that populates my model, runs 2 times. Oblivian wrote: I'm having a issue with forms loading multiple

Re: DropDownChoice ID's

2009-05-08 Thread Igor Vaynberg
new ichoicerendererstring { object getid(string object, int index) { return object; } string getdisplayvalue(string object) { return object; } } -igor On Fri, May 8, 2009 at 2:19 PM, Chris ch...@carlsoncentral.com wrote: List test = Arrays.asList(new String[] { A, B, C }); add(new

Re: DropDownChoice ID's

2009-05-08 Thread Oblivian
Think I figured it out by doing something like this. Is this the right way? public class StringChoiceRender implements IChoiceRenderer { public Object getDisplayValue(Object object) { return object.toString(); } public String getIdValue(Object object, int index) { return

inmethod grid generics patch

2009-05-08 Thread Brill Pappin
according to this post; http://tinyurl.com/qlghyf the inmethod grid it he wicketstuff modules was to get generics. I'm finding the missing generics a real pain in the behind but I also have a recent checkout of the 1.4-SNAPSHOT of wicketstuff, and it does not yet have generics. Does

Re: inmethod grid generics patch

2009-05-08 Thread Matej Knopp
Hi, it's not abandoned. There's a project created for it in wicketstuff jira that can be used to submit patches. -Matej On Fri, May 8, 2009 at 11:49 PM, Brill Pappin br...@pappin.ca wrote: according to this post; http://tinyurl.com/qlghyf the inmethod grid it he wicketstuff modules was to

Re: inmethod grid generics patch

2009-05-08 Thread Matej Knopp
Found the patch, will assign it to jira issue. And possibly apply after review. -Matej On Fri, May 8, 2009 at 11:54 PM, Matej Knopp matej.kn...@gmail.com wrote: Hi, it's not abandoned. There's a project created for it in wicketstuff jira that can be used to submit patches. -Matej On Fri,

Re: DropDownChoice ID's

2009-05-08 Thread Oblivian
Thanks. Oblivian wrote: List test = Arrays.asList(new String[] { A, B, C }); add(new DropDownChoice(test, test)); How can I make the Id's match the Values? There coming through as 1,2,3. I've tried custom ChoiceRenderer, but seem to be missing something. Any help is

Re: inmethod grid generics patch

2009-05-08 Thread Brill Pappin
That would be great! If you need an area to focus on, it's the generics that type things like getSelectedItems() etc. and some of the other common overrides. - Brill Pappin On 8-May-09, at 5:57 PM, Matej Knopp wrote: Found the patch, will assign it to jira issue. And possibly apply

Re: 60% waste

2009-05-08 Thread Martin Makundi
Interesting. I googled for printDoc Wicket but did not find anything. Where is that utility? public void printDocument() { System.out.println(tester.getServletResponse().getDocument()); } ** Martin - To unsubscribe,

Re: 60% waste

2009-05-08 Thread Martin Makundi
wicket component hierarchy is dynamic, so there is no predicting it at compile time. this is one of the most powerful features of wicket. Yes but each component is always fixed relative to its parent. The html markup fixes the hierarcy, so something might be devised here. What about