use of com.google.gwt.user.cellview.client.Column in project che by eclipse.
the class HistoryViewImpl method createRevisionsTable.
private void createRevisionsTable(org.eclipse.che.ide.Resources coreRes) {
Column<Revision, String> idColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getId().substring(0, 8) + "...";
}
};
Column<Revision, String> timeColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return dateTimeFormatter.getFormattedDate(revision.getCommitTime());
}
};
Column<Revision, String> authorColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getCommitter().getName();
}
};
Column<Revision, String> titleColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getMessage().substring(0, 50);
}
};
revisions = new CellTable<>(15, coreRes);
revisions.setWidth("100%");
revisions.addColumn(idColumn, locale.viewCompareRevisionTableIdTitle());
revisions.addColumn(timeColumn, locale.viewCompareRevisionTableTimeTitle());
revisions.addColumn(authorColumn, locale.viewCompareRevisionTableAuthorTitle());
revisions.addColumn(titleColumn, locale.viewCompareRevisionTableTitleTitle());
selectionModel = new SingleSelectionModel<Revision>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
description.setText(selectionModel.getSelectedObject().getMessage());
delegate.onRevisionSelected(selectionModel.getSelectedObject());
}
});
revisions.setSelectionModel(selectionModel);
revisions.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
delegate.onRevisionDoubleClicked();
}
}, DoubleClickEvent.getType());
this.revisionsPanel.add(revisions);
}
use of com.google.gwt.user.cellview.client.Column 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.user.cellview.client.Column in project rstudio by rstudio.
the class UnsavedChangesDialog method addSelectionColumn.
private Column<UnsavedChangesTarget, Boolean> addSelectionColumn() {
Column<UnsavedChangesTarget, Boolean> checkColumn = new Column<UnsavedChangesTarget, Boolean>(new CheckboxCell(true, false)) {
@Override
public Boolean getValue(UnsavedChangesTarget object) {
return selectionModel_.isSelected(object);
}
};
checkColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
targetsCellTable_.addColumn(checkColumn);
targetsCellTable_.setColumnWidth(checkColumn, 25, Unit.PX);
return checkColumn;
}
use of com.google.gwt.user.cellview.client.Column in project rstudio by rstudio.
the class FilesList method addSelectionColumn.
private Column<FileSystemItem, Boolean> addSelectionColumn() {
Column<FileSystemItem, Boolean> checkColumn = new Column<FileSystemItem, Boolean>(new CheckboxCell(true, false) {
@Override
public void render(Context context, Boolean value, SafeHtmlBuilder sb) {
// don't render the check box if its for the parent path
if (parentPath_ == null || context.getIndex() > 0)
super.render(context, value, sb);
}
}) {
@Override
public Boolean getValue(FileSystemItem item) {
return selectionModel_.isSelected(item);
}
};
checkColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
filesDataGrid_.addColumn(checkColumn);
filesDataGrid_.setColumnWidth(checkColumn, CHECK_COLUMN_WIDTH_PIXELS, Unit.PX);
return checkColumn;
}
use of com.google.gwt.user.cellview.client.Column 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