Beispiel #1
0
  private void navigateAndTranslate(String title) {
    navigate(title);

    if (engine.getTitleComparator().compare(title, getSelectedIndexText()) == 0) {
      translateSelected();
    } else {
      lastNavigated = null;
      model.translateNotFound(title);
    }
  }
Beispiel #2
0
  private void translateSelected() {
    if (getSelectedIndex() < 0) {
      return;
    }

    IArticle article = engine.getFinder().get(getSelectedIndex());

    model.bookmark(article);
    model.translate(article);

    selectAll();
  }
Beispiel #3
0
  public void onDocumentChanged(DocumentEvent event) {
    if (!isNavigationEnabled) {
      return;
    }

    if (Strings.isEmpty(getSearchText())) {
      return;
    }

    int index = engine.getFinder().indexOfFirstLike(getSearchText());

    setSelectedIndex(index);
    ensureSelectedOnTop(index);
  }