Sorry I meant :
public List<PhoneType> getPhoneTypes();
instead of :
public List<PhoneNumber> getPhoneTypes();
Regards,
Zied Hamdi
2007/6/21, Zied Hamdi <[EMAIL PROTECTED]>:
Thanks David,
Isn't there a way to use a converter between the two:
something like:
public List<PhoneNumber> getPhoneTypes();
and <tc:selectItems var="#{bean.phoneTypes}" converter="
util.jsf.tobago.PhoneTypeSelectItemBridge"/>
and finally an implementation of a generic interface :
public class PhoneTypeSelectItemBridge implements TobagoConverter<*PhoneType,
SelectItem*> {
public String getKey( *PhoneType* phone ) { }
public *PhoneType* getSource( String key ) {...}
public *SelectItem *getTarget( String key ) {...}
}
maybe also do something like the faces converter and put settings in
tobago-config (instead of in the tag).
If you like the idea, may I add it to the issues list? The thing is that I
don't like to be JSF implementation specific in my backing beans, if a have
a package for a set of converters I could name it tobago and have it grouped
together (in addition to all the benefits of separation of concerns)...
Regards,
Zied Hamdi
2007/6/21, David Steinkopff <[EMAIL PROTECTED]>:
>
> Hi Zied,
>
> generell JSF 1.1 and JSTL doesn´t work so fine together.
> http://wiki.java.net/bin/view/Projects/JavaServerFacesSpecFaq#11coreTags
>
>
> <tc:selectItems> required as var value a java.util.list with
> org.apache.myfaces.tobago.model.SelectItem
>
> public List<SelectItem> getSelectItems() {
> List<SelectItem> result = new ArrayList<SelectItem>();
> result.add(new SelectItem(value,label,description,image));
> return result;
> }
>
> <tc:selectItems var="#{bean.selectItems}" />
>
> regards
> David
>
>
> 2007/6/20, Zied Hamdi <[EMAIL PROTECTED]>:
> >
> > Hi,
> > I have a problem with combining JSTL with tobago:
> >
> > I'm in a sheet of phone numbers and I want to show the current phone
> > type: mobile, home,.. as a combo box (with images).
> >
> > I took a look at the examples in the demo and I didn't find how to
> > specify an image for every entry when using <tc:selectItems. So I
> > decided to try using JSTL and the select box shows as it should but:
> >
> > The problems are three:
> >
> > - A side effect adding other columns has appeared (view image:
> > columns are replicated twice with the exception of the select box)
> > - The selected value is not displayed
> > - No image is displayed (this is maybe not a bug: there are no
> > images with these names. I deduced this because theresn't the image for
'no
> > image')
> >
> >
> > <tc:sheet id="phones" columns="50px;15*;18px;18px"
> > value="#{personCtrl.current.bean.phones}" var="phone">
> > <tc:column sortable="true">
> > <tc:selectOneChoice value="#{phone.type}">
> > <c:forEach items="${personCtrl.phoneTypes}" var="type">
> > <tc:selectItem itemImage="#{type}"
> > itemLabel="${type}" itemValue="#{type}" value="#{type}"/>
> > </c:forEach>
> > </tc:selectOneChoice>
> > </tc:column>
> > <tc:column label="#{i18n.number}" sortable="true">
> > <tc:in id="number" value="#{ phone.number}" />
> > </tc:column>
> > <tc:column label="#{i18n.main}" sortable="true">
> > <f:verbatim>hi</f:verbatim>
> > </tc:column>
> > <tc:column>
> > <tc:link id="removePhone" image="image/delete.GIF" />
> > </tc:column>
> > </tc:sheet>
> >
> > in the output source there's no images but these are maybe added with
> > javascript after...
> > <div
> > id="page:personForm:details:phoneListSubview:phones_data_row_1_column0"
> > class="tobago-sheet-cell-outer" style="width:84px; "
> > ><div class="tobago-sheet-cell-inner"
> > ><select
> > name="page:personForm:details:phoneListSubview:phones:1:_idJsp24"
> > id="page:personForm:details:phoneListSubview:phones:1:_idJsp24"
> > style="width:80px; " class="tobago-selectOneChoice-default"
> > ><option value=""
> > >HOME</option><option value=""
> > >MOBILE</option><option value=""
> > >WORK</option><option value=""
> > >FAX</option><option value=""
> > >OTHER1</option><option value=""
> > >OTHER2</option></select></div></div>
> > Regards,
> > Zied
> >
> >
> >
>
--
Zied Hamdi
zatreex.sourceforge.net
--
Zied Hamdi
zatreex.sourceforge.net