Search in sources :

Example 21 with HtmlInsets

use of org.loboevolution.html.style.HtmlInsets in project LoboEvolution by LoboEvolution.

the class UListRenderState method getMarginInsets.

/**
 * {@inheritDoc}
 */
@Override
public HtmlInsets getMarginInsets() {
    HtmlInsets insets = this.marginInsets;
    if (insets != INVALID_INSETS) {
        return insets;
    }
    insets = super.getMarginInsets();
    if (insets == null || insets.htmlInsetsIsVoid()) {
        insets = getDefaultMarginInsets();
    }
    this.marginInsets = insets;
    return insets;
}
Also used : HtmlInsets(org.loboevolution.html.style.HtmlInsets)

Example 22 with HtmlInsets

use of org.loboevolution.html.style.HtmlInsets in project LoboEvolution by LoboEvolution.

the class FieldsetRenderState method getDefaultMarginInsets.

private HtmlInsets getDefaultMarginInsets() {
    HtmlInsets insets = new HtmlInsets();
    final int leftRight = HtmlValues.getPixelSize("2px", null, element.getDocumentNode().getDefaultView(), -1);
    insets.setLeft(leftRight);
    insets.setRight(leftRight);
    insets.setLeftType(HtmlInsets.TYPE_PIXELS);
    insets.setRightType(HtmlInsets.TYPE_PIXELS);
    return insets;
}
Also used : HtmlInsets(org.loboevolution.html.style.HtmlInsets)

Example 23 with HtmlInsets

use of org.loboevolution.html.style.HtmlInsets in project LoboEvolution by LoboEvolution.

the class FieldsetRenderState method getPaddingInsets.

@Override
public HtmlInsets getPaddingInsets() {
    HtmlInsets insets = this.paddingInsets;
    if (insets != INVALID_INSETS) {
        return insets;
    }
    insets = super.getPaddingInsets();
    if (insets == null || insets.htmlInsetsIsVoid()) {
        insets = getDefaultPaddingInsets();
    }
    this.marginInsets = insets;
    return insets;
}
Also used : HtmlInsets(org.loboevolution.html.style.HtmlInsets)

Example 24 with HtmlInsets

use of org.loboevolution.html.style.HtmlInsets in project LoboEvolution by LoboEvolution.

the class FieldsetRenderState method getDefaultPaddingInsets.

private HtmlInsets getDefaultPaddingInsets() {
    HtmlInsets insets = new HtmlInsets();
    final int top = HtmlValues.getPixelSize("0.35rem", null, element.getDocumentNode().getDefaultView(), -1);
    final int bottom = HtmlValues.getPixelSize("0.625rem", null, element.getDocumentNode().getDefaultView(), -1);
    final int leftRight = HtmlValues.getPixelSize("0.65rem", null, element.getDocumentNode().getDefaultView(), -1);
    insets.setTop(top);
    insets.setBottom(bottom);
    insets.setLeft(leftRight);
    insets.setRight(leftRight);
    insets.setTopType(HtmlInsets.TYPE_PIXELS);
    insets.setBottomType(HtmlInsets.TYPE_PIXELS);
    insets.setLeftType(HtmlInsets.TYPE_PIXELS);
    insets.setRightType(HtmlInsets.TYPE_PIXELS);
    return insets;
}
Also used : HtmlInsets(org.loboevolution.html.style.HtmlInsets)

Example 25 with HtmlInsets

use of org.loboevolution.html.style.HtmlInsets in project LoboEvolution by LoboEvolution.

the class HeadingRenderState method getDefaultMarginInsets.

/**
 * {@inheritDoc}
 */
@Override
protected HtmlInsets getDefaultMarginInsets() {
    final HtmlInsets insets = new HtmlInsets();
    final String tagName = element.getTagName();
    final int lastCharValue = tagName.charAt(1) - '0';
    switch(lastCharValue) {
        case 1:
            final int topBottom1 = HtmlValues.getPixelSize("0.67rem", null, element.getDocumentNode().getDefaultView(), -1);
            insets.setTop(topBottom1);
            insets.setBottom(topBottom1);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            insets.setBottomType(HtmlInsets.TYPE_PIXELS);
            break;
        case 2:
            final int topBottom2 = HtmlValues.getPixelSize("0.83rem", null, element.getDocumentNode().getDefaultView(), -1);
            insets.setTop(topBottom2);
            insets.setBottom(topBottom2);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            insets.setBottomType(HtmlInsets.TYPE_PIXELS);
            break;
        case 3:
            final int topBottom3 = HtmlValues.getPixelSize("1rem", null, element.getDocumentNode().getDefaultView(), -1);
            insets.setTop(topBottom3);
            insets.setBottom(topBottom3);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            break;
        case 4:
            final int topBottom4 = HtmlValues.getPixelSize("1.33rem", null, element.getDocumentNode().getDefaultView(), -1);
            insets.setTop(topBottom4);
            insets.setBottom(topBottom4);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            break;
        case 5:
            final int topBottom5 = HtmlValues.getPixelSize("1.67rem", null, element.getDocumentNode().getDefaultView(), -1);
            insets.setTop(topBottom5);
            insets.setBottom(topBottom5);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            break;
        case 6:
            final int topBottom6 = HtmlValues.getPixelSize("2.33rem", null, element.getDocumentNode().getDefaultView(), -1);
            insets.setTop(topBottom6);
            insets.setBottom(topBottom6);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            insets.setTopType(HtmlInsets.TYPE_PIXELS);
            break;
        default:
            break;
    }
    return insets;
}
Also used : HtmlInsets(org.loboevolution.html.style.HtmlInsets)

Aggregations

HtmlInsets (org.loboevolution.html.style.HtmlInsets)31 HTMLElementImpl (org.loboevolution.html.dom.domimpl.HTMLElementImpl)4 BorderInsets (org.loboevolution.html.style.BorderInsets)4 BorderInfo (org.loboevolution.info.BorderInfo)4 HTMLDocumentImpl (org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)2 FontMetrics (java.awt.FontMetrics)1 HTMLTableElement (org.loboevolution.html.dom.HTMLTableElement)1 CSS3Properties (org.loboevolution.html.node.css.CSS3Properties)1 RenderState (org.loboevolution.html.renderstate.RenderState)1 AbstractCSSProperties (org.loboevolution.html.style.AbstractCSSProperties)1