Java Code Examples for com.google.gwt.event.dom.client.KeyCodes#KEY_DOWN

The following examples show how to use com.google.gwt.event.dom.client.KeyCodes#KEY_DOWN . 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: RestrictedStringTokenHelpler.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected boolean handleKeyDown(int keyDown) {
	int currentIndex = 0;
	if (this.token != null) {
		currentIndex = this.restrictedValues.indexOf(this.token);
	}
	switch (keyDown) {
		case KeyCodes.KEY_DOWN:
			currentIndex += this.restrictedValues.size();
			currentIndex++;
			this.setToken(this.restrictedValues.get(currentIndex % this.restrictedValues.size()));
			break;
		case KeyCodes.KEY_UP:
			currentIndex += this.restrictedValues.size();
			currentIndex--;
			this.setToken(this.restrictedValues.get(currentIndex % this.restrictedValues.size()));
			break;
		default:
			return false;
	}
	return true;
}
 
Example 2
Source File: AutoSizingBase.java    From gwt-traction with Apache License 2.0 6 votes vote down vote up
protected void onKeyCodeEvent(KeyCodeEvent event, String newShadowText) {
// ignore arrow keys
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_UP:
case KeyCodes.KEY_DOWN:
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
    break;
default:
    // don't do this if there's a selection because it will get smaller
    if (box.getSelectionLength() == 0) {
	setShadowText(newShadowText);
	adjustSize();	    
	break;
    }
}	
   }
 
Example 3
Source File: AutoCompleteTextFieldConnector.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void handlePanelEventDelegation(final KeyUpEvent event) {
    switch (event.getNativeKeyCode()) {
    case KeyCodes.KEY_DOWN:
        arrowKeyDown(event);
        break;
    case KeyCodes.KEY_UP:
        arrorKeyUp(event);
        break;
    case KeyCodes.KEY_ESCAPE:
        escapeKey();
        break;
    case KeyCodes.KEY_ENTER:
        enterKey();
        break;
    default:
        doAskForSuggestion();
    }
}
 
Example 4
Source File: IntegerTokenHelper.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected boolean handleKeyDown(int keyDown) {
	switch (keyDown) {
		case KeyCodes.KEY_DOWN:
			if (this.value > 0) {
				this.setValue(--this.value);
			}
			break;
		case KeyCodes.KEY_UP:
			this.setValue(++this.value);
			break;
		default:
			break;
	}
	return true;
}
 
Example 5
Source File: UTCTimeBoxImplHtml4.java    From gwt-traction with Apache License 2.0 5 votes vote down vote up
@Override
public void onKeyDown(KeyDownEvent event) {
    switch (event.getNativeKeyCode()) {
    case KeyCodes.KEY_UP:
        menu.adjustHighlight(-1);
        break;
    case KeyCodes.KEY_DOWN:
        menu.adjustHighlight(1);
        break;
    case KeyCodes.KEY_ENTER:
    case KeyCodes.KEY_TAB:
        // accept current value
        if (menu.isShowing()) {
            menu.acceptHighlighted();
            hideMenu();
            clearInvalidStyle();
        } 
        else {
            
            // added a sync here because this is when we
            // accept the value we've typed if we're typing in
            // a new value.
            syncValueToText();
            
            validate();
        }
        break;
    case KeyCodes.KEY_ESCAPE:
        validate();
        hideMenu();
        break;
    default:
        hideMenu();
        clearInvalidStyle();
        break;
    }
}
 
