Re: How do I set the portlet title - in the portlet?

2001-08-31 Thread Raphaël Luta

Chris Kimpton wrote:

> Hi,
> 
> --- Raphaël Luta <[EMAIL PROTECTED]> wrote:
> 
>>
>>Chris Kimpton wrote:
>>
>>It all depends on when do you try to set up the title:
>>- if it's during the the getContent() call, then it depends on the
>>control implementation
>>  because if getContent is only called when needed, the portlet
>>title is already rendered...
>>  If you're using on Velocity, you can modify the control template
>>to do something like
>>  this :
>>
>>#if( ! $portlet.isClosed($data) )
>>#set ($content = $portlet.getContent($data))
>>
> 
> I have code like the above in my jetspeed.vm and have just switched
> to the latest jetspeed code from CVS - I am getting a problem where
> the first portlet has the content displayed before the title, but
> then the remainding portlets are displayed correctly.
> 
> Could this be a velocity problem - something to do with the #set
> command?
> 


This is related to the JSP inside Velocity fix: since JSP always stream
their response and it's not possible to intercept their response in servlet
2.2 environments; the default behavior for VelocityPortlet is now
to stream its response directly.

You can simply subclass VelocityPortlet.java to VelocityBufferedPortlet.java,
copy getContent() and patch it this way:

151c151
< TurbineVelocity.handleRequest(context, templatePath, rundata.getOut());
---
 > s = TurbineVelocity.handleRequest(context, templatePath);

You can then use the VelocityBufferedPortlet as the parent for your portlets that

require this title manipulation and keep the base VelocityPortlet for the others
(especially the Customization portlets that need the streaming features to work).

--
Raphael Luta - [EMAIL PROTECTED]
Vivendi Universal Networks - Paris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How do I set the portlet title - in the portlet?

2001-08-31 Thread Chris Kimpton

Hi,

--- Raphaël Luta <[EMAIL PROTECTED]> wrote:
> 
> 
> Chris Kimpton wrote:
> > 
> 
> It all depends on when do you try to set up the title:
> - if it's during the the getContent() call, then it depends on the
> control implementation
>   because if getContent is only called when needed, the portlet
> title is already rendered...
>   If you're using on Velocity, you can modify the control template
> to do something like
>   this :
> 
> #if( ! $portlet.isClosed($data) )
> #set ($content = $portlet.getContent($data))

I have code like the above in my jetspeed.vm and have just switched
to the latest jetspeed code from CVS - I am getting a problem where
the first portlet has the content displayed before the title, but
then the remainding portlets are displayed correctly.

Could this be a velocity problem - something to do with the #set
command?

Thanks for any insights,
Chris

=
Need somewhere to Live in London - http://freeflats.com

__
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How do I set the portlet title - in the portlet?

2001-07-04 Thread Chris Kimpton

Hi,

> 
> If you also modified the end of the control to use $content instead
> of
> $portlet.getContent($data) then no, you have no penalty: You just
> build
> the portlet content before the control content instead of building
> it
> within the control content but you'll never be able to include
> 'direct
> stream' portlets like JSP even when the Velocity/JSP is resolved.
> 

Thanks for that - I only noticed the first bit of the change - and
not even realised it was in there later - doh!

...and its only 6:15pm here, so I can't blame it on working late!

Chris

=
Need somewhere to Live in London - http://freeflats.com

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How do I set the portlet title - in the portlet?

2001-07-04 Thread Raphaël Luta

Chris Kimpton wrote:

