Search in sources :

Example 36 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x 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 ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x 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 38 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.

the class FilesPane method showDataImportFileChoice.

@Override
public void showDataImportFileChoice(FileSystemItem file, Command onView, Command onImport) {
    final ToolbarPopupMenu menu = new ToolbarPopupMenu();
    String editLabel = AppCommand.formatMenuLabel(commands_.renameFile().getImageResource(), "View File", null);
    String importLabel = AppCommand.formatMenuLabel(new ImageResource2x(StandardIcons.INSTANCE.import_dataset2x()), "Import Dataset...", null);
    menu.addItem(new MenuItem(editLabel, true, onView));
    menu.addItem(new MenuItem(importLabel, true, onImport));
    menu.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            Event event = Event.getCurrentEvent();
            PopupPositioner.setPopupPosition(menu, event.getClientX(), event.getClientY());
        }
    });
}
Also used : ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) PositionCallback(com.google.gwt.user.client.ui.PopupPanel.PositionCallback) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Event(com.google.gwt.user.client.Event) MenuItem(com.google.gwt.user.client.ui.MenuItem)

Example 39 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x 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)

Example 40 with ImageResource2x

use of org.rstudio.core.client.resources.ImageResource2x in project rstudio by rstudio.

the class CompileOutputPane method createMainToolbar.

@Override
protected Toolbar createMainToolbar() {
    Toolbar toolbar = new Toolbar();
    fileLabel_ = new ToolbarFileLabel(toolbar, 200);
    ImageResource showLogImage = new ImageResource2x(StandardIcons.INSTANCE.show_log2x());
    if (hasLogs_) {
        showLogButton_ = new ToolbarButton("View Log", showLogImage, (ClickHandler) null);
        showLogButton_.getElement().getStyle().setMarginBottom(3, Unit.PX);
        showLogButton_.setTitle(logTitle_);
        showLogSeparator_ = toolbar.addLeftSeparator();
        setShowLogVisible(false);
        toolbar.addLeftWidget(showLogButton_);
    }
    compilePanel_.connectToolbar(toolbar);
    return toolbar;
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Aggregations

ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)48 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)13 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)13 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)11 ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)10 ImageResource (com.google.gwt.resources.client.ImageResource)9 Image (com.google.gwt.user.client.ui.Image)7 Toolbar (org.rstudio.core.client.widget.Toolbar)6 Style (com.google.gwt.dom.client.Style)4 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)4 JsArrayString (com.google.gwt.core.client.JsArrayString)3 Element (com.google.gwt.dom.client.Element)3 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)3 TextColumn (com.google.gwt.user.cellview.client.TextColumn)3 Event (com.google.gwt.user.client.Event)3 HTML (com.google.gwt.user.client.ui.HTML)3 Label (com.google.gwt.user.client.ui.Label)3 MessageDialogImages (org.rstudio.core.client.widget.images.MessageDialogImages)3 TableRowElement (com.google.gwt.dom.client.TableRowElement)2 Column (com.google.gwt.user.cellview.client.Column)2