com.gargoylesoftware.htmlunit.html.HtmlTableCell Java Examples
The following examples show how to use
com.gargoylesoftware.htmlunit.html.HtmlTableCell.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PropertyTable.java From warnings-ng-plugin with MIT License | 5 votes |
/** * Creates a new instance of {@link PropertyTable}. * * @param page * the whole details HTML page * @param property * the property tab to extract */ @SuppressFBWarnings("BC") public PropertyTable(final HtmlPage page, final String property) { super(page); title = getTitleOfTable(page, property); DomElement propertyElement = page.getElementById(property); assertThat(propertyElement).isInstanceOf(HtmlTable.class); HtmlTable table = (HtmlTable) propertyElement; List<HtmlTableRow> tableHeaderRows = table.getHeader().getRows(); assertThat(tableHeaderRows).hasSize(1); HtmlTableRow header = tableHeaderRows.get(0); List<HtmlTableCell> cells = header.getCells(); assertThat(cells).hasSize(3); propertyName = cells.get(0).getTextContent(); assertThat(cells.get(1).getTextContent()).isEqualTo("Total"); assertThat(cells.get(2).getTextContent()).isEqualTo("Distribution"); List<HtmlTableBody> bodies = table.getBodies(); assertThat(bodies).hasSize(1); List<HtmlTableRow> contentRows = bodies.get(0).getRows(); for (HtmlTableRow row : contentRows) { List<HtmlTableCell> rowCells = row.getCells(); rows.add(new PropertyRow(rowCells)); } }
Example #2
Source File: PropertyTable.java From warnings-ng-plugin with MIT License | 5 votes |
/** * Creates a new row based on the content of a list of three HTML cells. * * @param columns * the values given as {@link HtmlTableCell} */ public PropertyRow(final List<HtmlTableCell> columns) { assertThat(columns).hasSize(3); name = columns.get(0).getTextContent(); size = Integer.parseInt(columns.get(1).getTextContent()); String style = columns.get(2).getFirstElementChild().getFirstElementChild().getAttribute("style"); Matcher matcher = WIDTH.matcher(style); assertThat(matcher.matches()).isTrue(); width = Integer.parseInt(matcher.group(1)); ignoreWidth = false; }
Example #3
Source File: HTMLTableCellElement.java From htmlunit with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public int getOffsetWidth() { float w = super.getOffsetWidth(); final MouseEvent event = MouseEvent.getCurrentMouseEvent(); if (isAncestorOfEventTarget(event)) { return (int) w; } if (isDisplayNone()) { return 0; } final ComputedCSSStyleDeclaration style = getWindow().getComputedStyle(this, null); if ("collapse".equals(style.getStyleAttribute(StyleAttributes.Definition.BORDER_COLLAPSE))) { final HtmlTableRow row = getRow(); if (row != null) { final HtmlElement thiz = getDomNodeOrDie(); final List<HtmlTableCell> cells = row.getCells(); final boolean ie = getBrowserVersion().hasFeature(JS_TABLE_CELL_OFFSET_INCLUDES_BORDER); final boolean leftmost = cells.indexOf(thiz) == 0; final boolean rightmost = cells.indexOf(thiz) == cells.size() - 1; w -= (ie && leftmost ? 0 : 0.5) * style.getBorderLeftValue(); w -= (ie && rightmost ? 0 : 0.5) * style.getBorderRightValue(); } } return (int) w; }
Example #4
Source File: HTMLTableCellElement.java From htmlunit with Apache License 2.0 | 5 votes |
/** * Returns the index of this cell within the parent row. * @return the index of this cell within the parent row * @see <a href="http://msdn.microsoft.com/en-us/library/ms533549.aspx">MSDN Documentation</a> */ @JsxGetter public Integer getCellIndex() { final HtmlTableCell cell = (HtmlTableCell) getDomNodeOrDie(); final HtmlTableRow row = cell.getEnclosingRow(); if (row == null) { // a not attached document.createElement('TD') return Integer.valueOf(-1); } return Integer.valueOf(row.getCells().indexOf(cell)); }
Example #5
Source File: HTMLTableCellElement.java From HtmlUnit-Android with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public int getOffsetWidth() { float w = super.getOffsetWidth(); final MouseEvent event = MouseEvent.getCurrentMouseEvent(); if (isAncestorOfEventTarget(event)) { return (int) w; } if (isDisplayNone()) { return 0; } final ComputedCSSStyleDeclaration style = getWindow().getComputedStyle(this, null); if ("collapse".equals(style.getStyleAttribute(StyleAttributes.Definition.BORDER_COLLAPSE))) { final HtmlTableRow row = getRow(); if (row != null) { final HtmlElement thiz = getDomNodeOrDie(); final List<HtmlTableCell> cells = row.getCells(); final boolean ie = getBrowserVersion().hasFeature(JS_TABLE_CELL_OFFSET_INCLUDES_BORDER); final boolean leftmost = cells.indexOf(thiz) == 0; final boolean rightmost = cells.indexOf(thiz) == cells.size() - 1; w -= (ie && leftmost ? 0 : 0.5) * style.getBorderLeftValue(); w -= (ie && rightmost ? 0 : 0.5) * style.getBorderRightValue(); } } return (int) w; }
Example #6
Source File: HTMLTableCellElement.java From HtmlUnit-Android with Apache License 2.0 | 5 votes |
/** * Returns the index of this cell within the parent row. * @return the index of this cell within the parent row * @see <a href="http://msdn.microsoft.com/en-us/library/ms533549.aspx">MSDN Documentation</a> */ @JsxGetter public Integer getCellIndex() { final HtmlTableCell cell = (HtmlTableCell) getDomNodeOrDie(); final HtmlTableRow row = cell.getEnclosingRow(); if (row == null) { // a not attached document.createElement('TD') return Integer.valueOf(-1); } return Integer.valueOf(row.getCells().indexOf(cell)); }