Package org.richfaces.photoalbum.model.event

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


     *
     * @param error - error to show
     *
     */
    public void showError(String summary, String errorMessage) {
        error.fire(new ErrorEvent(summary, errorMessage));
    }
View Full Code Here


     */
    public void search() {
        searchOptionsHolder = null;
        if (!isSearchOptionSelected()) {
            // If no options selected
            error.fire(new ErrorEvent(Constants.SEARCH_NO_OPTIONS_ERROR));
            return;
        }
        if (!isWhereSearchOptionSelected()) {
            // If both search in My and search is shared unselected
            error.fire(new ErrorEvent(Constants.SEARCH_NO_WHERE_OPTIONS_ERROR));
            return;
        }
        keywords = new ArrayList<String>();
        // Update view
        navEvent.fire(new NavEvent(NavigationEnum.SEARCH));
        // parse query
        keywords = parse(searchQuery);
        Iterator<ISearchOption> it = options.iterator();
        // Search by first keyword by default
        selectedKeyword = keywords.get(0).trim();
        while (it.hasNext()) {
            ISearchOption option = it.next();
            try {
                if (option.getSelected()) {
                    option.search(searchAction, selectedKeyword, seachInMyAlbums, searchInShared);
                }
            } catch (PhotoAlbumException e) {
                error.fire(new ErrorEvent("Error", option.getName() + ":" + e.getMessage()));
            }
        }
        searchOptionsHolder = new SearchInformationHolder(new ArrayList<ISearchOption>(options), seachInMyAlbums,
            searchInShared);
        searchQuery = "";
View Full Code Here

     *
     * @param keyword - keyword to search
     */
    public void searchKeyword(String keyword) {
        if (!isSearchOptionSelected()) {
            error.fire(new ErrorEvent(Constants.SEARCH_NO_OPTIONS_ERROR));
            return;
        }
        Iterator<ISearchOption> it = searchOptionsHolder.getOptions().iterator();
        selectedKeyword = keyword.trim();
        while (it.hasNext()) {
            ISearchOption option = it.next();
            try {
                if (option.getSelected()) {
                    option.search(searchAction, selectedKeyword, searchOptionsHolder.isSeachInMyAlbums(),
                        searchOptionsHolder.isSearchInShared());
                }
            } catch (PhotoAlbumException e) {
                error.fire(new ErrorEvent(option.getName() + ":" + e.getMessage()));
            }
        }
    }
View Full Code Here

                setLoginFailed(false);
                return true;
            }
        } catch (Exception nre) {
            loginFailed();
            error.fire(new ErrorEvent("Error:" + nre.getMessage()));
            return false;
        }
        return false;
    }
View Full Code Here

            }

            return true;
        } catch (Exception nre) {
            loginFailed();
            error.fire(new ErrorEvent("Error:" + nre.getMessage()));
            return false;
        }
    }
View Full Code Here

            }

            return true;
        } catch (Exception nre) {
            loginFailed();
            error.fire(new ErrorEvent("Error:" + nre.getMessage()));
            return false;
        }
    }
View Full Code Here

            return;
        }
        try {
            userAction.register(user);
        } catch (Exception e) {
            error.fire(new ErrorEvent(Constants.REGISTRATION_ERROR + ": " + e.getMessage()));
            return;
        }
        // Registration was successful, so we can login this user.
        try {
            this.user = userBean.logIn(user.getLogin(), HashUtils.hash(user.getPassword()));
        } catch (Exception e) {
            error.fire(new ErrorEvent(Constants.LOGIN_ERROR + "\n" + e.getMessage()));
            return;
        }
        if (this.user == null) {
            error.fire(new ErrorEvent(Constants.LOGIN_ERROR));
        }
        navEvent.fire(new NavEvent(NavigationEnum.USER_PREFS));

        UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
        UIComponent component = root.findComponent("overForm");
View Full Code Here

    public void editUser(@Observes @EventType(Events.EDIT_USER_EVENT) SimpleEvent se) {
        avatarData = uph.getAvatarData();
        // If new avatar was uploaded
        if (avatarData != null) {
            if (!fileManager.saveAvatar(avatarData, user)) {
                error.fire(new ErrorEvent(Constants.FILE_IO_ERROR));
                return;
            }
            avatarData.delete();
            avatarData = null;
            uph.setAvatarData(null);
            user.setHasAvatar(true);
        }
        try {
            // This check is actual only on livedemo server to prevent hacks.
            // Prevent hackers to mark user as pre-defined
            //user.setPreDefined(false);
            userAction.updateUser(user);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.UPDATE_USER_ERROR + " <br/>" + e.getMessage()));
            return;
        }
    }
View Full Code Here

    private boolean handleAvatar(User user) {
        avatarData = uph.getAvatarData();
        if (avatarData != null) {
            user.setHasAvatar(true);
            if (fileManager == null || !fileManager.saveAvatar(avatarData, user)) {
                error.fire(new ErrorEvent(Constants.AVATAR_SAVING_ERROR));
                return false;
            }
        }
        return true;
    }
View Full Code Here

            newEvent.setShelf(newShelf);

            eventAction.addEvent(newEvent);
            shelfAction.addShelf(newShelf);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.EVENT_SAVING_ERROR + " <br /> " + e.getMessage()));
            logger.log(Level.SEVERE, "exception occured", e);
            return;
        }
        shelfEvent.select(new EventTypeQualifier(Events.EVENT_ADDED_EVENT)).fire(new ShelfEvent(newEvent));
    }
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.