3 import javax.swing.AbstractListModel;
5 import tim.prune.data.Photo;
6 import tim.prune.data.PhotoList;
9 * Class to act as list model for the photo list
11 public class PhotoListModel extends AbstractListModel
13 PhotoList _photos = null;
16 * Constructor giving PhotoList object
17 * @param inList PhotoList
19 public PhotoListModel(PhotoList inList)
25 * @see javax.swing.ListModel#getSize()
29 return _photos.getNumPhotos();
33 * @see javax.swing.ListModel#getElementAt(int)
35 public Object getElementAt(int inIndex)
37 return _photos.getPhoto(inIndex).getFile().getName();
41 * Get the Photo at the given index
42 * @param inIndex index number, starting at 0
43 * @return Photo object
45 public Photo getPhoto(int inIndex)
47 return _photos.getPhoto(inIndex);
51 * Fire event to notify that contents have changed
53 public void fireChanged()
55 this.fireContentsChanged(this, 0, getSize()-1);