else if (profiles.size() > 0)
{
try
{
// Create an empty portlet container
Portlets portlets = new PsmlPortlets();
Control control = new PsmlControl();
control.setName(this.rolemergeControl);
portlets.setControl(control);
Controller controller = new PsmlController();
controller.setName(this.rolemergeController);
portlets.setController(controller);
// Set the skin
Skin skin = new PsmlSkin();
skin.setName(PortalToolkit.getSkin((String) null).getName());
portlets.setSkin(skin);
String mediaType = null;
// Process each role profile
int paneCount = 0;
for (Iterator it = profiles.iterator(); it.hasNext(); )
{
Profile roleProfile = (Profile)it.next();
mediaType = mediaType == null ? roleProfile.getMediaType() : mediaType;
Profile tmpProfile = (Profile) roleProfile.clone();
Portlets tmpPortlets = tmpProfile.getDocument().getPortlets();
// If topmost control is a tab control, then add each tab to the container
Control paneControl = tmpPortlets.getControl();
if (paneControl != null && paneControl.getName().equals(this.rolemergeControl))
{
for (int i = 0; i < tmpPortlets.getPortletsCount(); i++)
{
Portlets pane = tmpPortlets.getPortlets(i);
pane.setLayout(null);
portlets.addPortlets(pane);
paneCount++;
}
}
// Otherwise, add the contents of profile as a pane
else
{
if (tmpPortlets.getTitle() == null)
{
String title = org.apache.turbine.util.StringUtils.firstLetterCaps(roleProfile.getRoleName());
tmpPortlets.setTitle(title + " Home");
}
tmpPortlets.setLayout(null);
portlets.addPortlets(tmpPortlets);
paneCount++;
}
if (logger.isDebugEnabled())
{