Package org.exoplatform.webui.core

Examples of org.exoplatform.webui.core.UIApplication


        return getNodePath();
    }

    public String getTitle() throws Exception {
        String title = null;
        UIApplication uiApp = getUIApplication();
        UIStandaloneAppContainer container = uiApp.getChild(UIStandaloneAppContainer.class);
        if (container != null) {
            title = container.getCurrAppName();
        }

        if (title == null) {
View Full Code Here


                    LogoutControl.wantLogout();
                    prContext.setResponseComplete(true);
                    prContext.getResponse().sendRedirect(request.getContextPath());
                    return;
                } else {
                    UIApplication uiApp = prContext.getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.notExistAnymore", null));
                    prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
                }
            }
        }
View Full Code Here

            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            User newUser = (User)context.getAttribute(UIRegisterForm.ATTR_USER);

            // This means that registration has been successful
            if (newUser != null) {
                UIApplication uiApp = context.getUIApplication();
                UIRegisterForm uiRegisterForm = event.getSource();
                PortalRequestContext portalRequestContext = Util.getPortalRequestContext();

                // Save OAuth username as part of user profile of new user
                OrganizationService orgService = uiRegisterForm.getApplicationComponent(OrganizationService.class);
                UserProfileHandler profileHandler = orgService.getUserProfileHandler();
                UserProfile newUserProfile = profileHandler.findUserProfileByName(newUser.getUserName());

                AuthenticationRegistry authRegistry = uiRegisterForm.getApplicationComponent(AuthenticationRegistry.class);
                HttpServletRequest httpRequest = portalRequestContext.getRequest();
                OAuthPrincipal oauthPrincipal = (OAuthPrincipal)authRegistry.getAttributeOfClient(httpRequest, OAuthConstants.ATTRIBUTE_AUTHENTICATED_OAUTH_PRINCIPAL);

                newUserProfile.setAttribute(oauthPrincipal.getOauthProviderType().getUserNameAttrName(), oauthPrincipal.getUserName());
                try {
                    profileHandler.saveUserProfile(newUserProfile, true);
                } catch (OAuthException gtnOAuthException) {
                    // Show warning message if user with this facebookUsername (or googleUsername) already exists
                    // NOTE: It could happen only in case of parallel registration of same oauth user from more browser windows
                    if (gtnOAuthException.getExceptionCode() == OAuthExceptionCode.DUPLICATE_OAUTH_PROVIDER_USERNAME) {

                        // Drop new user
                        orgService.getUserHandler().removeUser(newUser.getUserName(), true);

                        // Clear previous message about successful creation of user because we dropped him. Add message about duplicate oauth username
                        Object[] args = new Object[] {gtnOAuthException.getExceptionAttribute(OAuthConstants.EXCEPTION_OAUTH_PROVIDER_USERNAME),
                                gtnOAuthException.getExceptionAttribute(OAuthConstants.EXCEPTION_OAUTH_PROVIDER_NAME)};
                        ApplicationMessage appMessage = new ApplicationMessage("UIAccountSocial.msg.failed-registration", args, ApplicationMessage.WARNING);
                        uiApp.addMessage(appMessage);
                        return;
                    } else {
                        throw gtnOAuthException;
                    }
                }

                // Clean portalUser from context as we don't need it anymore
                authRegistry.removeAttributeOfClient(httpRequest, OAuthConstants.ATTRIBUTE_AUTHENTICATED_PORTAL_USER);

                // Clear messages (message about successful registration of user)
                uiApp.clearMessages();

                // Close the registration popup
                UIMaskWorkspace.CloseActionListener closePopupListener = new UIMaskWorkspace.CloseActionListener();
                closePopupListener.execute((Event)event);
View Full Code Here

            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIRegisterInputSet registerInput = registerForm.getChild(UIRegisterInputSet.class);

            if (registerInput.save(userHandler, context)) {
                // TODO: Add Account Activating feature
                UIApplication uiApp = context.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIRegisterForm.registerWithSuccess.message", null));

                // Send mail to administrator after successful registration of user
                PostRegistrationService postRegistrationService = uiApp.getApplicationComponent(PostRegistrationService.class);
                User user = (User) context.getAttribute(ATTR_USER);
                postRegistrationService.sendMailAfterSuccessfulRegistration(user);
            }

            // Invalidate the capcha
View Full Code Here

                }
            }

            String typedUsername = userNameInput.getValue();
            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIApplication uiApp = context.getUIApplication();
            if (usernameIsUsed(typedUsername, orgService)) {
                uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.user-exist", new String[] { typedUsername },
                        ApplicationMessage.WARNING));
            } else {
                uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.user-not-exist", new String[] { typedUsername },
                        ApplicationMessage.INFO));
            }
        }
