private void addColumn(final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> column, final int columnIndex, final String header, final boolean isSortable, final int width) { column.setSortable(isSortable); column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); grid.addColumn(column, header); grid.setColumnWidth(column, width, Style.Unit.PCT); column.setFieldUpdater(new FieldUpdater<Map.Entry<String, String>, String>() { @Override public void update(final int index, final Map.Entry<String, String> object, final String value) { presenter.update(columnIndex, index, object, value); } }); }
private void addColumn(final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> column, final int columnIndex, final String header, final boolean isSortable, final int width) { column.setSortable(isSortable); column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); grid.addColumn(column, header); grid.setColumnWidth(column, width, Style.Unit.PCT); column.setFieldUpdater(new FieldUpdater<Map.Entry<String, String>, String>() { @Override public void update(final int index, final Map.Entry<String, String> object, final String value) { presenter.update(columnIndex, index, object, value); } }); }
protected com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> createAttributeRemoveColumn() { // On read mode, remove button not present. if (!canManageAttributes()) { return null; } // Create remove button column. final ButtonCell removeButtonCell = new ButtonCell(IconType.CLOSE, ButtonType.LINK, ButtonSize.SMALL); final com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> removeColumn = new com.google.gwt.user.cellview.client.Column<Entry<String, String>, String>(removeButtonCell) { @Override public String getValue(final Entry<String, String> object) { // if can be removed return empty string, if not, return null if (object != null) { final UserManager.UserAttribute attribute = getAttribute(object.getKey()); if (attribute != null && !attribute.isMandatory() && attribute.isEditable()) { removeButtonCell.setEnabled(true); return ""; } } removeButtonCell.setEnabled(false); return null; } }; removeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); removeColumn.setFieldUpdater(canManageAttributes() ? removeButtonHandler : null); return removeColumn; }
protected com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> createAttributeRemoveColumn() { // On read mode, remove button not present. if (!canManageAttributes()) { return null; } // Create remove button column. final ButtonCell removeButtonCell = new ButtonCell(IconType.CLOSE, ButtonType.LINK, ButtonSize.SMALL); final com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> removeColumn = new com.google.gwt.user.cellview.client.Column<Entry<String, String>, String>(removeButtonCell) { @Override public String getValue(final Entry<String, String> object) { // if can be removed return empty string, if not, return null if (object != null) { final UserManager.UserAttribute attribute = getAttribute(object.getKey()); if (attribute != null && !attribute.isMandatory() && attribute.isEditable()) { removeButtonCell.setEnabled(true); return ""; } } removeButtonCell.setEnabled(false); return null; } }; removeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); removeColumn.setFieldUpdater(canManageAttributes() ? removeButtonHandler : null); return removeColumn; }
/** Initialize the columns of the grid. */ private void initColumns() { indexFiles = new CellTable<>(); // Create files column: Column<IndexFile, String> filesColumn = new Column<IndexFile, String>(new TextCell()) { @Override public String getValue(IndexFile file) { return file.getPath(); } }; // Create column with checkboxes: Column<IndexFile, Boolean> checkColumn = new Column<IndexFile, Boolean>(new CheckboxCell(false, true)) { @Override public Boolean getValue(IndexFile file) { return !file.isIndexed(); } }; // Create bean value updater: FieldUpdater<IndexFile, Boolean> checkFieldUpdater = (index, file, value) -> file.setIndexed(!value); checkColumn.setFieldUpdater(checkFieldUpdater); filesColumn.setHorizontalAlignment(ALIGN_LEFT); indexFiles.addColumn(checkColumn, (SafeHtml) () -> " "); indexFiles.setColumnWidth(checkColumn, 1, Style.Unit.PCT); indexFiles.addColumn(filesColumn, FILES); indexFiles.setColumnWidth(filesColumn, 35, Style.Unit.PCT); indexFiles.addStyleName(resources.gitCSS().cells()); }
actionsColumn.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
actionsColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
actionsColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);