Hey Geoff...

I didn't quite understand the code below but after much cranial banging,
I've figured out how to do it. Since I'm new at Tapestry, I'll post the
solution tomorrow for everyone to look at (in case I'm doing something very
unTapestry-like/BadTM...).

BTW, I'll post the solution tomorrow because its late, I've been at this for
hours and my head feels like its about to explode; I think I'll call it a
day.

Cheers...

Davide

On 2/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Davide,

For this problem I only have code that worked in T3 using the
ListEdit component.  In T4 you should use the For component.  I hope
the clue you're looking for will be in here nonetheless...

                        <tr jwcid="@ListEdit" source="ognl:picksModel.keys
"
value="ognl:picksModel.key" listener="ognl:listeners.synchronizePick"
element="tr">
                                <td>
                                        <span jwcid="@PropertySelection"
model="ognl:pickSelectionModel"
value="ognl:pick.pick">PickSelector</span>
                                </td>
                        </tr>

The java...

        public abstract ListEditMap getPicksModel();
        public abstract void setPicksModel(ListEditMap value);
        public abstract void setPick(SinglePick value);

        private PickSelectionModel pickSelectionModel;
        public PickSelectionModel getPickSelectionModel() {
                if (pickSelectionModel == null) {
                        pickSelectionModel = new PickSelectionModel();
                }
                return pickSelectionModel;
        }

        public void synchronizePick(IRequestCycle cycle) {
                ListEditMap map = getPicksModel();

                SinglePick sp = (SinglePick) map.getValue();

                if (sp == null) {
                        setErrorMessage("out-of-date");
                        throw new PageRedirectException(this);
                }

                setPick(sp);
        }

        public void accept(IRequestCycle cycle) throws ValidationException
{
                Visit v = (Visit) getVisit();
                try {

                        // Get all the picks from the screen

                        ListEditMap map = getPicksModel();
                        List picks = map.getAllValues();

                        // iterate through the list, call back end, catch
exceptions, etc...

                }

        }

The Property Selection...

        public class PickSelectionModel implements IPropertySelectionModel
{

        // etc...

HTH,

Geoff Callender


On 12/02/2007, at 1:41 PM, Davide Bruzzone wrote:

> Greetings all...
>
> I've been trying to set up a table where each row contains several
> columns
> whose values can be selected from a PropertySelection component.
> I'm able to
> get the table to render when the page is first loaded but haven't
> figured
> out how to track the selected item in each dropdown cell when the
> page is
> reloaded.
>
> I used the example on the PropertySelection documentation page as a
> starting
> point; I have a class that implements the IPropertySelectionModel
> and a
> DropdownItem class that encapsulates a single dropdown item. I then
> have a
> domain object for each row and need to:
>
> - Set the values of the rows' properties that are set via dropdowns
> in the
> rows' domain objects
> - Remember what changes the user has made to any of the rows (on
> the first
> or subsequent pages) when the page is submitted and reloaded
>
> The PropertySelection example adds methods to the page class to
> track the
> selected item for a dropdown that's not repeated on multiple rows;
> I just
> can't figure out how to extrapolate the example to multiple table
> rows.
>
> Any suggestions, pointers to examples, etc. would be greatly
> appreciated...
>
> Cheers...
>
> Davide Bruzzone


Reply via email to