|
Autocomplete using a Wicket model
has been created by Will Hoover
(Oct 13, 2008).
Content:
/**
private static final Logger LOG = LoggerFactory.getLogger(AbstractAutoCompleteTextField.class);
private static final long serialVersionUID = 1L;
private final AutoCompleteChoiceBehavior autoCompleteBehavior;
private transient List<CHOICE> choiceList;
/**
/**
- Constructor
- @param id
- the ID to set
- @param model
- the model to set
- @param type
- the type to set
- @param preselect
- the preselect to set
*/
public AbstractAutoCompleteTextField(final String id, final IModel model, final Class<?> type, final boolean preselect) Unknown macro: {
this(id, model, type, StringAutoCompleteRenderer.INSTANCE, preselect);
}
/**
- Constructor
- @param id
- the ID to set
- @param model
- the model to set
- @param type
- the type to set
- @param settings
- the settings to set
*/
public AbstractAutoCompleteTextField(final String id, final IModel model, final Class<?> type, final AutoCompleteSettings settings) Unknown macro: {
this(id, model, type, StringAutoCompleteRenderer.INSTANCE, settings);
}
/**
/**
/**
/**
/**
/**
/**
/**
- Constructor
- @param id
- the ID to set
- @param type
- the type to set
- @param renderer
- the renderer to set
*/
public AbstractAutoCompleteTextField(final String id, final Class<?> type, final IAutoCompleteRenderer renderer) Unknown macro: {
this(id, null, type, renderer, false);
}
/**
- Constructor
- @param id
- the ID to set
- @param model
- the model to set
- @param renderer
- the renderer to set
*/
public AbstractAutoCompleteTextField(final String id, final IModel model, final IAutoCompleteRenderer renderer) Unknown macro: {
this(id, model, (Class<?>) null, renderer, false);
}
/**
- Constructor
- @param id
- the ID to set
- @param model
- the model to set
- @param type
- the type to set
- @param renderer
- the renderer to set
- @param preselect
- the preselect to set
*/
public AbstractAutoCompleteTextField(final String id, final IModel model, final Class<?> type, final IAutoCompleteRenderer renderer, final boolean preselect) Unknown macro: {
this(id, model, type, renderer, new AutoCompleteSettings().setPreselect(preselect));
}
/**
- Constructor that
- @param id
- the ID to set
- @param model
- the model to set
- @param type
- the type to set
- @param renderer
- the renderer to set
- @param settings
- the settings to set
*/
public AbstractAutoCompleteTextField(final String id, final IModel model, final Class<?> type, final IAutoCompleteRenderer renderer, final AutoCompleteSettings settings) {
super(id, model);
setType(type);
add(new SimpleAttributeModifier("autocomplete", "off"));
autoCompleteBehavior = createAutoCompleteBehavior(renderer, settings);
if (autoCompleteBehavior == null) Unknown macro: {
throw new NullPointerException("Auto complete behavior cannot be null");
}
add(autoCompleteBehavior);
}
/**
/**
/**
/**
- Call-back method that should return a list of all possible assist choice objects. These objects will be passed to the renderer to generate output.
- @param searchTextInput
- current input text
- @return iterator over all possible choice objects
*/
protected abstract List<CHOICE> getChoiceList(final String searchTextInput);
/**
- Gets the string value from the specified choice
- @param choice
- the choice that needs value extraction
- @return the unique string value of the choice
- @throws Throwable
- any error that may occur during choice extraction
*/
protected abstract String getChoiceValue(final CHOICE choice) throws Throwable;
/**
/**
|