Refine search
/** * This method is used for legacy AbstractCellTable that's not a * {@link TableSectionChangeHandler}. */ protected void replaceAllRowsImplLegacy(AbstractCellTable<?> table, TableSectionElement section, SafeHtml html) { // Remove all children. Element child = section.getFirstChildElement(); while (child != null) { Element next = child.getNextSiblingElement(); section.removeChild(child); child = next; } // Add new child elements. TableSectionElement newSection = convertToSectionElement(table, section.getTagName(), html); child = newSection.getFirstChildElement(); while (child != null) { Element next = child.getNextSiblingElement(); section.appendChild(child); child = next; } }
/** * Get the {@link TableCellElement} that is currently keyboard selected. * * @return the table cell element, or null if not selected */ private TableCellElement getKeyboardSelectedTableCellElement() { int colIndex = getKeyboardSelectedColumn(); if (colIndex < 0) { return null; } // Do not use getRowElement() because that will flush the presenter. int rowIndex = getKeyboardSelectedRow(); if (rowIndex < 0 || rowIndex >= getTableBodyElement().getRows().getLength()) { return null; } TableRowElement tr = getSubRowElement(rowIndex + getPageStart(), keyboardSelectedSubrow); if (tr != null) { int cellCount = tr.getCells().getLength(); if (cellCount > 0) { int column = Math.min(colIndex, cellCount - 1); return tr.getCells().getItem(column); } } return null; }
/** * Creates an HTML TFOOT element. * * @return the newly-created element */ public static com.google.gwt.user.client.Element createTFoot() { return Document.get().createTFootElement().cast(); }
Element parent = section.getParentElement(); Element nextSection = section.getNextSiblingElement(); detachSectionElement(section); TableRowElement insertBefore = table.getChildElement(startIndex).cast(); if (table.legacyRenderRowValues) { int count = 0; while (insertBefore != null && count < childCount) { Element next = insertBefore.getNextSiblingElement(); section.removeChild(insertBefore); insertBefore = (next == null) ? null : next.<TableRowElement> cast(); count++; while (insertBefore != null && table.tableBuilder.getRowValueIndex(insertBefore) < absEndIndex) { Element next = insertBefore.getNextSiblingElement(); section.removeChild(insertBefore); insertBefore = (next == null) ? null : next.<TableRowElement> cast(); TableSectionElement newSection = convertToSectionElement(table, section.getTagName(), html); Element newChild = newSection.getFirstChildElement(); while (newChild != null) { Element next = newChild.getNextSiblingElement(); section.insertBefore(newChild, insertBefore); newChild = next;
/** * Render a table section in the table. * * @param table the {@link AbstractCellTable} * @param section the {@link TableSectionElement} to replace * @param html the html of a table section element containing the rows */ public final void replaceAllRows(AbstractCellTable<?> table, TableSectionElement section, SafeHtml html) { // If the widget is not attached, attach an event listener so we can catch // synchronous load events from cached images. if (!table.isAttached()) { DOM.setEventListener(table.getElement(), table); } // Remove the section from the tbody. Element parent = section.getParentElement(); Element nextSection = section.getNextSiblingElement(); detachSectionElement(section); // Render the html. replaceAllRowsImpl(table, section, html); /* * Reattach the section. If next section is null, the section will be * appended instead. */ reattachSectionElement(parent, section, nextSection); // Detach the event listener. if (!table.isAttached()) { DOM.setEventListener(table.getElement(), null); } }
wrapper.getStyle().setPosition( Position.RELATIVE ); wrapper.setTabIndex( 0 ); // for focusability theadTable.getStyle().setWidth( 100, Unit.PCT ); theadTable.getStyle().setTableLayout( TableLayout.FIXED ); div0.getStyle().setWidth( 100, Unit.PCT ); TableRowElement tr1 = Document.get().createTRElement(); tr1.getStyle().setHeight( 100, Unit.PCT ); TableCellElement td1 = Document.get().createTDElement(); DivElement div1 = Document.get().createDivElement(); theadTable.appendChild( thead.<Node> cast() ); thead.appendChild( theadtr.<Node> cast() ); table.appendChild( tableColgroup ); table.appendChild( tbody.<Node> cast() ); td0.appendChild( div0 ); div0.appendChild( theadTable.<Node> cast() ); div2.appendChild( table ); td1.appendChild( div1.<Node> cast() ); tr0.appendChild( td0 ); tr1.appendChild( td1 ); wrapperTable.appendChild( tr0 );
@Override protected void templateOnColumnHiddenUpdated(int col, boolean hidden, int tw) { if (!enableGrouping) return; NodeList<Element> gs = getGroups(); String display = hidden ? "none" : ""; for (int i = 0, len = gs.getLength(); i < len; i++) { Element s = gs.getItem(i).getChildNodes().getItem(2).cast(); El.fly(s).setWidth(tw); El.fly(s.getFirstChildElement()).setWidth(tw); TableSectionElement tse = s.getFirstChildElement().cast(); Element e = tse.getRows().getItem(0).getChildNodes().getItem(col).cast(); e.getStyle().setProperty("display", display); } }
protected void updateAllColumnWidths() { int tw = getTotalWidth(); int clen = cm.getColumnCount(); Stack<Integer> ws = new Stack<Integer>(); header.updateAllColumnWidths(); for (int i = 0; i < clen; i++) { ws.push(getColumnWidth(i)); if (footer != null) { footer.updateColumnWidth(i, cm.getColumnWidth(i)); } } NodeList<Element> ns = getRows(); for (int i = 0, len = ns.getLength(); i < len; i++) { Element row = ns.getItem(i); row.getStyle().setPropertyPx("width", tw); if (row.getFirstChild() != null) { row.getFirstChildElement().getStyle().setPropertyPx("width", tw); TableSectionElement e = row.getFirstChild().cast(); TableRowElement nodeList = e.getRows().getItem(0); for (int j = 0; j < clen; j++) { ((Element) nodeList.getChildNodes().getItem(j)).getStyle().setPropertyPx("width", ws.get(j)); } } } templateOnAllColumnWidthsUpdated(ws, tw); syncHScroll(); }
protected void updateColumnHidden(int index, boolean hidden) { int tw = getTotalWidth(); String display = hidden ? "none" : ""; El.fly(innerHd.dom.getFirstChildElement()).setWidth(getOffsetWidth()); El.fly(innerHd.dom.getFirstChildElement().getFirstChildElement()).setWidth(tw); header.updateColumnHidden(index, hidden); if (footer != null) { footer.updateTotalWidth(getOffsetWidth(), tw); footer.updateColumnHidden(index, hidden); } NodeList<Element> ns = getRows(); for (int i = 0, len = ns.getLength(); i < len; i++) { Element elem = ns.getItem(i); elem.getStyle().setProperty("width", tw + "px"); TableSectionElement e = (TableSectionElement) elem.getFirstChild(); if (e != null) { e.getStyle().setProperty("width", tw + "px"); Element cell = e.getRows().getItem(0).getChildNodes().getItem(index).cast(); cell.getStyle().setProperty("display", display); } } templateOnColumnHiddenUpdated(index, hidden, tw); lastViewWidth = -1; layout(); syncHScroll(); }
protected void doAllWidths(List<Integer> ws, int tw) { if (!enableGrouping) return; NodeList<Element> gs = getGroups(); for (int i = 0, len = gs.getLength(); i < len; i++) { Element s = gs.getItem(i).getChildNodes().getItem(2).cast(); El.fly(s).setWidth(tw); if (s.getFirstChild() == null) return; El.fly(s.getFirstChildElement()).setWidth(tw); TableSectionElement tse = s.getFirstChildElement().cast(); NodeList<Element> cells = tse.getRows().getItem(0).getChildNodes().cast(); for (int j = 0, wlen = ws.size(); j < wlen; j++) { El.fly(cells.getItem(j)).setWidth(ws.get(j)); } } }
private void setHeaderWidthInformation(boolean shouldAffix) { // header if (shouldAffix) { table.getTableHeadElement().getStyle().setWidth(headerWidth, Style.Unit.PX); } else { table.getTableHeadElement().getStyle().clearWidth(); } final NodeList<TableRowElement> headerRows = table.getTableHeadElement().getRows(); for (int i = 0; i < headerRows.getLength(); i++) { final TableRowElement row = headerRows.getItem(i); // rows if (shouldAffix) { row.getStyle().setWidth(headerRowToWidthMap.get(i), Style.Unit.PX); } else { row.getStyle().clearWidth(); } // cells final NodeList<TableCellElement> cells = row.getCells(); for (int j = 0; j < cells.getLength(); j++) { final TableCellElement cell = cells.getItem(j); if (shouldAffix) { cell.getStyle().setWidth(headerCellToWidthMap.get(new Pair<>(i, j)), Style.Unit.PX); } else { cell.getStyle().clearWidth(); } } } }
protected void doWidth(int col, int w, int tw) { if (!enableGrouping) return; NodeList<Element> gs = getGroups(); for (int i = 0, len = gs.getLength(); i < len; i++) { Element s = gs.getItem(i).getChildNodes().getItem(2).cast(); El.fly(s).setWidth(tw); El.fly(s.getFirstChildElement()).setWidth(tw); TableSectionElement tse = s.getFirstChildElement().cast(); Element e = tse.getRows().getItem(0).getChildNodes().getItem(col).cast(); El.fly(e).setWidth(w); } }
/** * Creates and adds an installer. * * @param installerId installer id * @param installerName installer name * @param installerDescription installer description */ void addInstaller(String installerId, String installerName, String installerDescription) { Installer installer = installers.get(installerId); if (installer != null) { installer.setName(installerName); installer.setDescription(installerDescription); return; } installer = new Installer(installerName, installerDescription); installers.put(installerId, installer); tableBody.insertBefore(installer.section, machinesDelimiter); // Update `rowspan` attribute of machine icon cell icon.setAttribute("rowspan", "" + (2 + installers.size())); inlineDelimiter.getStyle().setProperty("height", "10px"); }
private void detectExtrawidth() { NodeList<TableRowElement> rows = tBodyElement.getRows(); if (rows.getLength() == 0) { tBodyElement.appendChild(scrollTableRow.getElement()); detectExtrawidth(); tBodyElement.removeChild(scrollTableRow.getElement()); } else { boolean noCells = false; TableRowElement item = rows.getItem(0); TableCellElement firstTD = item.getCells().getItem(0); if (firstTD == null) { : false; next.addCell(null, "", ALIGN_LEFT, "", true, sorted); firstTD = item.getCells().getItem(0); - wrapper.getOffsetWidth(); if (noCells) { firstTD.getParentElement().removeChild(firstTD);
if (table.getTBodies().getLength() > 0) { tbody = table.getTBodies().getItem(0); } else { tbody = Document.get().createTBodyElement(); tbodyLoading.appendChild(tr); tr.appendChild(tbodyLoadingCell); tbodyLoadingCell.setAlign("center"); tbodyLoadingCell.appendChild(messagesPanel.getElement());
NodeList<TableRowElement> rows = getTableBodyElement().getRows(); int rowCount = rows.getLength(); if (rowCount == 0) { return null; int domIndex = Math.min(relRow, frameEnd); while (domIndex >= frameStart && domIndex <= frameEnd) { TableRowElement curRow = rows.getItem(domIndex); int rowValueIndex = tableBuilder.getRowValueIndex(curRow); if (rowValueIndex == absRow) { if (subrowIndex >= rows.getLength()) {
@PatchMethod static TableRowElement insertRow(TableElement e, int index) { NodeList<TableRowElement> rows = e.getRows(); TableRowElement newRow = Document.get().createTRElement(); if (rows.getLength() < 1) { TableSectionElement tbody = Document.get().createTBodyElement(); e.appendChild(tbody); tbody.appendChild(newRow); } else { if (index == -1 || index >= rows.getLength()) { TableRowElement after = rows.getItem(rows.getLength() - 1); after.getParentElement().insertAfter(newRow, after); } else { TableRowElement before = rows.getItem(index); before.getParentElement().insertBefore(newRow, before); } } return newRow; }
public void saveHeaderWidthInformation() { headerWidth = table.getTableHeadElement().getOffsetWidth(); final NodeList<TableRowElement> headerRows = table.getTableHeadElement().getRows(); for (int i = 0; i < headerRows.getLength(); i++) { final TableRowElement row = headerRows.getItem(i); headerRowToWidthMap.put(i, row.getOffsetWidth()); final NodeList<TableCellElement> cells = row.getCells(); for (int j = 0; j < cells.getLength(); j++) { final TableCellElement cell = cells.getItem(j); headerCellToWidthMap.put(new Pair<>(i, j), cell.getOffsetWidth()); } } }
@PatchMethod static void deleteRow(TableSectionElement e, int index) { NodeList<TableRowElement> rows = e.getRows(); if (rows.getLength() < 1) { return; } if (index == -1) { index = rows.getLength() - 1; } TableRowElement rowToDelete = rows.getItem(index); e.removeChild(rowToDelete); }
private void addToDataGrid(final TableType tableType) { getTableHeadElement().getParentElement().addClassName(tableType.getCssName()); getTableBodyElement().getParentElement().addClassName(tableType.getCssName()); getTableFootElement().getParentElement().addClassName(tableType.getCssName()); }