Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 60606 invoked from network); 15 Sep 2006 22:02:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Sep 2006 22:02:19 -0000 Received: (qmail 49886 invoked by uid 500); 15 Sep 2006 22:02:15 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 49322 invoked by uid 500); 15 Sep 2006 22:02:14 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 49311 invoked by uid 99); 15 Sep 2006 22:02:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Sep 2006 15:02:14 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ssobot@wp.pl designates 212.77.101.4 as permitted sender) Received: from [212.77.101.4] (HELO smtp.wp.pl) (212.77.101.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Sep 2006 15:02:04 -0700 Received: (wp-smtpd smtp.wp.pl 14040 invoked from network); 16 Sep 2006 00:00:19 +0200 Received: from poczta-2.free.wp-sa.pl (HELO localhost) ([10.1.1.167]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with SMTP for ; 16 Sep 2006 00:00:19 +0200 Date: Sat, 16 Sep 2006 00:00:18 +0200 From: =?ISO-8859-2?Q?S=B3awek_Sob=F3tka?= To: MyFaces Discussion Subject: Re: writing optimal HtmlSelectManyListbox converter Message-ID: <450b2272d754a@wp.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Mailer: Interfejs WWW poczty Wirtualnej Polski Organization: Poczta Wirtualnej Polski S.A. http://www.wp.pl/ X-User-Agent: Opera/9.00 (Windows NT 5.1; U; pl) X-WP-IP: 80.55.100.14 X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO AS1=NO AS2=NO(0.809337) AS3=NO AS4=NO AS5=NO X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N thanx for response and sharing of Your ideas. i would like to register ma converter and use it on many pages. but when i hardcode this #{backingBean.selectItemList} than obvoiusly my converter is coupled with one specific bean (and few specific pages - in optimistic case) :/ btw: now im doing it like this: public class BackingBean{ private List items; public List getItems(){ return items }; public Converter getConverter(){ return new MyClassConverter(getItems()); } } i dont like my solution cause i just dont want to repeat: public Converter getConverter(){ return new MyClassConverter(getItems()); } in every bean that backs my combo controls (but it works and is flexible) best regards and once again thanks for response S�awek S. > Yeah, this is an ugly situation because converters don't allow > StateHolder like Validators and Components and it's hard to initialize > them with a set of values. > > Here's how I handle it. I store the stuff in a backing bean and > programmically fetch a reference to the backing bean. In your case, > the value binding would be the same one used in the page tag. > > ValueBinding binding = > FacesContext.getCurrentInstance().getApplication().createValueBinding("#{backingBean.selectItemList}"); > List list = (List > )binding.getValue(FacesContext.getCurrentInstance()); > > > > On 9/15/06, S�awek Sob�tka wrote: >> welome back guys. after 1 year of coding fat swt/swing clients i'm >> backing to jsf business (and to your great comunity;). >> >> i can't find SelectItems list in nym converter:( >> >> here is the situation: >> i have selectManyListbox thats value is binded to List. >> select items are binded to List but each SelectItem's >> value is set to one of the Workplace object. >> >> so we have class situation that needs converter - im working on object >> instead of threis IDs cause it is comfortable with hibernate stuff. >> >> w would like to do it like this: >> //======================================== >> public Object getAsObject(FacesContext fc, UIComponent comp, String >> str) throws ConverterException { >> UISelectMany selectMany = (UISelectMany) comp; >> List workplaces = selectMany. >> getAllSelectItemsThatAreBindedToComponent(); //<<<======= problem >> Integer id = new Integer(str); >> for (SelectItem o : workplaces) >> if (((Workplace)o.getValue()).getWorkPlaceId(). >> equals(id)) >> return o.getValue(); >> return null; >> } >> //======================================== >> >> where can i find method like this: >> List workplaces = selectMany. >> getAllSelectItemsThatAreBindedToComponent(); >> cause i dont want to fetch all Workplaces from DB once again? >> >> best regards S�awek S. >> >> ---------------------------------------------------- >> Codziennie nowe oferty pracy czekaj� na Ciebie - Sprawd�! >> Kliknij: http://klik.wp.pl/?adr=www.praca.wp.pl&sid=870 >> >> >> ---------------------------------------------------- Mega koncert - Duran Duran - Warszawa S�u�ewiec 23 wrze�nia 2006! Zdob�d� bilet dla siebie i swoich przyjaci� - Kliknij: http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fd2.html&sid=862