Search in sources :

Example 1 with ToolbarLabel

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

the class WebApplicationHeader method initCommandsPanel.

private void initCommandsPanel(final SessionInfo sessionInfo) {
    // add username 
    if (sessionInfo.getShowIdentity()) {
        ToolbarLabel usernameLabel = new ToolbarLabel();
        usernameLabel.getElement().getStyle().setMarginRight(2, Unit.PX);
        if (!BrowseCap.isFirefox())
            usernameLabel.getElement().getStyle().setMarginTop(2, Unit.PX);
        String userIdentity = sessionInfo.getUserIdentity();
        usernameLabel.setTitle(userIdentity);
        userIdentity = userIdentity.split("@")[0];
        usernameLabel.setText(userIdentity);
        headerBarCommandsPanel_.add(usernameLabel);
        ToolbarButton signOutButton = new ToolbarButton(new ImageResource2x(RESOURCES.signOut2x()), new ClickHandler() {

            public void onClick(ClickEvent event) {
                eventBus_.fireEvent(new LogoutRequestedEvent());
            }
        });
        signOutButton.setTitle("Sign out");
        headerBarCommandsPanel_.add(signOutButton);
        headerBarCommandsPanel_.add(signOutSeparator_ = createCommandSeparator());
    }
    overlay_.addCommands(this);
    headerBarCommandsPanel_.add(commands_.quitSession().createToolbarButton());
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) LogoutRequestedEvent(org.rstudio.studio.client.application.events.LogoutRequestedEvent) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 2 with ToolbarLabel

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

Example 3 with ToolbarLabel

use of org.rstudio.core.client.widget.ToolbarLabel 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 4 with ToolbarLabel

use of org.rstudio.core.client.widget.ToolbarLabel 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 5 with ToolbarLabel

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

the class ConnectionsPane method createSecondaryToolbar.

@Override
protected SecondaryToolbar createSecondaryToolbar() {
    secondaryToolbar_ = new SecondaryToolbar();
    secondaryToolbar_.addLeftWidget(connectionName_ = new ToolbarLabel());
    return secondaryToolbar_;
}
Also used : ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) SecondaryToolbar(org.rstudio.core.client.widget.SecondaryToolbar)

Aggregations

ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)5 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)2 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)2 WindowEx (org.rstudio.core.client.dom.WindowEx)2 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)2 CanFocus (org.rstudio.core.client.widget.CanFocus)2 FindTextBox (org.rstudio.core.client.widget.FindTextBox)2 RSConnectPublishButton (org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton)2 SuggestOracle (com.google.gwt.user.client.ui.SuggestOracle)1 ArrayList (java.util.ArrayList)1 LatchingToolbarButton (org.rstudio.core.client.widget.LatchingToolbarButton)1 SearchWidget (org.rstudio.core.client.widget.SearchWidget)1 SecondaryToolbar (org.rstudio.core.client.widget.SecondaryToolbar)1 Toolbar (org.rstudio.core.client.widget.Toolbar)1 ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)1 LogoutRequestedEvent (org.rstudio.studio.client.application.events.LogoutRequestedEvent)1 SlideNavigationToolbarMenu (org.rstudio.studio.client.common.presentation.SlideNavigationToolbarMenu)1