Thanks for those suggestions. I've actually got it kind of working
*with* an IComponentResolver and that seems to be working fine for now.

> -----Original Message-----
> From: Michael Mosmann [mailto:mich...@mosmann.de]
> Sent: Thursday, 10 September 2009 6:24 PM
> To: users@wicket.apache.org
> Subject: RE: Passing parameters from markup to panels
> 
> Am Donnerstag, den 10.09.2009, 14:03 +1000 schrieb Chris Colman:
> > > why? what is different between a 10 or a 50 item song panel? the
> > number
> > > of items? you should anyhow use a ListView which repeats the "her
is
> > the
> > > song"-block as many times as you want to..
> >
> > It is using a ListView - the desire was to provide an easy way for
the
> > UI guy to specify a row count in the markup.
> 
> ok.. i got this.. i would put it into an property file of the
component
> where the SongPanel is used and put a ResourceModel as parameter to
> SongPanel
> 
> > > > Let's say we make
> > > >
> > > > SongChartTop10Panel and SongChartTop50Panel
> > > >
> > > > (with .java and .html markup for each)
> > > >
> > > > Now he says he wants to make a top 20 list for one page and a
top 40
> > > > list for another page... the inefficiency and non OO nature of
this
> > > > approach becomes apparent.
> > >
> > > why do you make this?
> >
> > They each derive from SongChartTopPanel and invoke the constructor
with
> > a different row count - but without parameterization and using
standard
> > simple wicket devices (i.e. not component resolvers) then we need a
> > separate markup and separate .java class for each panel that has a
> > different number of songs displayed.
> 
> you can override getVariation to switch between markup.. so if you use
> the ResourceModel for this, this should be easy..
> 
> > > > If a simple parameter were able to be passed to the panel we
could
> > reuse
> > > > that panel code to show anywhere from 1 to n songs.
> >
> > Yes but you'd still require a separate markup for each one I would
think
> > - without going the with component resolver approach.
> 
> i am not sure, that i understand this problem as it is.. so excuse, if
> my solutions does not fit..
> 
> > The web designer will have a nice 'Top 10' image above the panel so
I
> > didn't want to put it in the hands of the user who might change the
> > rowcount to 13 or something. 'Top 13 songs around the country this
week'
> > doesn't sound right - especially if the image above it says 'Top
10'.
> 
> ok..
> some code to show you my view of this problem and the solution (may
not
> fit)..
> 
> ------------------------------------------------------------
> class SongPanel ..
> {
>   SongPanel(String id,ResourceModel topCountAsStringModel)
>   {
>     final int count=getCountAsInt(topCountAsStringModel,10);
>     IModel<Song> model=new LoadabledDetachModel()
>     {
>       load() { ... getSongs(count) }
>     }
>     add(new ListView("songs",model) {..}
>     add(new Image("topImg",new ResourceReference(getClass(),
"topImage",
> getLocale(), "top"+count)))
>   }
> 
>   getVariation()
>   {
>     return "top"+count;
>   }
> }
> ------------------------------------------------------------
> 
> SongPanel.html
> <wicket:panel>
>   Top 10 (default)
>   <img wicket:id="topImg">
>   <table><tr wicket:id="list">...</table>
> </wicket:panel>
> 
> ------------------------------------------------------------
> 
> SongPanel_top50.html
> <wicket:panel>
>   Top 50
>   <img wicket:id="topImg">
>   <table><tr wicket:id="list">...</table>
> </wicket:panel>
> 
> ------------------------------------------------------------
> 
> ComponentA(String id)
> {
>   add(new SongPanel("songs",new ResourceModel("songsInList",""));
> }
> 
> ------------------------------------------------------------
> 
> ComponentA.properties:
> songsInList=10;
> 
> ------------------------------------------------------------
> 
> ComponentB(String id)
> {
>   add(new SongPanel("songs",new ResourceModel("songsInList",""));
> }
> 
> ------------------------------------------------------------
> 
> ComponentB.properties:
> songsInList=50;
> 
> ------------------------------------------------------------
> 
> ..
> if you enable autolink, then this image-stuff could be much easier, so
> the web design guy have much control and you have much OO as you can..
> 
> .. hope this will help a little
> 
> mm:)
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.409 / Virus Database: 270.13.86/2355 - Release Date:
09/10/09
> 05:50:00

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to