Search in sources :

Example 16 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.

the class ProjectPopupMenu method getToolbarButton.

public ToolbarButton getToolbarButton() {
    if (toolbarButton_ == null) {
        String buttonText = activeProjectFile_ != null ? mruList_.getQualifiedLabel(activeProjectFile_) : "Project: (None)";
        toolbarButton_ = new ToolbarButton(buttonText, new ImageResource2x(RESOURCES.projectMenu2x()), this, true);
        if (activeProjectFile_ != null) {
            toolbarButton_.setTitle(activeProjectFile_);
            // also set the doc title so the browser tab carries the project
            if (!Desktop.isDesktop())
                Document.get().setTitle("RStudio - " + buttonText);
        }
        if (activeProjectFile_ == null) {
            toolbarButton_.addStyleName(ThemeResources.INSTANCE.themeStyles().emptyProjectMenu());
        }
    }
    return toolbarButton_;
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 17 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.

the class RmdOutputPanel method initToolbar.

@Override
protected void initToolbar(Toolbar toolbar, Commands commands) {
    slideNavigationMenu_ = new SlideNavigationToolbarMenu(toolbar, 400, 100, true);
    fileLabel_ = new ToolbarLabel();
    fileLabel_.addStyleName(ThemeStyles.INSTANCE.subtitle());
    fileLabel_.getElement().getStyle().setMarginRight(7, Unit.PX);
    toolbar.addLeftWidget(fileLabel_);
    fileLabelSeparator_ = toolbar.addLeftSeparator();
    ToolbarButton popoutButton = commands.viewerPopout().createToolbarButton();
    popoutButton.setText("Open in Browser");
    toolbar.addLeftWidget(popoutButton);
    findTextBox_ = new FindTextBox("Find");
    findTextBox_.setIconVisible(true);
    findTextBox_.setOverrideWidth(120);
    findTextBox_.getElement().getStyle().setMarginRight(6, Unit.PX);
    findSeparator_ = toolbar.addLeftSeparator();
    toolbar.addLeftWidget(findTextBox_);
    findTextBox_.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            // enter key triggers a find
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                event.preventDefault();
                event.stopPropagation();
                findInTopic(findTextBox_.getValue().trim(), findTextBox_);
                findTextBox_.focus();
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
                findTextBox_.setValue("");
            }
        }

        private void findInTopic(String term, CanFocus findInputSource) {
            // get content window
            WindowEx contentWindow = getFrame().getWindow();
            if (contentWindow == null)
                return;
            if (!contentWindow.find(term, false, false, true, false)) {
                RStudioGinjector.INSTANCE.getGlobalDisplay().showMessage(MessageDialog.INFO, "Find in Page", "No occurences found", findInputSource);
            }
        }
    });
    toolbar.addLeftSeparator();
    publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_DOCUMENT, true, null);
    toolbar.addRightWidget(publishButton_);
    toolbar.addRightSeparator();
    toolbar.addRightWidget(commands.viewerRefresh().createToolbarButton());
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) CanFocus(org.rstudio.core.client.widget.CanFocus) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) SlideNavigationToolbarMenu(org.rstudio.studio.client.common.presentation.SlideNavigationToolbarMenu) WindowEx(org.rstudio.core.client.dom.WindowEx) FindTextBox(org.rstudio.core.client.widget.FindTextBox)

Example 18 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.

the class HTMLPreviewPanel method createToolbar.

