String resizedName = p.getProperty("image.resizedName." + i); if (resizedName != null) { picture.setUrlResized(new URL(baseUrl + resizedName)); width = p.getIntProperty("image.resized_width." + i); height = p.getIntProperty("image.resized_height." + i); picture.setSizeResized(new Dimension(width, height)); }
su.stopProgress(StatusUpdate.LEVEL_GENERIC, GRI18n.getString(MODULE, "fetchAlbImagesDone", new String[]{"" + newPictures.size()})); } catch (GR2Exception e) { error(su, GRI18n.getString(MODULE, "error", new String[] {e.getMessage()})); su.stopProgress(StatusUpdate.LEVEL_GENERIC, e.getMessage()); }
		void runTask() {			su.startProgress(StatusUpdate.LEVEL_GENERIC, 0, 10, GRI18n.getString(MODULE, "fetchAlbImages",							new String[]{a.getName()}), true);			try {				// setup the protocol parameters				NVPair form_data[] = {					new NVPair("cmd", "fetch-album-images"),					new NVPair("protocol_version", PROTOCOL_VERSION),					new NVPair("set_albumName", a.getName())				};				Log.log(Log.LEVEL_TRACE, MODULE, "fetch-album-images parameters: " +						Arrays.asList(form_data));				// load and validate the response				GalleryProperties p = requestResponse(form_data);				if (p.getProperty("status").equals(GR_STAT_SUCCESS)) {					// parse and store the data					int numImages = p.getIntProperty("image_count");					String baseUrl = p.getProperty("baseurl");					int width;					int height;					ArrayList extraFields = a.getExtraFields();					ArrayList newPictures = new ArrayList();					for (int i = 1; i <= numImages; i++) {						Picture picture = new Picture();						picture.setOnline(true);						picture.setUrlFull(new URL(baseUrl + p.getProperty("image.name." + i)));						width = p.getIntProperty("image.raw_width." + i);						height = p.getIntProperty("image.raw_height." + i);						picture.setSizeFull(new Dimension(width, height));						String resizedName = p.getProperty("image.resizedName." + i);						if (resizedName != null) {							picture.setUrlResized(new URL(baseUrl + resizedName));							width = p.getIntProperty("image.resized_width." + i);							height = p.getIntProperty("image.resized_height." + i);							picture.setSizeResized(new Dimension(width, height));						}						picture.setUrlThumbnail(new URL(baseUrl + p.getProperty("image.thumbName." + i)));						width = p.getIntProperty("image.thumb_width." + i);						height = p.getIntProperty("image.thumb_height." + i);						picture.setSizeThumbnail(new Dimension(width, height));						picture.setFileSize(p.getIntProperty("image.raw_filesize." + i));						picture.setCaption(p.getProperty("image.caption." + i));						if (extraFields != null) {							for (Iterator it = extraFields.iterator(); it.hasNext();) {								String name = (String) it.next();								String value = p.getProperty("image.extrafield." + name + "." + i);								if (value != null) {									picture.setExtraField(name, value);								}							}						}						picture.setAlbumOnServer(a);						picture.setIndexOnServer(i - 1);						newPictures.add(picture);					}					su.stopProgress(StatusUpdate.LEVEL_GENERIC, GRI18n.getString(MODULE, "fetchAlbImagesDone",									new String[]{"" + numImages}));					a.setHasFetchedImages(true);					a.addPictures(newPictures);					GalleryRemote._().getCore().preloadThumbnails(newPictures.iterator());				} else {					error(su, "Error: " + p.getProperty("status_text"));				}			} catch (GR2Exception gr2e) {				Log.logException(Log.LEVEL_ERROR, MODULE, gr2e);				Object[] params2 = {gr2e.getMessage()};				error(su, GRI18n.getString(MODULE, "error", params2));			} catch (IOException ioe) {				Log.logException(Log.LEVEL_ERROR, MODULE, ioe);				Object[] params2 = {ioe.toString()};				error(su, GRI18n.getString(MODULE, "error", params2));			} catch (ModuleException me) {				Log.logException(Log.LEVEL_ERROR, MODULE, me);				Object[] params2 = {me.toString()};				error(su, GRI18n.getString(MODULE, "error", params2));			}		}