public void execute(Event<UIPortal> event) throws Exception {
   UIPortal uiPortal = event.getSource();
   String portletId = event.getRequestContext().getRequestParameter("portletId");
   UIPortlet uiPortlet = uiPortal.findComponentById(portletId);
   WebuiRequestContext context = event.getRequestContext();
   uiPortlet.createEvent("ChangeWindowState", event.getExecutionPhase(), context).broadcast();
 }
 public void loadView(Event<? extends UIComponent> event) throws Exception {
   UISpaceNavigationNodeSelector uiNodeSelector = getChild(UISpaceNavigationNodeSelector.class);
   UITree uiTree = uiNodeSelector.getChild(UITree.class);
   uiTree
       .createEvent("ChangeNode", event.getExecutionPhase(), event.getRequestContext())
       .broadcast();
 }
    public void execute(Event<UISocialGroupSelector> event) throws Exception {
      UISocialGroupSelector uiSelector = event.getSource();
      UIComponent uiPermission = uiSelector.<UIComponent>getParent().getParent();
      WebuiRequestContext pcontext = event.getRequestContext();

      UIPopupWindow uiPopup = uiSelector.getParent();
      UIForm uiForm = event.getSource().getAncestorOfType(UIForm.class);
      if (uiForm != null) {
        event.getRequestContext().addUIComponentToUpdateByAjax(uiForm.getParent());
      } else {
        event.getRequestContext().addUIComponentToUpdateByAjax(uiPopup);
      }
      if (uiSelector.getCurrentGroup() == null) {
        UIApplication uiApp = pcontext.getUIApplication();
        uiApp.addMessage(new ApplicationMessage("UIGroupSelector.msg.selectGroup", null));
        // pcontext.addUIComponentToUpdateByAjax(uiApp.getUIPopupMessages());
        uiPopup.setShow(true);
        return;
      }

      uiPermission.broadcast(event, event.getExecutionPhase());
      uiPopup.setShow(false);
    }
Esempio n. 4
0
    public void execute(Event<UIUserSelector> event) throws Exception {
      UIUserSelector uiForm = event.getSource();
      StringBuilder sb = new StringBuilder();

      uiForm.setSelectedItem();

      // get item from selected item map
      Set<String> items = uiForm.uiIterator_.getSelectedItems();
      if (items.size() == 0) {
        UIApplication uiApp = uiForm.getAncestorOfType(UIApplication.class);
        uiApp.addMessage(new ApplicationMessage("UIUserSelector.msg.user-required", null));
        return;
      }
      String[] arrItems = items.toArray(new String[items.size()]);
      Arrays.sort(arrItems);

      for (String key : arrItems) {
        if (sb.toString() != null && sb.toString().trim().length() != 0) sb.append(",");
        sb.append(key);
      }

      uiForm.setSelectedUsers(sb.toString());
      uiForm.<UIComponent>getParent().broadcast(event, event.getExecutionPhase());
    }
Esempio n. 5
0
    public void execute(Event<UIPageForm> event) throws Exception {
      UIPageForm uiPageForm = event.getSource();
      UIPortalApplication uiPortalApp = uiPageForm.getAncestorOfType(UIPortalApplication.class);
      PortalRequestContext pcontext = Util.getPortalRequestContext();
      UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
      uiMaskWS.setUIComponent(null);
      uiMaskWS.setShow(false);
      pcontext.addUIComponentToUpdateByAjax(uiMaskWS);

      UIPage uiPage = uiPageForm.getUIPage();
      if (uiPage == null) return;
      String storageId = uiPage.getStorageId();
      Page page = new Page();
      page.setPageId(uiPage.getPageId());
      uiPageForm.invokeSetBindingBean(page);
      page.setOwnerType(uiPage.getOwnerType());
      List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
      findAllPortlet(uiPortlets, uiPage);
      ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
      for (UIPortlet uiPortlet : uiPortlets) {
        applications.add(PortalDataMapper.buildModelObject(uiPortlet));
      }

      if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId())
          && !Page.DESKTOP_PAGE.equals(page.getFactoryId())) {
        page.setShowMaxWindow(false);
        uiPage.getChildren().clear();
        page.setChildren(applications);

        PortalDataMapper.toUIPage(uiPage, page);
        //        if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
        if (page.getChildren() == null) page.setChildren(new ArrayList<ModelObject>());

        //        uiEditBar.setUIPage(uiPage);
        //        Class<?> [] childrenToRender = {UIPageEditBar.class,
        //            UIPageNodeSelector.class, UIPageNavigationControlBar.class};
        //        uiManagement.setRenderedChildrenOfTypes(childrenToRender);

        pcontext.setFullRender(true);
        UIWorkingWorkspace uiWorkingWS =
            uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
        pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);

        return;
      }

      if (Page.DESKTOP_PAGE.equals(page.getFactoryId())) {
        uiPage.getChildren().clear();
        page.setChildren(applications);

        PortalDataMapper.toUIPage(uiPage, page);
        //        if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
        if (page.getChildren() == null) page.setChildren(new ArrayList<ModelObject>());

        UIPortalToolPanel toolPanel = Util.getUIPortalToolPanel();
        toolPanel.setShowMaskLayer(true);
        pcontext.setFullRender(true);
        UIWorkingWorkspace uiWorkingWS =
            uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
        pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
        DataStorage dataService = uiPageForm.getApplicationComponent(DataStorage.class);
        dataService.save(page);
        return;
      }

      List<UIComponent> uiChildren = uiPage.getChildren();
      if (uiChildren == null) {
        PortalDataMapper.toUIPage(uiPage, page);
        return;
      }
      ArrayList<ModelObject> children = new ArrayList<ModelObject>();
      for (UIComponent child : uiChildren) {
        ModelObject component = PortalDataMapper.buildModelObject(child);
        if (component != null) children.add(component);
      }
      page.setChildren(children);
      uiPage.getChildren().clear();

      try {
        PortalDataMapper.toUIPage(uiPage, page);
      } catch (NoSuchDataException de) {
        uiPortalApp.addMessage(
            new ApplicationMessage(
                "UIPageForm.msg.notExistOrDeleted", null, ApplicationMessage.ERROR));
        UIPortalComposer uiPortalComposer =
            (UIPortalComposer) uiPortalApp.findComponentById("UIPageEditor");
        if (uiPortalComposer != null) {
          Event aboutEvent =
              new Event<UIPortalComposer>(uiPortalComposer, "Abort", event.getRequestContext());
          uiPortalComposer.broadcast(aboutEvent, event.getExecutionPhase());
        }
      }

      uiPage.setStorageId(storageId);
      //      if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
      if (page.getChildren() == null) page.setChildren(new ArrayList<ModelObject>());
    }
Esempio n. 6
0
 public void execute(Event<UIUserSelector> event) throws Exception {
   UIUserSelector uiForm = event.getSource();
   uiForm.<UIComponent>getParent().broadcast(event, event.getExecutionPhase());
 }
Esempio n. 7
0
 public void execute(Event<UIUserSelector> event) throws Exception {
   UIUserSelector uiForm = event.getSource();
   String userName = event.getRequestContext().getRequestParameter(OBJECTID);
   uiForm.setSelectedUsers(userName);
   uiForm.<UIComponent>getParent().broadcast(event, event.getExecutionPhase());
 }