/** * Finds the index of the first matching column for the given dataIndex. * * @param dataIndex the data index * @return the column index, or -1 if no match was found */ public int findColumnIndex(String dataIndex) { for (int i = 0, len = configs.size(); i < len; i++) { if (configs.get(i).getDataIndex().equals(dataIndex)) { return i; } } return -1; }
/** * Returns the data index for the specified column. * * @param colIndex the column index * @return the data index */ public String getDataIndex(int colIndex) { ColumnConfig c = getColumn(colIndex); return c != null ? c.getDataIndex() : null; }
@Override public void handleEvent(GridEvent event) { if (readOnly) { event.setCancelled(true); } String property = getColumnModel().getColumn(event.getColIndex()).getDataIndex(); Month month = IndicatorRowDTO.monthForProperty(property); if (locked.apply(month)) { event.setCancelled(true); } } });
protected Filter getMenuFilter(MenuEvent me) { MenuItem item = (MenuItem) me.getItem(); ColumnConfig config = grid.getColumnModel().getColumn((Integer) item.getData("index")); return getFilter(config.getDataIndex()); }
public void updateColumnHeadings() { int cols = grid.getColumnModel().getColumnCount(); for (int i = 0; i < cols; i++) { ColumnConfig config = grid.getColumnModel().getColumn(i); if (!config.isHidden()) { ColumnHeader header = grid.getView().getHeader(); if (header != null) { Head h = header.getHead(i); if (h != null && h.isRendered()) { Filter f = getFilter(config.getDataIndex()); if (f != null) { h.el().setStyleName(filterStyle, f.isActive()); } } } } } }
checkFilterItem.setData("index", column); Filter f = getFilter(grid.getColumnModel().getColumn(column).getDataIndex()); if (f != null) { checkFilterItem.show();