> Hi,
> 
> --- Raphaël Luta <[EMAIL PROTECTED]> wrote:
> 
>>
>>Chris Kimpton wrote:
>>
>>>
>>>In the advanced version I want to set the portlet title, so I
>>>
>>have
>>
>>>this code
>>>
>>>portlet.setTitle("Advanced Search");
>>>
>>>Where portlet is the VelocityPortlet parameter into the
>>>buildNormalContext method.
>>>
>>>This does not seem to work, I always get the title specified in
>>>
>>the
>>
>>>.xreg file...
>>>
>>>
>>It all depends on when do you try to set up the title:
>>- if it's during the the getContent() call, then it depends on the
>>control implementation
>>  because if getContent is only called when needed, the portlet
>>title is already rendered...
>>  If you're using on Velocity, you can modify the control template
>>to do something like
>>  this :
>>
>>#if( ! $portlet.isClosed($data) )
>>
> 
>>#set ($content = $portlet.getContent($data))
>>
> 
> That worked great - but is there any overhead in doing this?  That
> is, am I now building the content twice perhaps?
> 


If you also modified the end of the control to use $content instead of
$portlet.getContent($data) then no, you have no penalty: You just build
the portlet content before the control content instead of building it
within the control content but you'll never be able to include 'direct
stream' portlets like JSP even when the Velocity/JSP is resolved.

--
Raphael Luta - [EMAIL PROTECTED]
Vivendi Universal Networks - Paris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How do I set the portlet title - in the portlet?

2001-07-04 Thread Chris Kimpton

Hi,

--- Raphaël Luta <[EMAIL PROTECTED]> wrote:
> 
> 
> Chris Kimpton wrote:
> > 
> > 
> > In the advanced version I want to set the portlet title, so I
> have
> > this code
> > 
> > portlet.setTitle("Advanced Search");
> > 
> > Where portlet is the VelocityPortlet parameter into the
> > buildNormalContext method.
> > 
> > This does not seem to work, I always get the title specified in
> the
> > .xreg file...
> > 
> 
> It all depends on when do you try to set up the title:
> - if it's during the the getContent() call, then it depends on the
> control implementation
>   because if getContent is only called when needed, the portlet
> title is already rendered...
>   If you're using on Velocity, you can modify the control template
> to do something like
>   this :
> 
> #if( ! $portlet.isClosed($data) )

> #set ($content = $portlet.getContent($data))

That worked great - but is there any overhead in doing this?  That
is, am I now building the content twice perhaps?

Thanks,
Chris

=
Need somewhere to Live in London - http://freeflats.com

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How do I set the portlet title - in the portlet?

2001-07-04 Thread Raphaël Luta



Chris Kimpton wrote:
> 
> Hi,
> 
> I am still working on search portlet, which switches between a quick
> and an advanced version.
> 
> In the advanced version I want to set the portlet title, so I have
> this code
> 
> portlet.setTitle("Advanced Search");
> 
> Where portlet is the VelocityPortlet parameter into the
> buildNormalContext method.
> 
> This does not seem to work, I always get the title specified in the
> .xreg file...
> 

It all depends on when do you try to set up the title:
- if it's during the the getContent() call, then it depends on the control 
implementation
  because if getContent is only called when needed, the portlet title is already 
rendered...
  If you're using on Velocity, you can modify the control template to do something like
  this :

#if( ! $portlet.isClosed($data) )
#set ($content = $portlet.getContent($data))



  $portlet.Title


#foreach ( $action in $actions )
  
#end


#if( ! $portlet.isMinimized($data) )





$content





#end

#end

Of course, this will never work for JSP portlets since they directly stream their 
results...

It's a limitation of the current API which is fixed by the new Portlet API.

--
Raphael Luta - [EMAIL PROTECTED]
Vivendi Universal Networks - Paris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How do I set the portlet title - in the portlet?

2001-07-04 Thread Chris Kimpton

Hi,

I am still working on search portlet, which switches between a quick
and an advanced version.

In the advanced version I want to set the portlet title, so I have
this code

portlet.setTitle("Advanced Search");

Where portlet is the VelocityPortlet parameter into the
buildNormalContext method.

This does not seem to work, I always get the title specified in the
.xreg file...

Thanks,
Chris

=
Need somewhere to Live in London - http://freeflats.com

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]