1 package org.vaadin.aceeditor; 2 3 import java.util.List; 4 5 6 public interface Suggester { 7 8 /** 9 * Returns a list of {@link Suggestion}s based on text and cursor position. 10 * 11 * @param text 12 * @param cursor 13 * @return list of {@link Suggestion}s, empty list = no suggestions 14 */ 15 public List<Suggestion> getSuggestions(String text, int cursor); 16 17 /** 18 * Applies the suggestion to the text. 19 * 20 * text and cursor are the same that were given to {@link #getSuggestions(String, int)} earlier. 21 * 22 * sugg is one of the objects received from {@link #getSuggestions(String, int)} 23 * So if you gave a subclass of {@link Suggestion}, that you shall receive. 24 * 25 * @param sugg 26 * @param text 27 * @param cursor 28 * @return Text after the suggestion has been applied. 29 */ 30 // TODO: It might be nice to also specify a cursor position (or selection) 31 // after applying a suggestion. 32 public String applySuggestion(Suggestion sugg, String text, int cursor); 33 }