Package org.eurekastreams.web.client.history

Examples of org.eurekastreams.web.client.history.CreateUrlRequest


            for (final Layout layout : Layout.values())
            {
                Hyperlink icon = new Hyperlink();
                icon.addStyleName(StaticResourceBundle.INSTANCE.coreCss().layoutIcon());
                icon.setText("layout");
                icon.setTargetHistoryToken(Session.getInstance().generateUrl(new CreateUrlRequest()));
                icon.addStyleName(layout.toString().toLowerCase());

                icon.addClickHandler(new ClickHandler()
                {
                    public void onClick(final ClickEvent event)
View Full Code Here


        Anchor externalLink = new Anchor("EurekaStreams.org", "http://www.eurekastreams.org", "_blank");
        externalLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().navBarButton());

        Hyperlink startPageLink = new Hyperlink("Start", Session.getInstance().generateUrl(
                new CreateUrlRequest(Page.START)));
        startPageLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().navBarButton());
        Hyperlink activityLink = new Hyperlink("Activity", Session.getInstance().generateUrl(
                new CreateUrlRequest(Page.ACTIVITY)));
        activityLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().navBarButton());
        Hyperlink directoryLink = new Hyperlink("Discover", Session.getInstance().generateUrl(
                new CreateUrlRequest(Page.DISCOVER)));
        directoryLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().navBarButton());
       
        Hyperlink settingsLink = new Hyperlink("Settings", Session.getInstance().generateUrl(
                new CreateUrlRequest(Page.SETTINGS)));
        settingsLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().navBarButton());
        Hyperlink myProfileLink = new Hyperlink("My Stream", Session.getInstance().generateUrl(
                new CreateUrlRequest(Page.PEOPLE, viewer.getAccountId())));
        myProfileLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().navBarButton());

        externalPageLinkPanel.add(externalLink);
        externalPageLinkPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().externalHeaderButton());
        startPageLinkPanel.add(startPageLink);
View Full Code Here

        params.put("activityId", null);
        if (streamViewId != null)
        {
            params.put("viewId", Long.toString(streamViewId));
        }
        return "#" + Session.getInstance().generateUrl(new CreateUrlRequest(params, false));
    }
View Full Code Here

            StreamEntityDTO destinationStream = activity.getDestinationStream();
            Page destinationPage = destinationStream.getEntityType() == EntityType.PERSON ? Page.PEOPLE : Page.GROUPS;
            String destinationView = destinationStream.getUniqueId();
            return "#"
                    + Session.getInstance()
                            .generateUrl(new CreateUrlRequest(destinationPage, destinationView, params));
        }
        // otherwise, search for hashtags in whatever stream the user is currently viewing
        else
        {
            return "#" + Session.getInstance().generateUrl(new CreateUrlRequest(params, false));
        }
    }
View Full Code Here

        if (page != null)
        {
            FlowPanel showAllPanel = new FlowPanel();
            showAllPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().singleActivityShowAll());
            showAllPanel.add(new Hyperlink(title, Session.getInstance().generateUrl(
                    new CreateUrlRequest(page, destinationStream.getUniqueId()))));
            add(showAllPanel);
        }

        StreamMessageItemRenderer renderer = new StreamMessageItemRenderer(showRecipient);
        renderer.setShowComment(showComment);
View Full Code Here

     * Tests building activity permalink URL request.
     */
    @Test
    public void testBuildActivityPermalink()
    {
        CreateUrlRequest result = sut.buildActivityPermalinkUrlRequest(ACTIVITY_ID, EntityType.PERSON,
                STREAM_UNIQUE_ID, null);

        assertEquals(Page.ACTIVITY, result.getPage());
        assertEquals(ACTIVITY_ID, Long.parseLong(result.getViews().get(0)));
    }
View Full Code Here

     * Tests building activity permalink URL request.
     */
    @Test
    public void testBuildActivityPermalink()
    {
        CreateUrlRequest result = sut.buildActivityPermalinkUrlRequest(ACTIVITY_ID, EntityType.PERSON,
                STREAM_UNIQUE_ID, null);

        assertEquals(Page.ACTIVITY, result.getPage());
        assertEquals(ACTIVITY_ID, Long.parseLong(result.getViews().get(0)));
    }
