You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Björn Voigt <bj...@itgis.com> on 2004/10/04 15:34:26 UTC

Reseting and reusing of upload-widgets

Moin,

i use an upload-widget (cocoon-2.1.5) in my cforms,
but I need it once more, but I cant set the value to
null to reset it for reuse.

setValue is not implemented and throws an exception.
It allready possible to reset it? If not, Is it possible
that you add an method like to Upload.java


public void reset() {
	this.part = null;
}


Thank you

Björn


Re: Reseting and reusing of upload-widgets

Posted by Sylvain Wallez <sy...@apache.org>.
Björn Voigt wrote:

> Sylvain Wallez wrote:


<snip/>

>> Why isn't is a good idea? It seems to me to be the cleanest way, as 
>> this is exactly how you would to it on a regular field.
>
>
> Sorry Sylvain I mean using setValue(null) with the current version of 
> this method would not be good. U r right lets fix the setValue(), that 
> it can handle with null. I dont need more then a possibility to set 
> the value back to null.


Ok. I updated Upload.setValue() so that it accepts a null value. Please 
update from SVN and cross-check.

Sylvain

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


Re: Reseting and reusing of upload-widgets

Posted by Björn Voigt <bj...@itgis.com>.
Sylvain Wallez wrote:
> Björn Voigt wrote:
> 
>> Björn Voigt wrote:
>>
>>> Joerg Heinicke wrote:
>>>
>>>> On 04.10.2004 15:34, Björn Voigt wrote:
>>>>
>>>>> Moin,
>>>>>
>>>>> i use an upload-widget (cocoon-2.1.5) in my cforms,
>>>>> but I need it once more, but I cant set the value to
>>>>> null to reset it for reuse.
>>>>>
>>>>> setValue is not implemented and throws an exception.
>>>>> It allready possible to reset it? If not, Is it possible
>>>>> that you add an method like to Upload.java
>>>>>
>>>>>
>>>>> public void reset() {
>>>>>     this.part = null;
>>>>> }
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> setValue() has been implemented: 
>>>> http://issues.apache.org/bugzilla/show_bug.cgi?id=30270. But I guess 
>>>> resetting it to null is not possible with the current implementation 
>>>> as the instanceof test would fail.
>>>>
>>>> Joerg
>>>>
>>>
>>> Hi Joerg,
>>>
>>> I tried this dirty workaround the Upload.java of the
>>> cocoon-2.1.5.1 release and this seems to work, but is
>>> with the current version of Upload a reset and reuse
>>> possible?
>>>
>>> Björn
>>
>>
>>
>> Oh u r right, setValue(null) would be not a good Idea,
>> is it possible to add a additional method for reseting ?
> 
> 
> 
> Why isn't is a good idea? It seems to me to be the cleanest way, as this 
> is exactly how you would to it on a regular field.
> 
> Sylvain
> 
  Sorry Sylvain I mean using setValue(null) with the current
version of this method would not be good. U r right lets fix
the setValue(), that it can handle with null. I dont need
more then a possibility to set the value back to null.

Thank


you


Re: Reseting and reusing of upload-widgets

Posted by Sylvain Wallez <sy...@apache.org>.
Björn Voigt wrote:

> Björn Voigt wrote:
>
>> Joerg Heinicke wrote:
>>
>>> On 04.10.2004 15:34, Björn Voigt wrote:
>>>
>>>> Moin,
>>>>
>>>> i use an upload-widget (cocoon-2.1.5) in my cforms,
>>>> but I need it once more, but I cant set the value to
>>>> null to reset it for reuse.
>>>>
>>>> setValue is not implemented and throws an exception.
>>>> It allready possible to reset it? If not, Is it possible
>>>> that you add an method like to Upload.java
>>>>
>>>>
>>>> public void reset() {
>>>>     this.part = null;
>>>> }
>>>
>>>
>>>
>>>
>>> setValue() has been implemented: 
>>> http://issues.apache.org/bugzilla/show_bug.cgi?id=30270. But I guess 
>>> resetting it to null is not possible with the current implementation 
>>> as the instanceof test would fail.
>>>
>>> Joerg
>>>
>>
>> Hi Joerg,
>>
>> I tried this dirty workaround the Upload.java of the
>> cocoon-2.1.5.1 release and this seems to work, but is
>> with the current version of Upload a reset and reuse
>> possible?
>>
>> Björn
>
>
> Oh u r right, setValue(null) would be not a good Idea,
> is it possible to add a additional method for reseting ?


Why isn't is a good idea? It seems to me to be the cleanest way, as this 
is exactly how you would to it on a regular field.

