return;
}
- selecting = filtering;
- if (!filtering) {
+ selectItemWhenReponseIsReceived = waitingForFilteringReponse;
+ if (!waitingForFilteringReponse) {
doPostFilterSelectedItemAction();
}
}
final MenuItem item = getSelectedItem();
final String enteredItemValue = tb.getText();
- selecting = false;
+ selectItemWhenReponseIsReceived = false;
// check for exact match in menu
int p = getItems().size();
private String selectedOptionKey;
- private boolean filtering = false;
- private boolean selecting = false;
- private boolean tabPressed = false;
+ private boolean waitingForFilteringReponse = false;
+ private boolean selectItemWhenReponseIsReceived = false;
+ private boolean tabPressedWhenPopupOpen = false;
private boolean initDone = false;
private String lastFilter = "";
}
}
- filtering = true;
+ waitingForFilteringReponse = true;
client.updateVariable(paintableId, "filter", filter, false);
client.updateVariable(paintableId, "page", page, true);
lastFilter = filter;
lastNewItemString = null;
currentSuggestions.clear();
- if (!filtering) {
+ if (!waitingForFilteringReponse) {
/*
* Clear the current suggestions as the server response always
* includes the new ones. Exception is when filtering, then we need
optionUidl);
currentSuggestions.add(suggestion);
if (optionUidl.hasAttribute("selected")) {
- if (!filtering || popupOpenerClicked) {
+ if (!waitingForFilteringReponse || popupOpenerClicked) {
String newSelectedOptionKey = Integer.toString(suggestion
.getOptionKey());
if (!newSelectedOptionKey.equals(selectedOptionKey)
captions += Util.escapeHTML(suggestion.getReplacementString());
}
- if ((!filtering || popupOpenerClicked) && uidl.hasVariable("selected")
+ if ((!waitingForFilteringReponse || popupOpenerClicked)
+ && uidl.hasVariable("selected")
&& uidl.getStringArrayVariable("selected").length == 0) {
// select nulled
- if (!filtering || !popupOpenerClicked) {
+ if (!waitingForFilteringReponse || !popupOpenerClicked) {
if (!focused) {
/*
* client.updateComponent overwrites all styles so we must
selectedOptionKey = null;
}
- if (filtering
+ if (waitingForFilteringReponse
&& lastFilter.toLowerCase().equals(
uidl.getStringVariable("filter"))) {
suggestionPopup.showSuggestions(currentSuggestions, currentPage,
totalMatches);
- filtering = false;
+ waitingForFilteringReponse = false;
if (!popupOpenerClicked && lastIndex != -1) {
// we're paging w/ arrows
MenuItem activeMenuItem;
lastIndex = -1; // reset
}
- if (selecting) {
+ if (selectItemWhenReponseIsReceived) {
suggestionPopup.menu.doPostFilterSelectedItemAction();
}
}
* The suggestion that just got selected.
*/
public void onSuggestionSelected(FilterSelectSuggestion suggestion) {
- selecting = false;
+ selectItemWhenReponseIsReceived = false;
currentSuggestion = suggestion;
String newKey;
break;
case KeyCodes.KEY_TAB:
if (suggestionPopup.isAttached()) {
- tabPressed = true;
+ tabPressedWhenPopupOpen = true;
filterOptions(currentPage);
}
// onBlur() takes care of the rest
focused = false;
if (!readonly) {
// much of the TAB handling takes place here
- if (tabPressed) {
- tabPressed = false;
+ if (tabPressedWhenPopupOpen) {
+ tabPressedWhenPopupOpen = false;
suggestionPopup.menu.doSelectedItemAction();
suggestionPopup.hide();
} else if (!suggestionPopup.isAttached()