You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by curro <fr...@avarmar.com> on 2010/03/09 15:55:55 UTC

RE: Hide portlet

Hello,

Well, finally I've not be capable to hide portlets dynamically. I'm not
sure, but I think that no works. The renderRequest.getAttribute() in
decorator.vm does not recover the attributes (none) that I put in the render
phase of my portlet (for example "js_" + Fragment.getId() +
"_HideDecorator",...). 

Nevertheless, I have solved my problem otherwise, but possibly you will not
like it. In the render phase, I recover the fragment from the request and
change his status for hidden...

Fragment F = (Fragment)request.getAttribute("org.apache.jetspeed.Fragment");
F.setState("hidden");

Well, this only hide a part of the portlet... I need hide all it. I have to
change my decorator.vm...

If I put a new fragment state... like "excluded", and I put in the decorator
some conditional tags, I can hide my portlet. 


<!-- Begin: Fragment: ${f.id} Decoration: ${decoration.Name} -->
#set($estado = $f.getState())
#if ($estado == "excluded")
	##to put the state at null again
	$f.setState(null)
#else
<div id="${f.id}" class="portlet ${decoration.baseCSSClass}">
...

...
</div>
#end
<!-- END: Fragment: ${f.id} Decoration: ${decoration.Name} -->

This one is the only way that it works. For the present time it works...

Regards
Francisco Rosado

-----Original Message-----
From: curro [mailto:franciscojavier.rosado@avarmar.com] 
Sent: jueves, 25 de febrero de 2010 9:40
To: 'Jetspeed Developers List'
Subject: RE: Hide portlet

Thanks David,

In my portlet, my doView method is:

public void doView(RenderRequest request, RenderResponse response)
       throws PortletException, IOException{
	
	Fragment F =
(Fragment)request.getAttribute("org.apache.jetspeed.Fragment");

	request.setAttribute("js"+F.getId()+"HideDecorator", new
Boolean(true));
	request.setAttribute("HideDecorator", new Boolean(true));
	request.setAttribute("Curro", "curro");

	response.setContentType("text/html");
	String jspName = getPortletConfig().getInitParameter("jspView");
	PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher(jspName);
	rd.include(request,response);
  }

in the decorator I do:

	#set($hidePortlet =
$renderRequest.getAttribute("js_${jetspeed.CurrentFragment.Id}_HideDecorator
")) 
	#set($Curro = $renderRequest.getAttribute("Curro"))

And I try to see his values in the screen for controlling if the attributes
arrive:

Oculto? = ${hidePortlet}
Solo? =   ${solo} 
Curro? = ${Curro}
fragmento? = ${jetspeed.CurrentFragment.Id}

#if (!$solo && !$hidePortlet)
    <div class="PTitle" >
      <div class="PTitleContent">
	...

And the result is 
oculto? =${hidePortlet} Solo? =   false Curro? = ${Curro} fragmento? =
dp-02-20.

And portlet is not hidden.

mmm... I'm doing something wrong, but I don't know... I tried it in my
custom portal and a binary of jetspeed. :(

Regards


-----Original Message-----
From: David Sean Taylor [mailto:d.taylor@onehippo.com] 
Sent: miércoles, 24 de febrero de 2010 23:37
To: Jetspeed Developers List
Subject: Re: Hide portlet

On Wed, Feb 24, 2010 at 5:02 AM, curro
<fr...@avarmar.com>wrote:

> Hello
>
> I understand RenderRequest is a subinterface of PortletRequest. Then, I
> thought that doing in the doView method of my Portlet
> RenderRequest.setAttribute("HideDecorator", new Boolean(true)), works.
>
> But the attribute not comes to decorator.vm. I make
> RenderRequest.setAttribute("Qro", "qro") and not comes to decorator.vm.
>
> Look at the velocity code in the decorator:

   #set($hidePortlet = $renderRequest.getAttribute("js_${
jetspeed.CurrentFragment.Id}_HideDecorator"))

The attribute name is specific to the current fragment window id


>
> Please, What am I doing wrong? The issue JS2-710 is not clear for me. The
> method getPortletRequest() confused me.
>
>
ignore the getPortletRequest(), that is confusing, its just a plain old
renderRequest

Se certificó que el correo entrante no contiene virus.
Comprobada por AVG - www.avg.es 
Versión: 9.0.733 / Base de datos de virus: 271.1.1/2707 - Fecha de la
versión: 02/24/10 08:34:00


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


Se certificó que el correo entrante no contiene virus.
Comprobada por AVG - www.avg.es 
Versión: 9.0.733 / Base de datos de virus: 271.1.1/2707 - Fecha de la
versión: 02/24/10 20:34:00


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