[richfaces-svn-commits] JBoss Rich Faces SVN: r13461 - in trunk/test-applications/realworld2/web/src/main: java/org/richfaces/realworld/ui and 8 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Apr 9 09:52:12 EDT 2009


Author: amarkhel
Date: 2009-04-09 09:52:12 -0400 (Thu, 09 Apr 2009)
New Revision: 13461

Added:
   trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/Upload/Noname/4/
   trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/Upload/Viking/3/
   trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/Upload/amarkhel/1/
   trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/Upload/amarkhel/2/
Modified:
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/DirectLinkHelper.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileWrapper.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/CopyImageStuff.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/SessionListener.java
   trunk/test-applications/realworld2/web/src/main/webapp/includes/album/albumsList.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/uploadResult.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageScroller.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
Log:
Refactoring FileManager

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -62,7 +62,12 @@
 			return;
 		}
 		validationSuccess = true;
-		albumAction.addAlbum(album);
+		try{
+			albumAction.addAlbum(album);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.ALBUM_SAVING_ERROR);
+			return;
+		}
 		Contexts.getConversationContext().set(Constants.ALBUM_VARIABLE, null);
 		Events.instance().raiseEvent(Constants.ALBUM_ADDED_EVENT, album);
 		Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
@@ -86,15 +91,25 @@
 
 	@Restrict("#{s:hasRole('admin')}")
 	public void editAlbum(Album album){
-		albumAction.editAlbum(album);
+		try{
+			albumAction.editAlbum(album);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.ALBUM_SAVING_ERROR);
+			return;
+		}
 		Events.instance().raiseEvent(Constants.ALBUM_EDITED_EVENT, album);
 	}
 	
 	@Restrict("#{s:hasRole('admin')}")
 	public void deleteAlbum(Album album){
-		String albumName = album.getId().toString();
-		albumAction.deleteAlbum(album);
-		Events.instance().raiseEvent(Constants.ALBUM_DELETED_EVENT, album, user.getLogin(), albumName);
+		String pathToDelete = album.getPath();
+		try{
+			albumAction.deleteAlbum(album);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.ALBUM_DELETING_ERROR);
+			return;
+		}
+		Events.instance().raiseEvent(Constants.ALBUM_DELETED_EVENT, album, pathToDelete);
 		Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
 	}
 	

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -21,7 +21,6 @@
 package org.richfaces.realworld.manager;
 
 import java.io.Serializable;
-import java.util.List;
 
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.annotations.In;
@@ -151,12 +150,12 @@
 	}
 	
 	@Observer(Constants.ALBUM_DELETED_EVENT)
-	public void onAlbumDeleted(Album album, String... parameters ){
+	public void onAlbumDeleted(Album album, String path){
 		model.resetModel(NavigationEnum.ALL_ALBUMS, model.getSelectedUser(), model.getSelectedShelf(), null, null, null);
 	}
 	
 	@Observer(Constants.SHELF_DELETED_EVENT)
-	public void onShelfDeleted(Shelf shelf, List<String> parameters){
+	public void onShelfDeleted(Shelf shelf, String path){
 		model.resetModel(NavigationEnum.ALL_SHELFS, model.getSelectedUser(), null, null, null, null);
 	}
 	
@@ -182,7 +181,7 @@
 	
 	public void showFileUpload(){
 		if(!(user.getShelfs().size() > 0)){
-			pushEvent(Constants.ADD_ERROR_EVENT, Constants.ALBUM_CREATE_ERROR);
+			pushEvent(Constants.ADD_ERROR_EVENT, Constants.FILE_UPLOAD_SHOW_ERROR);
 			return;
 		}
 		model.resetModel(NavigationEnum.FILE_UPLOAD, model.getSelectedUser(), model.getSelectedShelf(), model.getSelectedAlbum(), model.getSelectedImage(), model.getImages());
@@ -221,6 +220,10 @@
 		model.setSelectedTag(metatag);
 	}
 	
+	public void showError(String error){
+		pushEvent(Constants.ADD_ERROR_EVENT, error);
+	}
+	
 	public boolean isUserImage(Image image){
 		if(image == null || image.getAlbum() == null || image.getAlbum().getOwner() == null){
 			return false;

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -65,7 +65,12 @@
 
 	private void handleAlbum(Album dragValue, Shelf dropValue) {
 		dropValue.addAlbum(dragValue);
-		albumAction.editAlbum(dragValue);
+		try{
+			albumAction.editAlbum(dragValue);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.ERROR_IN_DB);
+			return;
+		}
 		Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
 	}
 
@@ -73,19 +78,13 @@
 		if(dragValue.getAlbum().equals(dropValue)){
 			return;
 		}
-		String newPath = generateNewPathOfImage(dragValue, dropValue);
-		dragValue.setPath(newPath);
 		dropValue.addImage(dragValue);
-		albumAction.editAlbum(dropValue);
+		try{
+			albumAction.editAlbum(dropValue);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.ERROR_IN_DB);
+			return;
+		}
 		Events.instance().raiseEvent(Constants.DNDUPLOADED_EVENT, dragValue);
 	}
-
-	private String generateNewPathOfImage(Image dragValue, Album dropValue) {
-		String fileNameOld = dragValue.getPath();
-		int lastIndexOf = dragValue.getPath().lastIndexOf(Constants.SLASH);
-		String prevPathEnd = dragValue.getPath().substring(lastIndexOf);
-		String fileNameNew = user.getLogin() + Constants.SLASH + dropValue.getId() + Constants.SLASH + prevPathEnd;
-		fileManager.renameImage(fileNameOld, fileNameNew);
-		return fileNameNew;
-	}
 }

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -20,23 +20,11 @@
  */
 package org.richfaces.realworld.manager;
 
