cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: [cforms] Editing existing list of uploads
Date Tue, 06 Jul 2004 09:43:35 GMT
Bruno Dumon wrote:

>On Sat, 2004-07-03 at 22:38, Sylvain Wallez wrote:
>>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 
>>> 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() !
>Something that doesn't sit entirely right for me is that one would
>'artificially' create a Part. While technically possible, the definition
>of a Part is that it is a file parsed from a http post.
>How about introducing a new interface for the value of an upload widget,
>lets say UploadData:
>UploadData {
>   /** Return true if it is newly uploaded data */
>   boolean isNew();
>   /** Returns the part if isNew returns true, otherwise null. */
>   Part getPart();
>   InputStream getInputStream();
>   String getMimeType();
>This would also allow to distinguish between new and unmodified uploads.

Do we really need a new abstraction, that furthermore depends on Part 
which it tries to hide? We could simply add isNew() to Part, and create 
some additional implementations, e.g. SourcePart whose isNew() would 
return false by default.


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

View raw message