/** * Returns true if the cell is editable. * * @param colIndex the column index * @return true if editable */ public boolean isCellEditable(int colIndex) { ColumnConfig c = getColumn(colIndex); return c != null && c.getEditor() != null; }
/** * Returns the column's editor. * * @param colIndex the column index * @return the cell editor */ public CellEditor getEditor(int colIndex) { ColumnConfig c = getColumn(colIndex); return c != null ? c.getEditor() : null; }
protected void doFocus(int colIndex) { if (isVisible()) { ColumnModel cm = this.grid.getColumnModel(); for (int i = colIndex, len = cm.getColumnCount(); i < len && i >= 0; i++) { ColumnConfig c = cm.getColumn(i); if (!c.isHidden() && c.getEditor() != null) { c.getEditor().getField().focus(); break; } } } }
protected void initFields() { ColumnModel cm = grid.getColumnModel(); for (int i = 0, len = cm.getColumnCount(); i < len; i++) { ColumnConfig c = cm.getColumn(i); CellEditor ed = c.getEditor(); Field<?> f = ed != null ? ed.getField() : new LabelField(); if (f instanceof TriggerField<?>) { ((TriggerField<? extends Object>) f).setMonitorTab(true); } f.setWidth(cm.getColumnWidth(i)); HBoxLayoutData ld = new HBoxLayoutData(); if (i == 0) { ld.setMargins(new Margins(0, 1, 2, 1)); } else if (i == len - 1) { ld.setMargins(new Margins(0, 0, 2, 1)); } else { ld.setMargins(new Margins(0, 1, 2, 2)); } f.setMessageTarget("tooltip"); f.addStyleName("x-row-editor-field"); // needed because we remove it from the celleditor clearParent(f); insert(f, i, ld); } initialized = true; }