示例#1
0
 /** Renders the paging information into the title bar. */
 private void renderTitle() {
   int resultEnd = querySize;
   String totalStr;
   if (search.getTotal() != Search.UNKNOWN_SIZE) {
     resultEnd = Math.min(resultEnd, search.getTotal());
     totalStr = messages.of(search.getTotal());
   } else {
     totalStr = messages.ofUnknown();
   }
   searchUi.setTitleText(queryText + " (0-" + resultEnd + " " + totalStr + ")");
 }
示例#2
0
 @Override
 public void onQueryEntered() {
   queryText = searchUi.getSearch().getQuery();
   querySize = DEFAULT_PAGE_SIZE;
   searchUi.setTitleText(messages.searching());
   doSearch();
 }
示例#3
0
  /** Adds custom buttons to the toolbar. */
  private void initToolbarMenu() {
    GroupingToolbar.View toolbarUi = searchUi.getToolbar();
    ToolbarView group = toolbarUi.addGroup();
    new ToolbarButtonViewBuilder()
        .setText(messages.newWave())
        .applyTo(
            group.addClickButton(),
            new ToolbarClickButton.Listener() {
              @Override
              public void onClicked() {
                actionHandler.onCreateWave();

                // HACK(hearnden): To mimic live search, fire a search poll
                // reasonably soon (500ms) after creating a wave. This will be unnecessary
                // with a real live search implementation. The delay is to give
                // enough time for the wave state to propagate to the server.
                int delay = 500;
                scheduler.scheduleRepeating(searchUpdater, delay, POLLING_INTERVAL_MS);
              }
            });
    // Fake group with empty button - to force the separator be displayed.
    group = toolbarUi.addGroup();
    new ToolbarButtonViewBuilder().setText("").applyTo(group.addClickButton(), null);
  }