{
// logic below is copied from org.apache.jetspeed.portlets.MultiColumnPortlet
portletDef = registry.getPortletDefinitionByUniqueName( layoutName, true );
if ( portletDef != null )
{
InitParam sizesParam = portletDef.getInitParam( "sizes" );
sizesVal = ( sizesParam == null ) ? null : sizesParam.getParamValue();
}
}
}
if ( sizesVal != null && sizesVal.length() > 0 )
{
if ( fragSizes != null )
fragSizes.put( layoutFragment.getId(), sizesVal );
int sepPos = -1, startPos = 0, sizesLen = sizesVal.length();
columnCount = 0;
do
{
sepPos = sizesVal.indexOf( ',', startPos );
if ( sepPos != -1 )
{
if ( sepPos > startPos )
columnCount++;
startPos = sepPos +1;
}
else if ( startPos < sizesLen )
{
columnCount++;
}
} while ( startPos < sizesLen && sepPos != -1 );
if ( ! suppressErrorLogging && columnCount <= 0 )
log.error( "getColumnCountAndSizes invalid columnCount - " + layoutFragment.getId() + " / " + layoutName + " count=" + columnCount + " sizes=" + sizesVal );
}
else if ( portletDef == null || portletDef.getInitParams().isEmpty() )
{
if ( ! suppressErrorLogging )
{
if ( layoutName == null )
log.error( "getColumnCountAndSizes null sizes, null layoutName - " + layoutFragment.getId() );
else if ( portletDef == null )
log.error( "getColumnCountAndSizes null sizes, null PortletDefinition - " + layoutFragment.getId() + " / " + layoutName );
else
log.error( "getColumnCountAndSizes null sizes, null ParameterSet - " + layoutFragment.getId() + " / " + layoutName );
}
}
else
{
InitParam colsParam = portletDef.getInitParam( "columns" );
String colsParamVal = ( colsParam == null ) ? null : colsParam.getParamValue();
if ( colsParamVal != null && colsParamVal.length() > 0 )
{
try
{
columnCount = Integer.parseInt( colsParamVal );