You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by cellis <ch...@uwa.edu.au> on 2011/10/04 04:25:30 UTC

Wicket 1.5.1 image resource not available if parent component is disabled

Got an odd issue since upgrading to 1.5.1.
An image in a form is somehow unable to determine it's resource when the
form is disabled (eg read-only "view" of a detail form). When the form is
"enabled" (ie into edit mode), the image becomes visible just fine.

Something to do with the anticache value perhaps?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-1-image-resource-not-available-if-parent-component-is-disabled-tp3869742p3869742.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by exl <er...@uwa.edu.au>.
Did a quick search and couldn't see anything so ticket raised: 
https://issues.apache.org/jira/browse/WICKET-4146 WICKET-4146 

-----

Eric is learning how to use Wicket and enjoying the experience so far...
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-1-image-resource-not-available-if-parent-component-is-disabled-tp3869742p3921054.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by exl <er...@uwa.edu.au>.
Martin Grigorov-4 wrote:
> 
>> What do you think?
> I think this problem deserves a ticket to be discussed in more details.
> 

I'd like to see this resolved for the dynamic image case.  Example use case:
1. I have a form that I'd like to re-use between two roles - "Admin" and
"Read-only User". That is, the form is enabled for an "Admin" (full
permission to change things) and disabled for a "Read-only User" (not
allowed to change anything). 
2. The form allows for an ID text field to be changed, which seeds the
generation of a dynamic image to be displayed within the form next to the
text field.
3. Both roles should be allowed to see the image (i.e. regardless of whether
the parent form is enabled).

Pre-Wicket 1.5.1 (was on 1.4.9), this was never an issue for dynamic images
- i.e. images still appeared within disabled forms. 

Has anyone raised a ticket for this already?  And/or perhaps can offer a
workaround?

-----

Eric is learning how to use Wicket and enjoying the experience so far...
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-1-image-resource-not-available-if-parent-component-is-disabled-tp3869742p3914246.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Oct 4, 2011 at 4:08 PM, Carl-Eric Menzel <cm...@wicketbuch.de> wrote:
> On Tue, 4 Oct 2011 10:59:53 +0200
> Martin Grigorov <mg...@apache.org> wrote:
>> > I think this is a not-so-easy problem, actually. In this use case
>> > (render an image) it seems obvious that even though the whole panel
>> > is disabled, it is being rendered, so the image resource should
>> > work.
>> Define "disabled image" and we may find a solution :-)
>
> Well, you can have for example a form that is disabled, so the user
> can't input anything. However, within that form you have an image,
> possibly one that's generated on the fly. Should that image be shown?
>
> - no => Then a disabled form can't have any non-context images at all.
>  Not good.
Not exactly.
You still can roll your own PackageImage component which extends
WebComponent and just sets the 'src' attribute on the ComponentTag.
The src attribute can be generated with: urlFor(new
PackageResourceReference(SomeComponent.class, "name.png"))
which will return something like:
wicket/resource/com/example/SomeComponent/name.png and this is
reachable without checking visible/enable on any component instance.
This wont work for image generation, only for static images.
>
> - yes => Then a possibly costly image generation might run even though
>  the form around it is disabled. Good/bad? Depends on the application.
Agree.
>
> - depends => For resources we should probably check isEnabled rather
>  than isEnabledInHierarchy and make the component responsible for
>  checking its own isEnabledInHierarchy.
>
> What do you think?
I think this problem deserves a ticket to be discussed in more details.
>
> Carl-Eric
> www.wicketbuch.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by cellis <ch...@uwa.edu.au>.
Thanks for the feedback/answers guys.
I can see both the pros and cons as you've mentioned and agree with both
(dammit!).

I've resorted to not show the image at all now (not entirely needed anyway)
as it was in fact a small image (<100kb) that was stored in the database,
and returned via a BlobImageResource, so yeh, a dynamic image, as opposed to
a static one.

