actually that is not the philosophy. the philosophy is to make that as close to reality as possible, and i think wicket comes very damn close, at least a lot closer then any other.
of course when you are going to start mapping things to wicket components that have no equivalent in html, like wicket repeaters, you will have a bit of a mismatch. on the other hand <div>Product</div> and <div><span>Product</span></div> are virtually identical, so there isnt a huge issue adding an extra span to represent the label besides, your usecase is almost designed to demonstrate the "flaw", how would you expect to map something like this: <div id="product">Product Name ($Price)</div> ? -igor -igor On Sun, Aug 22, 2010 at 5:12 PM, J <bluecar...@gmx.com> wrote: > A feature/philosophy is that Wicket HTML is just plain HTML. > This means that a webdesigner can create plain HTML, annotate it with > wicket:id attributes, and then the Java developer can just write Java code. > Plain HTML can be transformed to WicketHTML just by adding wicket:id > attributes. > > In the case of my problem, which is a very common scenario, you cannot just > add wicket:id's, and let it work. It requires the use of extra divs (or > wicket:container) just to let ListView work. The extra required div causes a > difference between the plain HTML and WicketHTML, and therefore for > WicketHTML the HTML rules differ. > The designer now has to know about these details of Wicket, such as: if the > developer is going to use a ListView, the developer has to wrap extra divs > around some elements. > > >> ----- Original Message ----- >> From: Igor Vaynberg >> Sent: 08/23/10 01:26 AM >> To: users@wicket.apache.org >> Subject: Re: setRenderBodyOnly with ListView and attributes >> >> first you have to prove that either of those cases is a "violation", i >> do not see either one of them as being one. >> >> -igor >> >> On Sun, Aug 22, 2010 at 2:40 PM, J <bluecar...@gmx.com> wrote: >> > That will work, but I already knew that. >> > >> > The whole problem is that it violates Wickets "just/pure HTML" philosphy >> > in that an extra unwanted div (or span) is required in WickedHTML just to >> > make ListView work, even though it's a common scenario. >> > If ListView would follow Wickets philosophy, it would support this >> > WicketHTML: >> > <div wicket:id="products" class="products"> >> > <div wicket:id="product" class="product">Product1....</div> >> > </div> >> > >> > At the moment, there are two known workarounds in this discussion: >> > 1) Accept the violation of "just HTML" by using the extra DIV. >> > 2) Accept the violation of "just HTML" by using wicket:container. >> > >> > >> > >> >> ----- Original Message ----- >> >> From: Igor Vaynberg >> >> Sent: 08/22/10 11:22 PM >> >> To: users@wicket.apache.org >> >> Subject: Re: setRenderBodyOnly with ListView and attributes >> >> >> >> listviews have nothing to do with tables, they are generic repeaters. >> >> here is the solution >> >> >> >> <html> >> >> <body> >> >> <div class="products"> >> >> <div wicket:id="products" class="product"> >> >> <span wicket:id="product" class="product"></span> >> >> </div> >> >> </div> >> >> </body> >> >> </html> >> >> >> >> the only change needed to code is the tweak to this line: >> >> item.add(new Label("product", product).setRenderBodyOnly(true)); >> >> >> >> -igor >> >> >> >> >> >> On Sat, Aug 21, 2010 at 10:31 AM, Fatih Mehmet UCAR <fmu...@gmail.com> >> >> wrote: >> >> > I think ListView is designed for html TABLE and each iteration prints >> >> > the TR >> >> > tag, see the wiki for example. >> >> > You may wanna use DataView instead to avoid that case. Live examples >> >> > can be >> >> > reference point for that. >> >> > >> >> > -fmu >> >> > >> >> > ----- Original Message ----- From: "J" <bluecar...@gmx.com> >> >> > To: <users@wicket.apache.org> >> >> > Sent: Saturday, August 21, 2010 4:44 PM >> >> > Subject: Re: setRenderBodyOnly with ListView and attributes >> >> > >> >> > >> >> >> Here is the complete (test) code >> >> >> >> >> >> >> >> >> ============ SOLUTION 1 : wicket:container ============= >> >> >> >> >> >> ++++ TestPage.html ++++ >> >> >> <html> >> >> >> <body> >> >> >> <div class="products"> >> >> >> <wicket:container wicket:id="products"> >> >> >> <div wicket:id="product" class="product"></div> >> >> >> </wicket:container> >> >> >> </div> >> >> >> </body> >> >> >> </html> >> >> >> >> >> >> >> >> >> ++++ TestPage.java ++++ >> >> >> import java.util.Arrays; >> >> >> import java.util.List; >> >> >> import org.apache.wicket.markup.html.WebPage; >> >> >> import org.apache.wicket.markup.html.basic.Label; >> >> >> import org.apache.wicket.markup.html.list.ListItem; >> >> >> import org.apache.wicket.markup.html.list.ListView; >> >> >> >> >> >> public class TestPage extends WebPage { >> >> >> >> >> >> public TestPage() { >> >> >> >> >> >> List products = Arrays.asList("productA", "productB", "productC"); >> >> >> ListView productsView = new ListView("products", products) { >> >> >> protected void populateItem(ListItem item) { >> >> >> String product = (String) item.getModelObject(); >> >> >> item.add(new Label("product", product)); >> >> >> } >> >> >> }; >> >> >> add(productsView); >> >> >> >> >> >> } >> >> >> } >> >> >> >> >> >> ============== SOLUTION 2 : extra div in WicketHTML ================== >> >> >> >> >> >> ++++ TestPage.html ++++ >> >> >> <html> >> >> >> <body> >> >> >> <div class="products"> >> >> >> <div wicket:id="products"> >> >> >> <div wicket:id="product" class="product"></div> >> >> >> </div> >> >> >> </div> >> >> >> </body> >> >> >> </html> >> >> >> >> >> >> >> >> >> ++++ TestPage.java ++++ >> >> >> import java.util.Arrays; >> >> >> import java.util.List; >> >> >> import org.apache.wicket.markup.html.WebPage; >> >> >> import org.apache.wicket.markup.html.basic.Label; >> >> >> import org.apache.wicket.markup.html.list.ListItem; >> >> >> import org.apache.wicket.markup.html.list.ListView; >> >> >> >> >> >> public class TestPage extends WebPage { >> >> >> >> >> >> public TestPage() { >> >> >> >> >> >> List products = Arrays.asList("productA", "productB", "productC"); >> >> >> ListView productsView = new ListView("products", products) { >> >> >> protected void populateItem(ListItem item) { >> >> >> String product = (String) item.getModelObject(); >> >> >> item.add(new Label("product", product)); >> >> >> item.setRenderBodyOnly(true); >> >> >> } >> >> >> }; >> >> >> add(productsView); >> >> >> >> >> >> } >> >> >> } >> >> >> >> >> >> >> >> >> ==== Wanted/Required and generated output of solution1 & 2 === >> >> >> <html> >> >> >> <body> >> >> >> <div class="products"> >> >> >> <div class="product">productA</div> >> >> >> <div class="product">productB</div> >> >> >> <div class="product">productC</div> >> >> >> </div> >> >> >> </body> >> >> >> </html> >> >> >> ========================================================== >> >> >> >> >> >> For this common scenario: >> >> >> -solution 1 violates Wickets "Just HTML" philosophy in that the >> >> >> wicket:container tag is used. >> >> >> -solution 2 violates Wickets "Just HTML" philosophy in that an extra >> >> >> unwanted div is required in WicketHTML (although not visible in the >> >> >> generated HTML). >> >> >> >> >> >> No other solutions have been found/discussed yet. >> >> >> >> >> >> >> >> >>> ----- Original Message ----- >> >> >>> From: Fatih Mehmet UCAR >> >> >>> Sent: 08/21/10 05:02 PM >> >> >>> To: users@wicket.apache.org >> >> >>> Subject: Re: setRenderBodyOnly with ListView and attributes >> >> >>> >> >> >>> send your html and java code, there may be other ways of doing this. >> >> >>> >> >> >>> >> >> >>> ----- Original Message ----- From: "J" <bluecar...@gmx.com> >> >> >>> To: <users@wicket.apache.org> >> >> >>> Sent: Saturday, August 21, 2010 3:29 PM >> >> >>> Subject: Re: setRenderBodyOnly with ListView and attributes >> >> >>> >> >> >>> >> >> >>> >I made a mistake in my first post. The output of wasn't: >> >> >>> > >> >> >>> > <div> >> >> >>> > <div class="product">.....</div> >> >> >>> > <div class="product">.....</div> >> >> >>> > <div class="product">.....</div> >> >> >>> > <div class="product">.....</div> >> >> >>> > </div> >> >> >>> > >> >> >>> > but it was: >> >> >>> > <div class="product">.....</div> >> >> >>> > <div class="product">.....</div> >> >> >>> > <div class="product">.....</div> >> >> >>> > <div class="product">.....</div> >> >> >>> > >> >> >>> > So the outer div is missing. >> >> >>> > Which is caused by item.setRenderBodyOnly(true). But if I disable >> >> >>> > (set >> >> >>> > > to >> >> >>> > false) this (the default), I get: >> >> >>> > >> >> >>> > <div class="products"><div class="product">.....</div></div> >> >> >>> > <div class="products"><div class="product">.....</div></div> >> >> >>> > <div class="products"><div class="product">.....</div></div> >> >> >>> > <div class="products"><div class="product">.....</div></div> >> >> >>> > >> >> >>> > which is even worse. >> >> >>> > >> >> >>> > A solution (the only?) to this double div problem and at the same >> >> >>> > time >> >> >>> > > the >> >> >>> > missing attribute problem, is using wicket:container tags. (see >> >> >>> > >> >> >>> > http://apache-wicket.1842946.n4.nabble.com/Panel-in-List-remove-extra-div-td1877053.html >> >> >>> > ) >> >> >>> > This leads to this solution: >> >> >>> > >> >> >>> > >> >> >>> > <div class="products"> >> >> >>> > <wicket:container wicket:id="products"> >> >> >>> > <div class="product" wicket:id="productPanel">.....</div> >> >> >>> > </wicket:container> >> >> >>> > </div> >> >> >>> > >> >> >>> > Wicket:container tags make it ugly imo, because it violates wickts > >> >> >>> > "just >> >> >>> > HTML" philosophy, even though my problem is a very common scenario. >> >> >>> > >> >> >>> > >> >> >>> >> ----- Original Message ----- >> >> >>> >> From: Fatih Mehmet UCAR >> >> >>> >> Sent: 08/21/10 04:05 PM >> >> >>> >> To: users@wicket.apache.org >> >> >>> >> Subject: Re: setRenderBodyOnly with ListView and attributes >> >> >>> >> >> >> >>> >> Add another html div with css class you want around the below list >> >> >>> >> div >> >> >>> >> >> ; >> >> >>> >> >> >> >>> >> <div class="products" wicket:id="productsView"> >> >> >>> >> >> >> >>> >> and for the productsViev in the java code setRenderBodyOnly to >> >> >>> >> true. >> >> >>> >> >> >> >>> >> -fmu >> >> >>> >> >> >> >>> >> >> >> >>> >> ----- Original Message ----- >> From: "J" <bluecar...@gmx.com> >> >> >>> >> To: <users@wicket.apache.org> >> >> >>> >> Sent: Saturday, August 21, 2010 2:49 PM >> >> >>> >> Subject: Re: setRenderBodyOnly with ListView and attributes >> >> >>> >> >> >> >>> >> >> >> >>> >> > It somehow feels bad/wrong to move CSS from WicketHTML to >> >> >>> >> > JavaCode, >> >> >>> >> > where >> >> >>> >> > it shouldn't belong, for such a common scenario. >> >> >>> >> > It defeats the purpose of having HTML in Wicket. But there >> >> >>> >> > probably >> >> >>> >> > >> > is >> >> >>> >> > no >> >> >>> >> > other way. >> >> >>> >> > >> >> >>> >> > Anyway, thanks for your reply :) >> >> >>> >> > >> >> >>> >> > >> >> >>> >> >> ----- Original Message ----- >> >> >>> >> >> >> >> >>> >> >> From: Fatih Mehmet UCAR >> >> >>> >> >> Sent: 08/21/10 03:43 PM >> >> >>> >> >> To: users@wicket.apache.org >> >> >>> >> >> Subject: Re: setRenderBodyOnly with ListView and attributes >> >> >>> >> >> >> >> >>> >> >> AttributeAppender class will help you to acheive that. >> >> >>> >> >> >> >> >>> >> >> -fmu >> >> >>> >> >> >> >> >>> >> >> ----- Original Message ----- >> >> From: "J" >> >> >>> >> >> <bluecar...@gmx.com> >> >> >>> >> >> To: <users@wicket.apache.org> >> >> >>> >> >> Sent: Saturday, August 21, 2010 2:24 PM >> >> >>> >> >> Subject: setRenderBodyOnly with ListView and attributes >> >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> > hi, I want to have Wicket to generate the following HTML >> >> >> >>> >> >> > >> > >> >> >>> >> >> > precisely: >> >> >>> >> >> > >> >> >>> >> >> > <div class="products"> >> >> >>> >> >> > <div class="product">.....</div> >> >> >>> >> >> > <div class="product">.....</div> >> >> >>> >> >> > <div class="product">.....</div> >> >> >>> >> >> > <div class="product">.....</div> >> >> >>> >> >> > </div> >> >> >>> >> >> > >> >> >>> >> >> > But with my code, I don't get further than: >> >> >>> >> >> > >> >> >>> >> >> > <div> >> >> >>> >> >> > <div class="product">.....</div> >> >> >>> >> >> > <div class="product">.....</div> >> >> >>> >> >> > <div class="product">.....</div> >> >> >>> >> >> > <div class="product">.....</div> >> >> >>> >> >> > </div> >> >> >>> >> >> > >> >> >>> >> >> > so the class attribute is missing in the outer div. >> >> >>> >> >> > >> >> >>> >> >> > My Wicket HTML is: >> >> >>> >> >> > <div class="products" wicket:id="productsView"> >> >> >>> >> >> > <div class="product" wicket:id="productPanel">.....</div> >> >> >>> >> >> > </div> >> >> >>> >> >> > >> >> >>> >> >> > >> >> >>> >> >> > My code: >> >> >>> >> >> > ListView productsView = new ListView("productsView", >> >> >>> >> >> > products) { >> >> >>> >> >> > protected void populateItem(ListItem item) { >> >> >>> >> >> > item.setRenderBodyOnly(true); >> >> >>> >> >> > item.add(new ProductPanel("productPanel", >> >> > >> >> >>> >> >> > item.getModelObject())); >> >> >>> >> >> > } >> >> >>> >> >> > }; >> >> >>> >> >> > add(productsView); >> >> >>> >> >> > >> >> >>> >> >> > >> >> >>> >> >> > What is the Wicket way of achieving this? >> >> >>> >> >> > (A solution is to use the wicket:container tag, but that's a >> >> >>> >> >> > bit >> >> >>> >> >> > ugly, >> >> >>> >> >> > right?) >> >> >>> >> >> > >> >> >>> >> >> > >> >> >>> >> >> > --------------------------------------------------------------------- >> >> >>> >> >> > 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 >> >> >>> >> > >> >> >>> >> > >> >> >>> >> > --------------------------------------------------------------------- >> >> >>> >> > 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 >> >> >>> > >> >> >>> > --------------------------------------------------------------------- >> >> >>> > 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 >> >> >> >> >> >> --------------------------------------------------------------------- >> >> >> 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 >> >> > >> >> > >> >> >> >> --------------------------------------------------------------------- >> >> 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 >> > >> > >> >> --------------------------------------------------------------------- >> 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org