コード例 #1
0
  /**
   * constructor
   *
   * @throws Exception
   */
  public UIUserActivitiesDisplay() throws Exception {
    List<SelectItemOption<String>> displayModes = new ArrayList<SelectItemOption<String>>(4);
    displayModes.add(
        new SelectItemOption<String>("All_Updates", DisplayMode.ALL_ACTIVITIES.toString()));
    displayModes.add(
        new SelectItemOption<String>("Space_Updates", DisplayMode.MY_SPACE.toString()));
    displayModes.add(
        new SelectItemOption<String>("Network_Updates", DisplayMode.CONNECTIONS.toString()));
    displayModes.add(
        new SelectItemOption<String>("My_Status", DisplayMode.MY_ACTIVITIES.toString()));

    UIDropDownControl uiDropDownControl =
        addChild(UIDropDownControl.class, "DisplayModesDropDown", null);
    uiDropDownControl.setOptions(displayModes);

    setSelectedMode(uiDropDownControl);

    addChild(uiDropDownControl);

    // TODO: init() run two time when initiation this form.
    // String remoteId = Utils.getOwnerRemoteId();
    // this.setOwnerName(remoteId);
    String selectedDisplayMode =
        Utils.getCookies(
            String.format(Utils.ACTIVITY_STREAM_TAB_SELECTED_COOKIED, Utils.getViewerRemoteId()));
    selectedDisplayMode =
        (selectedDisplayMode != null) ? selectedDisplayMode : DisplayMode.ALL_ACTIVITIES.name();

    //
    setSelectedDisplayMode(selectedDisplayMode);

    // set lastUpdatedNumber after init() method invoked inside setSelectedDisplayMode() method
    // int numberOfUpdates = this.getNumberOfUpdatedActivities();
    // setLastUpdatedNum(selectedDisplayMode.toString(), "" + numberOfUpdates);
  }
コード例 #2
0
    public void execute(Event<UIDropDownControl> event) throws Exception {
      UIDropDownControl uiDropDown = event.getSource();
      UIUserActivitiesDisplay uiUserActivities = uiDropDown.getParent();
      WebuiRequestContext requestContext = event.getRequestContext();
      String selectedDisplayMode = requestContext.getRequestParameter(OBJECTID);

      if (selectedDisplayMode.equals(DisplayMode.ALL_ACTIVITIES.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.ALL_ACTIVITIES);
      } else if (selectedDisplayMode.equals(DisplayMode.MY_ACTIVITIES.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.MY_ACTIVITIES);
      } else if (selectedDisplayMode.equals(DisplayMode.MY_SPACE.toString())) {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.MY_SPACE);
      } else {
        uiUserActivities.setSelectedDisplayMode(DisplayMode.CONNECTIONS);
      }

      if (selectedDisplayMode != null) {
        uiUserActivities.setSelectedDisplayMode(selectedDisplayMode);
        uiUserActivities.init();

        uiUserActivities.setChangedMode(false);

        // int numberOfUpdates = uiUserActivities.getNumberOfUpdatedActivities();

        //
        event
            .getRequestContext()
            .getJavascriptManager()
            .require("SHARED/social-ui-activity-updates", "activityUpdates")
            .addScripts(
                "activityUpdates.resetCookie('"
                    + String.format(
                        Utils.ACTIVITY_STREAM_TAB_SELECTED_COOKIED, Utils.getViewerRemoteId())
                    + "','"
                    + selectedDisplayMode
                    + "');");
        //
        //       event.getRequestContext().getJavascriptManager()
        //       .require("SHARED/social-ui-activity-updates",
        // "activityUpdates").addScripts("activityUpdates.resetCookie('" +
        // String.format(Utils.LAST_UPDATED_ACTIVITIES_NUM, selectedDisplayMode,
        // Utils.getViewerRemoteId()) + "','" + numberOfUpdates + "');");

      }

      requestContext.addUIComponentToUpdateByAjax(uiUserActivities);

      Utils.resizeHomePage();
    }
コード例 #3
0
 private void setSelectedMode(UIDropDownControl uiDropDownControl) {
   if (selectedDisplayMode != null) {
     uiDropDownControl.setValue(selectedDisplayMode.toString());
   }
 }