View Full Code Here

          {
                return "activity/" + Session.getInstance().getHistoryHandler().getParameters().get("activityId");
          }
          else
          {
            return Session.getInstance().generateUrl(new CreateUrlRequest(Page.PEOPLE, views));
          }
        case GROUPS_LEGACY:
          if (Session.getInstance().getHistoryHandler().getParameters().containsKey("activityId"))
          {
                return "activity/" + Session.getInstance().getHistoryHandler().getParameters().get("activityId");
          }
          else
          {
            return Session.getInstance().generateUrl(new CreateUrlRequest(Page.GROUPS, views));
          }
        case PERSONAL_SETTINGS:
            Session.getInstance().setPageTitle("Settings");
            GWT.runAsync(new RunAsyncCallback()
            {
View Full Code Here

        EventBus.getInstance().addObserver(UpdatedGroupResponseEvent.class, new Observer<UpdatedGroupResponseEvent>()
        {
            public void update(final UpdatedGroupResponseEvent arg1)
            {
                Session.getInstance().getEventBus().notifyObservers(
                        new UpdateHistoryEvent(new CreateUrlRequest(Page.GROUPS, arg1.getResponse().getShortName())));

                Session.getInstance().getEventBus().notifyObservers(
                        new ShowNotificationEvent(new Notification("Your group has been successfully saved")));
            }
        });

        form.addFormElement(new ValueOnlyFormElement(DomainGroupModelView.ID_KEY, Long.toString(entity.getId())));
        form.addFormElement(new ValueOnlyFormElement(DomainGroupModelView.SHORT_NAME_KEY, entity.getShortName()));

        AvatarUploadFormElement avatarFormEl = new AvatarUploadFormElement("Avatar",
                "Select a JPG, PNG or GIF image from your computer. The maxium file size is 4MB",
                "/eurekastreams/groupavatarupload?groupName=" + entity.getShortName(), Session.getInstance()
                        .getActionProcessor(), new AvatarUploadStrategy<DomainGroupModelView>(entity,
                        "resizeGroupAvatar", EntityType.GROUP));
        form.addWidget(avatarFormEl);

        form.addFormDivider();

        form.addFormElement(new BasicTextBoxFormElement(MAX_NAME, false, "Group Name", DomainGroupModelView.NAME_KEY,
                entity.getName(), "", true));
        form.addFormDivider();

        form.addFormElement(new BasicTextAreaFormElement(DomainGroup.MAX_DESCRIPTION_LENGTH, "Description",
                DomainGroupModelView.DESCRIPTION_KEY, entity.getDescription(),
                "Enter a few sentences that describe the purpose of your group's stream.  "
                        + "This description will appear beneath your avatar "
                        + "and in the profile search results pages.", false));

        form.addFormDivider();

        AutoCompleteItemDropDownFormElement keywords = new AutoCompleteItemDropDownFormElement("Keywords",
                DomainGroupModelView.KEYWORDS_KEY, DomainFormatUtility.buildCapabilitiesStringFromStrings(entity
                        .getCapabilities()),
                "Add keywords that describe your group and the topics your members will be talking about. Separate "
                        + "keywords with a comma. Including keywords helps others find your group when searching "
                        + "profiles.", false, "/resources/autocomplete/capability/", "itemNames", ",");
        keywords.setMaxLength(MAX_KEYWORDS);

        form.addFormElement(keywords);
        form.addFormDivider();

        form.addFormElement(new BasicTextBoxFormElement("Website URL", "url", entity.getUrl(),
                "If your group has a website, you can enter the URL above", false));
        form.addFormDivider();

        String coordinstructions = "The group coordinators will be responsible for managing the organization profile, "
                + "and moderating the group's activity stream";

        form.addFormElement(new PersonModelViewLookupFormElement("Group Coordinators", "Add Coordinator",
                coordinstructions, DomainGroupModelView.COORDINATORS_KEY, entity.getCoordinators(), true));

        form.addFormDivider();

        final Label currentPrivacySettingLabel = new Label();
        currentPrivacySettingLabel.setText("Privacy Settings");
        currentPrivacySettingLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
        final FlowPanel currentPrivacySettingDescription = new FlowPanel();
        final Label currentPrivacySettingDescriptionTitle = new Label();
        currentPrivacySettingDescriptionTitle.setText(entity.isPublic() ? "Public" : "Private");
        currentPrivacySettingDescriptionTitle.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formStaticValue());
        final Label currentPrivacySettingDescriptionInfo = new Label();
        if (entity.isPublic())
        {
            currentPrivacySettingDescriptionInfo.setText("Public groups are visible to all users and accessible "
                    + "through a profile search.");
        }
        else
        {
            currentPrivacySettingDescriptionInfo.setText("Access to private groups is restricted to employees"
                    + " approved by the group's coordinators.  Group coordinators can view a list of pending "
                    + "requests by going to the admin tab on the group's profile.");
        }
        currentPrivacySettingDescriptionInfo.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions());
        currentPrivacySettingDescription.add(currentPrivacySettingDescriptionTitle);
        currentPrivacySettingDescription.add(currentPrivacySettingDescriptionInfo);
        currentPrivacySettingDescription.addStyleName(StaticResourceBundle.INSTANCE.coreCss().privacySettingsValue());
        final FlowPanel currentPrivacySettingPanel = new FlowPanel();
        currentPrivacySettingPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formElement());
        currentPrivacySettingPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().privacySettings());
        currentPrivacySettingPanel.add(currentPrivacySettingLabel);
        currentPrivacySettingPanel.add(currentPrivacySettingDescription);
        form.addWidget(currentPrivacySettingPanel);

        if (!entity.isPublic())
        {
            final HTML privateNote = new HTML("<span class=\"form-static-value\">Please Note:</span> "
                    + "This group's name and description will be visible whenever employees browse or"
                    + " search profiles.");
            privateNote.addStyleName(StaticResourceBundle.INSTANCE.coreCss().privacySettingsNote());
            privateNote.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions());
            currentPrivacySettingPanel.add(privateNote);
        }

        form.addFormDivider();

        // TODO: evidently this is supposed to go away
        BasicCheckBoxFormElement blockWallPost = new BasicCheckBoxFormElement("Stream Moderation",
                DomainGroupModelView.STREAM_POSTABLE_KEY, "Allow others to post to your group's stream", false, entity
                        .isStreamPostable());
        BasicCheckBoxFormElement blockCommentPost = new BasicCheckBoxFormElement(null,
                DomainGroupModelView.STREAM_COMMENTABLE_KEY,
                "Allow others to comment on activity in your group's stream", false, entity.isCommentable());

        blockWallPost.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamModeration());
        blockCommentPost.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamModeration());
        blockCommentPost.addStyleName(StaticResourceBundle.INSTANCE.coreCss().commentModeration());

        form.addFormElement(blockWallPost);
        form.addFormElement(blockCommentPost);
        form.addFormDivider();

        // ---- Action buttons ----

        deleteButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formDeleteGroupButton());
        deleteButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton());

        deleteButton.addClickHandler(new ClickHandler()
        {
            public void onClick(final ClickEvent event)
            {
                if (new WidgetJSNIFacadeImpl().confirm("Are sure that you want to delete this group? "
                        + "Deleting the group will remove the profile from the system along with "
                        + "all of the activity that has been posted to its stream."))
                {
                    form.turnOffChangeCheck();
                    processingSpinny.setVisible(true);
                    deleteButton.setVisible(false);

                    // TODO - might should put this in GroupModel (and mark it as Deletable) but there's no
                    // custom onFailure ability there yet.
                    Session.getInstance().getActionProcessor().makeRequest("deleteGroupAction", entity.getId(),
                            new AsyncCallback<Boolean>()
                            {
                                public void onSuccess(final Boolean result)
                                {
                                    // adds notification to top of page
                                    Session.getInstance().getEventBus().notifyObservers(
                                            new ShowNotificationEvent(new Notification("The group '"
                                                    + entity.getName() + "' has been deleted")));

                                    // navigates away from settings page to the parent org profile page
                                    Session.getInstance().getEventBus().notifyObservers(
                                            new UpdateHistoryEvent(new CreateUrlRequest(Page.PEOPLE, Session
                                                    .getInstance().getCurrentPerson().getAccountId())));
                                }

                                public void onFailure(final Throwable caught)
                                {
                                    // adds notification to top of page
                                    Session.getInstance().getEventBus().notifyObservers(
                                            new ShowNotificationEvent(new Notification(
                                                    "An error has occured and the group '" + entity.getName()
                                                            + "' was not deleted")));
                                }
                            });
                }
            }
        });

        form.addWidgetToFormContainer(deleteButton);

        processingSpinny.setVisible(false);
        processingSpinny.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formSubmitSpinny());
        form.addWidgetToFormContainer(processingSpinny);

        form.setOnCancelHistoryToken(Session.getInstance().generateUrl(
                new CreateUrlRequest(Page.GROUPS, entity.getShortName())));

        panel.add(form);
    }
View Full Code Here

                            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>()
View Full Code Here

TOP

Related Classes of org.eurekastreams.web.client.history.CreateUrlRequest

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.