You can also do exactly as you mentioned.... In your base page, have a repeating view (i.e. ListView) that simply loops over a "List<Component> childPanels"..... Then your method addToRepeater(Component component) will add to that list.
Should work exactly as you described. What trickery is needed? I guess I miss that part. On Wed, Dec 10, 2008 at 5:20 PM, Nino Saturnino Martinez Vazquez Wael < [EMAIL PROTECTED]> wrote: > Scott, > > Think inheritance :) > > Just write a super which has abstract methods that returns components for > c1..c4() and thats it.. no need for trickery with > IMarkupResourceStreamProvider ... > > Should I elaborate more? > > You could also take a look at the wicketstuff accordion thing, it does > something along these lines[1]... > > > 1= > http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-accordion > > regards > > > smackie604 wrote: > >> Hi, >> >> My team has adopted wicket as it's web framework and we have been busy >> creating a lot of interesting Panels to build pages for our product. It >> is >> turning out that most of the time all the components on the page are >> Panels >> and we end up with a situation like this: >> >> MyPage.java >> -------------- >> public class MyPage extends BasePage >> { >> MyPage() >> { >> add(SomePanel("c1")); >> add(SomePanel("c2")); >> add(SomePanel("c3")); >> add(SomePanel("c4")); >> } >> } >> >> MyPage.html >> --------------- >> <wicket:extend> >> <wicket:container wicket:id="c1"/> >> <wicket:container wicket:id="c2"/> >> <wicket:container wicket:id="c3"/> >> <wicket:container wicket:id="c4"/> >> </wicket:extend> >> >> It would be nice if we didn't have to write html files for pages in these >> situations and instead just do something like this: >> >> MyPage.java >> -------------- >> public class MyPage extends BasePage >> { >> MyPage() >> { >> addToRepeater(SomePanel("c1")); >> addToRepeater(SomePanel("c2")); >> addToRepeater(SomePanel("c3")); >> addToRepeater(SomePanel("c4")); >> } >> } >> >> Where BasePage will have a method called addToRepeater which just adds the >> component to the repeater. >> I see we could do some trickery by implementing >> IMarkupResourceStreamProvider on the BasePage to force the template of >> it's >> child classes to always use BasePage.html. I'm not sure this is the best >> way of doing this, does anyone have any comments on using this approach? >> >> Thanks, >> >> Scott >> >> > > -- > -Wicket for love > > Nino Martinez Wael > Java Specialist @ Jayway DK > http://www.jayway.dk > +45 2936 7684 > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Jeremy Thomerson http://www.wickettraining.com
