On Fri, Nov 18, 2011 at 9:32 AM, Jablow, Eric R <[email protected]> wrote:
> Dear Igor,
>
> (me)>> I get a call with expression being "child", and target being the local 
> test object.  Were expression "parent.child", this would succeed, as it would 
> call getParent().getChild(). However, I'm not sure whether this is my bug or 
> the wicket-validation-bean library's.
>
> (Igor)>this is probably a misuse of the compound property model, which is
> evil anyways. you have to create your components with ids that match
> the path from the root object, so if you want to access person.address
> property you cant put a text field with id "address" into a
> webmarkupcontainer of id "person", you have to add a text field with
> component id "person.address"
>
> I'm sorry that I can't send or post the problematic code; much of it is 
> proprietary. Here's a censored précis.

but you can create a testcase, reproducing the bare bits of code in a
testcase just like you did in the email below. the advantage would be
that i would have something i can play with which makes it much easier
to find the problem.

>
> I have a Report object for people to fill out. Report has a variable of type 
> Publication, Publication being an interface.
>
> public class Report implements Serializable {
>        @Valid
>        private Publication publication;
> }
>
> public interface Publication extends Serializable {}
>
> public class Book implements Publication {}
> public class Article implements Publication {}
> public class Monograph implements Publication()
>
> I have UI panels:
>
> public class BookPanel extends FormComponentPanel<Book> {}
> public class ArticlePanel extends FormComponentPanel<Article> {}
> public class MonographPanel extends FormComponentPanel<Monograph> {}
>
> I'm trying to create a PublicationPanel:
>
> public class PublicationPanel extends FormComponentPanel<Publication> {
>        private RadioChoice<String> publicationTypeChoice;
>        private FormComponentPanel<? extends Publication> 
> specificPublicationPanel;
> }
>
> I will swap a BookPanel, ArticlePanel, and MonographPanel in depending on the 
> user's choice of type. If CompoundPropertyModels are evil (and I'd like a 
> pointer to why),

CPMs work great when they do, but when they do not it is extremely
difficult to find out why - as you have discovered in this case. their
implicit nature makes it so. this is why they are evil.

> how can I take a IModel<Report> and turn it into a IModel<Publication> and 
> IModel<Book>, and so on?

you have to cast it because only you know that at some point
Publication is actually a Book.

> Does the metagen project handle the polymorphism?

not in this case, just like java cant.

> Should I be using the single-argument constructor of FormComponentPanel<T> at 
> all?

not sure. would need to see more code

> Does it matter if I need to use the PublicationPanel more than once in the 
> ReportForm?

it shouldnt.

-igor

>
> Respectfully,
> Eric Jablow
>
> This communication, along with any attachments, is covered by federal and 
> state law governing electronic communications and may contain company 
> proprietary and legally privileged information.  If the reader of this 
> message is not the intended recipient, you are hereby notified that any 
> dissemination, distribution, use or copying of this message is strictly 
> prohibited.  If you have received this in error, please reply immediately to 
> the sender and delete this message.  Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

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

Reply via email to