Java Code Examples for com.google.gwt.event.dom.client.KeyCodes#KEY_PAGEDOWN
The following examples show how to use
com.google.gwt.event.dom.client.KeyCodes#KEY_PAGEDOWN .
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: EditorImpl.java From swellrt with Apache License 2.0 | 6 votes |
private boolean shouldTrackCursor(SignalEvent event) { if (event.isMouseButtonEvent()) { return true; } if (event.isKeyEvent()) { KeySignalType keySignalType = event.getKeySignalType(); // The cursor location should move if the user either has modified the // content (typed or delete), or move the cursor deliberately. However, page up/down // doesn't actually move the cursor, so we don't want to move the view port int keyCode = event.getKeyCode(); return keySignalType == KeySignalType.INPUT || keySignalType == KeySignalType.DELETE || keySignalType == KeySignalType.NAVIGATION && ( keyCode != KeyCodes.KEY_PAGEDOWN && keyCode != KeyCodes.KEY_PAGEUP); } return false; }
Example 2
Source File: EditorImpl.java From incubator-retired-wave with Apache License 2.0 | 6 votes |
private boolean shouldTrackCursor(SignalEvent event) { if (event.isMouseButtonEvent()) { return true; } if (event.isKeyEvent()) { KeySignalType keySignalType = event.getKeySignalType(); // The cursor location should move if the user either has modified the // content (typed or delete), or move the cursor deliberately. However, page up/down // doesn't actually move the cursor, so we don't want to move the view port int keyCode = event.getKeyCode(); return keySignalType == KeySignalType.INPUT || keySignalType == KeySignalType.DELETE || keySignalType == KeySignalType.NAVIGATION && ( keyCode != KeyCodes.KEY_PAGEDOWN && keyCode != KeyCodes.KEY_PAGEUP); } return false; }
Example 3
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 5 votes |
/** * 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 4
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 5 votes |
/** * 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 5
Source File: EventUtils.java From document-management-system with GNU General Public License v2.0 | 5 votes |
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 6
Source File: CubaSearchSelectWidget.java From cuba with Apache License 2.0 | 5 votes |
@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 7
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 5 votes |
/** * 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 8
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 5 votes |
/** * 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: ZoomInTool.java From geowe-core with GNU General Public License v3.0 | 5 votes |
private KeyUpHandler createKeyHandler() { KeyUpHandler handler= new KeyUpHandler() { @Override public void onKeyUp(final KeyUpEvent event) { if (KeyCodes.KEY_PAGEDOWN == event.getNativeEvent().getKeyCode()) { onRelease(); } } }; return handler; }
Example 10
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 4 votes |
/** * 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 11
Source File: CubaSearchSelectWidget.java From cuba with Apache License 2.0 | 4 votes |
@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 12
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 4 votes |
/** * 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 13
Source File: InputDatePicker.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
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; }