View Full Code Here

    public static class SelectPageActionListener extends EventListener<UIPageBrowser> {
        public void execute(Event<UIPageBrowser> event) throws Exception {
            UIPageBrowser uiPageBrowser = event.getSource();
            String id = event.getRequestContext().getRequestParameter(OBJECTID);
            WebuiRequestContext ctx = event.getRequestContext();
            UIApplication uiApp = ctx.getUIApplication();
            UIPageSelector uiPageSelector = uiPageBrowser.getAncestorOfType(UIPageSelector.class);
            UserPortalConfigService service = uiPageBrowser.getApplicationComponent(UserPortalConfigService.class);
            UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
            if (!userACL.hasPermission(service.getPageService().loadPage(PageKey.parse(id)))) {
                uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.NoPermission", new String[] { id }));
            }
            uiPageSelector.setValue(id);
            // uiPageBrowser.feedDataWithQuery(null);

            UIForm uiForm = uiPageSelector.getAncestorOfType(UIForm.class);
View Full Code Here

    /**
     * Show a popup informing that no result available for the last query
     *
     */
    public static void showNoResultMessagePopup() {
        UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
        uiApp.addMessage(new ApplicationMessage("UISearchForm.msg.empty", null));
    }
View Full Code Here

      }
      if (event == null)
      {
         return;
      }
      UIApplication uiApp = uicomponent.getAncestorOfType(UIApplication.class);
      List<UIComponent> children = uicomponent.getChildren();
      validateChildren(children, uiApp, context);

      /*List<Validator> validators = uiForm.getValidators() ;
      if(validators != null) {
        try {
          for(Validator validator : validators) validator.validate(uiForm) ;
        } catch (MessageException ex) {
          uiApp.addMessage(ex.getDetailMessage()) ;
          context.setProcessRender(true) ;
        } catch(Exception ex) {
          //TODO:  This is a  critical exception and should be handle  in the UIApplication
          uiApp.addMessage(new ApplicationMessage(ex.toString(), null)) ;       
          context.setProcessRender(true) ;
        }
      }*/

      if (context.getProcessRender())
      {
         context.addUIComponentToUpdateByAjax(uiApp.getUIPopupMessages());
         return;
      }
      event.broadcast();
   }
View Full Code Here

                    UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
                    UIPortal editPortal = (UIPortal) uiEditWS.getUIComponent();
                    uiForm.invokeSetBindingBean(editPortal);
                }
            } else {
                UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.notExistAnymore", null));

                UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
                prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
                prContext.setFullRender(true);
            }
View Full Code Here

            String template = uiForm.getChild(UIFormInputItemSelector.class).getSelectedItemOption().getValue().toString();
            String portalName = uiForm.getUIStringInput(FIELD_NAME).getValue();
            DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
            PortalConfig config = dataService.getPortalConfig(portalName);
            if (config != null) {
                UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.sameName", null));
                return;
            }

            UserPortalConfigService service = uiForm.getApplicationComponent(UserPortalConfigService.class);
            service.createUserPortalConfig(SiteType.PORTAL.getName(), portalName, template);
View Full Code Here

TOP

Related Classes of org.exoplatform.webui.core.UIApplication

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.