-import java.awt.Graphics2D;
 import java.awt.RenderingHints;
-import java.awt.Transparency;
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.List;
 
-import javax.imageio.ImageIO;
-import javax.imageio.ImageReader;
-import javax.imageio.ImageWriter;
-import javax.imageio.stream.ImageInputStream;
-
 import org.jboss.seam.Component;
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.annotations.AutoCreate;
@@ -50,6 +38,8 @@
 import org.richfaces.realworld.domain.Shelf;
 import org.richfaces.realworld.domain.User;
 import org.richfaces.realworld.service.Constants;
+import org.richfaces.realworld.util.FileUtils;
+import org.richfaces.realworld.util.ImageDimension;
 
 @Name("fileManager")
 @Scope(ScopeType.APPLICATION)
@@ -100,278 +90,80 @@
         return null;
     }
 
-    public boolean isDirectoryPresent(String directory) {
-        final File file = getFileByPath(directory);
-        return file.exists() && file.isDirectory();
-    }
-
     @Restrict("#{s:hasRole('admin')}")
     @Observer(Constants.ALBUM_DELETED_EVENT)
-    public void deleteDirectory(Album album, String... directories) {
-    	deleteDirectory(directories);
+    public void onAlbumDeleted(Album album, String path) {
+    	deleteDirectory(path);
     }
-
-    @Observer(Constants.USER_DELETED_EVENT)
-    public void deleteDirectory(String... directories){
-    	final File file = getFileByPath(joinFiles(directories).toString());
-        deleteDirectory(file);
-    }
     
-    private void deleteDirectory(File file) {
-    	if (file.exists()) {
-            for (String f : file.list()) {
-                final File temp = new File(file, f);
-                if(temp.isDirectory()){
-                	deleteDirectory(temp);
-                }else{
-                	temp.delete();
-                }
-            }
-            file.delete();
-        }
-	}
-
-	private String joinFiles(String... files) {
-        final StringBuilder res = new StringBuilder();
-        for (String file : files) {
-            res.append(file).append(File.pathSeparatorChar);
-        }
-        return res.substring(0, res.length() - 1);
+    @Restrict("#{s:hasRole('admin')}")
+    @Observer(Constants.SHELF_DELETED_EVENT)
+    public void onShelfDeleted(Shelf shelf, String path) {
+    	deleteDirectory(path);
     }
     
-    @Restrict("#{s:hasRole('admin')}")
-    public boolean renameDirectory(String directoryOld, String directoryNew) {
-        final File fileOld = getFileByPath(directoryOld);
-        final File fileNew = getFileByPath(directoryNew);
-
-        createDirectoryIfNotExist(directoryNew);
-        if (fileNew.exists()) {
-            if (fileNew.isDirectory()) {
-                return false;
-            } else {
-                fileNew.delete();
-            }
-        }
-        fileOld.renameTo(fileNew);
-        return true;
+    @Observer(Constants.USER_DELETED_EVENT)
+    public void onUserDeleted(User user){
+    	deleteDirectory(user.getPath());
     }
 
     @Restrict("#{s:hasRole('admin')}")
-    public void addDirectory(String... directories) {
-        final StringBuilder directory = new StringBuilder();
-        for (String chunk : directories) {
-            directory.append(chunk);
-        }
-
-        final File file = getFileByPath(directory.toString());
-        file.mkdirs();
-    }
-
-    @Restrict("#{s:hasRole('admin')}")
     public boolean saveAvatar(String path, User user) {
-		return writeFile(Constants.SLASH + user.getLogin() +
+		return writeFile(user.getPath() +
 				Constants.AVATAR_JPG, path, "", Constants.AVATAR_SIZE, true);
 	}
 
     @Restrict("#{s:hasRole('admin')}")
-    public void renameImage(String fileNameOld, String fileNameNew) {
-		createDirectoryIfNotExist(fileNameNew);
-		renameImage(getFileByPath(fileNameNew), getFileByPath(fileNameOld));
-		
-		renameImage(getFileByPath(transformPath(fileNameNew, Constants._MEDIUM)),
-			getFileByPath(transformPath(fileNameOld, Constants._MEDIUM)));
-		
-		renameImage(getFileByPath(transformPath(fileNameNew, Constants._SMALL80)),
-				getFileByPath(transformPath(fileNameOld, Constants._SMALL80)));
-		
-		renameImage(getFileByPath(transformPath(fileNameNew, Constants._SMALL120)),
-				getFileByPath(transformPath(fileNameOld, Constants._SMALL120)));
-		
-		renameImage(getFileByPath(transformPath(fileNameNew, Constants._SMALL160)),
-				getFileByPath(transformPath(fileNameOld, Constants._SMALL160)));
-		
-		renameImage(getFileByPath(transformPath(fileNameNew, Constants._SMALL200)),
-				getFileByPath(transformPath(fileNameOld, Constants._SMALL200)));
-	}
-
-    @Restrict("#{s:hasRole('admin')}")
     @Observer(Constants.IMAGE_DELETED_EVENT)
-	public void deleteImage(Image image, String fileName) {
-		deleteImage(getFileByPath(fileName));
-		deleteImage(getFileByPath(transformPath(fileName, Constants._MEDIUM)));
-		deleteImage(getFileByPath(transformPath(fileName, Constants._SMALL80)));
-		deleteImage(getFileByPath(transformPath(fileName, Constants._SMALL120)));
-		deleteImage(getFileByPath(transformPath(fileName, Constants._SMALL160)));
-		deleteImage(getFileByPath(transformPath(fileName, Constants._SMALL200)));
+	public void deleteImage(Image image, String path) {
+    	for(ImageDimension d : ImageDimension.values()){
+    		FileUtils.deleteFile(getFileByPath(transformPath(path, d.getFilePostfix())));
+    	}
 	}
 
     @Restrict("#{s:hasRole('admin')}")
 	public boolean addImage(String fileName, String  tempFilePath) {
 		createDirectoryIfNotExist(fileName);
-		if(!writeFile(fileName, tempFilePath, Constants._SMALL80, Constants.SMALL_80_SIZE, true)){
-			return false;
-		}
-		if(!writeFile(fileName, tempFilePath, Constants._SMALL120, Constants.SMALL_120_SIZE, true)){
-			return false;
-		}
-		if(!writeFile(fileName, tempFilePath, Constants._SMALL160, Constants.SMALL_160_SIZE, true)){
-			return false;
-		}
-		if(!writeFile(fileName, tempFilePath, Constants._SMALL200, Constants.SMALL_200_SIZE, true)){
-			return false;
-		}
-		if(!writeFile(fileName, tempFilePath, Constants._MEDIUM, Constants.MEDIUM_SIZE, true)){
-			return false;
-		}
-		if(!writeOriginalFile(fileName, tempFilePath, true)){
-			return false;
-		}
+		for(ImageDimension d : ImageDimension.values()){
+			if(!writeFile(fileName, tempFilePath, d.getFilePostfix(), d.getX(), true)){
+				return false;
+			}
+    	}
 		return true;
 	}
-
-    public static BufferedImage bitmapToImage(String data, String format) throws IOException {
-        final InputStream inb = new FileInputStream(data);
-        final ImageReader rdr = ImageIO.getImageReadersByFormatName(format).next();
-        final ImageInputStream imageInput = ImageIO.createImageInputStream(inb);
-        rdr.setInput(imageInput);
-        final BufferedImage image = rdr.read(0);
-        inb.close();
-        return image;
-    }
-
-    public static void imageToBitmap(BufferedImage image, String data, String format) throws IOException {
-        final OutputStream inb = new FileOutputStream(data);
-        final ImageWriter wrt = ImageIO.getImageWritersByFormatName(format).next();
-        final ImageInputStream imageInput = ImageIO.createImageOutputStream(inb);
-        wrt.setOutput(imageInput);
-        wrt.write(image);
-        inb.close();
-    }
-
-    /**
-     * Convenience method that returns a scaled instance of the
-     * provided {@code BufferedImage}.
-     *
-     * @param img           the original image to be scaled
-     * @param targetWidth   the desired width of the scaled instance,
-     *                      in pixels
-     * @param targetHeight  the desired height of the scaled instance,
-     *                      in pixels
-     * @param hint          one of the rendering hints that corresponds to
-     *                      {@code RenderingHints.KEY_INTERPOLATION} (e.g.
-     *                      {@code RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR},
-     *                      {@code RenderingHints.VALUE_INTERPOLATION_BILINEAR},
-     *                      {@code RenderingHints.VALUE_INTERPOLATION_BICUBIC})
-     * @param higherQuality if true, this method will use a multi-step
-     *                      scaling technique that provides higher quality than the usual
-     *                      one-step technique (only useful in downscaling cases, where
-     *                      {@code targetWidth} or {@code targetHeight} is
-     *                      smaller than the original dimensions, and generally only when
-     *                      the {@code BILINEAR} hint is specified)
-     * @return a scaled version of the original {@code BufferedImage}
-     */
-    public static BufferedImage getScaledInstance(BufferedImage img,
-                                                  int targetWidth,
-                                                  int targetHeight,
-                                                  Object hint,
-                                                  boolean higherQuality) {
-        final int type = img.getTransparency() == Transparency.OPAQUE ?
-                BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
-        BufferedImage ret = (BufferedImage) img;
-        int w;
-        int h;
-        if (higherQuality) {
-            // Use multi-step technique: start with original size, then
-            // scale down in multiple passes with drawImage()
-            // until the target size is reached
-            w = img.getWidth();
-            h = img.getHeight();
-        } else {
-            // Use one-step technique: scale directly from original
-            // size to target size with a single drawImage() call
-            w = targetWidth;
-            h = targetHeight;
-        }
-
-        do {
-            if (higherQuality && w > targetWidth) {
-                w /= 2;
-                if (w < targetWidth) {
-                    w = targetWidth;
-                }
-            }
-
-            if (higherQuality && h > targetHeight) {
-                h /= 2;
-                if (h < targetHeight) {
-                    h = targetHeight;
-                }
-            }
-
-            final BufferedImage tmp = new BufferedImage(w, h, type);
-            final Graphics2D g2 = tmp.createGraphics();
-            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, hint);
-            g2.drawImage(ret, 0, 0, w, h, null);
-            g2.dispose();
-
-            ret = tmp;
-        } while (w != targetWidth || h != targetHeight);
-
-        return ret;
-    }
-
-    public boolean writeOriginalFile(String newFileName, String fileName,
-			boolean includeUploadRoot){
-    	BufferedImage bsrc = null;
+    
+    @Restrict("#{s:hasRole('admin')}")
+	public boolean writeFile(String newFileName, String fileName,
+			String pattern, int size, boolean includeUploadRoot) {
+		BufferedImage bsrc = null;
 		try {
-			bsrc = bitmapToImage(fileName, Constants.JPG);
+			bsrc = FileUtils.bitmapToImage(fileName, Constants.JPG);
 		} catch (IOException e1) {
 			return false;
 		}
-		BufferedImage bdest = getScaledInstance(bsrc, bsrc.getWidth(), bsrc.getHeight(),
+		int i = bsrc.getWidth() > bsrc.getHeight() ? bsrc.getWidth() : bsrc.getHeight();
+		double d = (double) size / i;
+		Double yy = ((Double) d * bsrc.getWidth());
+		int width = yy.intValue();
+		yy = ((Double) d * bsrc.getHeight());
+		int height = yy.intValue();
+		// Too small picture or original size
+		if (width > bsrc.getWidth() || height > bsrc.getHeight() || size == 0) {
+			width = bsrc.getWidth();
+			height = bsrc.getHeight();
+		}
+		BufferedImage bdest = FileUtils.getScaledInstance(bsrc, width, height,
 				RenderingHints.VALUE_INTERPOLATION_BICUBIC, true);
 		String dest = includeUploadRoot ? this.uploadRootPath
-				+ newFileName : newFileName;
+				+ transformPath(newFileName, pattern) : transformPath(
+				newFileName, pattern);
 		try {
-			imageToBitmap(bdest, dest, Constants.JPG);
+			FileUtils.imageToBitmap(bdest, dest, Constants.JPG);
 		} catch (IOException ex) {
 			return false;
 		}
 		return true;
-    }
-    @Restrict("#{s:hasRole('admin')}")
-    	public boolean writeFile(String newFileName, String fileName,
-    			String pattern, int size, boolean includeUploadRoot) {
-    		BufferedImage bsrc = null;
-    		try {
-    			bsrc = bitmapToImage(fileName, Constants.JPG);
-    		} catch (IOException e1) {
-    			return false;
-    		}
-    		int i = bsrc.getWidth() > bsrc.getHeight() ? bsrc.getWidth() : bsrc
-    				.getHeight();
-    		double d = (double) size / i;
-    		Double yy = ((Double) d * bsrc.getWidth());
-    		int width = yy.intValue();
-    		yy = ((Double) d * bsrc.getHeight());
-    		int height = yy.intValue();
-    		//Too small picture
-    		if(width > bsrc.getWidth() || height > bsrc.getHeight()){
-    			width = bsrc.getWidth();
-    			height = bsrc.getHeight();
-    		}
-    		BufferedImage bdest = getScaledInstance(bsrc, width, height,
-    				RenderingHints.VALUE_INTERPOLATION_BICUBIC, true);
-    		String dest = includeUploadRoot ? this.uploadRootPath
-    				+ transformPath(newFileName, pattern) : transformPath(
-    				newFileName, pattern);
-    		try {
-    			imageToBitmap(bdest, dest, Constants.JPG);
-    		} catch (IOException ex) {
-    			return false;
-    		}
-    		return true;
-    	}
+	}
 
     public String transformPath(String target, String substitute) {
         final String begin = target.substring(0, target.lastIndexOf(Constants.DOT));
@@ -379,25 +171,16 @@
         return begin + substitute + end;
     }
 
-    private void deleteImage(File file) {
-        if (file.exists()) {
-            file.delete();
-        }
+	public File getFileByAbsolutePath(String path) {
+		return new File(path);
+	}
+	
+	private void deleteDirectory(String directory){
+    	final File file = getFileByPath(directory);
+        FileUtils.deleteDirectory(file, false);
     }
-
-    public String getPathOfImage(String path) {
-        final int i = path.lastIndexOf(Constants.SLASH);
-        return path.substring(i);
-    }
-
-    private void renameImage(File fileNew, File fileOld) {
-        if (fileNew.exists()) {
-            fileNew.delete();
-        }
-        fileOld.renameTo(fileNew);
-    }
-
-    private void createDirectoryIfNotExist(String fileNameNew) {
+	
+	private void createDirectoryIfNotExist(String fileNameNew) {
         final int lastIndexOf = fileNameNew.lastIndexOf(Constants.SLASH);
         if (lastIndexOf > 0) {
             final String directory = fileNameNew.substring(0, lastIndexOf);
@@ -407,20 +190,4 @@
             }
         }
     }
-
-    public boolean isImagePresent(String fileName) {
-        return getFileByPath(fileName) != null && getFileByPath(fileName).exists() && !getFileByPath(fileName).isDirectory();
-    }
-
-    @Restrict("#{s:hasRole('admin')}")
-    @Observer(Constants.SHELF_DELETED_EVENT)
-    public void deleteDirectories(Shelf shelf, List<String> directoriesToDelete) {
-        for (String directory : directoriesToDelete) {
-            deleteDirectory(directory);
-        }
-    }
-
-	public File getFileByAbsolutePath(String path) {
-		return new File(path);
-	}
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileUploadManager.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -74,28 +74,31 @@
 		try {
 			extractMetadata(item, image);
 		} catch (Exception e1) {
-			addError(item, image);
+			addError(item, image, Constants.FILE_PROCESSING_ERROR);
 			return;
 		}
 		image.setAlbum(model.getSelectedAlbum());
 		if(model.getSelectedAlbum() == null){
-			addError(item, image);
+			addError(item, image, Constants.NO_ALBUM_TO_DOWNLOAD_ERROR);
 			return;
 		}
-		String newPath = Constants.SLASH + model.getSelectedAlbum().getOwner().getLogin() + Constants.SLASH + model.getSelectedAlbum().getId() + Constants.SLASH +item.getFileName();
-		image.setPath(newPath);
-		if(!fileManager.addImage(newPath, item.getFile().getPath())){
-			addError(item, image);
+		try{
+			imageAction.addImage(image);
+		}catch(Exception e){
+			addError(item, image, Constants.IMAGE_SAVING_ERROR);
 			return;
 		}
+		if(!fileManager.addImage(image.getFullPath(), item.getFile().getPath())){
+			addError(item, image, Constants.FILE_SAVE_ERROR);
+			return;
+		}
 		fileWrapper.getFiles().add(image);
-		imageAction.addImage(image);
 		Events.instance().raiseEvent(Constants.IMAGE_ADDED_EVENT);
 		item.getFile().delete();
 	}
 
-	private void addError(UploadItem item, Image image) {
-		fileWrapper.getErrorFiles().add(image);
+	private void addError(UploadItem item, Image image, String error) {
+		fileWrapper.onFileUploadError(image, error);
 		item.getFile().delete();
 	}
 
@@ -105,6 +108,7 @@
 		image.setDescription(item.getFileName());
 		image.setName(item.getFileName());
 		image.setSize(item.getFileSize());
+		image.setPath(item.getFileName());
 		image.setAllowComments(true);
 		return image;
 	}

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -54,14 +54,24 @@
 
     @Restrict("#{s:hasRole('admin')}")
     public void deleteImage(Image image) {
-        String imagePath = image.getPath();
-        imageAction.deleteImage(image);
-        Events.instance().raiseEvent(Constants.IMAGE_DELETED_EVENT, image , imagePath);
+    	String pathToDelete = image.getFullPath();
+    	try{
+    		imageAction.deleteImage(image);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.IMAGE_DELETING_ERROR);
+			return;
+		}
+        Events.instance().raiseEvent(Constants.IMAGE_DELETED_EVENT, image, pathToDelete);
     }
 
     @Restrict("#{s:hasRole('admin')}")
     public void editImage(Image image) {
-        imageAction.editImage(image);
+    	try{
+    		imageAction.editImage(image);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.IMAGE_SAVING_ERROR);
+			return;
+		}
         Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT, NavigationEnum.ALBUM_IMAGE_PREVIEW);
     }
 
@@ -79,13 +89,23 @@
         comment.setImage(image);
         comment.setDate(new Date());
         comment.setMessage(message);
-        imageAction.addComment(comment);
+        try{
+        	 imageAction.addComment(comment);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.SAVE_COMMENT_ERROR);
+			return;
+		}
         Events.instance().raiseEvent(Constants.CLEAR_EDITOR_EVENT, "");
     }
 
     @Restrict("#{s:hasRole('admin')}")
     public void deleteComment(Comment comment) {
-        imageAction.deleteComment(comment);
+    	try{
+    		imageAction.deleteComment(comment);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.DELETE_COMMENT_ERROR);
+			return;
+		}
     }
 
     public List<MetaTag> popularTags() {
@@ -140,4 +160,4 @@
 		
 		return url.toString();
     }
