You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Nicolas Lafaury <ni...@smile.fr> on 2006/04/06 09:46:46 UTC

Problem with custom mode

Hello, 

I have declared this part in my portlet.xml

		<supports>
			<mime-type>text/html</mime-type>
			<portlet-mode>edit</portlet-mode>
			<portlet-mode>help</portlet-mode>
			<portlet-mode>about</portlet-mode>
			<portlet-mode>print</portlet-mode>
		</supports>

Then I add 

		<custom-portlet-mode>
			<description>Mode pour indiquer l'auteur de la
portlet par exemple</description>
			<name>about</name>
		</custom-portlet-mode>

		<custom-portlet-mode>
			<description>Mode pour
l'impression</description>
			<name>print</name>
		</custom-portlet-mode> 

But is it enough?  Because when I test the supported mode in doView

		Enumeration modeEnum =
request.getPortalContext().getSupportedPortletModes();
		writer.write("<p>Modes <br />");
		while (modeEnum.hasMoreElements()) {
			PortletMode pMode = (PortletMode)
modeEnum.nextElement();
			PortletURL modeUrl = response.createRenderURL();
			modeUrl.setPortletMode(pMode);
			writer.write("<li> <a href=\"" +
modeUrl.toString() + "\">" + pMode + "</a></li>");
		}
		writer.write("</p>");

I didn't retrieve my custom mode. 

My error appears when I tried to create a link on it :
javax.portlet.PortletModeException: unsupported Portlet Mode used: print

		PortletURL printModeUrl = response.createRenderURL();
		printModeUrl.setPortletMode(PRINT);


I have exactly the same probleme on Jboss.

Thanks for your help.

Nicolas

Nicolas LAFAURY
Smile- Motoriste Internet
01-41-40-11-05
nicolas.lafaury@smile.fr
 

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Problem with custom mode

Posted by Ate Douma <at...@douma.nu>.
Nicolas,

I think I can help you out for Jetspeed. Just wait a few more days :)
I'm working on providing "print" mode as well as "solo" state for Jetspeed-2 right now.
Expect that to become available early next week.

The reason the portal isn't providing you with the "print" mode from PortalContext.getSupportedPrintModes()
is because its a custom mode which the *portal* needs to support also. Its an optional mode, not required for
a portal to provide.
Thus, trying to invoke it (or just define it on a PortletURL) will (have to) result in a PortletModeException.

As I said, for Jetspeed, this will become available within days.
For other portals like JBoss and uPortal you'll have to check their documentation if they support is and
if so how to enable it.

The way I'm going to provide it for Jetspeed-2 will be quite flexible in that you can name your own custom
PortletMode anyway you like and "map" that onto the Jetspeed-2 internally provided "print" PortletMode.

Same goes for the new custom "solo" WindowState. This is sometimes called "popup" or "detached" by other
portals, but with our mapping solution that won't really matter anymore :)

Regards, Ate


Nicolas Lafaury wrote:
> Hello, 
> 
> I have declared this part in my portlet.xml
> 
> 		<supports>
> 			<mime-type>text/html</mime-type>
> 			<portlet-mode>edit</portlet-mode>
> 			<portlet-mode>help</portlet-mode>
> 			<portlet-mode>about</portlet-mode>
> 			<portlet-mode>print</portlet-mode>
> 		</supports>
> 
> Then I add 
> 
> 		<custom-portlet-mode>
> 			<description>Mode pour indiquer l'auteur de la
> portlet par exemple</description>
> 			<name>about</name>
> 		</custom-portlet-mode>
> 
> 		<custom-portlet-mode>
> 			<description>Mode pour
> l'impression</description>
> 			<name>print</name>
> 		</custom-portlet-mode> 
> 
> But is it enough?  Because when I test the supported mode in doView
> 
> 		Enumeration modeEnum =
> request.getPortalContext().getSupportedPortletModes();
> 		writer.write("<p>Modes <br />");
> 		while (modeEnum.hasMoreElements()) {
> 			PortletMode pMode = (PortletMode)
> modeEnum.nextElement();
> 			PortletURL modeUrl = response.createRenderURL();
> 			modeUrl.setPortletMode(pMode);
> 			writer.write("<li> <a href=\"" +
> modeUrl.toString() + "\">" + pMode + "</a></li>");
> 		}
> 		writer.write("</p>");
> 
> I didn't retrieve my custom mode. 
> 
> My error appears when I tried to create a link on it :
> javax.portlet.PortletModeException: unsupported Portlet Mode used: print
> 
> 		PortletURL printModeUrl = response.createRenderURL();
> 		printModeUrl.setPortletMode(PRINT);
> 
> 
> I have exactly the same probleme on Jboss.
> 
> Thanks for your help.
> 
> Nicolas
> 
> Nicolas LAFAURY
> Smile- Motoriste Internet
> 01-41-40-11-05
> nicolas.lafaury@smile.fr
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org