Package org.richfaces.photoalbum.model.event

Examples of org.richfaces.photoalbum.model.event.ErrorEvent


            return;
        }
        try {
            eventAction.editEvent(event);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.EVENT_SAVING_ERROR + " <br /> " + e.getMessage()));
            eventAction.resetEvent(event);
            return;
        }
        shelfEvent.select(new EventTypeQualifier(Events.EVENT_EDITED_EVENT)).fire(new ShelfEvent(event));
    }
View Full Code Here


            return;
        }
        try {
            eventAction.deleteEvent(event);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.EVENT_DELETING_ERROR + " <br /> " + e.getMessage()));
            return;
        }
        shelfEvent.select(new EventTypeQualifier(Events.EVENT_DELETED_EVENT)).fire(new ShelfEvent(event));
    }
View Full Code Here

                if (!resultCanonicalPath.startsWith(this.uploadRootPath)) {
                    result = null;
                }
                return result;
            } catch (IOException e) {
                error.fire(new ErrorEvent("no file found"));
                result = null;
            }
            return result;
        }
        return null;
View Full Code Here

        createDirectoryIfNotExist(avatarPath);
        try {
            InputStream is = new FileInputStream(avatarData);
            return writeFile(avatarPath, is, "", Constants.AVATAR_SIZE, true);
        } catch (IOException ioe) {
            error.fire(new ErrorEvent("error saving avatar"));
            return false;
        }
    }
View Full Code Here

                if (!writeFile(fileName, in, d.getFilePostfix(), d.getX(), true)) {
                    return false;
                }
                in.close();
            } catch (IOException ioe) {
                error.fire(new ErrorEvent("Error", "error saving image: " + ioe.getMessage()));
                return false;
            }
        }

        return true;
View Full Code Here

        }

        try {
            Files.createParentDirs(file2);
        } catch (IOException ioe) {
            error.fire(new ErrorEvent("Error moving file", ioe.getMessage()));
        }

        file.renameTo(file2);
    }
View Full Code Here

        String format = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType(newFileName).split("/")[1];
        try {
            // Read file form disk
            bsrc = FileManipulation.bitmapToImage(inputStream, format);
        } catch (IOException e1) {
            error.fire(new ErrorEvent("Error", "error reading file<br/>" + e1.getMessage()));
            return false;
        }
        int resizedParam = bsrc.getWidth() > bsrc.getHeight() ? bsrc.getWidth() : bsrc.getHeight();
        double scale = (double) size / resizedParam;
        Double widthInDouble = ((Double) scale * bsrc.getWidth());
        int width = widthInDouble.intValue();
        Double heightInDouble = ((Double) scale * bsrc.getHeight());
        int height = heightInDouble.intValue();
        // Too small picture or original size
        if (width > bsrc.getWidth() || height > bsrc.getHeight() || size == 0) {
            width = bsrc.getWidth();
            height = bsrc.getHeight();
        }
        // scale image if need
        BufferedImage bdest = FileManipulation
            .getScaledInstance(bsrc, width, height, RenderingHints.VALUE_INTERPOLATION_BICUBIC, true);
        // Determine new path of image file
        String dest = includeUploadRoot ? this.uploadRootPath + transformPath(newFileName, pattern) : transformPath(
            newFileName, pattern);
        try {
            // save to disk
            FileManipulation.imageToBitmap(bdest, dest, format);
        } catch (IOException ex) {
            error.fire(new ErrorEvent("Error", "error saving image to disc: " + ex.getMessage()));
            return false;
        }
        return true;
    }
View Full Code Here

        }
    }

    private void addError(Image image, String error) {
        String imageName = (image != null) ? image.getName() : "";
        this.error.fire(new ErrorEvent("(" + imageName + ") " + error));
    }
View Full Code Here

                new FacesMessage("", Constants.SHELF_MUST_BE_NOT_NULL_ERROR));
            return;
        }
        // Album name must be unique in shelf
        if (user.hasAlbumWithName(album)) {
            error.fire(new ErrorEvent("", Constants.SAME_ALBUM_EXIST_ERROR));
            return;
        }
        // All data is valid
        validationSuccess = true;
        try {
            // Save to DB
            album.setCreated(new Date());
            albumAction.addAlbum(album);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.ALBUM_SAVING_ERROR + "<br/>" + e.getMessage()));
            return;
        }
        // Reset 'album' component in conversation scope

        albumEvent.select(new EventTypeQualifier(Events.ALBUM_ADDED_EVENT)).fire(new AlbumEvent(album));
View Full Code Here

                shelf = model.getSelectedShelf();
            } else if (user.getShelves().size() > 0) {
                shelf = user.getShelves().get(0);
            }
            if (shelf == null) {
                error.fire(new ErrorEvent("", Constants.NO_SHELF_ERROR));
                setErrorInCreate(true);
                return;
            }
        }
        album.setShelf(shelf);
View Full Code Here

TOP

Related Classes of org.richfaces.photoalbum.model.event.ErrorEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.