beaneditform with option lists of objects

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

beaneditform with option lists of objects

Paul Stanton-3
Hi all,

I have tables:
Parent
------------------
parent_id
child_id

Child
---------------
child_id

and ORM entity:

Parent
---------------
Long Id
Child child (oneToOne in this case, joinColumn child_id)

Child is another ORM entity. Child could be one of many options from the
database.

I would like a form for editing Parent which using a <select> allows the
selection of one Child from all of the Child options.

What is the easiest way to integrate this model with BeanEditForm or
failing that, BeanEditor?

Thanks, Paul.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: beaneditform with option lists of objects

Barry Books-2
You will need to build a select model for your list

http://tapestry.apache.org/using-select-with-a-list.html

I would create an Interface and have the child implement it so you can
create a generic one

Then create an edit block out of that code. This will allow the BeanEditor
to edit this kind of list with your edit block

Lastly since the type is likely list or set you will need to annotate the
field with @Datatype so the bead editor can figure out what block to use to
edit the field. You might be able to write a data type analyzer to figure
this out without @Datatype but Java's type erasure makes this a bit
difficult.

It sounds like a lot of work but once you've done one it gets easier. Also
if you create a generic select model you'll only need one.

On Wednesday, September 21, 2016, Paul Stanton <[hidden email]> wrote:

> Hi all,
>
> I have tables:
> Parent
> ------------------
> parent_id
> child_id
>
> Child
> ---------------
> child_id
>
> and ORM entity:
>
> Parent
> ---------------
> Long Id
> Child child (oneToOne in this case, joinColumn child_id)
>
> Child is another ORM entity. Child could be one of many options from the
> database.
>
> I would like a form for editing Parent which using a <select> allows the
> selection of one Child from all of the Child options.
>
> What is the easiest way to integrate this model with BeanEditForm or
> failing that, BeanEditor?
>
> Thanks, Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>