/** * Get the keyboard selected element from the selected table cell. * * @return the keyboard selected element, or null if there is none */ private Element getKeyboardSelectedElement(TableCellElement td) { if (td == null) { return null; } /* * The TD itself is a cell parent, which means its internal structure * (including the tabIndex that we set) could be modified by its Cell. We * return the TD to be safe. */ if (tableBuilder.isColumn(td)) { return td; } /* * The default table builder adds a focusable div to the table cell because * TDs aren't focusable in all browsers. If the user defines a custom table * builder with a different structure, we must assume the keyboard selected * element is the TD itself. */ Element firstChild = td.getFirstChildElement(); if (firstChild != null && td.getChildCount() == 1 && "div".equalsIgnoreCase(firstChild.getTagName())) { return firstChild; } return td; }
/** * Inserts the selection checkbox in first column. */ private void insertSelectionCheckbox(final TableCellElement td) { com.google.gwt.dom.client.Element container = td.getFirstChildElement(); container.insertFirst(selectionCheckBox.getElement()); }
/** * Inserts a spacer element in the first column to ensure that positioning of content is the same when there is or is not a checkbox. */ private void insertSelectionCheckboxSpacer(final TableCellElement td) { com.google.gwt.dom.client.Element container = td.getFirstChildElement(); container.insertFirst(selectionCheckBoxSpacer.getElement()); }
cellParent = targetTableCell.getFirstChildElement();
/** * Get the keyboard selected element from the selected table cell. * * @return the keyboard selected element, or null if there is none */ private Element getKeyboardSelectedElement(TableCellElement td) { if (td == null) { return null; } /* * The TD itself is a cell parent, which means its internal structure * (including the tabIndex that we set) could be modified by its Cell. We * return the TD to be safe. */ if (tableBuilder.isColumn(td)) { return td; } /* * The default table builder adds a focusable div to the table cell because * TDs aren't focusable in all browsers. If the user defines a custom table * builder with a different structure, we must assume the keyboard selected * element is the TD itself. */ Element firstChild = td.getFirstChildElement(); if (firstChild != null && td.getChildCount() == 1 && "div".equalsIgnoreCase(firstChild.getTagName())) { return firstChild; } return td; }
/** * Get the keyboard selected element from the selected table cell. * * @return the keyboard selected element, or null if there is none */ private Element getKeyboardSelectedElement(TableCellElement td) { if (td == null) { return null; } /* * The TD itself is a cell parent, which means its internal structure * (including the tabIndex that we set) could be modified by its Cell. We * return the TD to be safe. */ if (tableBuilder.isColumn(td)) { return td; } /* * The default table builder adds a focusable div to the table cell because * TDs aren't focusable in all browsers. If the user defines a custom table * builder with a different structure, we must assume the keyboard selected * element is the TD itself. */ Element firstChild = td.getFirstChildElement(); if (firstChild != null && td.getChildCount() == 1 && "div".equalsIgnoreCase(firstChild.getTagName())) { return firstChild; } return td; }
@Override protected void initCellWithWidget(Widget w, char align, String style, boolean sorted, TableCellElement td) { super.initCellWithWidget(w, align, style, sorted, td); td.getFirstChildElement().addClassName(WIDGET_CELL_CLASSNAME); if (CubaTreeTableWidget.this.isSelectable()) { // Support for #PL-2080 recursiveAddFocusHandler(w, w); } }
@Override protected void initCellWithWidget(final Widget w, char align, String style, boolean sorted, TableCellElement td) { super.initCellWithWidget(w, align, style, sorted, td); td.getFirstChildElement().addClassName(WIDGET_CELL_CLASSNAME); if (CubaScrollTableWidget.this.isSelectable()) { // Support for #PL-2080 recursiveAddFocusHandler(w, w); } }
@Override public void onRowOver(int rowNum) { if(!table.isEnabled()) return; // toggle rollover tools if(rowNum<provider.getList().size()) { TableCellElement rollOverItem = table.getRowElement(rowNum).getCells().getItem(2); rollOverItem.getFirstChildElement().getFirstChildElement().addClassName("row-tools-enabled"); } }
@Override public void onRowOut(int rowNum) { if(!table.isEnabled()) return; if(rowNum<provider.getList().size()) { TableCellElement rollOverItem = table.getRowElement(rowNum).getCells().getItem(2); rollOverItem.getFirstChildElement().getFirstChildElement().removeClassName("row-tools-enabled"); } } }
/** * Returns the width available for column content. * * @param columnIndex * @return */ public int getColWidth(int columnIndex) { if (tBodyMeasurementsDone) { if (renderedRows.isEmpty()) { // no rows yet rendered return 0; } for (Widget row : renderedRows) { if (!(row instanceof VScrollTableGeneratedRow)) { TableRowElement tr = row.getElement().cast(); // Spanned rows might cause an NPE. if (columnIndex < tr.getChildCount()) { Element wrapperdiv = tr.getCells() .getItem(columnIndex).getFirstChildElement() .cast(); return wrapperdiv.getOffsetWidth(); } } } return 0; } else { return 0; } }
Element divWrapper = list.getItem(columnIndex).getFirstChildElement();
.getFirstChildElement(); cellExtraWidth = firstTD.getOffsetWidth() - wrapper.getOffsetWidth();
cellParent = targetTableCell.getFirstChildElement();
cellParent = targetTableCell.getFirstChildElement();