setGlassEnabled(true);
this.sentences = sen;
filter = new TextBox();
filter.setWidth("100%");
Constants constants = ((Constants) GWT.create(Constants.class));
final String defaultMessage = constants.enterTextToFilterList();
filter.setText(defaultMessage);
filter.addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
filter.setText("");
}
});
filter.addBlurHandler(new BlurHandler() {
public void onBlur(BlurEvent event) {
filter.setText(defaultMessage);
}
});
filter.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
applyChoice(self);
} else {
populateList(ListUtil.filter(sentences,
filter.getText()));
}
}
});
filter.setFocus(true);
VerticalPanel panel = new VerticalPanel();
panel.add(filter);
list = new ListBox();
list.setVisibleItemCount(5);
populateList(ListUtil.filter(this.sentences,
""));
panel.add(list);
Button ok = new Button(constants.OK());
ok.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
applyChoice(self);
}
});
Button cancel = new Button(constants.Cancel());
cancel.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
hide();
}
});