Package org.richfaces.photoalbum.model.event

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


            for (int i = 0; i < size; i++) {
                jo = ja.getJSONObject(i);

                if (!jo.has("albumId") || !jo.has("id")) {
                    error.fire(new ErrorEvent("Error, object does not contain images"));

                }

                imageId = jo.getString("id");

                images.get(albumId).put(imageId, jo);
            }

            albums.get(albumId).put("size", images.get(albumId).size());
        } catch (JSONException je) {
            error.fire(new ErrorEvent("Error", je.getMessage()));
        }
    }
View Full Code Here


                return;
            }

            storeAlbums(jo.getJSONArray("albums"), jo.getJSONArray("covers"));
        } catch (JSONException e) {
            error.fire(new ErrorEvent("Error: ", e.getMessage()));
        }
    }
View Full Code Here

            for (int i = 0; i < jAlbums.length(); i++) {
                jo = jAlbums.getJSONObject(i);
                jc = jCovers.getJSONObject(i - offset);

                if (!jo.has("id")) {
                    error.fire(new ErrorEvent("Error, object does not contain albums"));
                }

                albumId = jo.getString("id");

                if (jc.getString("pid").equals(jo.getString("cpid"))) {
                    jo.put("coverUrl", jc.getString("coverUrl"));
                } else { // album without cover -> empty
                    offset++;
                    jo.put("coverUrl", "resources/img/shell/frame_photo_120.png");
                    jo.put("empty", true);
                }

                if (albums.containsKey(albumId) && !rewrite) {
                    // the album has already been loaded
                    return;
                } else if (rewrite) {
                    albums.remove(albumId);
                }
                images.put(albumId, new HashMap<String, JSONObject>());
                albums.put(albumId, jo);
            }
        } catch (JSONException je) {
            error.fire(new ErrorEvent("Error", je.getMessage()));
        }
    }
View Full Code Here

            Map<String, JSONObject> album = images.get(albumId);
            for (int i = 0; i < albumImages.length(); i++) {
                jo = albumImages.getJSONObject(i);

                if (!jo.has("id")) {
                    error.fire(new ErrorEvent("Error, object does not contain images"));
                }

                imageId = jo.getString("id");

                album.put(imageId, jo);
            }

        } catch (JSONException je) {
            error.fire(new ErrorEvent("Error", je.getMessage()));
        }
    }
View Full Code Here

        try {
            for (int i = 0; i < ja.length(); i++) {
                jo = ja.getJSONObject(i);

                if (!jo.has("albumId") || !jo.has("id")) {
                    error.fire(new ErrorEvent("Error, object does not contain images"));

                }

                albumId = jo.getString("albumId");
                imageId = jo.getString("id");

                images.get(albumId).put(imageId, jo);
            }
        } catch (JSONException je) {
            error.fire(new ErrorEvent("Error", je.getMessage()));
        }
    }
View Full Code Here

            return;
        }

        shelf.setOwner(user);
        if (user.hasShelfWithName(shelf)) {
            error.fire(new ErrorEvent(Constants.SAME_SHELF_EXIST_ERROR));
            return;
        }
        validationSuccess = true;
        try {
            shelf.setCreated(new Date());
            shelfAction.addShelf(shelf);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.SHELF_SAVING_ERROR + " <br/>" + e.getMessage()));
            return;
        }
        shelfEvent.select(new EventTypeQualifier(Events.SHELF_ADDED_EVENT)).fire(new ShelfEvent(shelf));
    }
View Full Code Here

        if (user == null) {
            return;
        }
        try {
            if (user.hasShelfWithName(shelf)) {
                error.fire(new ErrorEvent(Constants.SAME_SHELF_EXIST_ERROR));
                shelfAction.resetShelf(shelf);
                return;
            }
            if (editFromInplace) {
                // We need validate shelf name manually
                Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
                Set<ConstraintViolation<Shelf>> constraintViolations = validator.validate(shelf);
                if (constraintViolations.size() > 0) {
                    for (ConstraintViolation<Shelf> cv : constraintViolations) {
                        error.fire(new ErrorEvent("Constraint violation", cv.getMessage()));
                    }
                    // If error occured we need refresh album to display correct value in inplaceInput
                    shelfAction.resetShelf(shelf);
                    return;
                }
            }
            shelfAction.editShelf(shelf);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.SHELF_SAVING_ERROR + " <br/>" + e.getMessage()));
            shelfAction.resetShelf(shelf);
            return;
        }
        shelfEvent.select(new EventTypeQualifier(Events.SHELF_EDITED_EVENT)).fire(new ShelfEvent(shelf));
    }
View Full Code Here

        }
        String pathToDelete = shelf.getPath();
        try {
            shelfAction.deleteShelf(shelf);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.SHELF_DELETING_ERROR + " <br/>" + e.getMessage()));
            return;
        }
        shelfEvent.select(new EventTypeQualifier(Events.SHELF_DELETED_EVENT)).fire(new ShelfEvent(shelf, pathToDelete));
    }
View Full Code Here

    public void setUpDownload(String albumName, String albumId, Map<String, JSONObject> images, Event event) {
        try {
            setImages(images);
        } catch (JSONException je) {
            error.fire(new ErrorEvent("Error", "error saving album<br/>" + je.getMessage()));
        }
       
        size = imageUrls.size();
        count = 0;
View Full Code Here

        // save the album
        try {
            albumAction.editAlbum(album);
            album = albumAction.resetAlbum(album);
        } catch (PhotoAlbumException pae) {
            error.fire(new ErrorEvent("Error", "error saving album<br/>" + pae.getMessage()));
        }

        // remove the remote album from the event
        if (event.getRemoteAlbumIds().contains("F" + albumId)) {
            event.getRemoteAlbumIds().remove("F" + albumId);
        } else if (event.getRemoteAlbumIds().contains("G" + albumId)) {
            event.getRemoteAlbumIds().remove("G" + albumId);
        }

        try {
            eventAction.editEvent(event);
        } catch (PhotoAlbumException pae) {
            error.fire(new ErrorEvent("Error", "error removing album<br/>" + pae.getMessage()));
        }

        pBarText = "";
        pBarValue = -1;
       
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.