* @param peid the peid of the portlet to render
* @return the rendered content of the portlet
*/
public ConcreteElement getPortletById(String peid)
{
ConcreteElement result = null;
Portlet found = null;
Stack sets = new Stack();
sets.push(rundata.getProfile().getRootSet());
while ((sets.size() > 0) && (found==null))
{
PortletSet set = (PortletSet)sets.pop();
if (set.getID().equals(peid))
{
found = set;
}
else
{
Enumeration en = set.getPortlets();
while((found==null) && en.hasMoreElements())
{
Portlet p = (Portlet)en.nextElement();
// unstack the controls to find the real PortletSets
Portlet real = p;
while (real instanceof PortletControl)
{
real = ((PortletControl)p).getPortlet();
}
if (real instanceof PortletSet)
{
// we'll explore this set afterwards
sets.push(real);
}
else if (p.getID().equals(peid))
{
found = p;
}
}
}
}
if (found!=null)
{
// Return portlet's content checking the security first
result = PortletWrapper.wrap(found).getContent(rundata);
}
if (result==null)
{
//the customizer already streamed its content, return a stub
result = new ConcreteElement();
}
return result;
}