Example 6
Source File: CourseFinderCourses.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void onKeyUp(KeyUpEvent event) {
	if (iCourses.getRowCount() < 2 || iCourses.getData(1) == null) return;
	int row = iCourses.getSelectedRow();
	if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN && isEnabled()) {
		if (row < 0 || iCourses.getSelectedRow() + 1 >= iCourses.getRowCount())
			iCourses.setSelected(1, true);
		else
			iCourses.setSelected(row + 1, true);
           scrollToSelectedRow();
           updateCourseDetails();
	} else if (event.getNativeKeyCode()==KeyCodes.KEY_UP && isEnabled()) {
		if (row - 1 < 1)
			iCourses.setSelected(iCourses.getRowCount() - 1, true);
		else
			iCourses.setSelected(row - 1, true);
		scrollToSelectedRow();
		updateCourseDetails();
	} else if (event.isControlKeyDown() || event.isAltKeyDown()) {
		for (Map.Entry<Character, Integer> entry: iTabAccessKeys.entrySet())
			if (event.getNativeKeyCode() == Character.toLowerCase(entry.getKey()) || event.getNativeKeyCode() == Character.toUpperCase(entry.getKey())) {
				iCourseDetailsTabBar.selectTab(entry.getValue(), true);
				event.preventDefault();
				event.stopPropagation();
			}
	}
}
 
Example 7
Source File: CourseFinderMultipleCourses.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
public void onKeyUp(KeyUpEvent event) {
	if (iCourses.getRowCount() < 2 || iCourses.getData(1) == null) return;
	int row = iCourses.getSelectedRow();
	if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN && isEnabled()) {
		if (row < 0 || iCourses.getSelectedRow() + 1 >= iCourses.getRowCount())
			iCourses.setSelected(1, true);
		else
			iCourses.setSelected(row + 1, true);
           scrollToSelectedRow();
           updateCourseDetails();
	} else if (event.getNativeKeyCode()==KeyCodes.KEY_UP && isEnabled()) {
		if (row - 1 < 1)
			iCourses.setSelected(iCourses.getRowCount() - 1, true);
		else
			iCourses.setSelected(row - 1, true);
		scrollToSelectedRow();
		updateCourseDetails();
	} else if (event.isControlKeyDown() || event.isAltKeyDown()) {
		for (Map.Entry<Character, Integer> entry: iTabAccessKeys.entrySet())
			if (event.getNativeKeyCode() == Character.toLowerCase(entry.getKey()) || event.getNativeKeyCode() == Character.toUpperCase(entry.getKey())) {
				iCourseDetailsTabBar.selectTab(entry.getValue(), true);
				event.preventDefault();
				event.stopPropagation();
			}
	}
}
 
Example 8
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Triggered when a key was depressed.
 *
 * @param event
 *            The KeyUpEvent of the key depressed
 */
@Override
public void onKeyUp(KeyUpEvent event) {
	debug("VComboBoxMultiselect: onKeyUp(" + event.getNativeKeyCode() + ")");

	if (this.enabled && !this.readonly) {
		switch (event.getNativeKeyCode()) {
		case KeyCodes.KEY_ENTER:
		case KeyCodes.KEY_TAB:
		case KeyCodes.KEY_SHIFT:
		case KeyCodes.KEY_CTRL:
		case KeyCodes.KEY_ALT:
		case KeyCodes.KEY_DOWN:
		case KeyCodes.KEY_UP:
		case KeyCodes.KEY_PAGEDOWN:
		case KeyCodes.KEY_PAGEUP:
		case KeyCodes.KEY_ESCAPE:
			// NOP
			break;
		default:
			if (this.textInputEnabled) {
				// when filtering, we always want to see the results on the
				// first page first.
				filterOptions(0);
			}
			break;
		}
	}
}
 
Example 9
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Triggered when a key is pressed in the text box
 *
 * @param event
 *            The KeyDownEvent
 */
