and also overide the equals method :

public boolean equals(Object object) {
        if (!(object instanceof Club)) {
            return false;
        }
        Club obj = (Club) object;
        return new EqualsBuilder()
                .append(this.idClub, obj.idClub)
                .append(this.clubName, obj.clubName)
                .isEquals();
    }


changed the encoder :

package edu.its.dreamteam.web.util;

import java.util.List;
import org.apache.tapestry.ValueEncoder;
import edu.its.dreamteam.daf.beans.Club;

public class ClubValueEncoder implements ValueEncoder<Club> {
    private List<Club> clubList;

    public ClubValueEncoder(List<Club> clubList) {
        this.clubList = clubList;
    }

    public String toClient(Club club) {

        return club.getIdClub();
    }

    public Club toValue(String value) {
        for(Club club : clubList){
            if(club.getIdClub().equals(value)){
                return club;
            }
        }
        return null;
    }



}


On Dec 21, 2007 10:04 PM, dwi ardi irawan <[EMAIL PROTECTED]> wrote:

> hi it works.... i just changed like this :
> <tr>
>        <td><t:label for="clubSelect"/></td>
>        <td>&nbsp;</td>
>        <td><t:select t:id="clubSelect" model="clubSelectionModel" value="
> Player.club" encoder="clubValueEncoder" label="Club"/></td>
> </tr>
>
> cos in the player object contains club object (i'm using iBatis+Spring for
> ORM) so what i should do it's to call Player.club not Player.idClub or
> Player.clubName(Club Properties).
>
> Thnx guys
>
>
> On Dec 21, 2007 9:52 PM, dwi ardi irawan <[EMAIL PROTECTED] > wrote:
>
> > ir works with the that one, but i'm still curious bout how implemented
> > it inside aq form...
> > Hmmm....
> > I already override the equals method but still didn't work
> >
> >
> > On Dec 21, 2007 4:30 AM, Sylwek < [EMAIL PROTECTED]>
> > wrote:
> >
> > >
> > > Hi,
> > >     will it be possible to use in this case BeanEditForm with
> > > component
> > > Select ?
> > >
> > > Something like this:
> > >
> > > <t:beaneditform  object="player">
> > >  <t:parameter name="club">
> > >    <t:label for="club"/>
> > >    <t:select t:id="club" model="clubSelectionModel" value="player.club
> > > "
> > > encoder="clubValueEncoder"/>
> > >  </t:parameter>
> > > </t:beaneditform>
> > >
> > >
> > > Sylwek
> > > --
> > > View this message in context:
> > > http://www.nabble.com/T5-%3A-select-component-in-a-form-didn%27t-show-the-selected-value--EDIT-MODE--tp14414479p14445453.html
> > > Sent from the Tapestry - User mailing list archive at Nabble.com.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > http://dwiardiirawan.blogspot.com
> > "cos everyone could be extraordinary...lighten up !"
> >
>
>
>
> --
> http://dwiardiirawan.blogspot.com
> "cos everyone could be extraordinary...lighten up !"
>



-- 
http://dwiardiirawan.blogspot.com
"cos everyone could be extraordinary...lighten up !"

Reply via email to