Forums de discussion

Maximize portlet in Edit mode

Adrien G, modifié il y a 13 années.

Maximize portlet in Edit mode

New Member Publications: 14 Date d'inscription: 15/10/10 Publications récentes
Hi all ! emoticon

How to change the default URL of edit mode ? Because for my own portlet, the edit mode uses the "normal" window state instead of "maximized". (p_p_state=normal)

Thanks, bye ;)
thumbnail
mohammed azam, modifié il y a 13 années.

RE: Maximize portlet in Edit mode

Regular Member Publications: 159 Date d'inscription: 06/11/09 Publications récentes
Adrien G:
Hi all ! emoticon

How to change the default URL of edit mode ? Because for my own portlet, the edit mode uses the "normal" window state instead of "maximized". (p_p_state=normal)

Thanks, bye ;)


Hi check this sample code... and implement it accordingly
PortletURL portletURL = renderResponse.createRenderURL();

portletURL.setWindowState(WindowState.MAXIMIZED);
Adrien G, modifié il y a 13 années.

RE: Maximize portlet in Edit mode

New Member Publications: 14 Date d'inscription: 15/10/10 Publications récentes
Thanks momo for your reply! ;)

I put this in my edit.jsp and I get "WindowState cannot be resolved"

Here is my code :


<%@ page contentType="text/html"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="core"%>

<%@ page import="javax.faces.context.FacesContext"%>

<portlet:defineobjects />

&lt;%
    PortletURL portletURL = renderResponse.createRenderURL();
    portletURL.setWindowState(WindowState.MAXIMIZED);
%&gt;



(I want to use JSF in the near future)

Thank you emoticon
thumbnail
Masroor Khan, modifié il y a 13 années.

RE: Maximize portlet in Edit mode

Regular Member Publications: 124 Date d'inscription: 09/09/08 Publications récentes
Hi,

you need to include init.jsp in you jsp page.


Regards,

Masroor
thumbnail
mohammed azam, modifié il y a 13 années.

RE: Maximize portlet in Edit mode

Regular Member Publications: 159 Date d'inscription: 06/11/09 Publications récentes
include this jsp file
<%@ include file="/html/portlet/init.jsp" %>

else directly import the package

<%@ page import="javax.portlet.WindowState" %>
Adrien G, modifié il y a 13 années.

RE: Maximize portlet in Edit mode

New Member Publications: 14 Date d'inscription: 15/10/10 Publications récentes
Thanks guys for your advise,
<%@ page import="javax.portlet.WindowState" %> works, I don't have any errors but no changes !

Here is my code :


&lt;%@ page contentType="text/html"%&gt;
&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;
&lt;%@ taglib uri="http://java.sun.com/jsf/html" prefix="html"%&gt;
&lt;%@ taglib uri="http://java.sun.com/jsf/core" prefix="core"%&gt;

&lt;%@ page import="javax.faces.context.FacesContext"%&gt;
&lt;%@ page import="javax.portlet.WindowState" %&gt;
&lt;%@page import="javax.portlet.PortletURL"%&gt;
&lt;%@page import="javax.portlet.RenderResponse"%&gt;

<portlet:defineobjects />

&lt;%
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setWindowState(WindowState.MAXIMIZED);

out.print(portletURL.toString());
%&gt;

<p>Edit mode</p>


The portletURL is printed, and this is the good one. So the page should be reload with this url.

Any ideas ? Thanks
Adrien G, modifié il y a 13 années.

RE: Maximize portlet in Edit mode

New Member Publications: 14 Date d'inscription: 15/10/10 Publications récentes
Ok I just add this to liferay-portlet.xml, and that's enough emoticon


<liferay-portlet-app>
    <portlet>
        <portlet-name>menu-portlet</portlet-name>
        <icon>/icon.png</icon>
        [color=#F01818][size=7][b]<maximize-edit>true</maximize-edit>[/b][/size][/color]
        <instanceable>true</instanceable>        
        <header-portlet-css>/css/main.css</header-portlet-css>
        <footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
    </portlet>
    ...
</liferay-portlet-app>


Thanks ;)