To expand a little on what Igor said, you basically want to create two Panels, one for the cancellation type and one for the adjustment type.  Then you can use a ListView.  In the ListView populateItem method, add whichever Panel you need based on whatever factors you use and make sure to use the same id for both types of panels, like this:

if (item.isCancellation())
   listItem.add(new CancellationPanel("myPanelId"));
else
   listItem.add(new AdjustmentPanel("myPanelId"));

In your HTML:

<... wicket:id="yourList">
    <span wicket:id="myPanelId"/>
</...>

Hope this helps,

Andrew

On 2/20/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
dont think you need a special imodel or anything here.
just use a listview for the order lines and based on the order line type include a proper panel that represents that order line type.

-Igor



On 2/20/06, Scott Swank <[EMAIL PROTECTED]> wrote:
Hello all,

I'm entirely new to Wicket, and thus far impressed with what it seems
to offer.  I've put together a couple of sample pages and now I want
to create a sample for my co-workers that re-works one of our existing
pages via Wicket.  (Our home-grown template engine has become a pain
point).  This page comes in two varieties, so it seems like a fine
opportunity for an abstract page with two concrete implementations.

It looks like this:

    customer info

    order info

    order line
    order line
    order line

The order lines differ as follows:

1) cancellation variety --

    checkbox  itemName  quantity  itemCost  cancellationFee  refundAmount

(where the refundAmount = quantity*itemCost-cancellationFee, and the
cancellationFee is editable)

2) adjustment variety --

    checkbox  itemName  quantity  itemCost  itemAdjustment  refundAmount

(refundAmount = quantity*itemAdjustment, where the itemAdjustment is editable)


At this point I want to know whether best-practice is to:

1. Create a IModel for the refundLine and a component for the refundLine
2. Create a IModel for each piece of the refund line and use standard
html components
3. Hybrid: one IModel for the refundLine that is share among various
standard components -- is this even possible?

Additionally, the examples make it pretty clear how components fit
into a package structure -- but how do folk tend to structure the
packages for their IModel implementations?

Feel free to simply point me toward a corner of the Wiki or a
JavaLobby article that I haven't come across yet.  I don't want to
waste anyone's time.

Many thanks,
Scott


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Reply via email to