Are you looking to auto-generate some kind of "editor"? If so, you should check out Wicketopia. That's what it does! If it doesn't work exactly for your needs, perhaps you can borrow from it or just shoot an email to the mailing list and we'll (or "I'll") take a look.
On Thu, May 10, 2012 at 10:37 AM, cristic83 <cristi.cior...@gmail.com> wrote: > Hi guys, > > I have the following scenario to implement and I couldn't devise my own > solution or find anywhere on the internet something that could help me, so I > thought to give it a try on this mailing list. So here it goes the issue > that I have: > > I want to add to a list view different components dynamically. E.g., > depending on the listItem model, I want to add an input field or a select > box to my list view. And I also want to use the CompoundPropertyModel for > these components added dynamically. > > What I did until now was something like this: in the populateItem method of > the listView I set the model of the listItem to be a compound propertymodel > like this: > > listItem.setModel(new > CompoundPropertyModel(fieldDescriptorListItem.getModel())); > > Then, I added a Label to the listItem like this: listItem.add(new > Label("name")); //the model has a name property -this works > > The model class has a type property which tells me what type of component I > should display: input or select and a String property which is used to hold > the value entered/selected by the user. > > Now, I want to add input or select fields dynamically based on the model > type property. In order to do that, the only solution I could find was to > create a panel for each type of field I wanted to add, e.g. TextFieldPanel > or DropDownBoxPanel. Then I added that panel to the listView. This is not > good for me, because this way I cannot bind the value entered by the user to > the model using the compound property model, since I have an intermediary > panel. Is there a way I could avoid wrapping the components in this > intermediary panel? I found this link: > https://cwiki.apache.org/WICKET/page-with-dynamic-components.html suggesting > to use the wicket:container tag but I could not make it work. > > Do you have any ideas on how this can be accomplished? > > Thanks in advance, > Cristi > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Add-components-dynamically-to-a-list-view-tp4623678.html > Sent from the Users forum 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org