I think I'm having problems because I use a custom model for my PropertySelection and Palette.
I am using a model that has both values and labels, the values being defined not by the position of the label on the drop down but by an ID that I fetch from the database. The content of that model is a type I defined as an interface with getters and setters for an int and a String, Now, I tried setting the selected elements of my Palette with both a List of the inner class that holds the values for my model and a List of models, each with only one value. Neither worked. Can anyone help me with this one? Many thanks, Rui On 6/15/06, Schulte Marcus <[EMAIL PROTECTED]> wrote:
I'll try: You have an implementation of IPropertySelectionModel, getOption(int) returns some Object from your domain model, say of class A. So the "model" parameter is boud to the IPropertySelectionModel. Then you bind the "selected" parameter to a collection of A (e.g. List<A>). Now Palette determines whether an object a of class A should be shown on the "selected" side of things by testing for something like selected.contains( a ). Therefore, class A must override Object.equals() if you don't work with the very same instances of A in the IPropertySelectionModel and the selected-list. To be more specific about this I'd have to know about exactly how your selected-List and your IPropertySelectionModel are populated hth Marcus > -----Original Message----- > From: Rui Pacheco [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 15, 2006 1:13 AM > To: Tapestry users > Subject: Re: Setting selected values on Palette > > Hi Marcus > > Could you please explain what do you mean by that? > > On 6/14/06, Rui Pacheco <[EMAIL PROTECTED]> wrote: > > > > > Just be sure that modelObj.equals( selectedObj ) returns > true when > > > it > > should. > > > > What do you mean? The object that I pass to the selected parameter > > should be the same as the model? But the documentation mentions a > > List. Should I pass a List of models, then? > > > > > > > > On 6/14/06, Schulte Marcus <[EMAIL PROTECTED]> wrote: > > > > > > You can use any collection of Model-objects (the objects > which are > > > returned by getOption(int) from your PropertySelectionModel). > > > > > > Just be sure that modelObj.equals( selectedObj ) returns > true when > > > it should. > > > Marcus > > > > > > > -----Original Message----- > > > > From: Rui Pacheco [mailto:[EMAIL PROTECTED] > > > > Sent: Wednesday, June 14, 2006 2:05 PM > > > > To: Tapestry users; Tapestry users > > > > Subject: Setting selected values on Palette > > > > > > > > My little project moves on. I started with a select > from which I > > > > needed to retrieve multiple values, now things have > changed (damn > > > > the spec, we don't need no stinkin' specs!) and I ended > up using a > > > > Palette. > > > > > > > > Which brings us to my question: I have no problem setting the > > > > model and retrieving the selected values. But how can I set the > > > > selected values if, say, I wanted to edit the information on my > > > > form instead of filling a new form? > > > > > > > > I tried passing a List of models (same type as the models I'm > > > > using to fill the Palette's model), and a simple list with > > > > Strings, but nothing happens. > > > > -- > > > > Cumprimentos, > > > > Rui Pacheco > > > > > > > > > > > -------------------------------------------------------------------- > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > Cumprimentos, > > Rui Pacheco > > > > > > -- > Cumprimentos, > Rui Pacheco > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Cumprimentos, Rui Pacheco