private void inputFieldKeyDown(KeyDownEvent event) {
	debug("VComboBoxMultiselect: inputFieldKeyDown(" + event.getNativeKeyCode() + ")");

	switch (event.getNativeKeyCode()) {
	case KeyCodes.KEY_DOWN:
	case KeyCodes.KEY_UP:
	case KeyCodes.KEY_PAGEDOWN:
	case KeyCodes.KEY_PAGEUP:
		// open popup as from gadget
		filterOptions(-1, "");
		this.tb.selectAll();
		this.dataReceivedHandler.popupOpenerClicked();
		break;
	case KeyCodes.KEY_ENTER:
		/*
		 * This only handles the case when new items is allowed, a text is
		 * entered, the popup opener button is clicked to close the popup
		 * and enter is then pressed (see #7560).
		 */
		if (!this.allowNewItems) {
			return;
		}

		if (this.currentSuggestion != null && this.tb.getText()
			.equals(this.currentSuggestion.getReplacementString())) {
			// Retain behavior from #6686 by returning without stopping
			// propagation if there's nothing to do
			return;
		}
		this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());

		event.stopPropagation();
		break;
	}

}
 
Example 10
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Triggered when a key is pressed in the text box
 *
 * @param event
 *            The KeyDownEvent
 */
private void inputFieldKeyDown(KeyDownEvent event) {
	debug("VComboBoxMultiselect: inputFieldKeyDown(" + event.getNativeKeyCode() + ")");

	switch (event.getNativeKeyCode()) {
	case KeyCodes.KEY_DOWN:
	case KeyCodes.KEY_UP:
	case KeyCodes.KEY_PAGEDOWN:
	case KeyCodes.KEY_PAGEUP:
		// open popup as from gadget
		filterOptions(-1, "");
		this.tb.selectAll();
		this.dataReceivedHandler.popupOpenerClicked();
		break;
	case KeyCodes.KEY_ENTER:
		/*
		 * This only handles the case when new items is allowed, a text is
		 * entered, the popup opener button is clicked to close the popup
		 * and enter is then pressed (see #7560).
		 */
		if (!this.allowNewItems) {
			return;
		}

		if (this.currentSuggestion != null && this.tb.getText()
			.equals(this.currentSuggestion.getReplacementString())) {
			// Retain behavior from #6686 by returning without stopping
			// propagation if there's nothing to do
			return;
		}
		this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());

		event.stopPropagation();
		break;
	}

}
 
Example 11
Source File: CubaSearchSelectWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !readonly) {
        switch (event.getNativeKeyCode()) {
            case KeyCodes.KEY_ENTER:
                String tbText = tb.getText() == null ? ""
                        : tb.getText();
                String currentText = currentSuggestion == null ? ""
                        : currentSuggestion.getReplacementString();
                if (!this.preventFilterAfterSelect && !tbText.equals(currentText)) {
                    filterOptions(currentPage);
                } else {
                    if (!event.isAnyModifierKeyDown()) {
                        event.stopPropagation();
                    }
                }
                this.preventFilterAfterSelect = false;
                break;
            case KeyCodes.KEY_TAB:
            case KeyCodes.KEY_SHIFT:
            case KeyCodes.KEY_CTRL:
            case KeyCodes.KEY_ALT:
            case KeyCodes.KEY_DOWN:
            case KeyCodes.KEY_UP:
            case KeyCodes.KEY_PAGEDOWN:
            case KeyCodes.KEY_PAGEUP:
                // NOP
                break;
            case KeyCodes.KEY_ESCAPE:
                reset();
                break;
        }
        updateEditState();
    }
}
 
Example 12
Source File: AbstractInputSelect.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
	super.onBrowserEvent(event);
	boolean mustKillEvent = false;
	switch (DOM.eventGetType(event)) {
		case Event.ONKEYDOWN:
			switch (event.getKeyCode()) {
				case KeyCodes.KEY_HOME:
					this.selectionHandler.onHomeKeyDown();
					mustKillEvent = true;
					break;
				case KeyCodes.KEY_END:
					this.selectionHandler.onEndKeyDown();
					mustKillEvent = true;
					break;
				case KeyCodes.KEY_UP:
					this.selectionHandler.onUpKeyDown();
					mustKillEvent = true;
					break;
				case KeyCodes.KEY_DOWN:
					this.selectionHandler.onDownKeyDown();
					mustKillEvent = true;
					break;
				default:
					break;
			}
			break;
		case Event.ONKEYPRESS:
			this.keyPressHandler.handleKeyPress(event.getCharCode());
			break;
		default:
			break;
	}

	if (mustKillEvent) {
		event.preventDefault();
		event.stopPropagation();
	}
}
 
