I'm trying to build a form dynamically and am having a little problem. Basically I have a class that takes a List<FormComponent> and then passes them into a ListView for display on screen. The problem is that they were created elsewhere and I have no control over two things: 1) The order/type of each FormComponent 2) The wicket:id that was chosen for them when the FormComponents were created
I think I've solved 1) by creating wrapper classes for each supported FormComponent type... for example, I have a DropDownChoicePanel which simply adds the DropDownChoice it is passed to its html, which is simply a <select wicket:id="component"></select>. This way I can simply wrap each FormComponent in the list with a panel and add all the panels to my listview rather than the components themselves -- this solves the problem of homogenizing the listview's HTML. But 2) is causing me problems, because unless I require all FormComponents to be given a wicket:id which is prespecified and is the same as that in the DropDownChoicePanel (wicket:id="component") then it will not work. Am I going about this all wrong? Is there any way I can receive a FormComponent and then change its wicket:id so that it will always be "component" in my ListView? Or is there a solution for this problem already? Much thanks for any advice.