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);
}
}
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_;
}
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;
}
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;
}
Aggregations