Example 13
Source File: EventUtils.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isModifierKey(int keyCode) {
	if (KeyCodes.KEY_SHIFT == keyCode || KeyCodes.KEY_ALT == keyCode || KeyCodes.KEY_CTRL == keyCode
			|| KeyCodes.KEY_DOWN == keyCode) {
		return true;
	} else {
		return false;
	}
}
 
Example 14
Source File: EventUtils.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isArrowKey(int keyCode) {
	if (KeyCodes.KEY_LEFT == keyCode || KeyCodes.KEY_RIGHT == keyCode || KeyCodes.KEY_UP == keyCode
			|| KeyCodes.KEY_DOWN == keyCode) {
		return true;
	} else {
		return false;
	}
}
 
Example 15
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Triggered when a key was depressed.
 *
 * @param event
 *            The KeyUpEvent of the key depressed
 */
@Override
public void onKeyUp(KeyUpEvent event) {
	debug("VComboBoxMultiselect: onKeyUp(" + event.getNativeKeyCode() + ")");

	if (this.enabled && !this.readonly) {
		switch (event.getNativeKeyCode()) {
		case KeyCodes.KEY_ENTER:
		case KeyCodes.KEY_TAB:
		case KeyCodes.KEY_SHIFT:
		case KeyCodes.KEY_CTRL:
		case KeyCodes.KEY_ALT:
		case KeyCodes.KEY_DOWN:
		case KeyCodes.KEY_UP:
		case KeyCodes.KEY_PAGEDOWN:
		case KeyCodes.KEY_PAGEUP:
		case KeyCodes.KEY_ESCAPE:
			// NOP
			break;
		default:
			if (this.textInputEnabled) {
				// when filtering, we always want to see the results on the
				// first page first.
				filterOptions(0);
			}
			break;
		}
	}
}
 
Example 16
Source File: InputDatePicker.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
private boolean handleKeyPress(int keyCode) {
	if (KeyEventUtils.isModifierKeyDown(Event.getCurrentEvent())) {
		return false;
	}
	boolean handleKey = false;
	switch (keyCode) {
		case KeyCodes.KEY_LEFT:
			CalendarUtil.addDaysToDate(this.cursor, -1);
			handleKey = true;
			break;
		case KeyCodes.KEY_RIGHT:
			CalendarUtil.addDaysToDate(this.cursor, 1);
			handleKey = true;
			break;
		case KeyCodes.KEY_UP:
			CalendarUtil.addDaysToDate(this.cursor, -7);
			handleKey = true;
			break;
		case KeyCodes.KEY_DOWN:
			CalendarUtil.addDaysToDate(this.cursor, 7);
			handleKey = true;
			break;
		case KeyCodes.KEY_PAGEUP:
			CalendarUtil.addMonthsToDate(this.cursor, -1);
			handleKey = true;
			break;
		case KeyCodes.KEY_PAGEDOWN:
			CalendarUtil.addMonthsToDate(this.cursor, 1);
			handleKey = true;
			break;
		case KeyCodes.KEY_ENTER:
			this.setValue(this.cursor, true);
			handleKey = true;
			break;
		case KeyCodes.KEY_ESCAPE:
			this.setValue(this.value);
			this.setFocus(false);
			handleKey = true;
			break;
		default:
			break;
	}
	if (handleKey) {
		this.redraw();
	}

	return handleKey;
}
 
Example 17
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 4 votes vote down vote up
/**
 * Triggered when a key was pressed in the suggestion popup.
 *
 * @param event
 *            The KeyDownEvent of the key
 */
