Search in sources :

Example 1 with HTMLTableElement

use of org.loboevolution.html.dom.HTMLTableElement in project LoboEvolution by LoboEvolution.

the class TableCellRenderState method getPaddingInsets.

/**
 * {@inheritDoc}
 */
@Override
public HtmlInsets getPaddingInsets() {
    HtmlInsets insets = this.paddingInsets;
    if (insets != INVALID_INSETS) {
        return insets;
    } else {
        final HTMLTableElement tableElement = getTableElement();
        if (tableElement == null) {
            // Return without caching
            return null;
        }
        String cellPaddingText = tableElement.getAttribute("cellpadding");
        if (Strings.isNotBlank(cellPaddingText)) {
            cellPaddingText = cellPaddingText.trim();
            HTMLDocumentImpl doc = (HTMLDocumentImpl) tableElement.getOwnerDocument();
            int cellPadding = HtmlValues.getPixelSize(cellPaddingText, this, doc.getDefaultView(), 0);
            int cellPaddingType = HtmlInsets.TYPE_PIXELS;
            if (cellPaddingText.endsWith("%")) {
                cellPaddingType = HtmlInsets.TYPE_PERCENT;
            }
            insets = new HtmlInsets(cellPadding, cellPaddingType);
        } else {
            insets = super.getPaddingInsets();
        }
    }
    this.paddingInsets = insets;
    return insets;
}
Also used : HtmlInsets(org.loboevolution.html.style.HtmlInsets) HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) HTMLTableElement(org.loboevolution.html.dom.HTMLTableElement)

Aggregations

HTMLTableElement (org.loboevolution.html.dom.HTMLTableElement)1 HTMLDocumentImpl (org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)1 HtmlInsets (org.loboevolution.html.style.HtmlInsets)1