}
return;
}
case Element.ROW:
{
Row row = (Row) element;
// start tag
addTabs(indent);
writeStart(HtmlTags.ROW);
writeMarkupAttributes(markup);
os.write(GT);
// contents
Element cell;
for (int i = 0; i < row.getColumns(); i++) {
if ((cell = (Element)row.getCell(i)) != null) {
write(cell, indent + 1);
}
}
// end tag
addTabs(indent);
writeEnd(HtmlTags.ROW);
return;
}
case Element.TABLE:
{
Table table;
try {
table = (Table) element;
}
catch(ClassCastException cce) {
try {
table = ((SimpleTable)element).createTable();
} catch (BadElementException e) {
throw new ExceptionConverter(e);
}
}
table.complete();
// start tag
addTabs(indent);
writeStart(HtmlTags.TABLE);
writeMarkupAttributes(markup);
os.write(SPACE);
write(HtmlTags.WIDTH);
os.write(EQUALS);
os.write(QUOTE);
write(String.valueOf(table.getWidth()));
if (!table.isLocked()){
write("%");
}
os.write(QUOTE);
String alignment = HtmlEncoder.getAlignment(table.getAlignment());
if (!"".equals(alignment)) {
write(HtmlTags.ALIGN, alignment);
}
write(HtmlTags.CELLPADDING, String.valueOf(table.getPadding()));
write(HtmlTags.CELLSPACING, String.valueOf(table.getSpacing()));
if (table.getBorderWidth() != Rectangle.UNDEFINED) {
write(HtmlTags.BORDERWIDTH, String.valueOf(table.getBorderWidth()));
}
if (table.getBorderColor() != null) {
write(HtmlTags.BORDERCOLOR, HtmlEncoder.encode(table.getBorderColor()));
}
if (table.getBackgroundColor() != null) {
write(HtmlTags.BACKGROUNDCOLOR, HtmlEncoder.encode(table.getBackgroundColor()));
}
os.write(GT);
// contents
Row row;
for (Iterator iterator = table.iterator(); iterator.hasNext(); ) {
row = (Row) iterator.next();
write(row, indent + 1);
}
// end tag