Search in sources :

Example 1 with UINode

use of org.loboevolution.html.dom.domimpl.UINode in project LoboEvolution by LoboEvolution.

the class HtmlBlockPanel method getUINode.

private UINode getUINode(Node currentNode) {
    UINode uiNode = null;
    while (currentNode != null) {
        if (currentNode instanceof HTMLElementImpl) {
            HTMLElementImpl element = (HTMLElementImpl) currentNode;
            uiNode = element.getUINode();
            if (uiNode != null) {
                break;
            }
        }
        currentNode = currentNode.getParentNode();
    }
    return uiNode;
}
Also used : HTMLElementImpl(org.loboevolution.html.dom.domimpl.HTMLElementImpl) UINode(org.loboevolution.html.dom.domimpl.UINode)

Example 2 with UINode

use of org.loboevolution.html.dom.domimpl.UINode in project LoboEvolution by LoboEvolution.

the class RBlockViewport method layoutRBlock.

/**
 * <p>layoutRBlock.</p>
 *
 * @param markupElement a {@link org.loboevolution.html.dom.domimpl.HTMLElementImpl} object.
 */
protected final void layoutRBlock(HTMLElementImpl markupElement) {
    final UINode uiNode = markupElement.getUINode();
    RBlock renderable = null;
    if (uiNode instanceof RBlock) {
        renderable = (RBlock) markupElement.getUINode();
    }
    if (renderable == null) {
        info.setModelNode(markupElement);
        renderable = new RBlock(info);
        markupElement.setUINode(renderable);
    }
    renderable.setOriginalParent(this);
    positionRBlock(markupElement, renderable);
}
Also used : UINode(org.loboevolution.html.dom.domimpl.UINode)

Example 3 with UINode

use of org.loboevolution.html.dom.domimpl.UINode in project LoboEvolution by LoboEvolution.

the class RBlockViewport method layoutRInlineBlock.

/**
 * <p>layoutRInlineBlock.</p>
 *
 * @param markupElement a {@link org.loboevolution.html.dom.domimpl.HTMLElementImpl} object.
 */
public void layoutRInlineBlock(final HTMLElementImpl markupElement) {
    final UINode uINode = markupElement.getUINode();
    RInlineBlock inlineBlock;
    if (uINode instanceof RInlineBlock) {
        inlineBlock = (RInlineBlock) uINode;
    } else {
        info.setModelNode(markupElement);
        final RInlineBlock newInlineBlock = new RInlineBlock(container, info);
        markupElement.setUINode(newInlineBlock);
        inlineBlock = newInlineBlock;
    }
    inlineBlock.doLayout(availContentWidth, availContentHeight, sizeOnly);
    addRenderableToLine(inlineBlock);
}
Also used : UINode(org.loboevolution.html.dom.domimpl.UINode)

Example 4 with UINode

use of org.loboevolution.html.dom.domimpl.UINode in project LoboEvolution by LoboEvolution.

the class HtmlBlockPanel method getNodeBoundsNoMargins.

/**
 * Gets the rectangular bounds of the given node with margins cut off.
 * <p>
 * Internally calls getNodeBounds and cuts off margins.
 *
 * @param node                 A node in the current document.
 * @param relativeToScrollable see getNodeBounds.
 * @return the node bounds no margins
 */
private Rectangle getNodeBoundsNoMargins(Node node, boolean relativeToScrollable) {
    RBlock block = this.rblock;
    if (block == null) {
        return null;
    }
    Node currentNode = node;
    UINode uiNode = getUINode(currentNode);
    if (uiNode == null) {
        return null;
    }
    Rectangle bounds;
    RCollection relativeTo = relativeToScrollable ? block.getRBlockViewport() : block;
    if (Objects.equals(node, currentNode)) {
        BoundableRenderable br = (BoundableRenderable) uiNode;
        Point guiPoint = br.getOriginRelativeTo(relativeTo);
        Dimension size = br.getSize();
        bounds = new Rectangle(guiPoint, size);
    } else {
        bounds = this.scanNodeBounds((RCollection) uiNode, node, relativeTo);
    }
    /* cut off margins */
    if (uiNode instanceof RElement) {
        RElement el = (RElement) uiNode;
        int top = el.getMarginTop();
        int left = el.getMarginLeft();
        bounds.x += left;
        bounds.y += top;
        bounds.width -= left + el.getMarginRight();
        bounds.height -= top + el.getMarginBottom();
    }
    return bounds;
}
Also used : UINode(org.loboevolution.html.dom.domimpl.UINode) ModelNode(org.loboevolution.html.dom.nodeimpl.ModelNode) Node(org.loboevolution.html.node.Node) UINode(org.loboevolution.html.dom.domimpl.UINode)

Aggregations

UINode (org.loboevolution.html.dom.domimpl.UINode)4 HTMLElementImpl (org.loboevolution.html.dom.domimpl.HTMLElementImpl)1 ModelNode (org.loboevolution.html.dom.nodeimpl.ModelNode)1 Node (org.loboevolution.html.node.Node)1