|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.extensions.ajax.markup.html.autocomplete.AbstractAutoCompleteRenderer<T>
T - public abstract class AbstractAutoCompleteRenderer<T>
A renderer that abstracts autoassist specific details and allows subclasses to only render the visual part of the assist instead of having to also render the necessary autoassist javascript hooks.
| Constructor Summary | |
|---|---|
AbstractAutoCompleteRenderer()
|
|
| Method Summary | |
|---|---|
protected CharSequence |
getOnSelectJavaScriptExpression(T item)
Allows the execution of a custom javascript expression when an item is selected in the autocompleter popup (either by clicking on it or hitting enter on the current selection). |
protected abstract String |
getTextValue(T object)
Retrieves the text value that will be set on the textbox if this assist is selected |
void |
render(T object,
Response response,
String criteria)
Render the html fragment for the given completion object. |
protected abstract void |
renderChoice(T object,
Response response,
String criteria)
Render the visual portion of the assist. |
void |
renderFooter(Response response,
int count)
Render the html footer fragment for the completion. |
void |
renderHeader(Response response)
Render the html header fragment for the completion. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractAutoCompleteRenderer()
| Method Detail |
|---|
public final void render(T object,
Response response,
String criteria)
IAutoCompleteRendererResponse.write(CharSequence).
render in interface IAutoCompleteRenderer<T>object - completion choice objectresponse - response objectcriteria - text entered by user so farpublic final void renderHeader(Response response)
IAutoCompleteRendererResponse.write(CharSequence).
renderHeader in interface IAutoCompleteRenderer<T>
public final void renderFooter(Response response,
int count)
IAutoCompleteRendererResponse.write(CharSequence).
renderFooter in interface IAutoCompleteRenderer<T>count - The number of choices rendered
protected abstract void renderChoice(T object,
Response response,
String criteria)
Response.write(CharSequence)
object - current assist choiceresponse - criteria - protected abstract String getTextValue(T object)
object - assist choice object
protected CharSequence getOnSelectJavaScriptExpression(T item)
null the chosen text value will be ignored.
example 1:
protected CharSequence getOnSelectJavaScript(Address address)
{
final StringBuilder js = new StringBuilder();
js.append("wicketGet('street').value ='" + address.getStreet() + "';");
js.append("wicketGet('zipcode').value ='" + address.getZipCode() + "';");
js.append("wicketGet('city').value ='" + address.getCity() + "';");
js.append("input"); // <-- do not use return statement here!
return js.toString();
}
example 2:
protected CharSequence getOnSelectJavaScript(Currency currency)
{
final StringBuilder js = new StringBuilder();
js.append("val rate = ajaxGetExchangeRateForCurrency(currencySymbol);");
js.append("if(rate == null) alert('exchange rate service currently not available');");
js.append("rate");
return js.toString();
}
Then the autocompleter popup will be closed.
item - the autocomplete item to get a custom javascript expression for
null if default behavior is
intented
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||