myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sławek Sobótka <sso...@wp.pl>
Subject writing optimal HtmlSelectManyListbox converter
Date Fri, 15 Sep 2006 14:32:45 GMT
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<Workplcae>. 
select items are binded to List<SelectItem> 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<SelectItem> 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<SelectItem> 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



Mime
View raw message