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;
}
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);
}
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);
}
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;
}
Aggregations