Package org.eurekastreams.web.client.ui.common.form

Examples of org.eurekastreams.web.client.ui.common.form.FormBuilder


     *            The system settings to use when preloading the form.
     */
    private void generateForm(final SystemSettings systemSettingValues)
    {
        this.clear();
        final FormBuilder form = new FormBuilder("", SystemSettingsModel.getInstance(), Method.UPDATE);

        Session.getInstance()
                .getEventBus()
                .addObserver(UpdatedSystemSettingsResponseEvent.class,
                        new Observer<UpdatedSystemSettingsResponseEvent>()
                        {

                            public void update(final UpdatedSystemSettingsResponseEvent arg1)
                            {
                                form.onSuccess();
                                Session.getInstance()
                                        .getEventBus()
                                        .notifyObservers(new ShowNotificationEvent(new Notification("Settings saved")));

                                clearRetainedValues();
                            }

                        });

        form.setOnCancelHistoryToken(Session.getInstance().generateUrl(new CreateUrlRequest(Page.START)));
        form.turnOffChangeCheck();
        hideableSiteLabel = new HideableTextAreaFormElement(MAX_SITELABEL, "Site Labeling", "siteLabel",
                systemSettingValues.getSiteLabel(), "I would like to add a label to the system.",
                "The site label will be displayed above the global navigation bar and below the "
                        + "footer on all pages in the system. If disabled, no label area will "
                        + "appear on your pages.", true);

        hideablePluginWarning = new HideableRichTextAreaFormElement("Plugin Configuration Warning", "pluginWarning",
                systemSettingValues.getPluginWarning(),
                "I would like to setup a plugin configuration warning for the system.",
                "This text will be displayed everytime a user configures a plugin for an individual or group", true);

        hideableContentWarning = new HideableTextAreaFormElement(MAX_CONTENT_WARNING, "Content Warning",
                "contentWarningText", systemSettingValues.getContentWarningText(),
                "I would like to add a warning to Activity Stream post boxes.",
                "This text will be displayed on the Activity Stream post boxes throughout the system.", true);

        activityExp = new ActivityExpirationFormElement(systemSettingValues.getContentExpiration(),
                "contentExpiration", true);

        tosElement = new HideableRichTextAreaFormElement("Terms Of Service", "termsOfService",
                systemSettingValues.getTermsOfService(), "I would like to setup the Terms of Service for the system.",
                "Users will be prompted to agree or disagree with a Terms of Service message "
                        + "on an interval of your choice.  You can also add a link to the full "
                        + "Terms of Service document.", true);

        tosElement.addStyleName(StaticResourceBundle.INSTANCE.coreCss().hideableTextarea());

        form.addFormElement(new PersonModelViewLookupFormElement("Eureka Administrators", "Add Administrator", "",
                "admins", systemSettingValues.getSystemAdministrators(), true));

        form.addFormDivider();

        Integer promptVal = systemSettingValues.getTosPromptInterval();

        if (null == promptVal)
        {
            promptVal = 1;
        }

        promptInterval = new TermsOfServicePromptIntervalFormElement(promptVal, "tosPromptInterval");
        form.addFormElement(new UserAssociationFormElement(systemSettingValues));

        BasicCheckBoxFormElement sendEmails = new BasicCheckBoxFormElement("", "sendWelcomeEmails",
                "Send email invitations to new users as their accounts are created.", false,
                systemSettingValues.getSendWelcomeEmails());

        sendEmails.addStyleName(StaticResourceBundle.INSTANCE.coreCss().welcomeEmailCheckbox());

        membershipRefreshButton = initializeRefreshButton();

        FlowPanel clearPanel = new FlowPanel();

        clearPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().clear());

        sendEmails.add(membershipRefreshButton);
        form.addFormElement(sendEmails);

        form.addFormDivider();
        form.addWidget(new SendNotificationWidget());
        form.addFormDivider();
        form.addFormElement(hideableSiteLabel);
        form.addFormDivider();
        form.addFormElement(hideableContentWarning);
        form.addFormDivider();
        form.addFormElement(hideablePluginWarning);
        form.addFormDivider();
        form.addFormElement(tosElement);
        form.addFormElement(promptInterval);
        form.addFormDivider();

        // Help Page

        form.addFormElement(new BasicTextBoxFormElement(MAX_GROUP_NAME, false, "Support Stream",
                "supportStreamGroupShortName", systemSettingValues.getSupportStreamGroupShortName(),
                "Enter the name of the stream you want to display on the help page", false));
        form.addFormDivider();

        form.addFormElement(activityExp);
        form.addFormDivider();

        BasicCheckBoxFormElement groupCreationPolicy = new BasicCheckBoxFormElement("New Group Moderation",
                "allUsersCanCreateGroups", "Enable Moderation.",
                "By enabling moderation, system administrators will be required to review new group requests.  "
                        + "Groups pending approval will be listed under the pending tab of system settings.", false,
                !systemSettingValues.getAllUsersCanCreateGroups());

        // The key is true for "allowing group creation" and the checkbox displays "allowing moderation". Since
        // these are opposites, the value needs to be reversed when the form gets submitted.
        groupCreationPolicy.setReverseValue(true);

        form.addFormElement(groupCreationPolicy);
        form.addFormDivider();

        if (!tosElement.isChecked())
        {
            promptInterval.setVisible(false);
        }
