Search in sources :

Example 1 with SearchWidget

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

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

the class ConnectionsPane method createMainToolbar.

@Override
protected Toolbar createMainToolbar() {
    toolbar_ = new Toolbar();
    searchWidget_ = new SearchWidget(new SuggestOracle() {

        @Override
        public void requestSuggestions(Request request, Callback callback) {
            // no suggestions
            callback.onSuggestionsReady(request, new Response(new ArrayList<Suggestion>()));
        }
    });
    backToConnectionsButton_ = new ToolbarButton(commands_.helpBack().getImageResource(), (ClickHandler) null);
    backToConnectionsButton_.setTitle("View all connections");
    // connect meuu
    ToolbarPopupMenu connectMenu = new ToolbarPopupMenu();
    connectMenu.addItem(connectMenuItem(commands_.historySendToConsole().getImageResource(), "R Console", ConnectionOptions.CONNECT_R_CONSOLE));
    connectMenu.addSeparator();
    connectMenu.addItem(connectMenuItem(commands_.newSourceDoc().getImageResource(), "New R Script", ConnectionOptions.CONNECT_NEW_R_SCRIPT));
    connectMenu.addItem(connectMenuItem(commands_.newRNotebook().getImageResource(), "New R Notebook", ConnectionOptions.CONNECT_NEW_R_NOTEBOOK));
    if (BrowseCap.INSTANCE.canCopyToClipboard()) {
        connectMenu.addSeparator();
        connectMenu.addItem(connectMenuItem(commands_.copyPlotToClipboard().getImageResource(), "Copy to Clipboard", ConnectionOptions.CONNECT_COPY_TO_CLIPBOARD));
    }
    connectMenuButton_ = new ToolbarButton("Connect", commands_.newConnection().getImageResource(), connectMenu);
    // manage connect menu visibility
    connectMenuButton_.setVisible(!commands_.disconnectConnection().isVisible());
    commands_.disconnectConnection().addVisibleChangedHandler(new VisibleChangedHandler() {

        @Override
        public void onVisibleChanged(AppCommand command) {
            connectMenuButton_.setVisible(!commands_.disconnectConnection().isVisible());
        }
    });
    installConnectionsToolbar();
    return toolbar_;
}
Also used : SearchWidget(org.rstudio.core.client.widget.SearchWidget) ArrayList(java.util.ArrayList) VisibleChangedHandler(org.rstudio.core.client.command.VisibleChangedHandler) ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) AppCommand(org.rstudio.core.client.command.AppCommand) AnimationCallback(com.google.gwt.layout.client.Layout.AnimationCallback) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) SuggestOracle(com.google.gwt.user.client.ui.SuggestOracle) Toolbar(org.rstudio.core.client.widget.Toolbar) SecondaryToolbar(org.rstudio.core.client.widget.SecondaryToolbar)

Example 3 with SearchWidget

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

the class EnvironmentPane method createSecondaryToolbar.

@Override
protected SecondaryToolbar createSecondaryToolbar() {
    SecondaryToolbar toolbar = new SecondaryToolbar();
    environmentMenu_ = new EnvironmentPopupMenu();
    environmentButton_ = new ToolbarButton(friendlyEnvironmentName(), imageOfEnvironment(environmentName_, environmentIsLocal_), environmentMenu_);
    toolbar.addLeftWidget(environmentButton_);
    SearchWidget 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) {
            objects_.setFilterText(event.getValue());
        }
    });
    searchWidget.getElement().getStyle().setMarginTop(1, Unit.PX);
    toolbar.addRightWidget(searchWidget);
    return toolbar;
}
Also used : SearchWidget(org.rstudio.core.client.widget.SearchWidget) JsArrayString(com.google.gwt.core.client.JsArrayString) ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ServerRequestCallback(org.rstudio.studio.client.server.ServerRequestCallback) SuggestOracle(com.google.gwt.user.client.ui.SuggestOracle) SecondaryToolbar(org.rstudio.core.client.widget.SecondaryToolbar)

Example 4 with SearchWidget

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

the class PackagesPane method createMainToolbar.

@Override
protected Toolbar createMainToolbar() {
    Toolbar toolbar = new Toolbar();
    // install packages
    toolbar.addLeftWidget(commands_.installPackage().createToolbarButton());
    toolbar.addLeftSeparator();
    // update packages
    toolbar.addLeftWidget(commands_.updatePackages().createToolbarButton());
    prePackratSeparator_ = toolbar.addLeftSeparator();
    // packrat (all packrat UI starts out hidden and then appears
    // in response to changes in the packages state)
    // create packrat bootstrap button
    packratBootstrapButton_ = commands_.packratBootstrap().createToolbarButton(false);
    toolbar.addLeftWidget(packratBootstrapButton_);
    packratBootstrapButton_.setVisible(false);
    // create packrat menu + button
    ToolbarPopupMenu packratMenu = new ToolbarPopupMenu();
    packratMenu.addItem(commands_.packratHelp().createMenuItem(false));
    packratMenu.addSeparator();
    packratMenu.addItem(commands_.packratClean().createMenuItem(false));
    packratMenu.addItem(commands_.packratBundle().createMenuItem(false));
    packratMenu.addSeparator();
    packratMenu.addItem(commands_.packratOptions().createMenuItem(false));
    packratMenuButton_ = new ToolbarButton("Packrat", commands_.packratBootstrap().getImageResource(), packratMenu);
    toolbar.addLeftWidget(packratMenuButton_);
    packratMenuButton_.setVisible(false);
    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) {
            observer_.onPackageFilterChanged(event.getValue().trim());
        }
    });
    toolbar.addRightWidget(searchWidget_);
    toolbar.addRightSeparator();
    toolbar.addRightWidget(commands_.refreshPackages().createToolbarButton());
    return toolbar;
}
Also used : SearchWidget(org.rstudio.core.client.widget.SearchWidget) PackageInstallRequest(org.rstudio.studio.client.workbench.views.packages.model.PackageInstallRequest) ArrayList(java.util.ArrayList) ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) SuggestOracle(com.google.gwt.user.client.ui.SuggestOracle) Toolbar(org.rstudio.core.client.widget.Toolbar)

Aggregations

SuggestOracle (com.google.gwt.user.client.ui.SuggestOracle)4 SearchWidget (org.rstudio.core.client.widget.SearchWidget)4 ArrayList (java.util.ArrayList)3 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)3 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 SecondaryToolbar (org.rstudio.core.client.widget.SecondaryToolbar)2 Toolbar (org.rstudio.core.client.widget.Toolbar)2 ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)2 JsArrayString (com.google.gwt.core.client.JsArrayString)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 AnimationCallback (com.google.gwt.layout.client.Layout.AnimationCallback)1 AppCommand (org.rstudio.core.client.command.AppCommand)1 VisibleChangedHandler (org.rstudio.core.client.command.VisibleChangedHandler)1 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)1 LatchingToolbarButton (org.rstudio.core.client.widget.LatchingToolbarButton)1 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)1 ServerRequestCallback (org.rstudio.studio.client.server.ServerRequestCallback)1 PackageInstallRequest (org.rstudio.studio.client.workbench.views.packages.model.PackageInstallRequest)1