1 /*** 2 * Created on Nov 30, 2005, Copyright UC Regents 3 */ 4 package org.telscenter.pas.ui.util; 5 6 import java.util.Collection; 7 import java.util.Iterator; 8 9 import net.sf.sail.core.entity.User; 10 11 /*** 12 * Takes a Collection of User objects and iterates over their names 13 * 14 * @author turadg 15 * 16 */ 17 public class UserDisplayNameIterator implements Iterator<String> { 18 19 private Iterator<User> usersIterator; 20 21 public UserDisplayNameIterator(Collection<User> users) { 22 usersIterator = users.iterator(); 23 } 24 25 public void remove() { 26 throw new UnsupportedOperationException(); 27 } 28 29 public boolean hasNext() { 30 return usersIterator.hasNext(); 31 } 32 33 public String next() { 34 User user = usersIterator.next(); 35 if (user == null) return null; 36 return user.getDisplayName(); 37 } 38 39 /*** 40 * @return the usersIterator 41 */ 42 public Iterator<User> getUsersIterator() { 43 return usersIterator; 44 } 45 46 /*** 47 * @param usersIterator the usersIterator to set 48 */ 49 public void setUsersIterator(Iterator<User> usersIterator) { 50 this.usersIterator = usersIterator; 51 } 52 53 }