use of com.google.gwt.user.cellview.client.Column 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.user.cellview.client.Column 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.user.cellview.client.Column 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.user.cellview.client.Column 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.user.cellview.client.Column in project rstudio by rstudio.
the class PackagesPane method initPackagesTable.
private void initPackagesTable() {
packagesTable_.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
packagesTable_.setSelectionModel(new NoSelectionModel<PackageInfo>());
LoadedColumn loadedColumn = new LoadedColumn();
NameColumn nameColumn = new NameColumn();
Column<PackageInfo, PackageInfo> descColumn = new Column<PackageInfo, PackageInfo>(new DescriptionCell()) {
@Override
public PackageInfo getValue(PackageInfo object) {
return object;
}
};
Column<PackageInfo, PackageInfo> versionColumn = new Column<PackageInfo, PackageInfo>(new VersionCell(false)) {
@Override
public PackageInfo getValue(PackageInfo object) {
return object;
}
};
ImageButtonColumn<PackageInfo> removeColumn = new ImageButtonColumn<PackageInfo>(new ImageResource2x(ThemeResources.INSTANCE.removePackage2x()), new OperationWithInput<PackageInfo>() {
@Override
public void execute(PackageInfo packageInfo) {
observer_.removePackage(packageInfo);
}
}, "Remove package");
// add common columns
packagesTable_.addColumn(loadedColumn, new TextHeader(""));
packagesTable_.addColumn(nameColumn, new TextHeader("Name"));
packagesTable_.addColumn(descColumn, new TextHeader("Description"));
packagesTable_.addColumn(versionColumn, new TextHeader("Version"));
packagesTable_.setColumnWidth(loadedColumn, 30, Unit.PX);
// set up Packrat-specific columns
if (packratContext_ != null && packratContext_.isModeOn()) {
Column<PackageInfo, PackageInfo> packratVersionColumn = new Column<PackageInfo, PackageInfo>(new VersionCell(true)) {
@Override
public PackageInfo getValue(PackageInfo object) {
return object;
}
};
TextColumn<PackageInfo> packratSourceColumn = new TextColumn<PackageInfo>() {
@Override
public String getValue(PackageInfo pkgInfo) {
if (pkgInfo.getInPackratLibary()) {
String source = pkgInfo.getPackratSource();
if (source.equals("github"))
return "GitHub";
else if (source.equals("Bioconductor"))
return "BioC";
else if (source.equals("source"))
return "Source";
else
return source;
} else
return "";
}
};
packagesTable_.addColumn(packratVersionColumn, new TextHeader("Packrat"));
packagesTable_.addColumn(packratSourceColumn, new TextHeader("Source"));
// distribute columns for extended package information
packagesTable_.setColumnWidth(nameColumn, 20, Unit.PCT);
packagesTable_.setColumnWidth(descColumn, 40, Unit.PCT);
packagesTable_.setColumnWidth(versionColumn, 15, Unit.PCT);
packagesTable_.setColumnWidth(packratVersionColumn, 15, Unit.PCT);
packagesTable_.setColumnWidth(packratSourceColumn, 10, Unit.PCT);
// highlight rows that are out of sync in packrat
packagesTable_.setRowStyles(new PackageRowStyles());
} else {
// distribute columns for non-extended package information
packagesTable_.setColumnWidth(nameColumn, 25, Unit.PCT);
packagesTable_.setColumnWidth(descColumn, 60, Unit.PCT);
packagesTable_.setColumnWidth(versionColumn, 15, Unit.PCT);
}
// remove column is common
packagesTable_.addColumn(removeColumn, new TextHeader(""));
packagesTable_.setColumnWidth(removeColumn, 35, Unit.PX);
packagesTable_.setTableBuilder(new PackageTableBuilder(packagesTable_));
packagesTable_.setSkipRowHoverCheck(true);
packagesTableContainer_.add(packagesTable_);
layoutPackagesTable();
packagesDataProvider_.addDataDisplay(packagesTable_);
}
Aggregations