use of com.google.gwt.cell.client.SafeHtmlCell in project che by eclipse.
the class GithubImporterPageViewImpl method createRepositoriesTable.
/**
* Creates table what contains list of available repositories.
*
* @param resources
*/
private void createRepositoriesTable(final Resources resources, GitHubLocalizationConstant locale) {
repositories = new CellTable<>(15, resources);
Column<ProjectData, ImageResource> iconColumn = new Column<ProjectData, ImageResource>(new ImageResourceCell()) {
@Override
public ImageResource getValue(ProjectData item) {
return null;
}
};
Column<ProjectData, SafeHtml> repositoryColumn = new Column<ProjectData, SafeHtml>(new SafeHtmlCell()) {
@Override
public SafeHtml getValue(final ProjectData item) {
return SafeHtmlUtils.fromString(item.getName());
}
};
Column<ProjectData, SafeHtml> descriptionColumn = new Column<ProjectData, SafeHtml>(new SafeHtmlCell()) {
@Override
public SafeHtml getValue(final ProjectData item) {
return new SafeHtmlBuilder().appendHtmlConstant("<span>").appendEscaped(item.getDescription() == null ? "" : item.getDescription()).appendHtmlConstant("</span>").toSafeHtml();
}
};
repositories.addColumn(iconColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
repositories.setColumnWidth(iconColumn, 28, Style.Unit.PX);
repositories.addColumn(repositoryColumn, locale.samplesListRepositoryColumn());
repositories.addColumn(descriptionColumn, locale.samplesListDescriptionColumn());
// don't show loading indicator
repositories.setLoadingIndicator(null);
final SingleSelectionModel<ProjectData> selectionModel = new SingleSelectionModel<>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
ProjectData selectedObject = selectionModel.getSelectedObject();
delegate.onRepositorySelected(selectedObject);
}
});
repositories.setSelectionModel(selectionModel);
}
Aggregations