public String renderComponents(MContainer parent, String separator)
{
try
{
StringParser parser = new StringParser();
MComponent[] components = parent.getComponents();
if (components.length > 0)
{
for (int i = 0; i < components.length; i++)
{
MBorderLayout.CompassDirection position = null;
MLayout.Alignment alignment = null;
try
{
Object constraint = parent.getConstraints(components[i]);
// If the constraint is an Object[], we have more than one constraint
// to work with.
if (constraint instanceof Object[])
{
Object[] constraints = (Object[])constraint;
position = (MBorderLayout.CompassDirection)constraints[0];
alignment = (MLayout.Alignment)constraints[1];
}
else if (constraint instanceof MBorderLayout.CompassDirection)
{
position = (MBorderLayout.CompassDirection)constraint;
alignment = ((MBorderLayout)parent.getLayout()).getAlignment();
}
else
{
throw new ClassCastException();
}
}
catch (ClassCastException exception)
{
System.err.println(new WarningString("An invalid constraint was passed to BorderLayout. Use BorderLayout.NORTH, SOUTH, EAST, WEST, or CENTER. Using default position of CENTER."));
position = MBorderLayout.CENTER;
alignment = ((MBorderLayout)parent.getLayout()).getAlignment();
}
parser.setVariable(position.toString(), doRenderComponent (components[i]));
parser.setVariable(position.toString() + "Align", alignment.toString());
}
}
return parser.parseString(super.getRenderTemplate((I_Renderable)parent.getLayout()));
}
catch (Exception exception)
{
System.err.println(new ErrorString(exception, "MBorderLayout_html.renderComponents()"));