-}
+}
\ No newline at end of file

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -21,7 +21,6 @@
 package org.richfaces.realworld.manager;
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.jboss.seam.ScopeType;
@@ -33,7 +32,6 @@
 import org.jboss.seam.annotations.security.Restrict;
 import org.jboss.seam.contexts.Contexts;
 import org.jboss.seam.core.Events;
-import org.richfaces.realworld.domain.Album;
 import org.richfaces.realworld.domain.Image;
 import org.richfaces.realworld.domain.Shelf;
 import org.richfaces.realworld.domain.User;
@@ -65,7 +63,12 @@
     public void addShelf(Shelf shelf) {
     	validationSuccess = true;
     	shelf.setPreDefined(false);
-        shelfAction.addShelf(shelf);
+    	try{
+    		shelfAction.addShelf(shelf);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.SHELF_SAVING_ERROR);
+			return;
+		}
         Events.instance().raiseEvent(Constants.SHELF_ADDED_EVENT, shelf);
         Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
     }
@@ -77,19 +80,25 @@
     @Restrict("#{s:hasRole('admin')}")
     public void editShelf(Shelf shelf) {
     	shelf.setPreDefined(false);
-        shelfAction.editShelf(shelf);
+    	try{
+    		shelfAction.editShelf(shelf);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.SHELF_SAVING_ERROR);
+			return;
+		}
         Events.instance().raiseEvent(Constants.SHELF_EDITED_EVENT, shelf);
     }
 
     @Restrict("#{s:hasRole('admin')}")
     public void deleteShelf(Shelf shelf) {
-        //Update domain model
-        List<String> directoriesToDelete = new ArrayList<String>();
-        for (Album a : shelf.getAlbums()) {
-            directoriesToDelete.add(user.getLogin() + Constants.SLASH + a.getId());
-        }
-        shelfAction.deleteShelf(shelf);
-        Events.instance().raiseEvent(Constants.SHELF_DELETED_EVENT, shelf, directoriesToDelete);
+    	String pathToDelete = shelf.getPath();
+    	try{
+    		shelfAction.deleteShelf(shelf);
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.SHELF_DELETING_ERROR);
+			return;
+		}
+        Events.instance().raiseEvent(Constants.SHELF_DELETED_EVENT, shelf, pathToDelete);
         Events.instance().raiseEvent(Constants.CLEAR_TREE_EVENT);
     }
 

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -94,8 +94,12 @@
 			avatarData.delete();
 			avatarData = null;
 			user.setHasAvatar(true);
