Java Code Examples for com.google.gwt.event.dom.client.KeyUpEvent#getNativeKeyCode()

The following examples show how to use com.google.gwt.event.dom.client.KeyUpEvent#getNativeKeyCode() . 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: 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 2
Source File: DiagramController.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Trigger action when key up event fired
 * 
 * @param event
 */
protected  void onKeyUp(KeyUpEvent event){
	logger.info("key" +event.getNativeKeyCode() );
	if(event.getNativeKeyCode()== 46){
		logger.info("delete widget");
		deleteWidget();
	}
}
 
Example 3
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 4
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 5
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 6
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 7
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 8
Source File: ApplicationRootView.java    From bitcoin-transaction-explorer with MIT License 5 votes vote down vote up
@UiHandler("lookupField")
public void onLookupKeyUp(final KeyUpEvent event) {
  if (event.getNativeKeyCode() != KeyCodes.KEY_ENTER) {
    return;
  }

  final ApplicationPlace place = PlaceTokenParseUtil.parseToken(lookupField.getText());
  if (place == null) {
    // Do something, like show a mild error.
    return;
  }

  placeController.goTo(place);
}