Package org.eurekastreams.web.client.events

Examples of org.eurekastreams.web.client.events.EventBus


        };

        initWidget(binder.createAndBindUi(this));
        checkIfSubmitAllowed();

        final EventBus eventBus = EventBus.getInstance();
        eventBus.addObserver(SendNotificationSuccessEvent.class, new Observer<SendNotificationSuccessEvent>()
        {
            public void update(final SendNotificationSuccessEvent inArg1)
            {
                eventBus.notifyObservers(ShowNotificationEvent.getInstance("Notification successfully sent"));

                messageUi.clear();
                urlUi.setValue("");

                waitSpinner.setVisible(false);
                sendButtonDisabled.setVisible(true);
            }
        });
        eventBus.addObserver(SendNotificationFailureEvent.class, new Observer<SendNotificationFailureEvent>()
        {
            public void update(final SendNotificationFailureEvent inArg1)
            {
                eventBus.notifyObservers(ShowNotificationEvent.getInstance("Error sending notification"));

                waitSpinner.setVisible(false);
                sendButton.setVisible(true);
            }
        });
View Full Code Here


    /**
     * Default Constructor.
     */
    public HistoryHandler()
    {
        EventBus eventBus = Session.getInstance().getEventBus();
        eventBus.addObserver(UpdateHistoryEvent.class, new Observer<UpdateHistoryEvent>()
        {
            public void update(final UpdateHistoryEvent event)
            {
                updateHistory(getHistoryToken(event.getRequest()));
            }
        });
        eventBus.addObserver(UpdateRawHistoryEvent.class, new Observer<UpdateRawHistoryEvent>()
        {
            public void update(final UpdateRawHistoryEvent event)
            {
                updateHistory(event.getHistoryToken());
            }
        });
        eventBus.addObserver(PreventHistoryChangeEvent.class, new Observer<PreventHistoryChangeEvent>()
        {
            public void update(final PreventHistoryChangeEvent event)
            {
                interruptHistoryChange = true;
            }
View Full Code Here

    /**
     * Add event bus observers.
     */
    private void addObservers()
    {
        EventBus eventBus = Session.getInstance().getEventBus();

        eventBus.addObserver(MembershipCriteriaAddedEvent.class, new Observer<MembershipCriteriaAddedEvent>()
        {
            public void update(final MembershipCriteriaAddedEvent event)
            {
                if (event.isNew())
                {
                    // TODO: Refactor to use new client models
                    processor.makeRequest("addMembershipCriteria", event.getMembershipCriteria(),
                            new AsyncCallback<Long>()
                            {
                                public void onFailure(final Throwable caught)
                                {
                                }

                                public void onSuccess(final Long persistedItemId)
                                {
                                    SystemSettingsModel.getInstance().clearCache();

                                    Session.getInstance()
                                            .getEventBus()
                                            .notifyObservers(
                                                    new ShowNotificationEvent(new Notification("Access List Saved")));
                                    History.newItem(History.getToken());

                                    MembershipCriteriaDTO result = event.getMembershipCriteria();
                                    result.setId(persistedItemId);
                                    Session.getInstance().getEventBus()
                                            .notifyObservers(new MembershipCriteriaPersistedEvent(result));
                                }
                            });
                }
            }
        });

        eventBus.addObserver(MembershipCriteriaRemovedEvent.class, new Observer<MembershipCriteriaRemovedEvent>()
        {
            public void update(final MembershipCriteriaRemovedEvent event)
            {
                processor.makeRequest("removeMembershipCriteria", event.getMembershipCriteria().getId(),
                        new AsyncCallback<SystemSettings>()
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void fetch(final MembershipCriteriaVerificationRequest inRequest, final boolean inUseClientCacheIfAvailable)
    {
        final EventBus eventBus = Session.getInstance().getEventBus();
        final String criterion = inRequest.getMembershipCriteria().getCriteria();

        if (inRequest.isGroup())
        {
            super.callReadAction("groupLookup", new GroupLookupRequest(criterion), new OnSuccessCommand<Boolean>()
            {
                public void onSuccess(final Boolean wasFound)
                {
                    sendSuccessEvent(inRequest.getMembershipCriteria(), wasFound);
                }
            }, new OnFailureCommand()
            {
                public void onFailure(final Throwable inEx)
                {
                    eventBus.notifyObservers(new MembershipCriteriaVerificationFailureEvent());
                }
            }, inUseClientCacheIfAvailable);
        }
        else
        {
            super.callReadAction("personLookupOrg", new PersonLookupRequest(criterion, MAX_RESULTS),
                    new OnSuccessCommand<ArrayList<PersonModelView>>()
                    {
                        public void onSuccess(final ArrayList<PersonModelView> people)
                        {
                            sendSuccessEvent(inRequest.getMembershipCriteria(), !people.isEmpty());
                        }
                    }, new OnFailureCommand()
                    {
                        public void onFailure(final Throwable inEx)
                        {
                            eventBus.notifyObservers(new MembershipCriteriaVerificationFailureEvent());
                        }
                    }, inUseClientCacheIfAvailable);
        }
    }
View Full Code Here

     * @param found
     *            If any query results found.
     */
    private void sendSuccessEvent(final MembershipCriteriaDTO inMembershipCriteria, final boolean found)
    {
        final EventBus eventBus = Session.getInstance().getEventBus();
        if (found)
        {
            eventBus.notifyObservers(new MembershipCriteriaAddedEvent(inMembershipCriteria, true));
        }
        else
        {
            eventBus.notifyObservers(new MembershipCriteriaVerificationNoUsersEvent());
        }
    }
View Full Code Here

                            .update(new ReviewPendingGroupRequest(group.getShortName(), false));
                }
            }
        });

        final EventBus eventBus = Session.getInstance().getEventBus();
        eventBus.addObserver(UpdatedReviewPendingGroupResponseEvent.class,
                new Observer<UpdatedReviewPendingGroupResponseEvent>()
                {
                    public void update(final UpdatedReviewPendingGroupResponseEvent ev)
                    {
                        if (ev.getResponse().getGroupShortName().equals(group.getShortName()))
                        {
                            eventBus.removeObserver(ev, this);
                            String msg =
                                    ev.getResponse().getApproved() ? "The " + group.getName()
                                            + " group has been approved" : "The request to create the "
                                            + group.getName() + " group has been denied";
                            eventBus.notifyObservers(new ShowNotificationEvent(new Notification(msg)));
                        }
                    }
                });

        return groupPanel;
View Full Code Here

    /**
     * Set the parent org.
     */
    public void setEntity()
    {
        final EventBus eventBus = Session.getInstance().getEventBus();

        this.clearContentPanel();
        this.setPreviousPage(new CreateUrlRequest(Page.DISCOVER, ""), "< Return to Profile");

        final FormBuilder form = new FormBuilder("", GroupModel.getInstance(), Method.INSERT);

        eventBus.addObserver(InsertedGroupResponseEvent.class, new Observer<InsertedGroupResponseEvent>()
        {
            public void update(final InsertedGroupResponseEvent ev)
            {
                DomainGroupModelView group = ev.getResponse();

                // destination depends on whether org allows immediate creation of groups
                CreateUrlRequest urlRqst = !group.isPending() ? new CreateUrlRequest(Page.GROUPS, group.getShortName())
                        : new CreateUrlRequest(Page.DISCOVER, "");
                eventBus.notifyObservers(new UpdateHistoryEvent(urlRqst));

                // tell the user what just happened
                eventBus.notifyObservers(new ShowNotificationEvent(new Notification(group.isPending() ? // \n
                "Your group has been submitted to an organization coordinator for approval"
                        : "Your group has been successfully created")));
            }
        });

View Full Code Here

     * @return The actions panel.
     */
    private Widget buildActions(final ActivityDTO msg, final Panel mainPanel, final CommentsListPanel commentsPanel,
            final VerbRenderer verbRenderer)
    {
        final EventBus eventBus = Session.getInstance().getEventBus();

        Panel actionsPanel = new FlowPanel();
        actionsPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().messageActionsArea());

        // Comment
View Full Code Here

    /**
     * The default constructor.
     */
    public PersonalProfileSettingsTabContent()
    {
        final EventBus eventBus = Session.getInstance().getEventBus();
        eventBus.addObserver(GotPersonalInformationResponseEvent.class,
                new Observer<GotPersonalInformationResponseEvent>()
                {
                    public void update(final GotPersonalInformationResponseEvent event)
                    {
                        person = event.getResponse();

                        eventBus.notifyObservers(new SetBannerEvent(person));

                        final FormBuilder form = new FormBuilder("", PersonalInformationModel.getInstance(),
                                Method.UPDATE);

                        eventBus.addObserver(UpdatedPersonalInformationResponseEvent.class,
                                new Observer<UpdatedPersonalInformationResponseEvent>()
                                {
                                    public void update(final UpdatedPersonalInformationResponseEvent arg1)
                                    {
                                        eventBus.notifyObservers(new ShowNotificationEvent(new Notification(
                                                "Your profile has been updated.")));
                                        form.onSuccess();
                                    }
                                });

View Full Code Here

        this.add(errorLabel);
        this.add(waitSpinner);
        this.add(noResults);
        this.add(moreButton);

        final EventBus eventBus = Session.getInstance().getEventBus();

        eventBus.addObserver(MessageStreamUpdateEvent.class, new Observer<MessageStreamUpdateEvent>()
        {
            public void update(final MessageStreamUpdateEvent event)
            {
                if (!addingMore)
                {
                    itemPanel.clear();
                }

                addingMore = false;
                waitSpinner.setVisible(false);
                moreButton.setVisible(event.isMoreResults());
                errorLabel.setVisible(false);

                if (!event.getMessages().getPagedSet().isEmpty())
                {
                    howManyInList = event.getMessages().getPagedSet().size();

                    for (ActivityDTO item : event.getMessages().getPagedSet())
                    {
                        itemPanel.add(renderer.render(item));
                    }
                }
                else
                {
                    noResults.setText("This stream does not contain any activity.");
                    noResults.setVisible(true);
                    howManyInList = 0;
                }

            }
        });

        eventBus.addObserver(DeletedActivityResponseEvent.class, new Observer<DeletedActivityResponseEvent>()
        {
            public void update(final DeletedActivityResponseEvent event)
            {
                howManyInList--;

                if (howManyInList == 0)
                {
                    noResults.setText("No activity has been posted.");
                    noResults.setVisible(true);
                }
            }
        });

        eventBus.addObserver(MessageStreamAppendEvent.class, new Observer<MessageStreamAppendEvent>()
        {
            public void update(final MessageStreamAppendEvent event)
            {
                howManyInList++;
            }
        });

        moreButton.addClickHandler(new ClickHandler()
        {
            public void onClick(final ClickEvent arg0)
            {
                waitSpinner.setVisible(true);
                addingMore = true;
                eventBus.notifyObservers(new StreamRequestMoreEvent());
            }
        });
    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.web.client.events.EventBus

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.