1 package tim.prune.load;
3 import tim.prune.data.Photo;
4 import tim.prune.data.PhotoList;
7 * This class starts a new thread to preload image sizes
8 * TODO: # Cache small image thumbnails too?
10 public class PhotoMeasurer implements Runnable
12 /** PhotoList to loop through */
13 private PhotoList _photoList = null;
18 * @param inPhotoList photo list to loop through
20 public PhotoMeasurer(PhotoList inPhotoList)
22 _photoList = inPhotoList;
27 * Start off the process to measure the photo sizes
29 public void measurePhotos()
31 // check if any photos in list
32 if (_photoList != null && _photoList.getNumPhotos() > 0)
35 new Thread(this).start();
41 * Run method called in new thread
47 // loop over all photos in list
48 for (int i=0; i<_photoList.getNumPhotos(); i++)
50 Photo photo = _photoList.getPhoto(i);
53 // call get size method which will calculate it if necessary
58 catch (ArrayIndexOutOfBoundsException obe) {} // ignore, must have been changed by other thread