View Full Code Here


                            String defaultCategory = null;
                            String defaultUrl = "";
                            String id = "";

                            FormBuilder form = new FormBuilder("Submit a Plugin", PluginDefinitionModel.getInstance(),
                                    Method.INSERT);

                            form.turnOffChangeCheck();
                            form.setOnCancelHistoryToken(Session.getInstance().generateUrl(
                                    new CreateUrlRequest(Page.SETTINGS, "tab", "Plugins")));
                            form.addFormElement(new ValueOnlyFormElement("id", id));
                            HTML infoMessage = new HTML(
                                    "<span class='gallery-upload-note'><strong>Please Note:</strong><br />"
                                            + "Please be sure your XML file includes the required fields.<br />"
                                            + " You will not be able to upload the XML without the required"
                                            + " fields.</span>");
                            infoMessage.addStyleName(StaticResourceBundle.INSTANCE.coreCss().addPluginInfoMessage());
                            form.addWidget(infoMessage);
                            form.addFormDivider();

                            List<String> categories = new LinkedList<String>();
                            categories.add("Internet Services");
                            form.addFormElement(new BasicDropDownFormElement("Category", "category", categories,
                                    defaultCategory, "", true));

                            form.addFormDivider();

                            form.addFormElement(new BasicTextBoxFormElement("Plugin XML:", "url", defaultUrl,
                                    "Enter the link to the xml file", true));

                            form.addFormDivider();

                            galleryAddOrEditContainer.add(form);

                        }
                        else
View Full Code Here

        body.addStyleName(StaticResourceBundle.INSTANCE.coreCss().listEditModal());
        body.clear();

        streamLists = new StreamListFormElement(null);

        form = new FormBuilder("Custom streams allow you to merge different streams "
                + "as well as optionally filter by keyword", CustomStreamModel.getInstance(), mode);
        form.turnOffChangeCheck();
        form.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamViewDialogBody());

        Session.getInstance().getEventBus()
