Use a LoadableDetachableModel<File>?

On Tue, Mar 2, 2010 at 8:24 AM, Martin Asenov <mase...@velti.com> wrote:
> Unfortunately doesn't work this way... The model is never refreshed...
>
> -----Original Message-----
> From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Sent: Tuesday, March 02, 2010 2:31 PM
> To: users@wicket.apache.org
> Subject: Re: DownloadLink problem
>
> Not sure... but could you try something like:
>
> DownloadLink downloadLink = new DownloadLink("link_id", new
> AbstractReadOnlyModel<File>(){
>            public File getObject() {
>                return this.linkModel;
>            };
>        },"myfile.xxx");
>        downloadLink.setOutputMarkupId(true);
>
> and make linkModel a member variable? This way file will be "refreshed".
>
> Best,
>
> Ernnesto
>
> On Tue, Mar 2, 2010 at 1:14 PM, Martin Asenov <mase...@velti.com> wrote:
>
>> Hi, guys!
>>
>> I experience some DownloadLink problem - I have these fields:
>>
>> File linkModel;
>> DownloadLink theLink = new DownloadLink("link_id", new
>> Model<File>(linkModel));
>> theLink.setOutputMarkupId(true);
>>
>> After another button click I have the linkModel field pointing to real file
>> on the file system. And then I say:
>>
>> target.addComponent(theLink);
>>
>> the link name is still invisible, and when I click on the small clickable
>> area, Wicket comes up with:
>>
>> WicketMessage: Method onLinkClicked of interface
>> org.apache.wicket.markup.html.link.ILinkListener targeted at component
>> [MarkupContainer [Component id = exported_file_link]] threw an exception
>>
>> Root cause:
>>
>> java.lang.IllegalStateException:
>> org.apache.wicket.markup.html.link.DownloadLink failed to retrieve a File
>> object from model
>>     at
>> org.apache.wicket.markup.html.link.DownloadLink.onClick(DownloadLink.java:141)
>>     at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:224)
>>     at java.lang.reflect.Method.invoke(Method.java:597)
>> I thought I've made everything perfect, but it seems that I haven't.
>> Any help is appreciated!
>>
>> Best regards,
>> Martin
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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

Reply via email to