Search in sources :

Example 6 with ImageResource2x

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

the class ChunkContextToolbar method initRunPrevious.

private void initRunPrevious(boolean dark) {
    runPrevious_.setTitle(RStudioGinjector.INSTANCE.getCommands().executePreviousChunks().getMenuLabel(false));
    runPrevious_.setResource(new ImageResource2x(dark ? RES.runPreviousChunksDark2x() : RES.runPreviousChunksLight2x()));
    DOM.sinkEvents(runPrevious_.getElement(), Event.ONCLICK);
    DOM.setEventListener(runPrevious_.getElement(), new EventListener() {

        @Override
        public void onBrowserEvent(Event event) {
            if (DOM.eventGetType(event) == Event.ONCLICK) {
                host_.runPreviousChunks();
            }
        }
    });
}
Also used : ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Event(com.google.gwt.user.client.Event) EventListener(com.google.gwt.user.client.EventListener)

Example 7 with ImageResource2x

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

the class StatusBarWidget method setScopeType.

public void setScopeType(int type) {
    scopeType_ = type;
    if (type == StatusBar.SCOPE_TOP_LEVEL || message_.isVisible())
        scopeIcon_.setVisible(false);
    else
        scopeIcon_.setVisible(true);
    if (type == StatusBar.SCOPE_CLASS)
        scopeIcon_.setResource(new ImageResource2x(CodeIcons.INSTANCE.clazz2x()));
    else if (type == StatusBar.SCOPE_NAMESPACE)
        scopeIcon_.setResource(new ImageResource2x(CodeIcons.INSTANCE.namespace2x()));
    else if (type == StatusBar.SCOPE_LAMBDA)
        scopeIcon_.setResource(new ImageResource2x(StandardIcons.INSTANCE.lambdaLetter2x()));
    else if (type == StatusBar.SCOPE_ANON)
        scopeIcon_.setResource(new ImageResource2x(StandardIcons.INSTANCE.functionLetter2x()));
    else if (type == StatusBar.SCOPE_FUNCTION)
        scopeIcon_.setResource(new ImageResource2x(StandardIcons.INSTANCE.functionLetter2x()));
    else if (type == StatusBar.SCOPE_CHUNK)
        scopeIcon_.setResource(new ImageResource2x(RES.chunk2x()));
    else if (type == StatusBar.SCOPE_SECTION)
        scopeIcon_.setResource(new ImageResource2x(RES.section2x()));
    else if (type == StatusBar.SCOPE_SLIDE)
        scopeIcon_.setResource(new ImageResource2x(RES.slide2x()));
    else
        scopeIcon_.setResource(new ImageResource2x(CodeIcons.INSTANCE.function2x()));
}
Also used : ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 8 with ImageResource2x

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

the class RMarkdownNoParamsDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    VerticalPanel panel = new VerticalPanel();
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    // add image
    MessageDialogImages images = MessageDialogImages.INSTANCE;
    Image image = new Image(new ImageResource2x(images.dialog_warning2x()));
    horizontalPanel.add(image);
    // add message widget
    VerticalPanel messagePanel = new VerticalPanel();
    Label label = new MultiLineLabel("There are no parameters defined for the current " + "R Markdown document.");
    label.setStylePrimaryName(ThemeResources.INSTANCE.themeStyles().dialogMessage());
    messagePanel.add(label);
    HelpLink helpLink = new HelpLink("Using R Markdown Parameters", "parameterized_reports", false);
    Style style = helpLink.getElement().getStyle();
    style.setMarginTop(4, Unit.PX);
    style.setMarginBottom(12, Unit.PX);
    messagePanel.add(helpLink);
    horizontalPanel.add(messagePanel);
    panel.add(horizontalPanel);
    return panel;
}
Also used : MessageDialogImages(org.rstudio.core.client.widget.images.MessageDialogImages) MultiLineLabel(org.rstudio.core.client.widget.MultiLineLabel) HelpLink(org.rstudio.studio.client.common.HelpLink) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Style(com.google.gwt.dom.client.Style) MultiLineLabel(org.rstudio.core.client.widget.MultiLineLabel)

Example 9 with ImageResource2x

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

the class GitStatusRenderer method render.

@Override
public SafeHtml render(String str) {
    if (str.length() != 2)
        return null;
    ImageResource2x indexImg = imgForStatus(str.charAt(0));
    ImageResource2x treeImg = imgForStatus(str.charAt(1));
    SafeHtmlBuilder builder = new SafeHtmlBuilder();
    builder.append(SafeHtmlUtils.fromTrustedString("<span " + "class=\"" + ctRes_.cellTableStyle().status() + "\" " + "title=\"" + SafeHtmlUtils.htmlEscape(descForStatus(str)) + "\">"));
    builder.append(indexImg.getSafeHtml());
    builder.append(treeImg.getSafeHtml());
    builder.appendHtmlConstant("</span>");
    return builder.toSafeHtml();
}
Also used : ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 10 with ImageResource2x

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

the class DataTable method initToolbar.

public void initToolbar(Toolbar toolbar, boolean isPreview) {
    filterButton_ = new LatchingToolbarButton("Filter", new ImageResource2x(DataViewerResources.INSTANCE.filterIcon2x()), new ClickHandler() {

        public void onClick(ClickEvent event) {
            boolean newFilterState = !filtered_;
            // ready/table is not initialized)
            if (setFilterUIVisible(newFilterState)) {
                filtered_ = newFilterState;
                filterButton_.setLatched(filtered_);
            }
        }
    });
    toolbar.addLeftWidget(filterButton_);
    filterButton_.setVisible(!isPreview);
    searchWidget_ = new SearchWidget(new SuggestOracle() {

        @Override
        public void requestSuggestions(Request request, Callback callback) {
            // no suggestions
            callback.onSuggestionsReady(request, new Response(new ArrayList<Suggestion>()));
        }
    });
    searchWidget_.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            applySearch(getWindow(), event.getValue());
        }
    });
    toolbar.addRightWidget(searchWidget_);
    searchWidget_.setVisible(!isPreview);
    if (isPreview) {
        ToolbarLabel label = new ToolbarLabel("(Displaying up to 1,000 records)");
        label.addStyleName(ThemeStyles.INSTANCE.toolbarInfoLabel());
        toolbar.addRightWidget(label);
    }
}
Also used : LatchingToolbarButton(org.rstudio.core.client.widget.LatchingToolbarButton) SearchWidget(org.rstudio.core.client.widget.SearchWidget) ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) SuggestOracle(com.google.gwt.user.client.ui.SuggestOracle)

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