private void popupKeyDown(KeyDownEvent event) {
	debug("VComboBoxMultiselect: popupKeyDown(" + event.getNativeKeyCode() + ")");

	// Propagation of handled events is stopped so other handlers such as
	// shortcut key handlers do not also handle the same events.
	switch (event.getNativeKeyCode()) {
	case KeyCodes.KEY_DOWN:
		this.suggestionPopup.selectNextItem();

		DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
		event.stopPropagation();
		break;
	case KeyCodes.KEY_UP:
		this.suggestionPopup.selectPrevItem();

		DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
		event.stopPropagation();
		break;
	case KeyCodes.KEY_PAGEDOWN:
		selectNextPage();
		event.stopPropagation();
		break;
	case KeyCodes.KEY_PAGEUP:
		selectPrevPage();
		event.stopPropagation();
		break;
	case KeyCodes.KEY_ESCAPE:
		reset();
		DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
		event.stopPropagation();
		break;
	case KeyCodes.KEY_TAB:
	case KeyCodes.KEY_ENTER:

		// queue this, may be cancelled by selection
		int selectedIndex = this.suggestionPopup.menu.getSelectedIndex();
		if (!this.allowNewItems && selectedIndex != -1) {

			debug("index before: " + selectedIndex);
			if (this.showClearButton) {
				selectedIndex = selectedIndex - 1;
			}
			if (this.showSelectAllButton) {
				selectedIndex = selectedIndex - 1;
			}

			debug("index after: " + selectedIndex);
			if (selectedIndex == -2) {
				this.clearCmd.execute();
			} else if (selectedIndex == -1) {
				if (this.showSelectAllButton) {
					this.selectAllCmd.execute();
				} else {
					this.clearCmd.execute();
				}
			}

			debug("entered suggestion: " + this.currentSuggestions.get(selectedIndex).caption);
			onSuggestionSelected(this.currentSuggestions.get(selectedIndex));
		} else {
			this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());
		}

		event.stopPropagation();
		break;
	}
}
 
Example 18
Source File: SuggestionsContainer.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
    if (getElement() == DOM.eventGetTarget(event)) {
        return;
    }

    SuggestionItem item = findItem(DOM.eventGetTarget(event));
    switch (DOM.eventGetType(event)) {
        case Event.ONMOUSEDOWN: {
            if (BrowserInfo.get().isIE()) {
                suggestionFieldWidget.iePreventBlur = true;
            }
            break;
        }

        case Event.ONCLICK: {
            if (event.getButton() == NativeEvent.BUTTON_LEFT) {
                performItemCommand(item);
            }
            break;
        }

        case Event.ONMOUSEOVER: {
            if (item != null) {
                selectItem(item);
            }
            break;
        }

        case Event.ONKEYDOWN: {
            int keyCode = KeyCodes.maybeSwapArrowKeysForRtl(
                    event.getKeyCode(),
                    LocaleInfo.getCurrentLocale().isRTL()
            );

            switch (keyCode) {
                case KeyCodes.KEY_UP:
                    selectPrevItem();
                    preventEvent(event);
                    break;
                case KeyCodes.KEY_DOWN:
                    selectNextItem();
                    preventEvent(event);
                    break;
                case KeyCodes.KEY_ESCAPE:
                    selectItem(null);
                    preventEvent(event);
                    break;
                case KeyCodes.KEY_TAB:
                    selectItem(null);
                    break;
                case KeyCodes.KEY_ENTER:
                    performItemCommand(item);
                    preventEvent(event);
                    break;
            }
            break;
        }
    }
    super.onBrowserEvent(event);
}
 
