You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bill Lear <ra...@zopyra.com> on 2003/03/09 15:41:29 UTC

Example of ListEdit?

I've been perusing doc and source code and can't seem to find a good
example of the ListEdit component, to see if I can use it to fill a
need.  I looked in the Vlib code and it is used there, but I can't
seem to get to that part of the Vlib via my browser --- I believe
ListEdit is used in the code that allows an administrative user to
edit publications, etc.

In any case, it may be that ListEdit is not what I want, so perhaps
if I describe what I do want, someone will be able to point me in
the right direction.

To simplify the expression of my problem greatly, suppose I have a
Person who has, aside from a name and age, a list of phone numbers:

public class Person {
    String name;
    int age;
    List phones;
    // ...
}

Suppose Phone looks like this:

public class Phone {
    String number;
    String location; // e.g., "home", "office", "mobile", etc.
}

When I visit my application, I would like to be able to push a button
that says "Add New Person" or some such.  Then, I would like a form
to be displayed that allows me to type in their name and address,
and to create as many Phone instances as are needed.

I decided that the easiest (and perhaps the dumbest) way to do this
was to have a form that looked something like this:


          New Person

    Name :________________________
    Age  :---

          Phones

    Number:_____________________ Location:____________
    Number:_____________________ Location:____________
    Number:_____________________ Location:____________


My question is: how best to accomplish this?  My data structures are
quite a bit more involved than this, with multiple levels of nesting.
Is it common to "explode" these data structures onto a single form
for initial creation, and then to allow more narrow editing later?

Another approach I thought of but rejected is the multi-pane "wizard"
approach.  Here, on the first screen would be the form for the person's
name and age, then a form to add one phone number and a button there
to submit and a button to move to the next wizard pane.  This seemed
like a lot of work, so I rejected this...

Any help greatly appreciated.


Thanks.


Bill