You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2011/07/13 11:31:39 UTC
The purpose of LocalizedImageResource.bind()
Hi,
While debugging https://issues.apache.org/jira/browse/WICKET-3890 and
https://issues.apache.org/jira/browse/WICKET-3869 I found that
org.apache.wicket.markup.html.image.resource.LocalizedImageResource.bind()
tries to register the image's ResourceReference in the application's
ResourceReferenceRegistry, no matter what is the type of the resource
reference.
What is the reason for that?
If I want my resource to be shared (application scope) then I would do
something like:
application.getSharedResources().add(resourceReference)
new Image("imgId", new SharedResourceReference(resourceReference.getKey()));
If I don't want to it to be shared then I'd use any other kind of
ResourceReference.
With the current behavior (it is the same in 1.4) the image registers
everything as shared.
As part of WICKET-3890 I added some javadocs in shared resources
related classes. Please check them whether they are correct if you
have more knowledge in the matter. I made them by reverse engineering.
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
Re: The purpose of LocalizedImageResource.bind()
Posted by Martin Grigorov <mg...@apache.org>.
Bump.
On Wed, Jul 13, 2011 at 12:31 PM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> While debugging https://issues.apache.org/jira/browse/WICKET-3890 and
> https://issues.apache.org/jira/browse/WICKET-3869 I found that
> org.apache.wicket.markup.html.image.resource.LocalizedImageResource.bind()
> tries to register the image's ResourceReference in the application's
> ResourceReferenceRegistry, no matter what is the type of the resource
> reference.
>
> What is the reason for that?
>
> If I want my resource to be shared (application scope) then I would do
> something like:
> application.getSharedResources().add(resourceReference)
> new Image("imgId", new SharedResourceReference(resourceReference.getKey()));
>
> If I don't want to it to be shared then I'd use any other kind of
> ResourceReference.
>
> With the current behavior (it is the same in 1.4) the image registers
> everything as shared.
>
> As part of WICKET-3890 I added some javadocs in shared resources
> related classes. Please check them whether they are correct if you
> have more knowledge in the matter. I made them by reverse engineering.
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com