Search in sources :

Example 1 with ImageResource2x

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

the class DirectoryContentsWidget method setContents.

public void setContents(FileSystemItem[] contents, FileSystemItem parentDirectory) {
    clearContents();
    if (parentDirectory != null)
        addItem(parentDirectory, "..", new ImageResource2x(FileIconResources.INSTANCE.iconUpFolder2x()));
    for (FileSystemItem fsi : contents) addItem(fsi, null, null);
    showProgress(false);
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 2 with ImageResource2x

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

the class PathBreadcrumbWidget method maybeAddProjectIcon.

private void maybeAddProjectIcon() {
    if (projectIconsAdded_)
        return;
    if (pSession_ == null || pSession_.get() == null)
        return;
    final FileSystemItem projDir = pSession_.get().getSessionInfo().getActiveProjectDir();
    if (projDir != null) {
        Image projIcon = new Image(new ImageResource2x(RES.projectImage2x()));
        projIcon.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
        projIcon.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                SelectionCommitEvent.fire(PathBreadcrumbWidget.this, projDir);
            }
        });
        projIcon.addStyleName(RES.styles().project());
        projIcon.setTitle("Go to project directory");
        eastFrame_.insert(projIcon, 0);
        // TODO: infer from contents
        double width = 42;
        frame_.setWidgetSize(eastFrame_, width);
        projectIconsAdded_ = true;
    }
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 3 with ImageResource2x

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

the class ShinyGadgetDialog method addCaptionWithCloseButton.

private void addCaptionWithCloseButton(String caption) {
    final Image closeIcon = new Image(new ImageResource2x(ThemeResources.INSTANCE.closeDialog2x()));
    Style closeIconStyle = closeIcon.getElement().getStyle();
    closeIconStyle.setCursor(Style.Cursor.POINTER);
    closeIconStyle.setMarginTop(2, Unit.PX);
    FlexTable captionLayoutTable = new FlexTable();
    captionLayoutTable.setWidth("100%");
    captionLayoutTable.setText(0, 0, caption);
    captionLayoutTable.setWidget(0, 1, closeIcon);
    captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.HorizontalAlignmentConstant.endOf(Direction.LTR));
    HTML captionWidget = (HTML) getCaption();
    captionWidget.getElement().appendChild(captionLayoutTable.getElement());
    captionWidget.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            EventTarget target = event.getNativeEvent().getEventTarget();
            Element targetElement = (Element) target.cast();
            if (targetElement == closeIcon.getElement()) {
                closeIcon.fireEvent(event);
            }
        }
    });
    closeIcon.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            performClose();
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Element(com.google.gwt.dom.client.Element) FlexTable(com.google.gwt.user.client.ui.FlexTable) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Style(com.google.gwt.dom.client.Style) HTML(com.google.gwt.user.client.ui.HTML) Image(com.google.gwt.user.client.ui.Image) EventTarget(com.google.gwt.dom.client.EventTarget)

Example 4 with ImageResource2x

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

the class TextEditingTargetWidget method setIsShinyFormat.

@Override
public void setIsShinyFormat(boolean showOutputOptions, boolean isPresentation, boolean isShinyPrerendered) {
    setRmdFormatButtonVisible(false);
    showRmdViewerMenuItems(!isPresentation, showOutputOptions, true, RmdOutput.TYPE_SHINY);
    String docType = isPresentation ? "Presentation" : "Document";
    knitCommandText_ = "Run " + docType;
    knitDocumentButton_.setTitle("View the current " + docType.toLowerCase() + " with Shiny (" + DomUtils.htmlToText(commands_.knitDocument().getShortcutPrettyHtml()) + ")");
    knitDocumentButton_.setText(knitCommandText_);
    knitDocumentButton_.setLeftImage(new ImageResource2x(StandardIcons.INSTANCE.run2x()));
    runDocumentMenuButton_.setVisible(isShinyPrerendered);
    setKnitDocumentMenuVisible(isShinyPrerendered);
    isShiny_ = true;
    if (publishButton_ != null)
        publishButton_.setIsStatic(false);
}
Also used : ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 5 with ImageResource2x

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

the class TextEditingTargetWidget method createCodeTransformMenuButton.

private Widget createCodeTransformMenuButton() {
    if (codeTransform_ == null) {
        ImageResource icon = new ImageResource2x(ThemeResources.INSTANCE.codeTransform2x());
        ToolbarPopupMenu menu = new ToolbarPopupMenu();
        menu.addItem(commands_.codeCompletion().createMenuItem(false));
        menu.addSeparator();
        menu.addItem(commands_.goToHelp().createMenuItem(false));
        menu.addItem(commands_.goToFunctionDefinition().createMenuItem(false));
        menu.addItem(commands_.findUsages().createMenuItem(false));
        menu.addSeparator();
        menu.addItem(commands_.extractFunction().createMenuItem(false));
        menu.addItem(commands_.extractLocalVariable().createMenuItem(false));
        menu.addItem(commands_.renameInScope().createMenuItem(false));
        menu.addSeparator();
        menu.addItem(commands_.reflowComment().createMenuItem(false));
        menu.addItem(commands_.commentUncomment().createMenuItem(false));
        menu.addItem(commands_.insertRoxygenSkeleton().createMenuItem(false));
        menu.addSeparator();
        menu.addItem(commands_.reindent().createMenuItem(false));
        menu.addItem(commands_.reformatCode().createMenuItem(false));
        menu.addSeparator();
        menu.addItem(commands_.showDiagnosticsActiveDocument().createMenuItem(false));
        menu.addItem(commands_.showDiagnosticsProject().createMenuItem(false));
        menu.addSeparator();
        menu.addItem(commands_.profileCode().createMenuItem(false));
        codeTransform_ = new ToolbarButton("", icon, menu);
        codeTransform_.setTitle("Code Tools");
    }
    return codeTransform_;
}
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