예제 #1
0
    @Override
    public void execute(Event<UISpaceSearch> event) throws Exception {
      WebuiRequestContext ctx = event.getRequestContext();
      UISpaceSearch uiSpaceSearch = event.getSource();
      String charSearch = ctx.getRequestParameter(OBJECTID);
      ResourceBundle resApp = ctx.getApplicationResourceBundle();
      String defaultSpaceNameAndDesc =
          resApp.getString(uiSpaceSearch.getId() + ".label.DefaultSpaceNameAndDesc");
      String searchCondition =
          (((UIFormStringInput) uiSpaceSearch.getChildById(SPACE_SEARCH)).getValue());
      if ((searchCondition == null || searchCondition.equals(defaultSpaceNameAndDesc))
          && charSearch == null) {
        uiSpaceSearch.setSelectedChar(null);
        uiSpaceSearch.setSpaceNameSearch(null);
        ctx.addUIComponentToUpdateByAjax(uiSpaceSearch);
      } else {
        if (searchCondition != null) {
          searchCondition = searchCondition.trim();
        }
        if (charSearch != null) {
          ((UIFormStringInput) uiSpaceSearch.getChildById(SPACE_SEARCH))
              .setValue(defaultSpaceNameAndDesc);
        }
        uiSpaceSearch.setSelectedChar(charSearch);
        uiSpaceSearch.setSpaceNameSearch(searchCondition);
        uiSpaceSearch.setNewSearch(true);

        Event<UIComponent> searchEvent =
            uiSpaceSearch.<UIComponent>getParent().createEvent(SEARCH, Event.Phase.DECODE, ctx);
        if (searchEvent != null) {
          searchEvent.broadcast();
        }
      }
    }
예제 #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();
    }
 public void processAction(UIStandaloneApplication uicomponent, WebuiRequestContext context)
     throws Exception {
   String componentId = context.getRequestParameter(context.getUIComponentIdParameterName());
   if (componentId == null) {
     return;
   }
   UIComponent uiTarget = uicomponent.findComponentById(componentId);
   if (uiTarget == null) {
     return;
   }
   if (uiTarget == uicomponent) {
     super.processAction(uicomponent, context);
   }
   uiTarget.processAction(context);
 }
 public void processDecode(UIStandaloneApplication uicomponent, WebuiRequestContext context)
     throws Exception {
   String componentId = context.getRequestParameter(context.getUIComponentIdParameterName());
   if (componentId == null) {
     return;
   }
   UIComponent uiTarget = uicomponent.findComponentById(componentId);
   if (uiTarget == null) {
     context.addUIComponentToUpdateByAjax(uicomponent.getChild(UIStandaloneAppContainer.class));
     return;
   }
   if (uiTarget == uicomponent) {
     super.processDecode(uicomponent, context);
   }
   uiTarget.processDecode(context);
 }
예제 #5
0
    @Override
    public void execute(Event<UIMembersPortlet> event) throws Exception {
      WebuiRequestContext ctx = event.getRequestContext();
      UIMembersPortlet uiMembersPortlet = event.getSource();

      UIProfileUserSearch uiSearch = uiMembersPortlet.uiSearchMemberOfSpace;

      String charSearch = ctx.getRequestParameter(OBJECTID);

      ResourceBundle resApp = ctx.getApplicationResourceBundle();

      String defaultNameVal = resApp.getString(uiSearch.getId() + ".label.name");
      String defaultPosVal = resApp.getString(uiSearch.getId() + ".label.position");
      String defaultSkillsVal = resApp.getString(uiSearch.getId() + ".label.skills");

      ProfileFilter filter = uiSearch.getProfileFilter();

      try {
        uiMembersPortlet.setSelectedChar(charSearch);
        if (charSearch != null) { // search by alphabet
          ((UIFormStringInput) uiSearch.getChildById(SEARCH)).setValue(defaultNameVal);
          ((UIFormStringInput) uiSearch.getChildById(Profile.POSITION)).setValue(defaultPosVal);
          ((UIFormStringInput) uiSearch.getChildById(Profile.EXPERIENCES_SKILLS))
              .setValue(defaultSkillsVal);
          filter.setName(charSearch);
          filter.setPosition("");
          filter.setSkills("");
          filter.setFirstCharacterOfName(charSearch.toCharArray()[0]);
          if (ALL_FILTER.equals(charSearch)) {
            filter.setFirstCharacterOfName(EMPTY_CHARACTER);
            filter.setName("");
          }
          uiSearch.setRawSearchConditional("");
        }

        uiSearch.setProfileFilter(filter);
        uiSearch.setNewSearch(true);
      } catch (Exception e) {
        uiSearch.setIdentityList(new ArrayList<Identity>());
      }

      uiMembersPortlet.loadSearch();
      uiMembersPortlet.setLoadAtEnd(false);
    }
예제 #6
0
    @Override
    public void execute(Event<UIInvitations> event) throws Exception {
      UIInvitations uiInvitations = event.getSource();

      WebuiRequestContext ctx = event.getRequestContext();
      UIProfileUserSearch uiSearch = uiInvitations.uiProfileUserSearch;

      String charSearch = ctx.getRequestParameter(OBJECTID);
      ProfileFilter filter = uiInvitations.uiProfileUserSearch.getProfileFilter();

      try {
        uiInvitations.setSelectedChar(charSearch);
        if (charSearch != null) { // search by alphabet
          filter.setName(charSearch);
          filter.setPosition("");
          filter.setSkills("");
          filter.setFirstCharacterOfName(charSearch.toCharArray()[0]);
          if (UIProfileUserSearch.ALL_FILTER.equals(charSearch)) {
            filter.setFirstCharacterOfName(UIProfileUserSearch.EMPTY_CHARACTER);
            filter.setName("");
          }
          uiSearch.setRawSearchConditional("");
        } else if (UIProfileUserSearch.ALL_FILTER.equals(uiSearch.getRawSearchConditional())) {
          uiInvitations.setSelectedChar(UIProfileUserSearch.ALL_FILTER);
        }

        uiSearch.setProfileFilter(filter);
        uiSearch.setNewSearch(true);
        uiInvitations.uiProfileUserSearch.setLoadFromSearch(true);
      } catch (Exception e) {
        uiSearch.setIdentityList(new ArrayList<Identity>());
      }

      uiInvitations.loadSearch();
      uiInvitations.setLoadAtEnd(false);
    }