use of org.rstudio.core.client.widget.LatchingToolbarButton 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);
}
}
Aggregations