+		}try{
+			user = userAction.updateUser();
+		}catch(Exception e){
+			Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.UPDATE_USER_ERROR);
+			return;
 		}
-		user = userAction.updateUser();
 	}
 	
 	@Observer(Constants.CANCEL_EDIT_USER_EVENT)
@@ -114,7 +118,7 @@
 	}
 	
 	@Observer(Constants.ALBUM_DELETED_EVENT)
-	public void onAlbumDeleted(Album album, String... parameters){
+	public void onAlbumDeleted(Album album, String path){
 		user.updateStatistics();
 	}
 	
@@ -124,7 +128,7 @@
 	}
 	
 	@Observer(Constants.SHELF_DELETED_EVENT)
-	public void onShelfDeleted(Shelf shelf, List<String> directories){
+	public void onShelfDeleted(Shelf shelf, String path){
 		user.updateStatistics();
 	}
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/DirectLinkHelper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/DirectLinkHelper.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/DirectLinkHelper.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -38,7 +38,7 @@
 			return;
 		}
 		if(im.getAlbum().getShelf().isShared() || (identity.hasRole(Constants.ADMIN_ROLE) && im.getAlbum().getOwner().getLogin().equals(credentials.getUsername()))){
-			imageLoader.paintImage(out, im.getPath());
+			imageLoader.paintImage(out, im.getFullPath());
 		}else{
 			return;
 		}

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileWrapper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileWrapper.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileWrapper.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -43,19 +43,30 @@
 	
 	private List<Image> files = new ArrayList<Image>();
 	
