Perfect!
Here is my PropertyConduit implementation

public class DownloadPropertyConduit implements PropertyConduit {

    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
        return null;
    }

    /**
     * @see org.apache.tapestry5.PropertyConduit#get(java.lang.Object)
     */
    public Object get(Object instance) {
        Upload upload = (Upload) instance;
        return upload.getName();
    }

    @SuppressWarnings("unchecked")
    public Class getPropertyType() {
        return String.class;
    }

    public void set(Object instance, Object value) {
        Upload upload = (Upload) instance;
        upload.setName((String) value);
    }


}

--- En date de : Mer 1.7.09, Thiago H. de Paula Figueiredo <thiag...@gmail.com> 
a écrit :

De: Thiago H. de Paula Figueiredo <thiag...@gmail.com>
Objet: Re: Grid / sortable additionnal column
À: "Tapestry users" <users@tapestry.apache.org>
Date: Mercredi 1 Juillet 2009, 12h46

On Wed, Jul 1, 2009 at 8:39 AM, Francois Malet<francois_ma...@yahoo.fr> wrote:
> Hello,

Hi!

>            PropertyModel dModel= beanModel.add("download",null);

The problem is here: Grid doesn't know how to get the download
property (column) value to sort it, as you passed a null
PropertyConduit to the add() method.
You need to implement a PropertyConduit for and pass it to the add()
method. If Upload implements sortable, you don't need to
dModel.sortable(true);.

Here's one example for a PropertyConduit related to the manager
property (which is of type User) of the Project class:

public class ProjectManagerPropertyConduit implements PropertyConduit {

    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
        return null;
    }

    /**
     * @see org.apache.tapestry5.PropertyConduit#get(java.lang.Object)
     */
    public Object get(Object instance) {
        Project project = (Project) instance;
        return project.getManager();
    }

    @SuppressWarnings("unchecked")
    public Class getPropertyType() {
        return User.class;
    }

    public void set(Object instance, Object value) {

        Project project = (Project) instance;
        project.setManager((User) value);

    }

}


-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




      

Reply via email to