public void onClick(final ClickEvent inArg0)
{
String searchText = view.getLastName().getText();
if (!searchText.isEmpty())
{
model.fetch(new PersonLookupRequest(searchText, MAX_RESULTS + 1), true);
}
}
});
// user pressed a key
view.getLastName().addKeyUpHandler(new KeyUpHandler()
{
public void onKeyUp(final KeyUpEvent ev)
{
String searchText = view.getLastName().getText();
boolean anyText = !searchText.isEmpty();
if (anyText && ev.getNativeKeyCode() == KeyCodes.KEY_ENTER && !ev.isAnyModifierKeyDown())
{
model.fetch(new PersonLookupRequest(searchText, MAX_RESULTS + 1), true);
}
}
});
// user selected a person in the list