Return-Path: X-Original-To: apmail-wicket-users-archive@minotaur.apache.org Delivered-To: apmail-wicket-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 318B6100BB for ; Thu, 18 Jul 2013 05:58:05 +0000 (UTC) Received: (qmail 71442 invoked by uid 500); 18 Jul 2013 05:58:03 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 71416 invoked by uid 500); 18 Jul 2013 05:58:01 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Received: (qmail 71404 invoked by uid 99); 18 Jul 2013 05:57:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jul 2013 05:57:59 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [62.96.223.214] (HELO smtpout.mpc-group.com) (62.96.223.214) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jul 2013 05:57:54 +0000 Received: from SHAMEXCASEFO1.efonds.ag ([172.20.20.13]) by smtpout.mpc-group.com (8.13.3/8.13.3/MPC Linux 0.1) with ESMTP id r6I5vWsG024893 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Thu, 18 Jul 2013 07:57:32 +0200 Received: from SMUCEXEFO1.efonds.ag (192.168.110.86) by SHAMEXCASEFO1.efonds.ag (172.20.20.13) with Microsoft SMTP Server (TLS) id 14.2.342.3; Thu, 18 Jul 2013 07:57:31 +0200 Received: from s1n001.efonds.ag (192.168.122.151) by SMUCEXEFO1.efonds.ag (192.168.110.86) with Microsoft SMTP Server (TLS) id 14.2.342.3; Thu, 18 Jul 2013 07:57:31 +0200 Message-ID: <51E783C9.1040406@efonds.com> Date: Thu, 18 Jul 2013 07:57:29 +0200 From: Stefan Renz User-Agent: Postbox 3.0.8 (Macintosh/20130427) MIME-Version: 1.0 To: Subject: Re: How to hide an optional Image component? References: <51E5B2D6.4020407@efonds.com> In-Reply-To: <51E5B2D6.4020407@efonds.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.122.151] X-Virus-Checked: Checked by ClamAV on apache.org 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