use of com.google.gwt.cell.client.TextCell in project che by eclipse.
the class SshKeyManagerViewImpl method initSshKeyTable.
/** Creates table what contains list of available ssh keys. */
private void initSshKeyTable(final CellTable.Resources res) {
keys = new CellTable<>(20, res);
Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {
@Override
public String getValue(SshPairDto object) {
return object.getName();
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-title-" + context.getIndex() + "\">");
super.render(context, object, sb);
}
};
hostColumn.setSortable(true);
Column<SshPairDto, String> publicKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
@Override
public String getValue(SshPairDto object) {
return "View";
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-key-" + context.getIndex() + "\">");
if (object != null && object.getPublicKey() != null) {
super.render(context, object, sb);
}
}
};
// Creates handler on button clicked
publicKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
@Override
public void update(int index, SshPairDto object, String value) {
delegate.onViewClicked(object);
}
});
Column<SshPairDto, String> deleteKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
@Override
public String getValue(SshPairDto object) {
return "Delete";
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-delete-" + context.getIndex() + "\">");
super.render(context, object, sb);
}
};
// Creates handler on button clicked
deleteKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
@Override
public void update(int index, SshPairDto object, String value) {
delegate.onDeleteClicked(object);
}
});
keys.addColumn(hostColumn, "Title");
keys.addColumn(publicKeyColumn, "Public Key");
keys.addColumn(deleteKeyColumn, "Delete");
keys.setColumnWidth(hostColumn, 50, Style.Unit.PCT);
keys.setColumnWidth(publicKeyColumn, 30, Style.Unit.PX);
keys.setColumnWidth(deleteKeyColumn, 30, Style.Unit.PX);
// don't show loading indicator
keys.setLoadingIndicator(null);
}
use of com.google.gwt.cell.client.TextCell in project che by eclipse.
the class SshKeyManagerViewImpl method initSshKeyTable.
/** Creates table what contains list of available ssh keys. */
private void initSshKeyTable(final CellTable.Resources res) {
keys = new CellTable<>(15, res);
Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {
@Override
public String getValue(SshPairDto object) {
return object.getName();
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-host-" + context.getIndex() + "\">");
super.render(context, object, sb);
}
};
hostColumn.setSortable(true);
Column<SshPairDto, String> publicKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
@Override
public String getValue(SshPairDto object) {
return "View";
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-key-" + context.getIndex() + "\">");
if (object != null && object.getPublicKey() != null) {
super.render(context, object, sb);
}
}
};
// Creates handler on button clicked
publicKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
@Override
public void update(int index, SshPairDto object, String value) {
delegate.onViewClicked(object);
}
});
Column<SshPairDto, String> deleteKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
@Override
public String getValue(SshPairDto object) {
return "Delete";
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-delete-" + context.getIndex() + "\">");
super.render(context, object, sb);
}
};
// Creates handler on button clicked
deleteKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
@Override
public void update(int index, SshPairDto object, String value) {
delegate.onDeleteClicked(object);
}
});
keys.addColumn(hostColumn, "Host");
keys.addColumn(publicKeyColumn, "Public Key");
keys.addColumn(deleteKeyColumn, "Delete");
keys.setColumnWidth(hostColumn, 50, Style.Unit.PCT);
keys.setColumnWidth(publicKeyColumn, 30, Style.Unit.PX);
keys.setColumnWidth(deleteKeyColumn, 30, Style.Unit.PX);
// don't show loading indicator
keys.setLoadingIndicator(null);
}
use of com.google.gwt.cell.client.TextCell in project che by eclipse.
the class ResetFilesViewImpl method initColumns.
/** Initialize the columns of the grid. */
private void initColumns() {
indexFiles = new CellTable<IndexFile>();
// 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 = new FieldUpdater<IndexFile, Boolean>() {
@Override
public void update(int index, IndexFile file, Boolean value) {
file.setIndexed(!value);
}
};
checkColumn.setFieldUpdater(checkFieldUpdater);
filesColumn.setHorizontalAlignment(ALIGN_LEFT);
indexFiles.addColumn(checkColumn, new SafeHtml() {
@Override
public String asString() {
return " ";
}
});
indexFiles.setColumnWidth(checkColumn, 1, Style.Unit.PCT);
indexFiles.addColumn(filesColumn, FILES);
indexFiles.setColumnWidth(filesColumn, 35, Style.Unit.PCT);
indexFiles.addStyleName(resources.gitCSS().cells());
}
use of com.google.gwt.cell.client.TextCell in project gwt-test-utils by gwt-test-utils.
the class CellListTest method beforeCellListTest.
@Before
public void beforeCellListTest() {
sb.delete(0, sb.length());
setBrowserErrorHandler(new BrowserErrorHandler() {
public void onError(String errorMessage) {
sb.append(errorMessage);
}
});
// Create a cell to render each value.
TextCell textCell = new TextCell();
// Create the CellList that uses the cell.
cellList = new CellList<String>(textCell);
// Set the total row count. This isn't strictly necessary, but it affects
// paging calculations, so its good habit to keep the row count up to
// date.
cellList.setRowCount(DAYS.size(), true);
// Push the data into the widget.
cellList.setRowData(0, DAYS);
cellList.setVisibleRange(0, 5);
// Add it to the root panel.
RootPanel.get().add(cellList);
// Preconditions
assertThat(cellList.getRowCount()).isEqualTo(DAYS.size());
assertThat(cellList.getVisibleItemCount()).isEqualTo(5);
assertThat(cellList.getVisibleItem(cellList.getVisibleItemCount() - 1)).isEqualTo("Thursday");
}
use of com.google.gwt.cell.client.TextCell in project kie-wb-common by kiegroup.
the class TemplateParamsTableView method addParamRequiredColumn.
private void addParamRequiredColumn() {
Column<TemplateParam, String> column = new Column<TemplateParam, String>(new TextCell()) {
@Override
public String getValue(TemplateParam templateParam) {
return templateParam.isRequired() ? "*" : "";
}
};
dataGrid.addColumn(column, " ");
dataGrid.setColumnWidth(column, 30, Style.Unit.PX);
}
Aggregations