Package org.eurekastreams.web.client.events

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


                session.setHistoryHandler(new HistoryHandler());

                determineLaunchPage();

                // catch attempts to go to profile pages and pop them up in a new window
                final EventBus eventBus = Session.getInstance().getEventBus();
                eventBus.addObserver(SwitchedHistoryViewEvent.class, new Observer<SwitchedHistoryViewEvent>()
                {
                    public void update(final SwitchedHistoryViewEvent ev)
                    {
                        switch (ev.getPage())
                        {
View Full Code Here


                StreamsDiscoveryModel.getInstance().clearCache();

                // clear following model
                CurrentUserPersonFollowingStatusModel.getInstance().clearCache();

                EventBus eventBus = Session.getInstance().getEventBus();
                eventBus.notifyObservers(new InsertedGroupMemberResponseEvent(request, response));

                // simulate a status request for recipients that don't listen for changes. Event type has person in the
                // name, but that is the event used when querying groups
                eventBus.notifyObservers(new GotPersonFollowerStatusResponseEvent(FollowerStatus.FOLLOWING));
            }
        });
    }
View Full Code Here

            {
                // clear following model
                CurrentUserPersonFollowingStatusModel.getInstance().clearCache();
                StreamsDiscoveryModel.getInstance().clearCache();

                EventBus eventBus = Session.getInstance().getEventBus();
                eventBus.notifyObservers(new DeletedGroupMemberResponseEvent(request, response));

                // simulate a status request for recipients that don't listen for changes. Event type has person in the
                // name, but that is the event used when querying groups
                eventBus.notifyObservers(new GotPersonFollowerStatusResponseEvent(FollowerStatus.NOTFOLLOWING));
               
                // In the event that a User is removed as a Follower of a Group,
                // then it's necessary to update the UI to see that
                // the removed User is no longer is a member of this Group, and that
                // the Followers Count decrements by 1.
View Full Code Here

        displayPanel.add(closeDisplayButton);
        displayPanel.add(selector);
        displayPanel.add(linkInfoPanel);
        displayPanel.add(selector.getPagingControls());

        EventBus eventBus = Session.getInstance().getEventBus();
        eventBus.addObserver(ParseLinkEvent.getEvent(), new Observer<ParseLinkEvent>()
        {
            public void update(final ParseLinkEvent event)
            {
                onAddLinkClicked();
                linkUrl.setText(event.getUrl());
                fetchLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().verifyingLink());
                fetchLink(event.getUrl());
            }
        });

        eventBus.addObserver(MessageAttachmentChangedEvent.class, new Observer<MessageAttachmentChangedEvent>()
        {
            public void update(final MessageAttachmentChangedEvent evt)
            {
                if (evt.getAttachment() != null && evt.getAttachment() instanceof Bookmark)
                {
View Full Code Here

    public void fetchLink(final String inLinkUrl)
    {
      linkError.setVisible(false);

        // very basic url validation
        final EventBus eventBus = Session.getInstance().getEventBus();
        if (inLinkUrl == null || inLinkUrl.isEmpty() || !inLinkUrl.contains("://"))
        {
            linkError.setVisible(true);
            fetchLink.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().verifyingLink());
        }
        else if (inLinkUrl != fetchedLink)
        {
            Session.getInstance().getActionProcessor()
                    .makeRequest("getParsedLinkInformation", inLinkUrl, new AsyncCallback<LinkInformation>()
                    {
                        /* implement the async call back methods */
                        public void onFailure(final Throwable caught)
                        {
                            LinkInformation linkInformation = new LinkInformation();
                            linkInformation.setTitle(inLinkUrl);
                            linkInformation.setUrl(inLinkUrl);

                            MessageAttachmentChangedEvent event = new MessageAttachmentChangedEvent(new Bookmark(
                                    linkInformation));
                            eventBus.notifyObservers(event);

                            eventBus.notifyObservers(new
                            // line break.
                            ShowNotificationEvent(new Notification(UNVERIFIED_URL_MESSAGE)));
                        }

                        public void onSuccess(final LinkInformation result)
                        {
                            MessageAttachmentChangedEvent event = new MessageAttachmentChangedEvent(new Bookmark(
                                    result));

                            boolean titleBlank = result.getTitle() == null || result.getTitle().isEmpty();
                            if (titleBlank)
                            {
                                result.setTitle(result.getUrl());
                            }

                            eventBus.notifyObservers(event);
                        }
                    });
        }

        fetchedLink = inLinkUrl;
View Full Code Here

     * @param groupShortName
     *            identifies the group the user wants to join
     */
    public RequestAccessPanel(final String groupShortName)
    {
        final EventBus eventBus = Session.getInstance().getEventBus();

        // TODO make it look like the wireframe
        this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().requestGroupAccess());
        this.add(new Label("private group: please contact the "));
        this.add(request);
        this.add(new Label(" to request access"));

        eventBus.addObserver(InsertedRequestForGroupMembershipResponseEvent.class,
                new Observer<InsertedRequestForGroupMembershipResponseEvent>()
                {
                    public void update(final InsertedRequestForGroupMembershipResponseEvent inArg1)
                    {
                        eventBus.notifyObservers(new ShowNotificationEvent(new Notification(
                                "Your request for access has been sent")));

                        // TODO disable button instead
                        clear();
                        Label sent = new Label("Request Sent");
View Full Code Here

        this.add(activityDetailPanel);

        stream.reinitialize();

        // ---- Wire up events ----
        final EventBus eventBus = Session.getInstance().getEventBus();

        eventBus.addObserver(UpdatedHistoryParametersEvent.class, new Observer<UpdatedHistoryParametersEvent>()
        {
            public void update(final UpdatedHistoryParametersEvent event)
            {
                checkHistory(event.getParameters());

                // Only process this once.
                eventBus.removeObserver(UpdatedHistoryParametersEvent.class, this);
            }
        }, true);

        eventBus.addObserver(UpdatedHistoryParametersEvent.class, new Observer<UpdatedHistoryParametersEvent>()
        {
            public void update(final UpdatedHistoryParametersEvent event)
            {
                if (checkHistory(event.getParameters()))
                {
                    eventBus.notifyObservers(StreamReinitializeRequestEvent.getEvent());
                }
            }
        });

        eventBus.addObserver(GotActivityResponseEvent.class, new Observer<GotActivityResponseEvent>()
        {
            public void update(final GotActivityResponseEvent event)
            {
                setSingleActivityMode();
                activityDetailPanel.clear();
                activityDetailPanel.add(new ActivityDetailPanel(event.getResponse(), inShowRecipients));
            }
        });

        eventBus.addObserver(StreamRequestMoreEvent.class, new Observer<StreamRequestMoreEvent>()
        {
            public void update(final StreamRequestMoreEvent arg1)
            {
                JSONObject jsonObj = StreamJsonRequestFactory.getJSONRequest(jsonQuery);
                jsonObj = StreamJsonRequestFactory.setMaxId(lastSeenId, jsonObj);

                // Must be sorted by date to request more.
                jsonObj = StreamJsonRequestFactory.setSort("date", jsonObj);

                if (!search.isEmpty())
                {
                    searchBoxWidget.setSearchTerm(search);
                    searchStatusWidget.setSearchTerm(search);

                    jsonObj = StreamJsonRequestFactory.setSearchTerm(search, jsonObj);
                }

                StreamModel.getInstance().fetch(jsonObj.toString(), false);
            }
        });

        eventBus.addObserver(GotStreamResponseEvent.class, new Observer<GotStreamResponseEvent>()
        {
            public void update(final GotStreamResponseEvent event)
            {
                PagedSet<ActivityDTO> activity = event.getStream();

                int numberOfActivities = activity.getPagedSet().size();
                if (numberOfActivities > 0)
                {
                    lastSeenId = activity.getPagedSet().get(numberOfActivities - 1).getId();
                }

                MessageStreamUpdateEvent updateEvent = new MessageStreamUpdateEvent(activity);
                updateEvent.setMoreResults(activity.getTotal() > activity.getPagedSet().size());

                error.setText("");
                error.setVisible(false);
                eventBus.notifyObservers(updateEvent);
                stream.setVisible(true);
            }
        });

        eventBus.addObserver(StreamReinitializeRequestEvent.class, new Observer<StreamReinitializeRequestEvent>()
        {
            public void update(final StreamReinitializeRequestEvent event)
            {
                eventBus.notifyObservers(new StreamRequestEvent(streamName, jsonQuery, true));
            }
        });

        eventBus.addObserver(MessageStreamAppendEvent.class, new Observer<MessageStreamAppendEvent>()
        {
            public void update(final MessageStreamAppendEvent evt)
            {
                if ("date".equals(sortPanel.getSort()))
                {
                    eventBus.notifyObservers(StreamReinitializeRequestEvent.getEvent());
                }
                else
                {
                    sortPanel.updateSelected("date", true);
                }
            }
        });

        eventBus.addObserver(StreamRequestEvent.class, new Observer<StreamRequestEvent>()
        {
            public void update(final StreamRequestEvent event)
            {
                if (event.getForceReload() || !event.getJson().equals(jsonQuery))
                {
                    streamName = event.getStreamName();
                    jsonQuery = event.getJson();
                    if (activityId != 0L)
                    {
                        ActivityModel.getInstance().fetch(activityId, false);
                    }
                    else
                    {
                        setListMode();
                        stream.reinitialize();

                        String titleLinkUrl = null;
                        String updatedJson = jsonQuery;
                        JSONObject queryObject = JSONParser.parse(updatedJson).isObject().get("query").isObject();

                        // Only show cancel option if search is not part of the view.
                        Boolean canChange = !queryObject.containsKey("keywords");

                        if (queryObject.containsKey("keywords"))
                        {
                            final String streamSearchText = queryObject.get("keywords").isString().stringValue();

                            searchBoxWidget.setSearchTerm(streamSearchText);
                            searchStatusWidget.setSearchTerm(streamSearchText);

                            updatedJson = StreamJsonRequestFactory.setSearchTerm(streamSearchText,
                                    StreamJsonRequestFactory.getJSONRequest(updatedJson)).toString();
                        }
                        else if (!search.isEmpty())
                        {
                            searchBoxWidget.setSearchTerm(search);
                            searchStatusWidget.setSearchTerm(search);

                            updatedJson = StreamJsonRequestFactory.setSearchTerm(search,
                                    StreamJsonRequestFactory.getJSONRequest(updatedJson)).toString();

                        }
                        // see if the stream belongs to a group and set up the stream title as a link
                        else if (queryObject.containsKey("recipient")
                                && queryObject.get("recipient").isArray().size() == 1)
                        {
                            JSONArray recipientArr = queryObject.get("recipient").isArray();
                            JSONObject recipientObj = recipientArr.get(0).isObject();

                            // only show the link if viewing a group stream on the activity page
                            if ("GROUP".equals(recipientObj.get("type").isString().stringValue())
                                    && Session.getInstance().getUrlPage() == Page.ACTIVITY)
                            {
                                String shortName = recipientObj.get("name").isString().stringValue();
                                titleLinkUrl = Session.getInstance().generateUrl(
                                        new CreateUrlRequest(Page.GROUPS, shortName));
                            }
                            searchBoxWidget.onSearchCanceled();
                            searchStatusWidget.onSearchCanceled();
                        }

                        else
                        {
                            searchBoxWidget.onSearchCanceled();
                            searchStatusWidget.onSearchCanceled();
                        }

                        sort = sortPanel.getSort();

                        updatedJson = StreamJsonRequestFactory.setSort(sort,
                                StreamJsonRequestFactory.getJSONRequest(updatedJson)).toString();

                        streamTitleWidget.setStreamTitle(streamName, titleLinkUrl);
                        addGadgetWidget.setStreamTitle(streamName);
                        searchBoxWidget.setCanChange(canChange);
                        searchStatusWidget.setCanChange(canChange);

                        StreamModel.getInstance().fetch(updatedJson, false);
                    }
                }
            }
        });

        eventBus.addObserver(StreamSearchBeginEvent.class, new Observer<StreamSearchBeginEvent>()
        {
            public void update(final StreamSearchBeginEvent event)
            {
                eventBus.notifyObservers(new UpdateHistoryEvent(new CreateUrlRequest("search", event.getSearchText(),
                        false)));
            }
        });

        eventBus.addObserver(DeletedActivityResponseEvent.class, new Observer<DeletedActivityResponseEvent>()
        {
            public void update(final DeletedActivityResponseEvent ev)
            {
                eventBus.notifyObservers(new ShowNotificationEvent(new Notification("Activity has been deleted")));
            }
        });
    }
View Full Code Here

        coreCss = StaticResourceBundle.INSTANCE.coreCss();
        main = binder.createAndBindUi(this);
        currentReadFilterWidget = unreadFilterUi;

        // -- setup events --
        final EventBus eventBus = Session.getInstance().getEventBus();

        eventBus.addObserver(GotNotificationListResponseEvent.class, new Observer<GotNotificationListResponseEvent>()
        {
            public void update(final GotNotificationListResponseEvent ev)
            {
                eventBus.removeObserver(ev, this);
                storeReceivedNotifications(ev.getResponse());
                selectSource(currentSource);
            }
        });
        eventBus.addObserver(NotificationClickedEvent.class, notificationClickedObserver);
        eventBus.addObserver(NotificationDeleteRequestEvent.class, notificationDeleteRequestObserver);

        // -- request data --
        NotificationListModel.getInstance().fetch(null, false);
    }
View Full Code Here

    /**
     * Sets up event handling.
     */
    private void setupEvents()
    {
        final EventBus eventBus = Session.getInstance().getEventBus();

        searchTerm.addKeyUpHandler(new KeyUpHandler()
        {
            public void onKeyUp(final KeyUpEvent ev)
            {
                // ENTER key
                if (ev.getNativeKeyCode() == KeyCodes.KEY_ENTER && !ev.isAnyModifierKeyDown())
                {
                    // navigating the list of search results - pick it
                    if (activeItem != null)
                    {
                        activeItem.getElement().dispatchEvent(
                                Document.get().createClickEvent(1, 0, 0, 0, 0, false, false, false, false));
                    }
                    // search term in box - go to search page (should this be here?)
                    else if (!searchTerm.getText().isEmpty())
                    {
                        eventBus.notifyObservers(new UpdateHistoryEvent(new CreateUrlRequest(Page.SEARCH,
                                generateParams(searchTerm.getText()), false)));
                    }
                }
                else if (ev.isDownArrow() && activeItem != null)
                {
                    int activeIndex = resultsPanel.getWidgetIndex(activeItem);
                    if (activeIndex + 1 < resultsPanel.getWidgetCount())
                    {
                        selectItem((Panel) resultsPanel.getWidget(activeIndex + 1));
                    }
                }
                else if (ev.isUpArrow() && activeItem != null)
                {
                    int activeIndex = resultsPanel.getWidgetIndex(activeItem);
                    if (activeIndex >= 1)
                    {
                        selectItem((Panel) resultsPanel.getWidget(activeIndex - 1));
                    }
                }
                else if (termLength != searchTerm.getText().length())
                {
                    termLength = searchTerm.getText().length();
                    if (termLength == 0)
                    {
                        resultsPanelContainer.setVisible(false);
                        resultsPanel.clear();
                    }
                    else
                    {
                        GetDirectorySearchResultsRequest request = new GetDirectorySearchResultsRequest(searchTerm
                                .getText(), "", 0, 4, "bookmark");
                        SearchResultsModel.getInstance().fetch(request, true);
                    }
                }
            }
        });

        eventBus.addObserver(GotSearchResultsResponseEvent.class, new Observer<GotSearchResultsResponseEvent>()
        {
            public void update(final GotSearchResultsResponseEvent event)
            {
                if ("bookmark".equals(event.getCallerKey()))
                {
                    activeItem = null;
                    resultsPanel.clear();
                    resultsPanelContainer.setVisible(event.getResponse().getPagedSet().size() > 0);

                    for (ModelView result : event.getResponse().getPagedSet())
                    {
                        final FocusPanel itemContainer = new FocusPanel();
                        final FlowPanel itemPanel = new FlowPanel();
                        final Anchor name = new Anchor();
                        name.addStyleName(StaticResourceBundle.INSTANCE.coreCss().bookmarkSearchName());
                        name.addStyleName(StaticResourceBundle.INSTANCE.coreCss().ellipsis());

                        if (result instanceof PersonModelView)
                        {
                            final PersonModelView person = (PersonModelView) result;
                            itemPanel.add(AvatarLinkPanel.create(person, Size.VerySmall, false));
                            name.setText(person.getDisplayName());
                            name.setTitle(person.getDisplayName());
                            itemContainer.addClickHandler(new ClickHandler()
                            {
                                public void onClick(final ClickEvent event)
                                {
                                    StreamBookmarksModel.getInstance().insert(person.getStreamId());
                                }
                            });

                        }
                        else if (result instanceof DomainGroupModelView)
                        {
                            final DomainGroupModelView group = (DomainGroupModelView) result;
                            itemPanel.add(new AvatarLinkPanel(EntityType.GROUP, group.getShortName(), group
                                    .getAvatarId(), Size.VerySmall, false));
                            name.setText(group.getName());
                            name.setTitle(group.getName());
                            itemContainer.addClickHandler(new ClickHandler()
                            {
                                public void onClick(final ClickEvent event)
                                {
                                    StreamBookmarksModel.getInstance().insert(group.getStreamId());
                                }
                            });
                        }

                        itemContainer.addMouseOverHandler(new MouseOverHandler()
                        {
                            public void onMouseOver(final MouseOverEvent arg0)
                            {
                                selectItem(itemContainer);
                            }
                        });

                        name.addStyleName(StaticResourceBundle.INSTANCE.coreCss().bookmarkNameLink());
                        name.addStyleName(StaticResourceBundle.INSTANCE.coreCss().ellipsis());
                        itemPanel.add(name);

                        itemContainer.add(itemPanel);
                        resultsPanel.add(itemContainer);

                        if (activeItem == null)
                        {
                            selectItem(itemContainer);
                        }
                    }
                }
            }
        });

        eventBus.addObserver(SwitchedHistoryViewEvent.class, new Observer<SwitchedHistoryViewEvent>()
        {
            public void update(final SwitchedHistoryViewEvent event)
            {
                if (event.getPage() != Page.SEARCH)
                {
View Full Code Here

    /**
     * Add events.
     */
    private void addObservers()
    {
        final EventBus eventBus = EventBus.getInstance();
        eventBus.addObserver(GotActivityResponseEvent.class, new Observer<GotActivityResponseEvent>()
        {

            public void update(final GotActivityResponseEvent event)
            {
                gotActivity(event);
            }
        });
        eventBus.addObserver(GotStreamResponseEvent.class, new Observer<GotStreamResponseEvent>()
        {
            public void update(final GotStreamResponseEvent event)
            {
                // throw out results if for the wrong stream (or we don't want the results)
                if (currentStreamRequest == null || !currentStreamRequest.equals(event.getRequest()))
                {
                    return;
                }

                final PagedSet<ActivityDTO> activitySet = event.getStream();
                if (activitySet.getPagedSet().size() > 0)
                {
                    longNewestActivityId = activitySet.getPagedSet().get(0).getEntityId();
                    longOldestActivityId = activitySet.getPagedSet().get(activitySet.getPagedSet().size() - 1)
                            .getEntityId();
                }

                if (StreamJsonRequestFactory.getJSONRequest(event.getJsonRequest()).containsKey("minId"))
                {
                    for (int i = activitySet.getPagedSet().size(); i > 0; i--)
                    {
                        appendActivity(activitySet.getPagedSet().get(i - 1));
                    }
                }
                else if (StreamJsonRequestFactory.getJSONRequest(event.getJsonRequest()).containsKey("maxId"))
                {
                    moreSpinner.addClassName(StaticResourceBundle.INSTANCE.coreCss().displayNone());
                    for (ActivityDTO activity : activitySet.getPagedSet())
                    {
                        streamPanel.add(renderer.render(activity));
                    }
                    moreLink.setVisible(activitySet.getTotal() > activitySet.getPagedSet().size());
                }
                else
                {
                    streamPanel.clear();
                    unseenActivityNotificationPanel.setActive(true);
                    activitySpinner.addClassName(StaticResourceBundle.INSTANCE.coreCss().displayNone());
                    streamPanel.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().hidden());

                    List<ActivityDTO> activities = activitySet.getPagedSet();
                    for (ActivityDTO activity : activities)
                    {
                        streamPanel.add(renderer.render(activity));
                    }
                    if (activities.size() == 0)
                    {
                        noResults.removeClassName(StaticResourceBundle.INSTANCE.coreCss().displayNone());
                    }
                    moreLink.setVisible(activitySet.getTotal() > activities.size());
                }
                if (activitySet.getPagedSet().size() > 0)
                {
                    noResults.addClassName(StaticResourceBundle.INSTANCE.coreCss().displayNone());
                }
            }
        });

        // users are not initially subscribed for emails when following a person/group, so set the status properly (else
        // if you were following and unsubscribed, then re-subscribed, the status would be old and wrong)
        eventBus.addObserver(InsertedPersonFollowerResponseEvent.class,
                new Observer<InsertedPersonFollowerResponseEvent>()
                {
                    public void update(final InsertedPersonFollowerResponseEvent ev)
                    {
                        setSubscribeStatus(false);
                    }
                });

        eventBus.addObserver(InsertedGroupMemberResponseEvent.class, new Observer<InsertedGroupMemberResponseEvent>()
        {
            public void update(final InsertedGroupMemberResponseEvent ev)
            {
                setSubscribeStatus(false);
            }
        });

        eventBus.addObserver(GotPersonFollowerStatusResponseEvent.class,
                new Observer<GotPersonFollowerStatusResponseEvent>()
                {
                    public void update(final GotPersonFollowerStatusResponseEvent event)
                    {
                        subscribeViaEmail.setVisible(event.getResponse().equals(FollowerStatus.FOLLOWING));
                    }
                });

        eventBus.addObserver(HistoryViewsChangedEvent.class, new Observer<HistoryViewsChangedEvent>()
        {
            public void update(final HistoryViewsChangedEvent event)
            {
                searchTimer.cancel();
                searchUrlTimer.cancel();
                handleViewsChanged(event.getViews());
                final String searchText = Session.getInstance().getParameterValue("search");
                if (!searchBox.getText().equals(searchText))
                {
                    searchBox.setText(searchText);
                }
            }
        });

        eventBus.addObserver(MessageStreamAppendEvent.class, new Observer<MessageStreamAppendEvent>()
        {
            public void update(final MessageStreamAppendEvent event)
            {
                longNewestActivityId = event.getMessage().getId();

                if (sortKeyword.equals("date"))
                {
                    appendActivity(event.getMessage());
                    noResults.addClassName(StaticResourceBundle.INSTANCE.coreCss().displayNone());
                }
                else
                {
                    recentSort.getElement().dispatchEvent(
                            Document.get().createClickEvent(1, 0, 0, 0, 0, false, false, false, false));
                }

            }
        });

        eventBus.addObserver(CustomStreamCreatedEvent.class, new Observer<CustomStreamCreatedEvent>()
        {
            public void update(final CustomStreamCreatedEvent event)
            {
                CustomStreamModel.getInstance().fetch(null, true);
            }
        });

        eventBus.addObserver(CustomStreamDeletedEvent.class, new Observer<CustomStreamDeletedEvent>()
        {
            public void update(final CustomStreamDeletedEvent event)
            {
                CustomStreamModel.getInstance().fetch(null, true);
            }
        });

        eventBus.addObserver(CustomStreamUpdatedEvent.class, new Observer<CustomStreamUpdatedEvent>()
        {
            public void update(final CustomStreamUpdatedEvent event)
            {
                CustomStreamModel.getInstance().fetch(null, true);
            }
        });

        eventBus.addObserver(StreamReinitializeRequestEvent.class, new Observer<StreamReinitializeRequestEvent>()
        {
            public void update(final StreamReinitializeRequestEvent event)
            {
                loadStream(Session.getInstance().getUrlViews(), Session.getInstance().getParameterValue("search"));
            }
        });

        eventBus.addObserver(UpdatedHistoryParametersEvent.class, new Observer<UpdatedHistoryParametersEvent>()
        {
            public void update(final UpdatedHistoryParametersEvent event)
            {
                searchTimer.cancel();
                searchUrlTimer.cancel();
                if (!event.getViewChanged())
                {
                    handleViewsChanged(Session.getInstance().getUrlViews());
                }
            }
        });

        eventBus.addObserver(AddedFeaturedStreamResponseEvent.class, new Observer<AddedFeaturedStreamResponseEvent>()
        {
            public void update(final AddedFeaturedStreamResponseEvent event)
            {
                eventBus.notifyObservers(new ShowNotificationEvent(new Notification("Stream has been featured.")));
            }
        });

        eventBus.addObserver(UpdatedGroupStickyActivityEvent.class, new Observer<UpdatedGroupStickyActivityEvent>()
        {
            public void update(final UpdatedGroupStickyActivityEvent ev)
            {
                // make sure event applies to the current view (since current view may not even be a group)
                if (currentStreamEntity != null && currentStreamEntity.getEntityType() == EntityType.GROUP
                        && ev.getGroupId() == currentStreamEntity.getEntityId() && !singleActivityMode)
                {
                    if (ev.getActivity() == null)
                    {
                        stickyActivityHolder.clear();
                        UIObject.setVisible(stickyActivityArea, false);
                    }
                    else
                    {
                        stickyActivityHolder.clear();
                        stickyActivityHolder.add(stickyActivityRenderer.render(ev.getActivity()));
                        UIObject.setVisible(stickyActivityArea, true);
                    }

                    // reload the stream to get prior sticky activities back in it (and a freshly stuck activity out)
                    eventBus.notifyObservers(StreamReinitializeRequestEvent.getEvent());
                }
            }
        });

        addEntityObservers();
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.