Sylvain

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


Re: Reseting and reusing of upload-widgets

Posted by Joerg Heinicke <jo...@gmx.de>.
On 04.10.2004 16:47, Björn Voigt wrote:

>>>> Moin,
>>>>
>>>> i use an upload-widget (cocoon-2.1.5) in my cforms,
>>>> but I need it once more, but I cant set the value to
>>>> null to reset it for reuse.
>>>>
>>>> setValue is not implemented and throws an exception.
>>>> It allready possible to reset it? If not, Is it possible
>>>> that you add an method like to Upload.java
>>>>
>>>>
>>>> public void reset() {
>>>>     this.part = null;
>>>> }
>>>
>>> setValue() has been implemented: 
>>> http://issues.apache.org/bugzilla/show_bug.cgi?id=30270. But I guess 
>>> resetting it to null is not possible with the current implementation 
>>> as the instanceof test would fail.
>>
>> I tried this dirty workaround the Upload.java of the
>> cocoon-2.1.5.1 release and this seems to work, but is
>> with the current version of Upload a reset and reuse
>> possible?

IMO this is not a dirty workaround, but the way to go, especially when 
the binding is fixed (see the link to the referenced bug in bug 30270).

> Oh u r right, setValue(null) would be not a good Idea,
> is it possible to add a additional method for reseting ?

The setValue() should just be fixed to also accept null. All other 
widgets don't have reset() so why should have this one - though it's 
indeed a special widget?

Joerg

Re: Reseting and reusing of upload-widgets

Posted by Björn Voigt <bj...@itgis.com>.
Björn Voigt wrote:
> Joerg Heinicke wrote:
> 
>> On 04.10.2004 15:34, Björn Voigt wrote:
>>
>>> Moin,
>>>
>>> i use an upload-widget (cocoon-2.1.5) in my cforms,
>>> but I need it once more, but I cant set the value to
>>> null to reset it for reuse.
>>>
>>> setValue is not implemented and throws an exception.
>>> It allready possible to reset it? If not, Is it possible
>>> that you add an method like to Upload.java
>>>
>>>
>>> public void reset() {
>>>     this.part = null;
>>> }
>>
>>
>>
>> setValue() has been implemented: 
>> http://issues.apache.org/bugzilla/show_bug.cgi?id=30270. But I guess 
>> resetting it to null is not possible with the current implementation 
>> as the instanceof test would fail.
>>
>> Joerg
>>
> 
> Hi Joerg,
> 
> I tried this dirty workaround the Upload.java of the
> cocoon-2.1.5.1 release and this seems to work, but is
> with the current version of Upload a reset and reuse
> possible?
> 
> Björn
> 
> 

Oh u r right, setValue(null) would be not a good Idea,
is it possible to add a additional method for reseting ?

Björn


Re: Reseting and reusing of upload-widgets

Posted by Björn Voigt <bj...@itgis.com>.
Joerg Heinicke wrote:
> On 04.10.2004 15:34, Björn Voigt wrote:
> 
>> Moin,
>>
>> i use an upload-widget (cocoon-2.1.5) in my cforms,
>> but I need it once more, but I cant set the value to
>> null to reset it for reuse.
>>
>> setValue is not implemented and throws an exception.
>> It allready possible to reset it? If not, Is it possible
>> that you add an method like to Upload.java
>>
>>
>> public void reset() {
>>     this.part = null;
>> }
> 
> 
> setValue() has been implemented: 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=30270. But I guess 
> resetting it to null is not possible with the current implementation as 
> the instanceof test would fail.
> 
> Joerg
> 

Hi Joerg,

I tried this dirty workaround the Upload.java of the
cocoon-2.1.5.1 release and this seems to work, but is
with the current version of Upload a reset and reuse
possible?

Björn


Re: Reseting and reusing of upload-widgets

Posted by Joerg Heinicke <jo...@gmx.de>.
On 04.10.2004 15:34, Björn Voigt wrote:

> Moin,
> 
> i use an upload-widget (cocoon-2.1.5) in my cforms,
> but I need it once more, but I cant set the value to
> null to reset it for reuse.
> 
> setValue is not implemented and throws an exception.
> It allready possible to reset it? If not, Is it possible
> that you add an method like to Upload.java
> 
> 
> public void reset() {
>     this.part = null;
> }

setValue() has been implemented: 
http://issues.apache.org/bugzilla/show_bug.cgi?id=30270. But I guess 
resetting it to null is not possible with the current implementation as 
the instanceof test would fail.

Joerg