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

The following examples show how to use com.google.gwt.event.dom.client.KeyUpEvent#preventDefault() . 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: 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 2
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 3
Source File: AutoCompleteTextFieldConnector.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void arrorKeyUp(final KeyUpEvent event) {
    select.moveSelectionUp();
    event.preventDefault();
    event.stopPropagation();
}
 
Example 4
Source File: AutoCompleteTextFieldConnector.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void arrowKeyDown(final KeyUpEvent event) {
    select.moveSelectionDown();
    event.preventDefault();
    event.stopPropagation();
}