Example usage for com.liferay.portal.kernel.util WebKeys RENDER_PORTLET

List of usage examples for com.liferay.portal.kernel.util WebKeys RENDER_PORTLET

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util WebKeys RENDER_PORTLET.

Prototype

String RENDER_PORTLET

To view the source code for com.liferay.portal.kernel.util WebKeys RENDER_PORTLET.

Click Source Link

Usage

From source file:com.liferay.portlet.configuration.sharing.web.internal.portlet.configuration.icon.NetvibesPortletConfigurationIcon.java

License:Open Source License

protected String getWidgetURL(PortletRequest portletRequest) throws PortalException {

    Portlet portlet = (Portlet) portletRequest.getAttribute(WebKeys.RENDER_PORTLET);

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    return _portal.getWidgetURL(portlet, themeDisplay);
}

From source file:com.liferay.portlet.PortletURLUtil.java

License:Open Source License

public static String getRefreshURL(HttpServletRequest request, ThemeDisplay themeDisplay) {

    StringBundler sb = new StringBundler(32);

    sb.append(themeDisplay.getPathMain());
    sb.append("/portal/render_portlet?p_l_id=");

    long plid = themeDisplay.getPlid();

    sb.append(plid);/*from ww  w. ja  v a  2s.c om*/

    Portlet portlet = (Portlet) request.getAttribute(WebKeys.RENDER_PORTLET);

    String portletId = portlet.getPortletId();

    sb.append("&p_p_id=");
    sb.append(portletId);

    sb.append("&p_p_lifecycle=0&p_t_lifecycle=");
    sb.append(themeDisplay.getLifecycle());

    WindowState windowState = WindowState.NORMAL;

    if (themeDisplay.isStatePopUp()) {
        windowState = LiferayWindowState.POP_UP;
    } else {
        LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

        if (layoutTypePortlet.hasStateMaxPortletId(portletId)) {
            windowState = WindowState.MAXIMIZED;
        } else if (layoutTypePortlet.hasStateMinPortletId(portletId)) {
            windowState = WindowState.MINIMIZED;
        }
    }

    sb.append("&p_p_state=");
    sb.append(windowState);

    sb.append("&p_p_mode=view&p_p_col_id=");

    String columnId = (String) request.getAttribute(WebKeys.RENDER_PORTLET_COLUMN_ID);

    sb.append(columnId);

    Integer columnPos = (Integer) request.getAttribute(WebKeys.RENDER_PORTLET_COLUMN_POS);

    sb.append("&p_p_col_pos=");
    sb.append(columnPos);

    Integer columnCount = (Integer) request.getAttribute(WebKeys.RENDER_PORTLET_COLUMN_COUNT);

    sb.append("&p_p_col_count=");
    sb.append(columnCount);

    if (portlet.isStatic()) {
        sb.append("&p_p_static=1");

        if (portlet.isStaticStart()) {
            sb.append("&p_p_static_start=1");
        }
    }

    sb.append("&p_p_isolated=1");

    String doAsUserId = themeDisplay.getDoAsUserId();

    if (Validator.isNotNull(doAsUserId)) {
        sb.append("&doAsUserId=");
        sb.append(HttpUtil.encodeURL(doAsUserId));
    }

    String currentURL = PortalUtil.getCurrentURL(request);

    sb.append("&currentURL=");
    sb.append(HttpUtil.encodeURL(currentURL));

    String ppid = ParamUtil.getString(request, "p_p_id");

    if (ppid.equals(portletId)) {
        String namespace = PortalUtil.getPortletNamespace(portletId);

        Map<String, String[]> parameters = request.getParameterMap();

        for (Map.Entry<String, String[]> entry : parameters.entrySet()) {
            String name = entry.getKey();

            if (!PortalUtil.isReservedParameter(name) && !name.equals("currentURL")
                    && !isRefreshURLReservedParameter(name, namespace)) {

                String[] values = entry.getValue();

                for (int i = 0; i < values.length; i++) {
                    sb.append(StringPool.AMPERSAND);
                    sb.append(name);
                    sb.append(StringPool.EQUAL);
                    sb.append(HttpUtil.encodeURL(values[i]));
                }
            }
        }
    }

    String outerPortletId = PortalUtil.getOuterPortletId(request);

    if (outerPortletId != null) {
        sb.append(StringPool.AMPERSAND);
        sb.append("p_o_p_id");
        sb.append(StringPool.EQUAL);
        sb.append(HttpUtil.encodeURL(outerPortletId));
    }

    return sb.toString();
}

From source file:com.liferay.taglib.ui.InputEditorTag.java

License:Open Source License

@Override
protected void setAttributes(HttpServletRequest request) {
    String cssClasses = "portlet ";

    Portlet portlet = (Portlet) request.getAttribute(WebKeys.RENDER_PORTLET);

    if (portlet != null) {
        cssClasses += portlet.getCssClassWrapper();
    }/*  w w  w .j  a  v  a 2 s . com*/

    String editorImpl = EditorUtil.getEditorValue(request, _editorImpl);

    _page = "/html/js/editor/" + editorImpl + ".jsp";

    request.setAttribute("liferay-ui:input-editor:configParams", _configParams);
    request.setAttribute("liferay-ui:input-editor:cssClass", _cssClass);
    request.setAttribute("liferay-ui:input-editor:cssClasses", cssClasses);
    request.setAttribute("liferay-ui:input-editor:editorImpl", editorImpl);
    request.setAttribute("liferay-ui:input-editor:fileBrowserParams", _fileBrowserParams);
    request.setAttribute("liferay-ui:input-editor:height", _height);
    request.setAttribute("liferay-ui:input-editor:initMethod", _initMethod);
    request.setAttribute("liferay-ui:input-editor:name", _name);
    request.setAttribute("liferay-ui:input-editor:onChangeMethod", _onChangeMethod);
    request.setAttribute("liferay-ui:input-editor:skipEditorLoading", String.valueOf(_skipEditorLoading));
    request.setAttribute("liferay-ui:input-editor:toolbarSet", _toolbarSet);
    request.setAttribute("liferay-ui:input-editor:width", _width);
}