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

The following examples show how to use com.google.gwt.event.dom.client.KeyCodes#KEY_HOME . 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: SinglePageLayout.java    From djvu-html5 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onKeyDown(KeyDownEvent event) {
	int key = event.getNativeKeyCode();
	if (event.isControlKeyDown()) {
		if (key == KEY_PLUS || key == KEY_MINUS) {
			app.getToolbar().zoomChangeClicked(key == KEY_PLUS ? 1 : -1);
			event.preventDefault();
		}
	} else if (!event.isShiftKeyDown()) {
		boolean handled = true;
		switch (key) {
		case KeyCodes.KEY_HOME:
			changePage(0, -1, -1);
			break;
		case KeyCodes.KEY_END:
			changePage(dataStore.getPageCount() - 1, 1, 1);
			break;
		default:
			handled = false;
		}
		if (handled)
			event.preventDefault();
	}
}
 
Example 2
Source File: EventUtils.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isNavigationKey(int keyCode) {
	if (isArrowKey(keyCode) || KeyCodes.KEY_HOME == keyCode || KeyCodes.KEY_END == keyCode ||
			KeyCodes.KEY_PAGEUP == keyCode || KeyCodes.KEY_PAGEDOWN == keyCode) {
		return true;
	} else {
		return false;
	}
}
 
Example 3
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 4
Source File: InputSlider.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onKeyDown(KeyDownEvent event) {
	if (!InputSlider.this.isStateValid()) {
		return;
	}
	int paddingValue = 1;
	if (event.isControlKeyDown()) {
		paddingValue = InputSlider.this.items.size() / 5;
	}
	switch (event.getNativeKeyCode()) {
		case KeyCodes.KEY_HOME:
			InputSlider.this.handleWidget.moveStart();
			this.killEvent(event);
			break;
		case KeyCodes.KEY_END:
			InputSlider.this.handleWidget.moveEnd();
			this.killEvent(event);
			break;
		case KeyCodes.KEY_SPACE:
			InputSlider.this.handleWidget.moveMiddle();
			this.killEvent(event);
			break;
		case KeyCodes.KEY_LEFT:
			InputSlider.this.handleWidget.moveLeft(paddingValue);
			this.killEvent(event);
			break;
		case KeyCodes.KEY_RIGHT:
			InputSlider.this.handleWidget.moveRight(paddingValue);
			this.killEvent(event);
			break;
		default:
			break;
	}
}