*/
protected PortletSet getSet(Portlets portlets, VariableInteger theCount)
{
// Create a new BasePortletSet to handle the portlets
BasePortletSet set = new BasePortletSet();
PortletController controller = getController(portlets.getController());
set.setController(controller);
String name = portlets.getName();
if (name != null)
{
set.setName(name);
}
else
set.setName(String.valueOf(theCount.getValue()));
set.setID(portlets.getId());
theCount.setValue(theCount.getValue() + 1);
//FIXME: this sucks ! we should either associate the portlet set
//with its portlets peer or set the porpoerties directly on the portlet
//set object
//Unfortunately, this would change the API too drastically for now...
set.setPortletConfig(getPortletConfig(portlets));
// Add all sub portlet sets in the main set
// Portlets[] subsets = portlets.getPortlets();
// for (int i=0; i < subsets.length; i++ )
for (Iterator it = portlets.getPortletsIterator(); it.hasNext();)
{
Portlets subset = (Portlets) it.next();
// Set this subset's parent Portlets collection.
subset.setParentPortlets(portlets);
Map constraints = getParameters(subset.getLayout());
int position = getPosition(subset.getLayout());
set.addPortlet(
getSet(subset, theCount),
controller.getConstraints(constraints),
position);
}
// Populate the PortletSet with Portlets
// Entry[] entries = portlets.getEntry();
// for( int i = 0; i < entries.length; ++i )
for (Iterator eit = portlets.getEntriesIterator(); eit.hasNext();)
{
try
{
Entry psmlEntry = (Entry) eit.next();
PortletEntry entry =
(PortletEntry) Registry.getEntry(Registry.PORTLET, psmlEntry.getParent());
if (entry != null)
{
Portlet p = PortletFactory.getPortlet(psmlEntry);
if (p != null)
{
Map constraints = getParameters(psmlEntry.getLayout());
int position = getPosition(psmlEntry.getLayout());
PortletControl control = getControl(psmlEntry.getControl(), entry);
set.addPortlet(
initControl(control, p),
controller.getConstraints(constraints),
position);
}
}
else
{