<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Building a ListEditor form component</title>
	<atom:link href="http://wicketinaction.com/2008/10/building-a-listeditor-form-component/feed/" rel="self" type="application/rss+xml" />
	<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/</link>
	<description>A comprehensive guide for Java developers building Wicket-based web applications</description>
	<lastBuildDate>Fri, 15 Jan 2010 04:01:26 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sam</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-593</link>
		<dc:creator>sam</dc:creator>
		<pubDate>Thu, 24 Sep 2009 06:18:27 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-593</guid>
		<description>I&#039;m getting this error:

java.lang.UnsupportedOperationException: Model class x.x.x.listeditor.ListEditorItem$ListItemModel does not support setObject(Object)
at org.apache.wicket.model.AbstractReadOnlyModel.setObject(AbstractReadOnlyModel.java:55)
     at org.apache.wicket.Component.setDefaultModelObject(Component.java:3052)
     at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)</description>
		<content:encoded><![CDATA[<p>I&#8217;m getting this error:</p>
<p>java.lang.UnsupportedOperationException: Model class x.x.x.listeditor.ListEditorItem$ListItemModel does not support setObject(Object)<br />
at org.apache.wicket.model.AbstractReadOnlyModel.setObject(AbstractReadOnlyModel.java:55)<br />
     at org.apache.wicket.Component.setDefaultModelObject(Component.java:3052)<br />
     at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ivaynberg</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-561</link>
		<dc:creator>ivaynberg</dc:creator>
		<pubDate>Thu, 30 Jul 2009 16:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-561</guid>
		<description>@John: Remember, the whole point of the ListEditor was that submit is atomic. The problem, I would guess, is that you use a regular TabbedPanel which uses a regular anchor link to switch tabs. That means the form is not submitted.

There are two ways to solve it:

a) Override tabbedpanel&#039;s newLink() factory and return a SubmitLink instead - this will submit the form between tab switches.

b) Use a javascript tab panel instead so that everything is still kept on the same page.</description>
		<content:encoded><![CDATA[<p>@John: Remember, the whole point of the ListEditor was that submit is atomic. The problem, I would guess, is that you use a regular TabbedPanel which uses a regular anchor link to switch tabs. That means the form is not submitted.</p>
<p>There are two ways to solve it:</p>
<p>a) Override tabbedpanel&#8217;s newLink() factory and return a SubmitLink instead &#8211; this will submit the form between tab switches.</p>
<p>b) Use a javascript tab panel instead so that everything is still kept on the same page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-556</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sat, 25 Jul 2009 15:48:35 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-556</guid>
		<description>Also, now when I switch tabs any updates get lost unless I have submitted the whole form. This is not very intuitive for the user as the tabs really just split up a very very long form which has many parts that are optional.</description>
		<content:encoded><![CDATA[<p>Also, now when I switch tabs any updates get lost unless I have submitted the whole form. This is not very intuitive for the user as the tabs really just split up a very very long form which has many parts that are optional.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-553</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 24 Jul 2009 15:39:03 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-553</guid>
		<description>I had this working fine when everything was on a single page. I also used the above example to make it work with lists of strings.

Then I separated different parts of the form into panels on tabs. Now that it is in a panel the add button does not update its model so always adds an empty string.

I don&#039;t see why it should behave differently. Any ideas?

The hierachy was..
form-&gt;listeditor stuff

The hierarchy is now..
form-&gt;tabbedpanel-&gt;panel-&gt;listeditor stuff

Maybe there is another problem with forms separated into panels but wizards do this fine..

Help!</description>
		<content:encoded><![CDATA[<p>I had this working fine when everything was on a single page. I also used the above example to make it work with lists of strings.</p>
<p>Then I separated different parts of the form into panels on tabs. Now that it is in a panel the add button does not update its model so always adds an empty string.</p>
<p>I don&#8217;t see why it should behave differently. Any ideas?</p>
<p>The hierachy was..<br />
form-&gt;listeditor stuff</p>
<p>The hierarchy is now..<br />
form-&gt;tabbedpanel-&gt;panel-&gt;listeditor stuff</p>
<p>Maybe there is another problem with forms separated into panels but wizards do this fine..</p>
<p>Help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ivaynberg</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-546</link>
		<dc:creator>ivaynberg</dc:creator>
		<pubDate>Fri, 10 Jul 2009 04:14:20 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-546</guid>
		<description>@garz: Because we want all changes to the list to be comitted atomically when the form is submitted we make a copy of the actual list backing the model.

If we did not do this then operations such as move up and move down, for example, would immediately affect the model object before the form was submitted.</description>
		<content:encoded><![CDATA[<p>@garz: Because we want all changes to the list to be comitted atomically when the form is submitted we make a copy of the actual list backing the model.</p>
<p>If we did not do this then operations such as move up and move down, for example, would immediately affect the model object before the form was submitted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: garz</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-545</link>
		<dc:creator>garz</dc:creator>
		<pubDate>Thu, 09 Jul 2009 15:43:37 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-545</guid>
		<description>hi ivaynberg,

at first i want to thank you for this article. i have the book &quot;wicket in action&quot; and there it isnt explained the same way as it is here and i have the feeling, this solution is nicer than the one in the book. thank you very much!

i have one question. in the ListEditor-class in the method onBeforeRender() you set the items-attribute like this:
items = new ArrayList(getModelObject());
why not doing it like this:
items = getModelObject();
why do you create a new ArrayList-object? is it because the constructor supports the more general interface Collection? if so, why not using Collection as the type for the items-attribute?

just asking because i dont want to miss something. maybe there is something i dont understand.

thank you and keep the good work up. :)</description>
		<content:encoded><![CDATA[<p>hi ivaynberg,</p>
<p>at first i want to thank you for this article. i have the book &#8220;wicket in action&#8221; and there it isnt explained the same way as it is here and i have the feeling, this solution is nicer than the one in the book. thank you very much!</p>
<p>i have one question. in the ListEditor-class in the method onBeforeRender() you set the items-attribute like this:<br />
items = new ArrayList(getModelObject());<br />
why not doing it like this:<br />
items = getModelObject();<br />
why do you create a new ArrayList-object? is it because the constructor supports the more general interface Collection? if so, why not using Collection as the type for the items-attribute?</p>
<p>just asking because i dont want to miss something. maybe there is something i dont understand.</p>
<p>thank you and keep the good work up. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L'engin</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-509</link>
		<dc:creator>L'engin</dc:creator>
		<pubDate>Mon, 08 Jun 2009 08:04:27 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-509</guid>
		<description>Ok, cool!

I used the FormComponentPanel method you suggested. It took a bit (ok a lot) of fumbling with details to get it to work, but now that it&#039;s done, works like a charm. Also, other than a few things (like have to use getParent().iterator() instead of getParent().get(int) in the RemoveButton), most things are portable as you say.

Thanks!</description>
		<content:encoded><![CDATA[<p>Ok, cool!</p>
<p>I used the FormComponentPanel method you suggested. It took a bit (ok a lot) of fumbling with details to get it to work, but now that it&#8217;s done, works like a charm. Also, other than a few things (like have to use getParent().iterator() instead of getParent().get(int) in the RemoveButton), most things are portable as you say.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ivaynberg</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-507</link>
		<dc:creator>ivaynberg</dc:creator>
		<pubDate>Sat, 06 Jun 2009 17:44:31 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-507</guid>
		<description>The only piece that is missing in 1.3.x is the IFormModelUpdateListener, so you will have to manually invoke updateModel() on the ListEditor. There are many options to do this:

	Implement IFormModelUpdateListener yourself and call it from a custom form&#039;s overridden process() method.
	Put the ListEditor into a FormComponentPanel and call ListEditor.updateModel() from FCP.updateModel()
	Add a HiddenField to the form and call ListEditor.updateModel() from HiddenField.updateModel()


Other then that everything else should be portable I believe.</description>
		<content:encoded><![CDATA[<p>The only piece that is missing in 1.3.x is the IFormModelUpdateListener, so you will have to manually invoke updateModel() on the ListEditor. There are many options to do this:</p>
<p>	Implement IFormModelUpdateListener yourself and call it from a custom form&#8217;s overridden process() method.<br />
	Put the ListEditor into a FormComponentPanel and call ListEditor.updateModel() from FCP.updateModel()<br />
	Add a HiddenField to the form and call ListEditor.updateModel() from HiddenField.updateModel()</p>
<p>Other then that everything else should be portable I believe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L'engin</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-504</link>
		<dc:creator>L'engin</dc:creator>
		<pubDate>Sat, 06 Jun 2009 08:25:02 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-504</guid>
		<description>Great article!

I was looking how to do this in 1.3.x, and it appears to be much more complicated due to final methods and coding against classes vs. interfaces.

How would you suggest one do this in older versions of Wicket?</description>
		<content:encoded><![CDATA[<p>Great article!</p>
<p>I was looking how to do this in 1.3.x, and it appears to be much more complicated due to final methods and coding against classes vs. interfaces.</p>
<p>How would you suggest one do this in older versions of Wicket?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick</title>
		<link>http://wicketinaction.com/2008/10/building-a-listeditor-form-component/comment-page-1/#comment-464</link>
		<dc:creator>Rick</dc:creator>
		<pubDate>Thu, 23 Apr 2009 05:15:47 +0000</pubDate>
		<guid isPermaLink="false">http://wicketinaction.com/?p=228#comment-464</guid>
		<description>Thanks for this great article. This is exactly what I was looking for. Superb.</description>
		<content:encoded><![CDATA[<p>Thanks for this great article. This is exactly what I was looking for. Superb.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
