Java Code Examples for com.google.gwt.event.dom.client.KeyPressEvent#getSource()
The following examples show how to use
com.google.gwt.event.dom.client.KeyPressEvent#getSource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AddressBookView.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@UiHandler("searchBox") void onSearchBox(KeyPressEvent event) { final InputText source = (InputText) event.getSource(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { String query = source.flush(); if (query == null || query.length() == 0) { displayList(displayedList); } else { final String queryToCompare = query.toLowerCase().trim(); Iterable<Contact> filteredIteable = Iterables.filter(displayedList, new Predicate<Contact>() { @Override public boolean apply(Contact contact) { return contact.getName() != null && contact.getName().toLowerCase().contains(queryToCompare); } }); displayList(Lists.newArrayList(filteredIteable)); } } }); }
Example 2
Source File: AddressBookPage.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@UiHandler("searchBox") void onSearchBox(KeyPressEvent event) { final InputText source = (InputText) event.getSource(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { String query = source.flush(); if (query == null || query.length() == 0) { AddressBookPage.this.displayList(AddressBookPage.this.displayedList); } else { final String queryToCompare = query.toLowerCase().trim(); Iterable<Contact> filteredIteable = Iterables.filter(AddressBookPage.this.displayedList, new Predicate<Contact>() { @Override public boolean apply(Contact contact) { return contact.getName() != null && contact.getName().toLowerCase().contains(queryToCompare); } }); AddressBookPage.this.displayList(Lists.newArrayList(filteredIteable)); } } }); }