Type Parameters:
T -
All Superinterfaces:
IClusterable, IDetachable, Serializable
All Known Implementing Classes:
AbstractAutoCompleteRenderer, AbstractAutoCompleteTextRenderer, StringAutoCompleteRenderer

public interface IAutoCompleteRenderer<T> extends IDetachable
A renderer used to generate html output for the AutoCompleteBehavior.

Helper implementations of this interface may abstract the implementation specific details. Direct implementations of this interface should only be used when total control is required.

The autocompletion value is supplied via an attribute on the first html element named textvalue, if no attribute is found the innerHtml property of the first element will be used instead. For example:

 new IAutoCompleteRenderer() {
     void renderHead(Response r) { r.write("
 <ul>
 "); }
     
     void render(Object o, Response r) {
        // notice the textvalue attribute we define for li element
        r.write("
 <li textvalue=\""+o.toString()+"\">
 <i>"+o.toString()+"</i>
 </li>
 ";
     }
     
     void renderFooter(Response r) { r.write("
 </ul>
 "); }
 }
 
Since:
1.2
Author:
Igor Vaynberg (ivaynberg), Janne Hietamäki (jannehietamaki)
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Override when needed.
    void
    render(T object, Response response, String criteria)
    Render the html fragment for the given completion object.
    void
    renderFooter(Response response, int count)
    Render the html footer fragment for the completion.
    void
    Render the html header fragment for the completion.
  • Method Details

    • render

      void render(T object, Response response, String criteria)
      Render the html fragment for the given completion object. Usually the html is written out by calling Response.write(CharSequence).
      Parameters:
      object - completion choice object
      response - response object
      criteria - text entered by user so far
    • renderHeader

      void renderHeader(Response response)
      Render the html header fragment for the completion. Usually the html is written out by calling Response.write(CharSequence).
      Parameters:
      response -
    • renderFooter

      void renderFooter(Response response, int count)
      Render the html footer fragment for the completion. Usually the html is written out by calling Response.write(CharSequence).
      Parameters:
      response -
      count - The number of choices rendered
    • detach

      default void detach()
      Override when needed.
      Specified by:
      detach in interface IDetachable