I don't understand your question, linjua. Please describe the error you get.

Cheers,
PS

On 4/12/06, linuja <[EMAIL PROTECTED]> wrote:
>
> The Adapter interface:
>
> public interface NameAdaptable<T> {
>     public String getName(T obj);
> }
>
> The IPropertySelectionModel impl class:
>
> public class PropertySelectionModel<T> implements IPropertySelectionModel
> {
>
>     private final NameAdaptable<T> nameAdapter;
>
>     private final List<T> items;
>
>     public PropertySelectionModel(NameAdaptable<T>
> nameAdaptable,Collection<T> items){
>         this.nameAdapter = nameAdaptable;
>         this.items= new ArrayList<T>(items.size());
>         this.items.addAll(items);
>     }
>
>     public int getOptionCount() {
>         return items.size();
>     }
>
>     public Object getOption(int index) {
>         return getItem(index);
>     }
>
>     public String getLabel(int index) {
>         T item = getItem(index);
>         return nameAdapter.getName(item);
>     }
>
>     public String getValue(int index) {
>         return String.valueOf(index);
>     }
>
>     public Object translateValue(String value) {
>         return getOption(Integer.parseInt(value));
>     }
>
>     public T getFirstItem(){
>         return getItem(0);
>     }
>
>     private T getItem(int index){
>         if(index>items.size()) index = items.size();
>         return items.get(index);
>     }
> }
>
> Try User it:
>
> Collection<Pojo> pojos= service.getPojos(...);
> return new PropertySelectionModel<Pojo>(new
> NameAdaptable<Pojo>(){...},pojos);
>
> Any ideas?
>
>

Reply via email to