Refs #1631 Fix clearing value on blur in VSearchSelect

This commit is contained in:
Yuriy Artamonov 2012-11-15 11:13:53 +00:00
parent 4ce5ef8d1b
commit 71678a3017
2 changed files with 26 additions and 8 deletions

View File

@ -881,6 +881,17 @@ public class VFilterSelect extends Composite implements Paintable, Field,
suggestionPopup.showSuggestions(currentSuggestions, currentPage, totalMatches);
}
protected void handleSelectionOnBlur() {
if (tabPressed) {
tabPressed = false;
suggestionPopup.menu.doSelectedItemAction();
suggestionPopup.hide();
} else if (!suggestionPopup.isAttached()
|| suggestionPopup.isJustClosed()) {
suggestionPopup.menu.doSelectedItemAction();
}
}
private void setPromptingOn() {
if (!prompting) {
prompting = true;
@ -1208,14 +1219,7 @@ public class VFilterSelect extends Composite implements Paintable, Field,
focused = false;
if (!readonly) {
// much of the TAB handling takes place here
if (tabPressed) {
tabPressed = false;
suggestionPopup.menu.doSelectedItemAction();
suggestionPopup.hide();
} else if (!suggestionPopup.isAttached()
|| suggestionPopup.isJustClosed()) {
suggestionPopup.menu.doSelectedItemAction();
}
handleSelectionOnBlur();
if (selectedOptionKey == null) {
setPromptingOn();
}

View File

@ -113,6 +113,20 @@ public class VSearchSelect extends VFilterSelect {
}
}
@Override
protected void handleSelectionOnBlur() {
if (tabPressed) {
tabPressed = false;
suggestionPopup.menu.doSelectedItemAction();
suggestionPopup.hide();
} else if (!suggestionPopup.isAttached()
|| suggestionPopup.isJustClosed()) {
if (currentSuggestion == null ||
!currentSuggestion.getReplacementString().equals(tb.getText()))
suggestionPopup.menu.doSelectedItemAction();
}
}
@Override
public void onBlur(BlurEvent event) {
super.onBlur(event);