wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Renz <s.r...@efonds.com>
Subject Re: How to hide an optional Image component?
Date Thu, 18 Jul 2013 05:57:29 GMT
Hello,

just to tie up loose ends -- here's the solution I decided on:

First, a Model encapsulates the logic and DB-access for a Logo object. I
can pass this into a LogoResource (extends DynamicImageResource), which
streams out the data from that Model's object. The model, however, also
serves to show or hide the Image component using that Resource.

Thanks for your time and suggestions.
Bye
    Stefan

Stefan Renz wrote:
> Hi guys,
> 
> I'm desparate for your help: I just can't figure out how to suppress an
> Image in case its IResource yields nothing.
> 
> Here's some context:
> 
> A customer may have a custom logo image (in fact, there's some logic
> involved in determining which exact logo to use, but that's beside the
> point) located in some database. Using Wicket's Image component, I
> figured I would need to implement the logo resolution algorithm and
> loading from the DB with either subclassing DynamicImageResource, or
> subclassing AbstractResourceStream (which is more approriate?).
> 
> Works fine if a logo is there -- the image shows up. However, if there
> _is_ no logo, the browser (firefox in my case) renders a question mark
> instead of showing nothing. Both returning null or an empty byte array
> doesn't matter.
> 
> I usually suppress a component with a behavior, or within the
> #onConfigure()-Method, but in the Image's case, where I only have an
> IResource or ResourceReference, I just don't have a hint on how to
> determine if the image data is there or not (apart from asking the
> database _again_ for the data or presence thereof).
> 
> Any ideas? What method/class have I missed? Where should I look?
> 
> Thanks for your help.
> Cheers
>     Stefan
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

-- 
im Auftrag der eFonds Solutions AG, +49-89-579494-3417


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


Mime
View raw message