/** * Returns the cell. * * @param elem the cell element or a child element * @return the cell element */ public Element findCell(Element elem) { if (elem == null) { return null; } return fly(elem).findParentElement(cellSelector, cellSelectorDepth); }
/** * Returns the row element. * * @param el the row element or any child element * @return the matching row element */ public Element findRow(Element el) { if (el == null) { return null; } return fly(el).findParentElement(rowSelector, rowSelectorDepth); }
protected void addRowStyle(Element elem, String style) { if (elem != null) { fly(elem).addStyleName(style); } }
protected void removeRowStyle(Element row, String style) { fly(row).removeStyleName(style); }
protected void removeRow(int row) { Element r = getRow(row); if (r != null) { fly(r).removeFromParent(); } }
/** * Returns the cell index. * * @param elem the cell or child element * @param requiredStyle an optional required style name * @return the cell index or -1 if not found */ public int findCellIndex(Element elem, String requiredStyle) { Element cell = findCell(elem); if (cell != null && (requiredStyle == null || fly(cell).hasStyleName(requiredStyle))) { return getCellIndex(cell); } return -1; }
protected void onCellDeselect(int row, int col) { Element cell = getCell(row, col); if (cell != null) { fly(cell).removeStyleName("x-grid3-cell-selected"); if (GXT.isAriaEnabled()) { cell.setAttribute("aria-selected", "false"); } } }
protected void renderWidgets(int startRow, int endRow) { if (grid.isViewReady()) { if (endRow == -1) { endRow = widgetList.size() - 1; } for (int i = startRow; i <= endRow; i++) { List<Widget> m = i < widgetList.size() ? widgetList.get(i) : null; if (m != null) { for (int j = 0; j < grid.getColumnModel().getColumnCount(); j++) { Widget w = j < m.size() ? m.get(j) : null; if (w != null) { Element cell = getWidgetCell(i, j); if (cell != null) { if (w.getElement().getParentElement() != cell) { fly(cell).removeChildren(); cell.appendChild(w.getElement()); } if (grid.isAttached()) { ComponentHelper.doAttach(w); } } } } } } } }
protected void onCellSelect(int row, int col) { Element cell = getCell(row, col); if (cell != null) { fly(cell).addStyleName("x-grid3-cell-selected"); if (GXT.isAriaEnabled()) { cell.setAttribute("aria-selected", "true"); grid.setAriaState("aria-activedescendant", cell.getId()); } } }