private Toolbar createToolbar(Commands commands) {
    Toolbar toolbar = new Toolbar();
    toolbar.addLeftWidget(new ToolbarLabel("Preview: "));
    fileLabel_ = new ToolbarLabel();
    fileLabel_.addStyleName(ThemeStyles.INSTANCE.subtitle());
    fileLabel_.getElement().getStyle().setMarginRight(7, Unit.PX);
    toolbar.addLeftWidget(fileLabel_);
    toolbar.addLeftSeparator();
    toolbar.addLeftWidget(commands.openHtmlExternal().createToolbarButton());
    showLogButtonSeparator_ = toolbar.addLeftSeparator();
    showLogButton_ = commands.showHtmlPreviewLog().createToolbarButton();
    toolbar.addLeftWidget(showLogButton_);
    saveHtmlPreviewAsSeparator_ = toolbar.addLeftSeparator();
    if (Desktop.isDesktop()) {
        saveHtmlPreviewAs_ = commands.saveHtmlPreviewAs().createToolbarButton();
        toolbar.addLeftWidget(saveHtmlPreviewAs_);
    } else {
        ToolbarPopupMenu menu = new ToolbarPopupMenu();
        menu.addItem(commands.saveHtmlPreviewAs().createMenuItem(false));
        menu.addItem(commands.saveHtmlPreviewAsLocalFile().createMenuItem(false));
        saveHtmlPreviewAs_ = toolbar.addLeftWidget(new ToolbarButton("Save As", commands.saveSourceDoc().getImageResource(), menu));
    }
    publishButtonSeparator_ = toolbar.addLeftSeparator();
    toolbar.addLeftWidget(publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_DOCUMENT, true, null));
    findTextBox_ = new FindTextBox("Find");
    findTextBox_.setIconVisible(true);
    findTextBox_.setOverrideWidth(120);
    findTextBox_.getElement().getStyle().setMarginRight(6, Unit.PX);
    toolbar.addRightWidget(findTextBox_);
    findTextBox_.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            // enter key triggers a find
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                event.preventDefault();
                event.stopPropagation();
                findInTopic(findTextBox_.getValue().trim(), findTextBox_);
                findTextBox_.focus();
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
                findTextBox_.setValue("");
            }
        }

        private void findInTopic(String term, CanFocus findInputSource) {
            // get content window
            WindowEx contentWindow = previewFrame_.getWindow();
            if (contentWindow == null)
                return;
            if (!contentWindow.find(term, false, false, true, false)) {
                RStudioGinjector.INSTANCE.getGlobalDisplay().showMessage(MessageDialog.INFO, "Find in Page", "No occurences found", findInputSource);
            }
        }
    });
    refreshButtonSeparator_ = toolbar.addRightSeparator();
    refreshButton_ = toolbar.addRightWidget(commands.refreshHtmlPreview().createToolbarButton());
    return toolbar;
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) CanFocus(org.rstudio.core.client.widget.CanFocus) WindowEx(org.rstudio.core.client.dom.WindowEx) FindTextBox(org.rstudio.core.client.widget.FindTextBox) Toolbar(org.rstudio.core.client.widget.Toolbar)

Example 19 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.

the class ViewFilePanel method createToolbar.

private Toolbar createToolbar() {
    toolbar_ = new ViewFileToolbar();
    toolbar_.addLeftWidget(new ToolbarButton("Save As", commands_.saveSourceDoc().getImageResource(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            saveFileAs();
        }
    }));
    toolbar_.addLeftSeparator();
    toolbar_.addLeftWidget(new ToolbarButton(null, commands_.printSourceDoc().getImageResource(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            docDisplay_.print();
        }
    }));
    toolbar_.addLeftSeparator();
    toolbar_.addLeftWidget(findReplace_.createFindReplaceButton());
    return toolbar_;
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 20 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.

the class EnvironmentPane method createMainToolbar.

// WorkbenchPane overrides -------------------------------------------------
@Override
protected Toolbar createMainToolbar() {
    Toolbar toolbar = new Toolbar();
    toolbar.addLeftWidget(commands_.loadWorkspace().createToolbarButton());
    toolbar.addLeftWidget(commands_.saveWorkspace().createToolbarButton());
    toolbar.addLeftSeparator();
    toolbar.addLeftWidget(createImportMenu());
    toolbar.addLeftSeparator();
    toolbar.addLeftWidget(commands_.clearWorkspace().createToolbarButton());
    ToolbarPopupMenu menu = new ToolbarPopupMenu();
    menu.addItem(createViewMenuItem(EnvironmentObjects.OBJECT_LIST_VIEW));
    menu.addItem(createViewMenuItem(EnvironmentObjects.OBJECT_GRID_VIEW));
    viewButton_ = new ToolbarButton(nameOfViewType(EnvironmentObjects.OBJECT_LIST_VIEW), imageOfViewType(EnvironmentObjects.OBJECT_LIST_VIEW), menu);
    toolbar.addRightWidget(viewButton_);
    toolbar.addRightSeparator();
    toolbar.addRightWidget(commands_.refreshEnvironment().createToolbarButton());
    return toolbar;
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) SecondaryToolbar(org.rstudio.core.client.widget.SecondaryToolbar) Toolbar(org.rstudio.core.client.widget.Toolbar)

Aggregations

ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)24 ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)13 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)11 Toolbar (org.rstudio.core.client.widget.Toolbar)10 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)8 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)7 RSConnectPublishButton (org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton)5 SecondaryToolbar (org.rstudio.core.client.widget.SecondaryToolbar)4 ImageResource (com.google.gwt.resources.client.ImageResource)3 SuggestOracle (com.google.gwt.user.client.ui.SuggestOracle)3 SearchWidget (org.rstudio.core.client.widget.SearchWidget)3 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)3 JsArrayString (com.google.gwt.core.client.JsArrayString)2 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)2 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)2 ArrayList (java.util.ArrayList)2 WindowEx (org.rstudio.core.client.dom.WindowEx)2 CanFocus (org.rstudio.core.client.widget.CanFocus)2 FindTextBox (org.rstudio.core.client.widget.FindTextBox)2 SlideNavigationToolbarMenu (org.rstudio.studio.client.common.presentation.SlideNavigationToolbarMenu)2