List of usage examples for com.google.gwt.user.cellview.client Column getFieldUpdater
@Override
public FieldUpdater<T, C> getFieldUpdater()
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.GridView.java
License:Apache License
@SuppressWarnings("unchecked") public void fillDownKeyboardSelectedColumn() { int colIndex = dataGrid.getKeyboardSelectedColumn(); int rowIndex = dataGrid.getKeyboardSelectedRow() + dataGrid.getPageStart(); if (colIndex >= 1 && colIndex < dataGrid.getColumnCount() && rowIndex >= 0 && rowIndex < dataGrid.getRowCount()) { Column<R, ?> column = dataGrid.getColumn(colIndex); List<R> rows = dataProvider.getList(); if (isColumnEditable(column, rows.get(rowIndex)) && !(column instanceof SamplesViewImpl.SampleNameColumn)) { AbstractEditableCell<R, String> cell = (AbstractEditableCell<R, String>) column.getCell(); String value = (String) column.getValue(rows.get(rowIndex)); FieldUpdater<R, String> updater = (FieldUpdater<R, String>) column.getFieldUpdater(); for (int i = rowIndex + 1; i < rows.size(); i++) { if (isColumnEditable(column, rows.get(i))) { updater.update(i, rows.get(i), value); cell.clearViewData(rows.get(i)); }//from w w w . j av a 2 s.c om } dataProvider.refresh(); } else { NotificationPopupPanel.warning("Fill-down function is not allowed for this column", true, false); } } }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.GridView.java
License:Apache License
@SuppressWarnings("unchecked") public boolean importValuesToKeyboardSelectedColumn(List<String> values) { int colIndex = dataGrid.getKeyboardSelectedColumn(); int rowIndex = dataGrid.getKeyboardSelectedRow() + dataGrid.getPageStart(); if (null != values && !values.isEmpty()) { if (colIndex >= 1 && colIndex < dataGrid.getColumnCount() && rowIndex >= 0 && rowIndex < dataGrid.getRowCount()) { Column<R, ?> column = dataGrid.getColumn(colIndex); List<R> rows = dataProvider.getList(); if (isColumnEditable(column, rows.get(rowIndex))) { if (column instanceof SamplesViewImpl.SampleNameColumn) { for (int i = 0; i < values.size(); i++) { String value = values.get(i); for (int j = i + 1; j < values.size(); j++) { if (value.equalsIgnoreCase(values.get(j))) { NotificationPopupPanel .error("Please ensure all sample names are unique, duplicate name '" + values.get(j) + "'.", true, false); return false; }//from w ww . j a v a2s .c om } } } Cell<String> cell = (Cell<String>) column.getCell(); FieldUpdater<R, String> updater = (FieldUpdater<R, String>) column.getFieldUpdater(); for (int i = 0; i < Math.min(rows.size() - rowIndex, values.size()); i++) { int j = i + rowIndex; if (isColumnEditable(column, rows.get(j))) { updater.update(j, rows.get(j), values.get(i)); ((AbstractEditableCell) cell).clearViewData(rows.get(j)); } } dataProvider.refresh(); } } } return true; }