private HtmlRowBackgroundStruct getCommonBackground(final FastGridLayout gridLayout,
final int columnCount,
final int row)
{
final HtmlRowBackgroundStruct bg = new HtmlRowBackgroundStruct();
BorderEdge topEdge = BorderEdge.EMPTY;
BorderEdge bottomEdge = BorderEdge.EMPTY;
Color color = null;
for (int col = 0; col < columnCount; col += 1)
{
FastGridLayout.GridCell gridCell = gridLayout.get(col, row);
if (gridCell == null)
{
// spanned cell
continue;
}
CellBackground backgroundAt = gridCell.getLayoutInfo().getBackground();
if (backgroundAt == null)
{
bg.fail();
return bg;
}
boolean fail = false;
if (col == 0)
{
color = backgroundAt.getBackgroundColor();
topEdge = backgroundAt.getTop();
bottomEdge = backgroundAt.getBottom();
}
else
{
if (ObjectUtilities.equal(color, backgroundAt.getBackgroundColor()) == false)
{
fail = true;
}
if (ObjectUtilities.equal(topEdge, backgroundAt.getTop()) == false)
{
fail = true;
}
if (ObjectUtilities.equal(bottomEdge, backgroundAt.getBottom()) == false)
{
fail = true;
}
}
if (BorderCorner.EMPTY.equals(backgroundAt.getBottomLeft()) == false)
{
fail = true;
}
if (BorderCorner.EMPTY.equals(backgroundAt.getBottomRight()) == false)
{
fail = true;
}
if (BorderCorner.EMPTY.equals(backgroundAt.getTopLeft()) == false)
{
fail = true;
}
if (BorderCorner.EMPTY.equals(backgroundAt.getTopRight()) == false)
{
fail = true;
}
if (fail)
{
bg.fail();
break;
}
}
bg.set(color, topEdge, bottomEdge);
return bg;
}