An interesting discussion nonetheless...

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-1-image-resource-not-available-if-parent-component-is-disabled-tp3869742p3873097.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by Carl-Eric Menzel <cm...@wicketbuch.de>.
On Tue, 4 Oct 2011 10:59:53 +0200
Martin Grigorov <mg...@apache.org> wrote:
> > I think this is a not-so-easy problem, actually. In this use case
> > (render an image) it seems obvious that even though the whole panel
> > is disabled, it is being rendered, so the image resource should
> > work.
> Define "disabled image" and we may find a solution :-)

Well, you can have for example a form that is disabled, so the user
can't input anything. However, within that form you have an image,
possibly one that's generated on the fly. Should that image be shown?

- no => Then a disabled form can't have any non-context images at all.
  Not good.

- yes => Then a possibly costly image generation might run even though
  the form around it is disabled. Good/bad? Depends on the application.

- depends => For resources we should probably check isEnabled rather
  than isEnabledInHierarchy and make the component responsible for
  checking its own isEnabledInHierarchy.

What do you think?

Carl-Eric
www.wicketbuch.de

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Oct 4, 2011 at 10:55 AM, Carl-Eric Menzel <cm...@wicketbuch.de> wrote:
> On Tue, 4 Oct 2011 10:41:27 +0200
> Martin Grigorov <mg...@apache.org> wrote:
>
>> RequestListenerInterface stops the execution of callbacks for disabled
>> and/or invisible components/behaviors but its seems it also forbids
>> requesting a resource ...
>
> I think this is a not-so-easy problem, actually. In this use case
> (render an image) it seems obvious that even though the whole panel is
> disabled, it is being rendered, so the image resource should work.
Define "disabled image" and we may find a solution :-)
>
> But is it always true that a resource should be allowed even if the
> parent is disabled?
Not sure.
>
> On the other hand, this can only affect component-hosted resources, I
> think. One could reasonably say that in those cases the component is
> responsible to see whether to allow the resource.
Yes, only "component-hosted" resources are protected this way. That's
why I suggested ContextImage as a workaround, or maybe it is more
correct to say solution.
>
> Carl-Eric
> www.wicketbuch.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by Carl-Eric Menzel <cm...@wicketbuch.de>.
On Tue, 4 Oct 2011 10:41:27 +0200
Martin Grigorov <mg...@apache.org> wrote:

> RequestListenerInterface stops the execution of callbacks for disabled
> and/or invisible components/behaviors but its seems it also forbids
> requesting a resource ...

I think this is a not-so-easy problem, actually. In this use case
(render an image) it seems obvious that even though the whole panel is
disabled, it is being rendered, so the image resource should work.

But is it always true that a resource should be allowed even if the
parent is disabled?

On the other hand, this can only affect component-hosted resources, I
think. One could reasonably say that in those cases the component is
responsible to see whether to allow the resource.

Carl-Eric
www.wicketbuch.de

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Oct 4, 2011 at 5:08 AM, cellis <ch...@uwa.edu.au> wrote:
> ok, so its the parent.isEnabledInHierarchy that's forcing the
> RequestListenerInterface   - component not enabled or visible; ignoring
> call.
> Any chance I could override that somehow, or should I/we refactor our design
> to not have view/edit forms (groan)
RequestListenerInterface stops the execution of callbacks for disabled
and/or invisible components/behaviors but its seems it also forbids
requesting a resource ...

As a workaround you may use ContextImage which generates a value for
src attribute for image which is not delivered by Wicket.
The same approach can be used for PackageResource (as Image does) but
by using urlFor(ResourceReference)...
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-1-image-resource-not-available-if-parent-component-is-disabled-tp3869742p3869819.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Wicket 1.5.1 image resource not available if parent component is disabled

Posted by cellis <ch...@uwa.edu.au>.
ok, so its the parent.isEnabledInHierarchy that's forcing the
RequestListenerInterface   - component not enabled or visible; ignoring
call.
Any chance I could override that somehow, or should I/we refactor our design
to not have view/edit forms (groan)

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-1-image-resource-not-available-if-parent-component-is-disabled-tp3869742p3869819.html
Sent from the Users forum mailing list archive at Nabble.com.

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