-	private List<Image> errorFiles = new ArrayList<Image>();
+	private List<ErrorImage> errorFiles = new ArrayList<ErrorImage>();
 	
-	public String getErrorNames(){
-		StringBuilder s = new StringBuilder();
-		for(int i = 0; i < errorFiles.size(); i++){
-			Image im = errorFiles.get(i);
-			s.append(im.getName());
-			if(!(i == errorFiles.size() - 1)){
-				s.append(" ,");
-			}
+	class ErrorImage{
+		private Image image;
+		private String errorDescription;
+		ErrorImage(Image i, String description){
+			image = i;
+			errorDescription = description;
 		}
-		return s.toString();
+		
+		public Image getImage() {
+			return image;
+		}
+		public void setImage(Image image) {
+			this.image = image;
+		}
+		public String getErrorDescription() {
+			return errorDescription;
+		}
+		public void setErrorDescription(String errorDescription) {
+			this.errorDescription = errorDescription;
+		}
 	}
+	
 	public int getSize() {
 		return getFiles().size();
 	}
@@ -80,6 +91,19 @@
 		complete = false;
 	}
 
+	public void onFileUploadError(Image image, String error){
+		ErrorImage e = new ErrorImage(image, error);
+		errorFiles.add(e);
+	}
+	
+	public Image getErrorImage(ErrorImage e){
+		return e.getImage();
+	}
+	
+	public String getErrorDescription(ErrorImage e){
+		return e.getErrorDescription();
+	}
+	
 	public boolean isComplete() {
 		return complete;
 	}
@@ -88,11 +112,11 @@
 		this.complete = complete;
 	}
 
