Package org.exoplatform.web.application

Examples of org.exoplatform.web.application.JavascriptManager


    public Text generateRenderMarkup(PortletInvocationResponse pir, WebuiRequestContext context) {
        PortalRequestContext prcontext = (PortalRequestContext) context;

        Text markup = null;
        if (pir instanceof FragmentResponse) {
            JavascriptManager jsMan = context.getJavascriptManager();
            jsMan.loadScriptResource(ResourceScope.PORTLET, getApplicationId());

            FragmentResponse fragmentResponse = (FragmentResponse) pir;
            switch (fragmentResponse.getType()) {
                case FragmentResponse.TYPE_CHARS:
                    markup = Text.create(fragmentResponse.getContent());
                    break;
                case FragmentResponse.TYPE_BYTES:
                    markup = Text.create(fragmentResponse.getBytes(), Charset.forName("UTF-8"));
                    break;
                case FragmentResponse.TYPE_EMPTY:
                    markup = Text.create("");
                    break;
            }
            setConfiguredTitle(fragmentResponse.getTitle());

            // setup portlet properties
            if (fragmentResponse.getProperties() != null) {
                // setup transport headers
                if (fragmentResponse.getProperties().getTransportHeaders() != null) {
                    MultiValuedPropertyMap<String> transportHeaders = fragmentResponse.getProperties().getTransportHeaders();
                    for (String key : transportHeaders.keySet()) {
                        if (JAVASCRIPT_DEPENDENCY.equals(key)) {
                            for (String value : transportHeaders.getValues(key)) {
                                jsMan.require(value);
                            }
                        } else {
                            for (String value : transportHeaders.getValues(key)) {
                                prcontext.getResponse().setHeader(key, value);
                            }
View Full Code Here


    public void setWorkingComponent(UIComponent component) {
        setUIComponent(component);
    }

    public void processRender(WebuiRequestContext context) throws Exception {
        JavascriptManager jsmanager = context.getJavascriptManager();

        super.processRender(context);
        if (showMaskLayer) {
            jsmanager.require("SHARED/UIMaskLayer", "mask").addScripts("mask.createMask('UIPortalToolPanel', null, 10) ;");
        }
    }
View Full Code Here

                state.setAttribute(CacheUserProfileFilter.USER_PROFILE, user);
                UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
                uiWorkingWS.updatePortletsByName("UserInfoPortlet");
                uiWorkingWS.updatePortletsByName("OrganizationPortlet");
            } else {
                JavascriptManager jsManager = Util.getPortalRequestContext().getJavascriptManager();
                jsManager.require("SHARED/base").addScripts(
                        "if(confirm('"
                                + Util.getPortalRequestContext().getApplicationResourceBundle()
                                        .getString("UIAccountProfiles.msg.NotExistingAccount") + "')) {eXo.portal.logout();}");
            }
        }
View Full Code Here

            w.write("</div>");
            w.write("<div class=\"LoadingScripts\">");
            writeLoadingScripts(context);
            w.write("</div>");
            w.write("<div class=\"PortalResponseScript\">");
            JavascriptManager jsManager = context.getJavascriptManager();
            w.write(jsManager.getJavaScripts());
            w.write("</div>");
            w.write("</div>");
        }
    }
View Full Code Here

        w.write("</div>");
    }

    public Map<String, Boolean> getScripts() {
        WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
        JavascriptManager jsMan = context.getJavascriptManager();

        // Need to add bootstrap as immediate since it contains the loader
        jsMan.loadScriptResource(ResourceScope.SHARED, "bootstrap");

        //
        FetchMap<ResourceId> requiredResources = jsMan.getScriptResources();
        log.debug("Resource ids to resolve: {}", requiredResources);

        //
        JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
        LinkedHashMap<String, Boolean> ret = new LinkedHashMap<String, Boolean>();
        Map<ScriptResource, FetchMode> tmp = service.resolveIds(requiredResources);
        for (ScriptResource rs : tmp.keySet()) {
            ResourceId id = rs.getId();
            boolean isRemote = !rs.isEmpty() && rs.getModules().get(0) instanceof Module.Remote;
            ret.put(id.toString(), isRemote);
        }
        for (String url : jsMan.getExtendedScriptURLs()) {
            ret.put(url, true);
        }

        //
        log.debug("Resolved resources for page: " + ret);
View Full Code Here

                uiMaskWS.setUIComponent(uiAccountForm);
                uiMaskWS.setShow(true);
                event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
            } else {
                // Show message detail to user and then logout if user press ok button
                JavascriptManager jsManager = Util.getPortalRequestContext().getJavascriptManager();
                jsManager.require("SHARED/base").addScripts(
                        "if(confirm('"
                                + Util.getPortalRequestContext().getApplicationResourceBundle()
                                        .getString("UIAccountProfiles.msg.NotExistingAccount") + "')) {eXo.portal.logout();}");
            }
        }
View Full Code Here

                UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
                uiWorkingWS.updatePortletsByName("UserInfoPortlet");
                uiWorkingWS.updatePortletsByName("OrganizationPortlet");
            } else {
                JavascriptManager jsManager = Util.getPortalRequestContext().getJavascriptManager();
                jsManager.require("SHARED/base").addScripts(
                        "if(confirm('"
                                + Util.getPortalRequestContext().getApplicationResourceBundle()
                                .getString("UIAccountProfiles.msg.NotExistingAccount") + "')) {eXo.portal.logout();}");
            }
        }
View Full Code Here

                case UIPortalApplication.CONTAINER_VIEW_EDIT_MODE:
                    Util.showComponentEditInViewMode(UIPortlet.class);
                    break;
            }
        }
        JavascriptManager jsManager = Util.getPortalRequestContext().getJavascriptManager();
        jsManager.require("SHARED/portal", "portal").addScripts("eXo.portal.portalMode=" + portalMode + ";");
    }
View Full Code Here

        super(app);

        //
        this.urlFactory = (URLFactoryService) PortalContainer.getComponent(URLFactoryService.class);
        this.controllerContext = controllerContext;
        this.jsmanager_ = new JavascriptManager();

        //
        request_ = controllerContext.getRequest();
        response_ = controllerContext.getResponse();
        response_.setBufferSize(1024 * 100);
 
View Full Code Here

            SiteKey siteKey = currentNode.getNavigation().getKey();
            PageNodeEvent<UIPortalApplication> pnevent = new PageNodeEvent<UIPortalApplication>(uiPortalApp,
                    PageNodeEvent.CHANGE_NODE, siteKey, currentNode.getURI());
            uiPortalApp.broadcast(pnevent, Event.Phase.PROCESS);
            prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
            JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
            jsManager.require("SHARED/portal", "portal").addScripts(
                    "eXo.portal.portalMode=" + UIPortalApplication.NORMAL_MODE + ";");
        }
View Full Code Here

TOP

Related Classes of org.exoplatform.web.application.JavascriptManager

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.