Joerg Heinicke wrote:

This thread on users list was about implementing the setValue() method on the upload widget. The use case is - as the subject says - editing existing list of uploads. The complete thread can be found at http://thread.gmane.org/gmane.text.xml.cocoon.user/38910. What has been the reason for not implementing the method besides a missing use case? No security reason came to my mind. What about implementing it the most simple way:

public void setValue(Object object) {
    if (!(object instanceof Part)) {
        throw new RuntimeException("not a part");
    }
    this.part = (Part) object;
}


That makes sense. This allows for example forms that edit some data with binary attachements to display the existing attachments and newly added ones in a uniform way.

However, as outlined in the discussion, the form binding will have to take care of distinguishing new and existing attachments, and also existing attachments that were deleted. But that's another problem.

Something I've been thinking about also is a way to make the uploaded parts accessible from the browser. That would allow e.g. to display a preview of uploaded images.

For low, let's add Upload.setValue() !

Sylvain



--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to