use of org.loboevolution.html.dom.nodeimpl.NodeImpl in project LoboEvolution by LoboEvolution.
the class HtmlPanel method scrollToElementImpl.
private void scrollToElementImpl(String nameOrId) {
final NodeImpl node = this.rootNode;
if (node instanceof HTMLDocumentImpl) {
final HTMLDocumentImpl doc = (HTMLDocumentImpl) node;
final Element element = doc.getElementById(nameOrId);
if (element != null) {
this.scrollTo(element);
}
}
}
use of org.loboevolution.html.dom.nodeimpl.NodeImpl in project LoboEvolution by LoboEvolution.
the class RBlockViewport method layoutChildren.
private void layoutChildren(NodeImpl node) {
final NodeListImpl nodeList = node.getNodeList();
if (nodeList != null) {
nodeList.forEach(nd -> {
final NodeImpl child = (NodeImpl) nd;
final NodeType nodeType = child.getNodeType();
switch(nodeType) {
case TEXT_NODE:
layoutText(child);
break;
case ELEMENT_NODE:
this.currentLine.addStyleChanger(new RStyleChanger(child));
final String nodeName = child.getNodeName().toUpperCase();
MarkupLayout ml = RLayout.elementLayout.get(HTMLTag.get(nodeName));
if (ml == null) {
ml = miscLayout;
}
ml.layoutMarkup(this, (HTMLElementImpl) child);
this.currentLine.addStyleChanger(new RStyleChanger(node));
break;
case DOCUMENT_FRAGMENT_NODE:
final DocumentFragmentImpl fragment = (DocumentFragmentImpl) child;
fragment.getNodeList().forEach(fragNode -> {
final NodeImpl fragChild = (NodeImpl) fragNode;
layoutChildren(fragChild);
});
break;
case COMMENT_NODE:
case PROCESSING_INSTRUCTION_NODE:
default:
break;
}
});
}
}
use of org.loboevolution.html.dom.nodeimpl.NodeImpl in project LoboEvolution by LoboEvolution.
the class BaseBoundableRenderable method resetCursorOnMouseOut.
private static void resetCursorOnMouseOut(final ModelNode nodeStart, final ModelNode limit) {
Optional<Cursor> foundCursorOpt = Optional.empty();
ModelNode node = limit;
while (node != null) {
if (node instanceof NodeImpl) {
final NodeImpl uiElement = (NodeImpl) node;
final RenderState rs = uiElement.getRenderState();
final Optional<Cursor> cursorOpt = rs.getCursor();
foundCursorOpt = cursorOpt;
if (cursorOpt.isPresent()) {
break;
}
}
node = node.getParentModelNode();
}
if (nodeStart instanceof NodeImpl) {
final NodeImpl uiElement = (NodeImpl) nodeStart;
final HtmlRendererContext rcontext = uiElement.getHtmlRendererContext();
rcontext.setCursor(foundCursorOpt);
}
}
use of org.loboevolution.html.dom.nodeimpl.NodeImpl in project LoboEvolution by LoboEvolution.
the class Geolocation method geoError.
private void geoError(final Function error, Exception e) {
final NodeImpl node = (NodeImpl) window.getDocumentNode();
PositionError pError = null;
if (e instanceof UnknownHostException) {
pError = new PositionError(PositionError.POSITION_UNAVAILABLE);
} else if (e instanceof TimeoutException) {
pError = new PositionError(PositionError.TIMEOUT);
}
Executor.executeFunction(node, error, null, new Object[] { pError });
}
use of org.loboevolution.html.dom.nodeimpl.NodeImpl in project LoboEvolution by LoboEvolution.
the class HtmlController method setMouseOnMouseOver.
private static void setMouseOnMouseOver(final BaseBoundableRenderable renderable, final ModelNode nodeStart, final ModelNode limit) {
ModelNode node = nodeStart;
while (node != null) {
if (node == limit) {
break;
}
if (node instanceof NodeImpl) {
final NodeImpl uiElement = (NodeImpl) node;
final HtmlRendererContext rcontext = uiElement.getHtmlRendererContext();
final RenderState rs = uiElement.getRenderState();
final Optional<Cursor> cursorOpt = rs.getCursor();
if (cursorOpt.isPresent()) {
rcontext.setCursor(cursorOpt);
break;
} else {
if (node.getParentModelNode() == limit) {
if (renderable instanceof RWord || renderable instanceof RBlank) {
rcontext.setCursor(Optional.of(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)));
}
}
}
}
node = node.getParentModelNode();
}
}
Aggregations