use of com.google.gwt.cell.client.ImageResourceCell 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);
}
use of com.google.gwt.cell.client.ImageResourceCell in project rstudio by rstudio.
the class UnsavedChangesDialog method addIconColumn.
private Column<UnsavedChangesTarget, ImageResource> addIconColumn() {
Column<UnsavedChangesTarget, ImageResource> iconColumn = new Column<UnsavedChangesTarget, ImageResource>(new ImageResourceCell()) {
@Override
public ImageResource getValue(UnsavedChangesTarget object) {
return object.getIcon();
}
};
targetsCellTable_.addColumn(iconColumn);
targetsCellTable_.setColumnWidth(iconColumn, 20, Unit.PX);
return iconColumn;
}
use of com.google.gwt.cell.client.ImageResourceCell in project rstudio by rstudio.
the class FilesList method addIconColumn.
private Column<FileSystemItem, ImageResource> addIconColumn(final FileTypeRegistry fileTypeRegistry) {
Column<FileSystemItem, ImageResource> iconColumn = new Column<FileSystemItem, ImageResource>(new ImageResourceCell()) {
@Override
public ImageResource getValue(FileSystemItem object) {
if (object == parentPath_)
return new ImageResource2x(FileIconResources.INSTANCE.iconUpFolder2x());
else
return fileTypeRegistry.getIconForFile(object);
}
};
iconColumn.setSortable(true);
filesDataGrid_.addColumn(iconColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
filesDataGrid_.setColumnWidth(iconColumn, ICON_COLUMN_WIDTH_PIXELS, Unit.PX);
sortHandler_.setComparator(iconColumn, new FilesListComparator() {
@Override
public int doCompare(FileSystemItem arg0, FileSystemItem arg1) {
if (arg0.isDirectory() && !arg1.isDirectory())
return 1;
else if (arg1.isDirectory() && !arg0.isDirectory())
return -1;
else
return arg0.getExtension().compareTo(arg1.getExtension());
}
});
return iconColumn;
}
Aggregations