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 E129610430 for ; Tue, 16 Jul 2013 21:01:35 +0000 (UTC) Received: (qmail 45419 invoked by uid 500); 16 Jul 2013 21:01:34 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 45392 invoked by uid 500); 16 Jul 2013 21:01:34 -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 45384 invoked by uid 99); 16 Jul 2013 21:01:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jul 2013 21:01:34 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [212.227.126.171] (HELO moutng.kundenserver.de) (212.227.126.171) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jul 2013 21:01:28 +0000 Received: from [192.168.178.21] (p4FC7C8AD.dip0.t-ipconnect.de [79.199.200.173]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MgYEB-1UlDya0wEB-00NNih; Tue, 16 Jul 2013 23:00:47 +0200 Message-ID: <51E5B47E.1030305@meiers.net> Date: Tue, 16 Jul 2013 23:00:46 +0200 From: Sven Meier User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: users@wicket.apache.org 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; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:avE21iXX764RsqSjLZEq15gKpNUjEPws5bRMpXWPbGz vOrSYjLNUxUBlC1gBJklaPSgWfwcJpnkwcs4D/SPBc/7KlTHG4 9y/Wq4gGKNbk+TGfuWYIV/aEj9hdFxRq9tmoQOTrVieETIbL1G JXUUiE/n9LY7TOGkWZXLq/8hauY0Z+vqRYwklgmw97F+obHkof Q+9PEA/6ViTqK0T2xGKBgSl1lSd8AJtX6jLBj438JNWv95lyx8 e6jamTUbWDxnpbSl9xmHquNJ0g+nDEYS9n29iWvPKaEEb3P0it g8nP0wEVuJTRCMHHrNogKCpIN8UvDNWLEYmBuMWvzsA3kWrWdZ tAO4ho5QCFPYKuW5s4/c= X-Virus-Checked: Checked by ClamAV on apache.org > apart from asking the database _again_ for the data or presence thereof Whether the image is visible must be determined when the page is rendered. The actual loading of the image is done in another request. Thus two times to ask the databse. Alternatively you may render a default resource (e.g. https://www.google.com/search?q=no+image) if your database doesn't have any data to stream back when the image is requested. Regards Sven On 07/16/2013 10:53 PM, 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org