-	public List<Image> getErrorFiles() {
+	public List<ErrorImage> getErrorFiles() {
 		return errorFiles;
 	}
 
-	public void setErrorFiles(List<Image> errorFiles) {
+	public void setErrorFiles(List<ErrorImage> errorFiles) {
 		this.errorFiles = errorFiles;
 	}
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -6,6 +6,8 @@
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.service.Constants;
+import org.richfaces.realworld.util.ImageDimension;
 
 /**
  * @author Andrey Markavtsov
@@ -15,65 +17,9 @@
 @Scope(ScopeType.EVENT)
 public class ImageSizeHelper {
 
-	static final int DEFAULT_VALUE = 120;
-
-	int value = DEFAULT_VALUE;
-
-	public static enum ImageDimension {
-
-		SIZE_80(80), SIZE_120(120), SIZE_160(160), SIZE_200(200);
-
-		final static String CSS_CLASS = "preview_box_photo_";
-		final static String FILE_POSTFIX = "_small";
-		final static String IMAGE_BG = "/img/shell/frame_photo_%1$d.png";
-		final static String IMAGE_BG_STYLE = "width: %1$dpx; height: %1$dpx";
-		
-		int x;
-		String bgStyle;
-		String cssClass;
-		String imageBgSrc;
-		String filePostfix;
-
-		private ImageDimension(int x) {
-			this.x = x;
-			this.bgStyle = String.format(IMAGE_BG_STYLE, x + 20);
-			cssClass = CSS_CLASS + x;
-			imageBgSrc = String.format(IMAGE_BG, (x == 160) ? 200 : x);
-			filePostfix = FILE_POSTFIX + x;
-		}
-
-		public int getX() {
-			return x;
-		}
-
-		public String getCssClass() {
-			return cssClass;
-		}
-
-		public String getImageBg() {
-			return imageBgSrc;
-		}
-		
-		public String getImageBgStyle() {
-			return bgStyle;
-		}
-
-		public String getFilePostfix() {
-			return filePostfix;
-		}
-		
-		public static ImageDimension getInstance(int x) {
-			ImageDimension [] all = values();
-			for (int i=0; i<all.length; i++) {
-				if (all[i].x == x) {
-					return all[i];
-				}
-			}
-			return values()[DEFAULT_VALUE];
-		}
-	};
+	int value = Constants.DEFAULT_IMAGE_SIZEVALUE;
 	
-	ImageDimension currentDimension = ImageDimension.getInstance(DEFAULT_VALUE);
+	ImageDimension currentDimension = ImageDimension.getInstance(Constants.DEFAULT_IMAGE_SIZEVALUE);
 	
 	public ImageDimension getCurrentDimension() {
 		return currentDimension;
@@ -85,6 +31,6 @@
 
 	public void setValue(int value) {
 		currentDimension = ImageDimension.getInstance(value);
-		this.value = currentDimension.x;
+		this.value = currentDimension.getX();
 	}
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/CopyImageStuff.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/CopyImageStuff.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/CopyImageStuff.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -46,7 +46,7 @@
 	
 	@Destroy
 	public void destroy()throws IOException {
-		FileUtils.deleteDirectory(uploadRoot);
+		FileUtils.deleteDirectory(uploadRoot, true);
 	}
 	
 	void resolveImageFolder() {
@@ -85,7 +85,7 @@
 		if (uploadRootPath != null) {
 			uploadRoot = new File(uploadRootPath);
 			if (uploadRoot.exists()) {
-				FileUtils.deleteDirectory(uploadRoot);
+				FileUtils.deleteDirectory(uploadRoot, true);
 			}
 			uploadRoot.mkdir();
 			this.uploadRootPath = uploadRoot.getCanonicalPath();

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -1,8 +1,17 @@
 package org.richfaces.realworld.util;
 
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
 import java.io.*;
 import java.util.zip.*;
 
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.ImageWriter;
+import javax.imageio.stream.ImageInputStream;
+
 public class FileUtils {
 
     private static final String JPEG = "jpeg";
@@ -65,14 +74,17 @@
         }
     }
 
-    public static void deleteDirectory(File dir){
+    public static boolean deleteDirectory(File dir , boolean isInitialDelete){
         if (dir.isDirectory()) {
             if (dir.exists()) {
                 for (File child : dir.listFiles()) {
                 	try{
-                		deleteDirectory(child);
+                		deleteDirectory(child, isInitialDelete);
                 	}catch(Exception e){
-                		continue;
+                		if(isInitialDelete){
+                			continue;
+                		}
+                		else return false;
                 	}
                 }
             }
@@ -85,5 +97,103 @@
             }
         }
         dir.delete();
+        return true;
     }
+    
+    public static void deleteFile(File file) {
+        if (file.exists()) {
+            file.delete();
+        }
+    }
+    
+    public static BufferedImage bitmapToImage(String data, String format) throws IOException {
+        final InputStream inb = new FileInputStream(data);
+        final ImageReader rdr = ImageIO.getImageReadersByFormatName(format).next();
+        final ImageInputStream imageInput = ImageIO.createImageInputStream(inb);
+        rdr.setInput(imageInput);
+        final BufferedImage image = rdr.read(0);
+        inb.close();
+        return image;
+    }
+
+    public static void imageToBitmap(BufferedImage image, String data, String format) throws IOException {
+        final OutputStream inb = new FileOutputStream(data);
+        final ImageWriter wrt = ImageIO.getImageWritersByFormatName(format).next();
+        final ImageInputStream imageInput = ImageIO.createImageOutputStream(inb);
+        wrt.setOutput(imageInput);
+        wrt.write(image);
+        inb.close();
+    }
+
+    /**
+     * Convenience method that returns a scaled instance of the
+     * provided {@code BufferedImage}.
+     *
+     * @param img           the original image to be scaled
+     * @param targetWidth   the desired width of the scaled instance,
+     *                      in pixels
+     * @param targetHeight  the desired height of the scaled instance,
+     *                      in pixels
+     * @param hint          one of the rendering hints that corresponds to
+     *                      {@code RenderingHints.KEY_INTERPOLATION} (e.g.
+     *                      {@code RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR},
+     *                      {@code RenderingHints.VALUE_INTERPOLATION_BILINEAR},
+     *                      {@code RenderingHints.VALUE_INTERPOLATION_BICUBIC})
+     * @param higherQuality if true, this method will use a multi-step
+     *                      scaling technique that provides higher quality than the usual
+     *                      one-step technique (only useful in downscaling cases, where
+     *                      {@code targetWidth} or {@code targetHeight} is
+     *                      smaller than the original dimensions, and generally only when
+     *                      the {@code BILINEAR} hint is specified)
+     * @return a scaled version of the original {@code BufferedImage}
+     */
+    public static BufferedImage getScaledInstance(BufferedImage img,
+                                                  int targetWidth,
+                                                  int targetHeight,
+                                                  Object hint,
+                                                  boolean higherQuality) {
+        final int type = img.getTransparency() == Transparency.OPAQUE ?
+                BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
+        BufferedImage ret = (BufferedImage) img;
+        int w;
+        int h;
+        if (higherQuality) {
+            // Use multi-step technique: start with original size, then
+            // scale down in multiple passes with drawImage()
+            // until the target size is reached
+            w = img.getWidth();
+            h = img.getHeight();
+        } else {
+            // Use one-step technique: scale directly from original
+            // size to target size with a single drawImage() call
+            w = targetWidth;
+            h = targetHeight;
+        }
+
+        do {
+            if (higherQuality && w > targetWidth) {
+                w /= 2;
+                if (w < targetWidth) {
+                    w = targetWidth;
+                }
+            }
+
+            if (higherQuality && h > targetHeight) {
+                h /= 2;
+                if (h < targetHeight) {
+                    h = targetHeight;
+                }
+            }
+
+            final BufferedImage tmp = new BufferedImage(w, h, type);
+            final Graphics2D g2 = tmp.createGraphics();
+            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, hint);
+            g2.drawImage(ret, 0, 0, w, h, null);
+            g2.dispose();
+
+            ret = tmp;
+        } while (w != targetWidth || h != targetHeight);
+
+        return ret;
+    }
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/SessionListener.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/SessionListener.java	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/SessionListener.java	2009-04-09 13:52:12 UTC (rev 13461)
@@ -29,7 +29,7 @@
 			user = em.merge(user);
 			em.remove(user);
 			em.flush();
-			Events.instance().raiseEvent(Constants.USER_DELETED_EVENT, user.getLogin());
+			Events.instance().raiseEvent(Constants.USER_DELETED_EVENT, user);
 		}
 	}
 }

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/album/albumsList.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/uploadResult.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageScroller.xhtml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageScroller.xhtml	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageScroller.xhtml	2009-04-09 13:52:12 UTC (rev 13461)
@@ -19,7 +19,7 @@
 						<h:panelGroup>
 							<a4j:mediaOutput element="img"
 								createContent="#{imageLoader.paintImage}"