Example 19
Source File: CubaSearchSelectWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void popupKeyDown(KeyDownEvent event) {
    // Propagation of handled events is stopped so other handlers such as
    // shortcut key handlers do not also handle the same events.
    switch (event.getNativeKeyCode()) {
        case KeyCodes.KEY_DOWN:
            keyboardNavigation = true;
            suggestionPopup.selectNextItem();
            suggestionPopup.menu.selectItem(suggestionPopup.menu
                    .getSelectedItem());
            DOM.eventGetCurrentEvent().preventDefault();
            event.stopPropagation();
            break;
        case KeyCodes.KEY_UP:
            keyboardNavigation = true;
            suggestionPopup.selectPrevItem();
            suggestionPopup.menu.selectItem(suggestionPopup.menu
                    .getSelectedItem());
            DOM.eventGetCurrentEvent().preventDefault();
            event.stopPropagation();
            break;
        case KeyCodes.KEY_PAGEDOWN:
            keyboardNavigation = false;
            if (hasNextPage()) {
                filterOptions(currentPage + 1, lastFilter);
            }
            event.stopPropagation();
            break;
        case KeyCodes.KEY_PAGEUP:
            keyboardNavigation = false;
            if (currentPage > 0) {
                filterOptions(currentPage - 1, lastFilter);
            }
            event.stopPropagation();
            break;
        case KeyCodes.KEY_ESCAPE:
            keyboardNavigation = false;
            reset();
            event.stopPropagation();
            break;
        case KeyCodes.KEY_TAB:
        case KeyCodes.KEY_ENTER:
            int selectedIndex = suggestionPopup.menu.getSelectedIndex();
            currentSuggestion = currentSuggestions.get(selectedIndex);
            if (currentSuggestion != null &&
                    currentSuggestion.getReplacementString().equals(tb.getText())) {
                this.preventFilterAfterSelect = true;
                onSuggestionSelected(currentSuggestion);
            }

            keyboardNavigation = false;

            event.stopPropagation();
            break;
    }
}
 
Example 20
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 4 votes vote down vote up
/**
 * Triggered when a key was pressed in the suggestion popup.
 *
 * @param event
 *            The KeyDownEvent of the key
 */
private void popupKeyDown(KeyDownEvent event) {
	debug("VComboBoxMultiselect: popupKeyDown(" + event.getNativeKeyCode() + ")");

	// Propagation of handled events is stopped so other handlers such as
	// shortcut key handlers do not also handle the same events.
	switch (event.getNativeKeyCode()) {
	case KeyCodes.KEY_DOWN:
		this.suggestionPopup.selectNextItem();

		DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
		event.stopPropagation();
		break;
	case KeyCodes.KEY_UP:
		this.suggestionPopup.selectPrevItem();

		DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
		event.stopPropagation();
		break;
	case KeyCodes.KEY_PAGEDOWN:
		selectNextPage();
		event.stopPropagation();
		break;
	case KeyCodes.KEY_PAGEUP:
		selectPrevPage();
		event.stopPropagation();
		break;
	case KeyCodes.KEY_ESCAPE:
		reset();
		DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
		event.stopPropagation();
		break;
	case KeyCodes.KEY_TAB:
	case KeyCodes.KEY_ENTER:

		// queue this, may be cancelled by selection
		int selectedIndex = this.suggestionPopup.menu.getSelectedIndex();
		if (!this.allowNewItems && selectedIndex != -1) {

			debug("index before: " + selectedIndex);
			if (this.showClearButton) {
				selectedIndex = selectedIndex - 1;
			}
			if (this.showSelectAllButton) {
				selectedIndex = selectedIndex - 1;
			}

			debug("index after: " + selectedIndex);
			if (selectedIndex == -2) {
				this.clearCmd.execute();
			} else if (selectedIndex == -1) {
				if (this.showSelectAllButton) {
					this.selectAllCmd.execute();
				} else {
					this.clearCmd.execute();
				}
			}

			debug("entered suggestion: " + this.currentSuggestions.get(selectedIndex).caption);
			onSuggestionSelected(this.currentSuggestions.get(selectedIndex));
		} else {
			this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());
		}

		event.stopPropagation();
		break;
	}
}