Search in sources :

Example 36 with ImageResource

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;
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Image(com.google.gwt.user.client.ui.Image)

Example 37 with ImageResource

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));
    }
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) EnvironmentFrame(org.rstudio.studio.client.workbench.views.environment.model.EnvironmentFrame)

Example 38 with ImageResource

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;
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) IdentityColumn(com.google.gwt.user.cellview.client.IdentityColumn) Column(com.google.gwt.user.cellview.client.Column) UnsavedChangesTarget(org.rstudio.studio.client.workbench.model.UnsavedChangesTarget) ImageResourceCell(com.google.gwt.cell.client.ImageResourceCell)

Example 39 with ImageResource

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);
        }
    });
}
Also used : AbstractSafeHtmlRenderer(com.google.gwt.text.shared.AbstractSafeHtmlRenderer) ImageResource(com.google.gwt.resources.client.ImageResource) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) JsArrayString(com.google.gwt.core.client.JsArrayString) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) ClickableTextCell(com.google.gwt.cell.client.ClickableTextCell)

Example 40 with ImageResource

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;
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ImageResource(com.google.gwt.resources.client.ImageResource) LinkColumn(org.rstudio.core.client.cellview.LinkColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn) Column(com.google.gwt.user.cellview.client.Column) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) ImageResourceCell(com.google.gwt.cell.client.ImageResourceCell)

Aggregations

ImageResource (com.google.gwt.resources.client.ImageResource)63 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)24 Image (com.google.gwt.user.client.ui.Image)11 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)9 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)7 Element (com.google.gwt.dom.client.Element)6 Column (com.google.gwt.user.cellview.client.Column)6 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Test (org.junit.Test)4 ImageResourceCell (com.google.gwt.cell.client.ImageResourceCell)3 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)3 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)3 ArrayList (java.util.ArrayList)3 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)3 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)3 Context (com.google.gwt.cell.client.Cell.Context)2 JsArray (com.google.gwt.core.client.JsArray)2 JsArrayString (com.google.gwt.core.client.JsArrayString)2