示例#1
0
 /**
  * Subscribe to the SearchListener and receive events, if the user searches for some thing. You
  * will receive a list of words
  *
  * @param l
  */
 public void addSearchListener(SearchTextListener l) {
   if (listeners.contains(l)) {
     return;
   } else {
     listeners.add(l);
   }
   // fire event for the new subscriber
   l.searchText(getSearchwords(searchField.getText()));
 }
示例#2
0
  /**
   * Fires an event if a search was started / canceled
   *
   * @param t
   */
  private void fireSearchlistenerEvent(String t) {
    // parse the Search string to words
    ArrayList<String> words;
    if ((t == null) || (t.isEmpty())) {
      words = null;
    } else {
      words = getSearchwords(t);
    }

    // fire an event for every listener
    for (SearchTextListener s : listeners) {
      s.searchText(words);
    }
  }