use of com.google.gwt.resources.client.ImageResource in project rstudio by rstudio.
the class ConsoleInterruptProfilerButton method CreateProfilerButton.
public static Image CreateProfilerButton() {
ImageResource icon = new ImageResource2x(FileIconResources.INSTANCE.iconProfiler2x());
Image button = new Image(icon);
button.addStyleName(ThemeResources.INSTANCE.themeStyles().toolbarButtonLeftImage());
button.getElement().getStyle().setMarginRight(4, Unit.PX);
button.setTitle("Profiling Code");
return button;
}
use of com.google.gwt.resources.client.ImageResource in project rstudio by rstudio.
the class EnvironmentPane method rebuildEnvironmentMenu.
private void rebuildEnvironmentMenu() {
environmentMenu_.clearItems();
if (environments_ == null) {
return;
}
for (int i = 0; i < environments_.length(); i++) {
final EnvironmentFrame frame = environments_.get(i);
ImageResource img = imageOfEnvironment(frame.getName(), frame.isLocal());
environmentMenu_.addItem(ImageMenuItem.create(img, friendlyNameOfEnvironment(frame.getName()), new Scheduler.ScheduledCommand() {
@Override
public void execute() {
loadEnvironmentFrame(frame);
}
}, 2));
}
}
use of com.google.gwt.resources.client.ImageResource 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.resources.client.ImageResource in project rstudio by rstudio.
the class EnvironmentObjectList method createExpandColumn.
private void createExpandColumn() {
// the column containing the expand command; available only on objects
// with contents (such as lists and data frames).
SafeHtmlRenderer<String> expanderRenderer = new AbstractSafeHtmlRenderer<String>() {
@Override
public SafeHtml render(String object) {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
sb.appendHtmlConstant(object);
return sb.toSafeHtml();
}
};
objectExpandColumn_ = new Column<RObjectEntry, String>(new ClickableTextCell(expanderRenderer)) {
@Override
public String getValue(RObjectEntry object) {
String imageUri = "";
String imageStyle = style_.expandIcon();
if (object.canExpand()) {
imageStyle = imageStyle + " " + ThemeStyles.INSTANCE.handCursor();
ImageResource expandImage = object.isExpanding ? CoreResources.INSTANCE.progress() : object.expanded ? new ImageResource2x(EnvironmentResources.INSTANCE.collapseIcon2x()) : new ImageResource2x(EnvironmentResources.INSTANCE.expandIcon2x());
imageUri = expandImage.getSafeUri().asString();
} else if (object.hasTraceInfo()) {
imageUri = new ImageResource2x(EnvironmentResources.INSTANCE.tracedFunction2x()).getSafeUri().asString();
imageStyle += (" " + style_.unclickableIcon());
}
if (imageUri.length() > 0) {
return "<input type=\"image\" src=\"" + imageUri + "\" " + "class=\"" + imageStyle + "\" />";
}
return "";
}
};
objectExpandColumn_.setFieldUpdater(new FieldUpdater<RObjectEntry, String>() {
@Override
public void update(int index, RObjectEntry object, String value) {
if (!object.canExpand())
return;
expandObject(index, object);
}
});
}
use of com.google.gwt.resources.client.ImageResource 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