use of org.loboevolution.html.dom.domimpl.HTMLElementImpl in project LoboEvolution by LoboEvolution.
the class VirtualCell method getHeightLength.
/**
* <p>getHeightLength.</p>
*
* @return a {@link org.loboevolution.html.style.HtmlLength} object.
*/
public HtmlLength getHeightLength() {
final RTableCell cell = this.actualCell;
final String heightText = cell.getHeightText();
HTMLElementImpl elem = cell.getCellElement();
final HTMLDocumentImpl doc = (HTMLDocumentImpl) elem.getOwnerDocument();
HtmlLength length = heightText == null ? null : new HtmlLength(heightText, doc);
if (length != null) {
length.divideBy(cell.getRowSpan());
}
return length;
}
use of org.loboevolution.html.dom.domimpl.HTMLElementImpl in project LoboEvolution by LoboEvolution.
the class ComputedCSSStyleDeclaration method getFontSize.
public String getFontSize() {
final HTMLDocumentImpl doc = (HTMLDocumentImpl) element.getDocumentNode();
HTMLElementImpl parent = (HTMLElementImpl) element.getParentElement();
int fontSize = -1;
if (parent != null) {
AbstractCSSProperties currentStyle = parent.getCurrentStyle();
fontSize = FontValues.getPixelSize(currentStyle.getFontSize(), null, doc.getDefaultView(), -1);
}
if (fontSize == -1) {
fontSize = Float.valueOf(FontValues.getFontSize(style.getFontSize(), doc.getDefaultView(), null)).intValue();
}
return fontSize + "px";
}
use of org.loboevolution.html.dom.domimpl.HTMLElementImpl in project LoboEvolution by LoboEvolution.
the class HtmlRendererContext method onContextMenu.
/**
* This method must be overridden to implement a context menu.
*
* @param element a {@link org.loboevolution.html.dom.HTMLElement} object.
* @param event a {@link java.awt.event.MouseEvent} object.
* @return a boolean.
*/
public boolean onContextMenu(HTMLElement element, MouseEvent event) {
HTMLElementImpl elem = (HTMLElementImpl) element;
HTMLImageElementImpl elmImg = new HTMLImageElementImpl();
if (elem.getCurrentStyle() != null && Strings.isNotBlank(elem.getCurrentStyle().getBackgroundImage())) {
final String backgroundImageText = elem.getCurrentStyle().getBackgroundImage();
String start = "url(";
int startIdx = start.length() + 1;
int closingIdx = backgroundImageText.lastIndexOf(')') - 1;
String quotedUri = backgroundImageText.substring(startIdx, closingIdx);
elmImg.setSrc(quotedUri);
element = elmImg;
}
HtmlContextMenu menu = new HtmlContextMenu(element, this);
if (element instanceof HTMLImageElementImpl) {
JPopupMenu popupMenuImage = menu.popupMenuImage(htmlPanel.getBrowserPanel());
popupMenuImage.show(event.getComponent(), event.getX(), event.getY());
return false;
} else if (element instanceof HTMLLinkElementImpl) {
JPopupMenu popupMenuLink = menu.popupMenuLink(htmlPanel.getBrowserPanel());
popupMenuLink.show(event.getComponent(), event.getX(), event.getY());
return false;
} else if (element instanceof HTMLElementImpl) {
JPopupMenu popupMenuAbstract = menu.popupMenuAbstractUI();
popupMenuAbstract.show(event.getComponent(), event.getX(), event.getY());
return false;
}
return true;
}
use of org.loboevolution.html.dom.domimpl.HTMLElementImpl in project LoboEvolution by LoboEvolution.
the class ComputedCSSStyleDeclaration method getHeight.
public String getHeight() {
final HTMLDocumentImpl doc = (HTMLDocumentImpl) element.getDocumentNode();
HTMLElementImpl parent = (HTMLElementImpl) element.getParentElement();
int availSize = -1;
if (parent != null) {
AbstractCSSProperties currentStyle = parent.getCurrentStyle();
availSize = HtmlValues.getPixelSize(currentStyle.getHeight(), null, doc.getDefaultView(), -1);
}
if (availSize == -1) {
HtmlRendererContext htmlRendererContext = doc.getHtmlRendererContext();
HtmlPanel htmlPanel = htmlRendererContext.getHtmlPanel();
Dimension preferredSize = htmlPanel.getPreferredSize();
availSize = preferredSize.height;
}
final int height = HtmlValues.getPixelSize(style.getHeight(), null, doc.getDefaultView(), -1, availSize);
return height + "px";
}
use of org.loboevolution.html.dom.domimpl.HTMLElementImpl in project LoboEvolution by LoboEvolution.
the class ComputedCSSStyleDeclaration method getWidth.
public String getWidth() {
final HTMLDocumentImpl doc = (HTMLDocumentImpl) element.getDocumentNode();
HTMLElementImpl parent = (HTMLElementImpl) element.getParentElement();
int availSize = -1;
if (parent != null) {
AbstractCSSProperties currentStyle = parent.getCurrentStyle();
availSize = HtmlValues.getPixelSize(currentStyle.getWidth(), null, doc.getDefaultView(), -1);
}
if (availSize == -1) {
HtmlRendererContext htmlRendererContext = doc.getHtmlRendererContext();
HtmlPanel htmlPanel = htmlRendererContext.getHtmlPanel();
Dimension preferredSize = htmlPanel.getPreferredSize();
availSize = preferredSize.width;
}
final int width = HtmlValues.getPixelSize(style.getWidth(), null, doc.getDefaultView(), -1, availSize);
return width + "px";
}
Aggregations