Examples of ErrorEvent


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

        Object dropValue = dropEvent.getDropValue();
        if (dragValue instanceof Image) {
            // If user drag image
            if (!((Album) dropValue).getOwner().getLogin().equals(user.getLogin())) {
                // Drag in the album, that not belongs to user
                error.fire(new ErrorEvent("", Constants.DND_PHOTO_ERROR));
                return;
            }
            handleImage((Image) dragValue, (Album) dropValue);
        } else if (dragValue instanceof Album) {
            // If user drag album
            if (!((Shelf) dropValue).getOwner().getLogin().equals(user.getLogin())) {
                // Drag in the shelf, that not belongs to user
                error.fire(new ErrorEvent("", Constants.DND_ALBUM_ERROR));
                return;
            }
            handleAlbum((Album) dragValue, (Shelf) dropValue);
        }
    }
View Full Code Here

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

        String pathOld = dragValue.getPath();
        dropValue.addAlbum(dragValue);
        try {
            albumAction.editAlbum(dragValue);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error:", Constants.ERROR_IN_DB + "<br/>" + e.getMessage()));
            return;
        }
        albumEvent.fire(new AlbumEvent(dragValue, pathOld));
        ApplicationUtils.addToRerender(Constants.TREE_ID);
    }
View Full Code Here

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

        String pathOld = dragValue.getFullPath();
        dropValue.addImage(dragValue);
        try {
            albumAction.editAlbum(dropValue);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error:", Constants.ERROR_IN_DB + "<br/>" + e.getMessage()));
            return;
        }
        imageEvent.fire(new ImageEvent(dragValue, pathOld));
        ApplicationUtils.addToRerender(Constants.TREE_ID);
    }
View Full Code Here

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

            try {
                albumAction.editAlbum(album);
                eventAction.editEvent(event);
            } catch (PhotoAlbumException e) {
                error.fire(new ErrorEvent("Error:", Constants.ERROR_IN_DB + ": " + e.getMessage()));
            }
            albumEvent.fire(new AlbumEvent(album, pathOld));
        }
    }
View Full Code Here

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

        }
        String pathToDelete = image.getFullPath();
        try {
            imageAction.deleteImage(image);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.IMAGE_DELETING_ERROR + " <br/>" + e.getMessage()));
            return;
        }
        // Raise 'imageDeleted' event, parameter path - path of file to delete
        imageEvent.fire(new ImageEvent(image, pathToDelete));
    }
View Full Code Here

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

        if (user == null) {
            return;
        }
        try {
            if (user.hasImageWithName(image)) {
                error.fire(new ErrorEvent("Error", Constants.SAME_IMAGE_EXIST_ERROR));
                imageAction.resetImage(image);
                return;
            }
            if (editFromInplace) {
                // We need validate image name manually
                Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
                Set<ConstraintViolation<Image>> constraintViolations = validator.validate(image);
                if (constraintViolations.size() > 0) {
                    for (ConstraintViolation<Image> cv : constraintViolations) {
                        error.fire(new ErrorEvent("Constraint violation", cv.getMessage()));
                    }
                    // If error occurred we need refresh album to display correct value in inplaceInput
                    imageAction.resetImage(image);
                    return;
                }
            }
            imageAction.editImage(image, !editFromInplace);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.IMAGE_SAVING_ERROR + " <br/>" + e.getMessage()));
            imageAction.resetImage(image);
            return;
        }
        navEvent.fire(new NavEvent(NavigationEnum.ALBUM_IMAGE_PREVIEW));
    }
View Full Code Here

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

    public void addComment(Image image) {
        if (user == null) {
            return;
        }
        if (null == user.getLogin()) {
            error.fire(new ErrorEvent(Constants.ADDING_COMMENT_ERROR));
            return;
        }
        if (message.trim().equals("")) {
            error.fire(new ErrorEvent(Constants.NULL_COMMENT_ERROR));
            return;
        }
        Comment comment = new Comment();
        comment.setAuthor(user);
        comment.setImage(image);
        comment.setDate(new Date());
        comment.setMessage(message);
        try {
            imageAction.addComment(comment);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.SAVE_COMMENT_ERROR + " <br/>" + e.getMessage()));
            return;
        }
        message = "";
    }
View Full Code Here

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

            return;
        }
        try {
            imageAction.deleteComment(comment);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.DELETE_COMMENT_ERROR + " <br/>" + e.getMessage()));
            return;
        }
    }
View Full Code Here

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

    private void onError(boolean isShowOnUI) {
        stopSlideshow();
        errorDetected = true;
        ApplicationUtils.addToRerender(Constants.MAINAREA_ID);
        if (isShowOnUI) {
            error.fire(new ErrorEvent(Constants.NO_IMAGES_FOR_SLIDESHOW_ERROR));
        }
        return;
    }
View Full Code Here

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

        }

        Image image = (Image) selectedImage.getImage();

        if (!fileManager.isFilePresent(image.getFullPath())) {
            error.fire(new ErrorEvent(Constants.IMAGE_RECENTLY_DELETED_ERROR));
            active = false;
            errorDetected = true;
            ApplicationUtils.addToRerender(Constants.MAINAREA_ID);
            model.resetModel(NavigationEnum.ALBUM_IMAGE_PREVIEW, image.getAlbum().getOwner(), image.getAlbum().getShelf(),
                image.getAlbum(), null, image.getAlbum().getImages());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.