View Full Code Here

        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")));
            }
        });

        final BasicTextBoxFormElement groupName = new BasicTextBoxFormElement(50, false, "Group Name",
                DomainGroupModelView.NAME_KEY, "", "", true);
        form.addFormElement(groupName);
        DeferredCommand.addCommand(new Command()
        {
            public void execute()
            {
                groupName.setFocus();
            }
        });

        form.addFormDivider();

        ShortnameFormElement shortName = new ShortnameFormElement("Group Web Address",
                DomainGroupModelView.SHORT_NAME_KEY, "", "http://" + Window.Location.getHost() + "/groups/",
                "Please restrict your group's name in the web address "
                        + "to 20 lower case alpha numeric characters without spaces.", true);
        shortName.addStyleName(StaticResourceBundle.INSTANCE.coreCss().groupShortName());
        form.addFormElement(shortName);

        form.addFormDivider();

        form.addFormElement(new BasicTextAreaFormElement(DomainGroup.MAX_DESCRIPTION_LENGTH, "Description",
                DomainGroupModelView.DESCRIPTION_KEY, "",
                "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.", true));

        form.addFormDivider();

        String coordinstructions = "The group coordinators"
                + " will be responsible for setting up the group profile, setting group permissions, "
                + "and managing group access";
        PersonModelViewLookupFormElement personLookupFormElement = new PersonModelViewLookupFormElement(
                "Group Coordinators", "Add Coordinator", coordinstructions, DomainGroupModelView.COORDINATORS_KEY,
                new HashSet<PersonModelView>(), true);
        personLookupFormElement.addPerson(Session.getInstance().getCurrentPerson());
        form.addFormElement(personLookupFormElement);

        form.addFormDivider();

        /**
         * CheckBox for Form.
         */

        final GroupPrivacySettings radioButtonGroup = new GroupPrivacySettings("Privacy Settings",
                DomainGroupModelView.PRIVACY_KEY, "privacySettings", "");

        radioButtonGroup.clearGroup();
        radioButtonGroup.addRadioButton("Public", "Allow all users to view this profile.", "true", Boolean.TRUE);
        BasicRadioButtonFormElement privateButton = radioButtonGroup.addRadioButton("Private",
                "Restrict access to users approved by this group's coordinators.", "false", Boolean.FALSE);

        Panel extraInstructions = new FlowPanel();
        extraInstructions.addStyleName(StaticResourceBundle.INSTANCE.coreCss().groupPrivateExtraNote());
        extraInstructions.add(new InlineLabel("Please Note: "));
        extraInstructions.add(new InlineLabel(
                "This group's name and description will be visible whenever employees browse or search profiles."));
        privateButton.addToInstructions(extraInstructions);

        form.addFormElement(radioButtonGroup);

        form.addClear();

        form.addFormDivider();
        panel.add(form);

        // -- events ---

        form.addOnCancelCommand(new Command()
        {
            public void execute()
            {
                History.back();
            }
View Full Code Here

            defaultDescription = Session.getInstance().getParameterValue("description");
            tabDropDownInstructions = "If no tab is selected, original tab will be maintained.";
        }

        this.setPageTitle(title);
        FormBuilder form = new FormBuilder("", GalleryTabTemplateModel.getInstance(), method);

        if (method.equals(Method.UPDATE))
        {
            form.setSubmitButtonClass(StaticResourceBundle.INSTANCE.coreCss().formUpdateButton());
        }

        form.setOnCancelHistoryToken(Session.getInstance().generateUrl(new CreateUrlRequest(Page.GALLERY, urlParams)));
        form.addFormElement(new ValueOnlyFormElement("id", id));
        form.addWidget(new HTML("<em class='gallery-upload-note'><strong>Please Note:</strong><br />"
                + "When users add your tab from the gallery they will be making a copy of the tab. "
                + "Updates you make to the tab will not be reflected for users who have previously add it."));
        form.addFormDivider();

        form.addFormElement(new BasicDropDownFormElement("Tabs", "tab", startPageTabsDropDownValues, "-1",
                tabDropDownInstructions, method == Method.INSERT));
        form.addFormDivider();

        form
                .addFormElement(new BasicDropDownFormElement("Category", "category", categories, defaultCategory, "",
                        true));

        form.addFormDivider();

        form.addFormElement(new BasicTextBoxFormElement("Description:", "description", defaultDescription, "", true));

        form.addFormDivider();

        galleryAddOrEditContainer.clear();
        galleryAddOrEditContainer.add(form);
    }
View Full Code Here

            defaultCategory = Session.getInstance().getParameterValue("category");
            id = Session.getInstance().getParameterValue("id");
        }

        this.setPageTitle(title);
        FormBuilder form = new FormBuilder("", ThemeModel.getInstance(), method);

        if (method.equals(Method.UPDATE))
        {
            form.setSubmitButtonClass(StaticResourceBundle.INSTANCE.coreCss().formUpdateButton());
        }

        form.setOnCancelHistoryToken(Session.getInstance().generateUrl(new CreateUrlRequest(Page.GALLERY, urlParams)));
        form.addFormElement(new ValueOnlyFormElement("id", id));
        form.addWidget(new HTML("<em class='gallery-upload-note'><strong>Please Note:</strong><br />"
                + "Please be sure your XML file includes the "
                + "<a href='http://docs.eurekastreams.org/Technical-Specification/1.1/Theme%20Format.html' "
                + "target='_blank'>required fields</a>. "
                + "You will not be able to upload the XML without the required fields."));
        form.addFormDivider();

        form
                .addFormElement(new BasicDropDownFormElement("Category", "category", categories, defaultCategory, "",
                        true));

        form.addFormDivider();

        form.addFormElement(new BasicTextBoxFormElement("Theme XML:", "url", defaultUrl,
                "Enter the link to the xml file", true));

        form.addFormDivider();

        galleryAddOrEditContainer.clear();
        galleryAddOrEditContainer.add(form);
    }
