but you can do that

listview has newlistitem, there you can create the proper listitem subclass

then in populate item you do

item.add(((MyItem)item).getPricingPanel())

it is simply a matter of taste - whether something like this belongs in the
class hierarchy or is it orthogonal and merits its own resolution mechanism.

-igor


On 3/1/07, Scott Swank <[EMAIL PROTECTED]> wrote:

Thank you Eelco & Iman.

I was hoping to have a custom component that played the role of the
ListItem but which had methods such as

abstract Panel getPricingPanle()

which were variously implemented in subclasses as

return new ShowPricingPanel() or
return new HotelPricingPanel()

instead of pushing that determination off to a factory.  Oh, and the
issue isn't just one of handling pricing, but rather of markup &
display as well.

Cheers,
Scott



On 2/28/07, Iman Rahmatizadeh <[EMAIL PROTECTED]> wrote:
> Another solution would be to put all the complexity of managing items
into a
> general CartPanel class, but that wont get much cleaner I guess. One
thing
> that comes to mind is, If you have a Pricing domain object to handle
pricing
> issues, and a Summary object to handle the items summary , you can
somehow
> get rid of the inheritance hierarchy and manage them with a single Item
> class at the top, and two dependent objects(Pricing and Summary). The
actual
> smell I sniff in your code is the parallel inheritance hierarchies in
the
> domain objects and UI. Thats what forces you to use a factory.
>
>
> On 3/1/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > On 2/28/07, Scott Swank <[EMAIL PROTECTED]> wrote:
> > > In our application we have several places where we are construction
an
> > > html table but the content of the rows varies by ProductType.  For
> > > example:
> > >
> > > column 1. always an image
> > > column 2. the pricing: for hotels by room, for shows by ticket, for
> > > limo by hours
> > > column 3. item summary: for hotels the rooms/nights, for shows the
> > > seats and show time, etc
> > > column 4. the total
> > >
> > > There is a natural class hierarchy here where we have
> > >
> > > AbstractItem
> > >   HotelItem
> > >   ShowItem
> > >   LimoItem
> > >
> > > I'd like to have a comparable hierarchy of perhaps "RepeaterRow"
> > > objects that could have methods such as:
> > >
> > > AbstractItemRow
> > >   protected abstract Panel getPricingPanel();
> > >   protected abstract Panel getSummaryPanel();
> > >
> > > I've gotten this working with a ListView, but I'm doing things like:
> > >
> > >   populateItem(ListItem listItem) {
> > >     final AbstractItem cartItem =
> (AbstractItem)listItem.getModelObject();
> > >     add(CartPanelFactory.getPricingPanel(cartItem));
> > >     add(CartPanelFactory.getSummaryPanel(cartItem));
> > >   }
> > >
> > > Is there a cleaner way than delegating this decision about which
Panel
> > > I need to a factory?
> >
> > That looks like a fine pattern to me tbh. What don't you like about
it?
> >
> > Eelco
> >
> >
>
-------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to
share
> your
> > opinions on IT & business topics through brief surveys-and earn cash
> >
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
>
-------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>


--
Scott Swank
reformed mathematician

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to