-								value="#{fileManager.transformPath(img.path, '_small80')}">
+								value="#{fileManager.transformPath(img.fullPath, '_small80')}">
 								<f:param value="#{imageSizeHelper.currentDimension.x}" name="x" />
 							</a4j:mediaOutput>
 							<br />

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml	2009-04-09 13:52:12 UTC (rev 13461)
@@ -16,7 +16,7 @@
 							createContent="#{imageLoader.paintImage}" 
 							styleClass="album-cover-image"
 							
-							value="#{fileManager.transformPath(album.coveringImage.path, '_small120')}">
+							value="#{fileManager.transformPath(album.coveringImage.fullPath, '_small120')}">
 						</a4j:mediaOutput>	
 						<h:graphicImage rendered="#{album.isEmpty()}" 
 								style="width:80px; height:80px;" 

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml	2009-04-09 13:34:06 UTC (rev 13460)
+++ trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml	2009-04-09 13:52:12 UTC (rev 13461)
@@ -22,7 +22,7 @@
 								<a4j:mediaOutput id="img"  element="img" 
 									createContent="#{imageLoader.paintImage}" 
 									style="border : 2px solid #FFFFFF;"
-									value="#{fileManager.transformPath(image.path, imageSizeHelper.currentDimension.filePostfix)}">
+									value="#{fileManager.transformPath(image.fullPath, imageSizeHelper.currentDimension.filePostfix)}">
 									<f:param value="#{imageSizeHelper.currentDimension.x}" name="x" />
 								</a4j:mediaOutput>
 					</a4j:commandLink>




More information about the richfaces-svn-commits mailing list