View Full Code Here

                    {
                        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();
                                    }
                                });

                        form.addFormElement(new ValueOnlyFormElement("accountId", person.getAccountId()));

                        form.addWidget(new AvatarUploadFormElement("Photo", "/eurekastreams/personavatarupload",
                                Session.getInstance().getActionProcessor(), new AvatarUploadStrategy<PersonModelView>(
                                        person, "resizePersonAvatar", EntityType.PERSON)));
                        form.addFormDivider();

                        form.addFormElement(new BasicTextBoxFormElement(MAX_LENGTH, false, "Title",
                                PersonModelView.TITILE_KEY, person.getTitle(),
                                "Your title will appear below your photo on the profile page", true));
                        form.addFormDivider();
                        form.addFormElement(new BasicTextBoxFormElement(MAX_LENGTH, false, "First Name",
                                PersonModelView.PREFERREDNAME_KEY, person.getPreferredName(),
                                "Entering a display name will replace your first name anywhere your name "
                                        + "appears in the system", true));
                        form.addFormDivider();
                        form.addFormElement(new BasicTextAreaFormElement(Person.MAX_JOB_DESCRIPTION_LENGTH,
                                "Job Description", PersonModelView.DESCRIPTION_KEY, person.getJobDescription(),
                                "Enter a brief description of your job responsibilities.", false));
                        form.addFormDivider();

                        String skills = DomainFormatUtility.buildCapabilitiesStringFromStrings(person.getInterests());

                        form.addFormElement(new AutoCompleteItemDropDownFormElement("Keywords",
                                PersonModelView.SKILLS_KEY, skills,
                                "Add keywords that describe your work experience, skills, interests, or "
                                        + "hobbies. Separate keywords with a comma. Including tags increases your "
                                        + "chances of being found in a profile search.", false,
                                "/resources/autocomplete/skill/", "itemNames", ElementType.TEXTAREA, ","));
                        form.addFormDivider();

                        form.addFormElement(new BasicTextBoxFormElement(MAX_LENGTH, false, "Phone",
                                PersonModelView.WORKPHONE_KEY, person.getWorkPhone(), null, false));
                        form.addFormDivider();
                        form.addFormElement(new BasicTextBoxFormElement(MAX_EMAIL, false, "Email",
                                PersonModelView.EMAIL_KEY, person.getEmail(), "(ex. user@example.com)", true));

                        form.addFormDivider();
                        BasicCheckBoxFormElement blockWallPost = new BasicCheckBoxFormElement("Stream Moderation",
                                "streamPostable", " Allow others to post to your stream", false, person
                                        .isStreamPostable());
                        BasicCheckBoxFormElement blockCommentPost = new BasicCheckBoxFormElement(null, "commentable",
                                " Allow others to comment on activity in your stream", false, person.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();

                        HashMap<String, String> currentPageParams = new HashMap<String, String>();
                        currentPageParams.put("tab", "Basic+Info");

                        form.setOnCancelHistoryToken(Session.getInstance().generateUrl(
                                new CreateUrlRequest(Page.PEOPLE, person.getAccountId())));

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

            defaultCategory = Session.getInstance().getParameterValue("category");
            id = Session.getInstance().getParameterValue("id");
        }

        this.setPageTitle(title);
        FormBuilder form = new FormBuilder("", GadgetDefinitionModel.getInstance(), method);

        if (method.equals(Method.UPDATE))
        {
            form.setSubmitButtonClass(StaticResourceBundle.INSTANCE.coreCss().formUpdateButton());
        }

        form.setOnCancelHistoryToken(Session.getInstance().generateUrl(new CreateUrlRequest(Page.GALLERY, urlParams)));
        form.addFormElement(new ValueOnlyFormElement("id", id));
        form.addWidget(new HTML("<em class='gallery-upload-note'><strong>Please Note:</strong><br />"
                + "Please be sure your XML file includes the required fields. You will not be able to upload the XML "
                + "without the required fields."));
        form.addFormDivider();

        form
                .addFormElement(new BasicDropDownFormElement("Category", "category", categories, defaultCategory, "",
                        true));

        form.addFormDivider();

        form.addFormElement(new BasicTextBoxFormElement("App XML:", "url", defaultUrl,
                "Enter the link to the xml file", true));

        form.addFormDivider();

        galleryAddOrEditContainer.clear();
        galleryAddOrEditContainer.add(form);
    }
View Full Code Here

    public void setEntity(final DomainGroupModelView entity)
    {
        // Set the banner.
        Session.getInstance().getEventBus().notifyObservers(new SetBannerEvent(entity));

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

        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

    {
        mode = inMode;
        confValues = inConfValues;


        formBuilder = new FormBuilder("", model, mode);
        this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamPluginConfPanel());
        formBuilder.setVisible(false);

        final Integer random = Random.nextInt(10000);
View Full Code Here

TOP

Related Classes of org.eurekastreams.web.client.ui.common.form.FormBuilder

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.