@Override public void injectEvents(HandlerManager eventBus) { // TODO Auto-generated method stub eventBus.addHandler(RVKeyDownEvent.type, new RVKeyDownEventHandler() { @Override public void onKeyDown(RVKeyDownEvent event) { KeyDownEvent keyDownEvent = event.getEvent(); if (keyDownEvent.isControlKeyDown() && keyDownEvent.isShiftKeyDown() && keyDownEvent.getNativeEvent().getKeyCode() == 39) { // Ctrl + Shift + -> keyDownEvent.getNativeEvent().preventDefault(); nextBatchPage(); } } }); }
@Override public EntitiesExplorerView configure(final String entityType, final EntitiesList.View entitiesListView) { this.entitiesListView = entitiesListView; this.entityType = entityType; initWidget(uiBinder.createAndBindUi(this)); searchBox.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { doSearch(searchBox.getText()); } } }); searchButton.addClickHandler(e -> doSearch(searchBox.getText())); clearSearchButton.addDomHandler(new ClickHandler() { @Override public void onClick(final ClickEvent clickEvent) { doSearch(""); } }, ClickEvent.getType()); clearSearch(); return this; }
public VImageViewer() { /* Create widget's root panel */ panelRoot = new FlowPanel(); Style style = panelRoot.getElement().getStyle(); style.setPosition(Position.RELATIVE); setStyleName(CLASSNAME); panelRoot.setStyleName(CLASSNAME + "-flow"); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); /* Create image container */ imageContainer = new FlowPanel(); style = imageContainer.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setOverflow(Overflow.HIDDEN); /* Add widgets */ setWidget(panelRoot); panelRoot.add(imageContainer); /* Register handlers */ addDomHandler(this, KeyDownEvent.getType()); addDomHandler(this, ClickEvent.getType()); addMouseWheelHandler(new MouseWheelHandler() { public void onMouseWheel(MouseWheelEvent event) { event.preventDefault(); if (event.isNorth()) { moveImages(true); } else { moveImages(false); } } }); }
@Override public void onKeyDown(final KeyDownEvent event) { if (event.getNativeKeyCode() == keyCode) { actionButton.fireEvent( new GwtEvent<ClickHandler>() { @Override public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() { return ClickEvent.getType(); } @Override protected void dispatch(final ClickHandler handler) { handler.onClick(null); } }); } }
@Override public void onKeyDown(KeyDownEvent keyDownEvent) { if (keyDownEvent.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class); if (panel != null) { WidgetUtil.focus(panel.getParent().getElement()); // prevent further bubbling of the event as it has only // navigational purpose if thrown at this depth. A subsequent // press of ESC is not stopped, so ESC abort actions of the // application should work as soon as the focus is in // "navigational mode" on a grid-cell keyDownEvent.preventDefault(); keyDownEvent.stopPropagation(); } } }
/** * Installs a key handler for key events on this window. * * @param handler handler to receive key events. */ static void install(KeySignalHandler handler) { // // NOTE: There are three potential candidate elements for sinking keyboard // events: the window, the document, and the document body. IE7 does not // fire events on the window element, and GWT's RootPanel is already a // listener on the body, leaving the document as the only cross-browser // whole-window event-sinking 'element'. // DocumentPanel panel = new DocumentPanel(handler); panel.setElement(Document.get().<Element>cast()); panel.addDomHandler(panel, KeyDownEvent.getType()); panel.addDomHandler(panel, KeyPressEvent.getType()); panel.addDomHandler(panel, KeyUpEvent.getType()); RootPanel.detachOnWindowClose(panel); panel.onAttach(); }
@Override protected boolean isRightButtonModKeyDown(KeyDownEvent event) { //Here we only initiate login on enter if the login and password are set //We actually do it here instead of checking for the right button modifier //because this is our indicator for doing login on enter. This allows to //avoid error caused by the Enter pressed by the user during the login and //password field's auto completion. boolean result = true; try{ //Validate the form data validate( getUsername(), getPassword() ); } catch ( UserLoginException e ){ result = false; } return result; }
@Override public void onKeyDown(KeyDownEvent event) { int keyCode = event.getNativeKeyCode(); if((keyCode == KEY_BACKSPACE || keyCode >= KEY_DELETE) && keyCode != 91 && keyCode != 93) { // Command/Window keyboard keys cancelTimer(); timer = new Timer() { public void run() { dataProvider.setFilter(filterTextBox.getValue()); } }; timer.schedule(TIMEOUT); } else if(keyCode == KEY_ENTER) { cancelTimer(); dataProvider.setFilter(filterTextBox.getValue()); } }
@Override public void onKeyDown(KeyDownEvent event) { int keyCode = event.getNativeKeyCode(); if((keyCode == KEY_BACKSPACE || keyCode >= KEY_DELETE) && keyCode != 91 && keyCode != 93) { // Command/Window keyboard keys cancelTimer(); timer = new Timer() { public void run() { eventBus.fireEventFromSource(new SearchEvent(searchInput.getValue()), searchInput); } }; timer.schedule(TIMEOUT); } else if(keyCode == KEY_ENTER) { cancelTimer(); eventBus.fireEventFromSource(new SearchEvent(searchInput.getValue()), searchInput); } }
public Hashtags() { initWidget(uiBinder.createAndBindUi(this)); hashtagTextBox.setVisibleLength(VISIBLE_LENGTH); hashtagTextBox.addKeyDownHandler( new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent e) { if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { onCancel(null); } else if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { onAdd(null); } } }); addHashtagIcon.addDomHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { onOpenForm(); } }, ClickEvent.getType()); }
@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(); } }
@Override public void onKeyDown(KeyDownEvent p_event) { switch( p_event.getNativeKeyCode() ) { case KeyCodes.KEY_ESCAPE: hide(); p_event.stopPropagation(); break; case KeyCodes.KEY_ENTER: sendMessage(); p_event.stopPropagation(); p_event.getNativeEvent().stopPropagation(); break; default: break; } }
private void addKeyDownHandler(final PropertyEditorFieldInfo property, final PropertyEditorPasswordTextBox passwordTextBox) { passwordTextBox.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (validate(property, passwordTextBox.getText())) { passwordTextBox.clearOldValidationErrors(); property.setCurrentStringValue(passwordTextBox.getText()); propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property, passwordTextBox.getText())); } else { passwordTextBox.setValidationError(getValidatorErrorMessage(property, passwordTextBox.getText())); passwordTextBox.setText(property.getCurrentStringValue()); } } } }); }
private void addEnterKeyHandler(final PropertyEditorFieldInfo property, final PropertyEditorTextBox textBox) { textBox.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (validate(property, textBox.getText())) { textBox.clearOldValidationErrors(); property.setCurrentStringValue(textBox.getText()); propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property, textBox.getText())); } else { textBox.setValidationError(getValidatorErrorMessage(property, textBox.getText())); textBox.setText(property.getCurrentStringValue()); } } } }); }
@Override public void onKeyDown(final KeyDownEvent event) { final GridWidget selectedGridWidget = getSelectedGridWidget(); if (selectedGridWidget == null) { return; } final KeyboardOperation operation = getOperation(event); if (operation == null) { return; } final boolean redraw = operation.perform(selectedGridWidget, event.isShiftKeyDown(), event.isControlKeyDown()); event.preventDefault(); event.stopPropagation(); flushDOMElements(selectedGridWidget); if (redraw) { gridLayer.draw(); } }
@UiHandler("searchBox") void searchBoxEnter(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { SuggestionDisplay suggestionDisplay = searchBox.getSuggestionDisplay(); // This should always be true unless GWT changes the type of the suggestion generated by the // SuggestBox. It is too complicated and nasty to switch out the SuggestBox suggestion display // factory, so we're left with this type safety check and broken functionality if GWT changes. Preconditions.checkState(suggestionDisplay instanceof DefaultSuggestionDisplay); // At this point this should always be true. if (suggestionDisplay instanceof DefaultSuggestionDisplay) { DefaultSuggestionDisplay suggestions = (DefaultSuggestionDisplay) suggestionDisplay; if (!suggestions.isSuggestionListShowing()) { presenter.handleSearch(searchBox.getValue()); } } } }
public void setKeyPressed(JavaScriptObject aValue) { if (keyPressed != aValue) { if (keyDownReg != null) { keyDownReg.removeHandler(); keyDownReg = null; } keyPressed = aValue; if (keyPressed != null && component instanceof HasKeyDownHandlers) { keyDownReg = ((HasKeyDownHandlers) component).addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (keyPressed != null) { event.stopPropagation(); executeEvent(keyPressed, EventsPublisher.publish(event)); } } }); } } }
public static KeyDownHandler createSuggestionHandler(final UIObject sender, final EventListenerGVO ev, final List<InputVariableGVO> input) { return new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (event.getSource() instanceof QSuggestBox) { QSuggestBox qSuggestBox = (QSuggestBox) event.getSource(); String expression = qSuggestBox.getText(); if (expression != null) { if (expression.length() >= qSuggestBox.getSuggestCharactersLength()) { qSuggestBox.clearSuggestions(); CallbackHandler.createCallBack(sender, QAMLConstants.EVENT_ONCHANGE, ev, input); } } } } } }; }
public void onKeyDown(KeyDownEvent event) { if (((SpreadsheetCell) event.getSource()).getMode() == SpreadsheetCell.DISPLAY) { switch (event.getNativeKeyCode()) { case KeyCodes.KEY_LEFT: if (event.getSource() == west) { west.setFocus(false); } else { west.setFocus(true); } break; case KeyCodes.KEY_RIGHT: if (event.getSource() == east) { east.setFocus(false); } else { east.setFocus(true); } break; default: ; } } }
private TextArea createTextArea() { TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text")); textArea.addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { event.preventDefault(); if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { createWordCloud(); } } }); return textArea; }
public DynTreeInTreeTable( TreeTable table, TreeRefMng<T> refMng, Resources resources ) { if( resources == null ) { if( defaultResources == null ) defaultResources = GWT.create( DefaultResources.class ); this.resources = defaultResources; } else { this.resources = resources; } this.table = table; this.refMng = refMng; table.addTableHeaderClickHandler( tableHeaderClickHandler ); table.addTableCellClickHandler( tableCellClickHandler ); table.addDomHandler( onTableKeyUp, KeyDownEvent.getType() ); table.addDomHandler( onTableMouseDown, MouseDownEvent.getType() ); }
@Override public void onKeyDown(KeyDownEvent event) { try { if (event.isRightArrow()) pageView.getScrollPanel().scroll(10, 0); else if (event.isLeftArrow()) pageView.getScrollPanel().scroll(-10, 0); else if (event.isUpArrow()) pageView.getScrollPanel().scroll(0, -10); else if (event.isDownArrow()) pageView.getScrollPanel().scroll(0, 10); else if (event.getNativeKeyCode() == KeyCodes.KEY_PAGEDOWN) selectNextObject(); else if (event.getNativeKeyCode() == KeyCodes.KEY_PAGEUP) selectPreviousObject(); } catch (Exception exc) { logManager.logError(ERROR_UNSPECIFIED, "Error in onKeyDown()"); exc.printStackTrace(); } }
@Override public void onKeyDown(KeyDownEvent event) { // Use the popup's key preview hooks to close the dialog when either // enter or escape is pressed. int eventCode = event.getNativeKeyCode(); // check if CTRL key is pressed & another key is sending the event if (event.isControlKeyDown() && eventCode != 17 && !PlaceholderManageWidget.getInstance().isShowing() && !preOptionsPopupWidget.isShowing()) { // Code 67 = c if (eventCode == 67 && copyPlaceholderButton.isEnabled()) { if (copyPlaceholder()) { event.stopPropagation(); } } // Code ?? = v else if (eventCode == 86 && contentBar.getSelectedTab() == LAYOUT_INDEX) { pastePlaceholder(); } } }
@SuppressWarnings("rawtypes") public Code(KeyEvent event){ if (event != null){ if (event instanceof KeyPressEvent){ kP_Event = (KeyPressEvent)event; } else if (event instanceof KeyDownEvent){ kD_Event = (KeyDownEvent)event; } isCtrlDown = event.isControlKeyDown(); isAltDown = event.isAltKeyDown(); isShiftDown = event.isShiftKeyDown(); } int temp = 0; if (kP_Event != null){ charCode = kP_Event.getUnicodeCharCode(); } else if (kD_Event != null){ temp = keyCode = kD_Event.getNativeKeyCode(); } isFunctionKey = false; for (int k : keyCodes){ if (temp == k) { isFunctionKey = true; break; } } }
@Override public DatePickerDOMElement createDomElement(final GridLayer gridLayer, final GridWidget gridWidget, final GridBodyCellRenderContext context) { this.widget = createWidget(); this.e = new DatePickerDOMElement(widget, gridLayer, gridWidget); widget.addChangeDateHandler((e) -> doValueUpdate()); widget.addDomHandler(new KeyDownHandlerDatePicker(gridPanel, gridLayer, gridWidget, this, context), KeyDownEvent.getType()); return e; }
@Override public void onKeyDown(final KeyDownEvent e) { final int keyCode = e.getNativeKeyCode(); final boolean isShiftKeyDown = e.isShiftKeyDown(); switch (keyCode) { case KeyCodes.KEY_TAB: case KeyCodes.KEY_ENTER: gridCell.flush(); moveSelection(keyCode, isShiftKeyDown); e.preventDefault(); case KeyCodes.KEY_ESCAPE: gridCell.destroyResources(); gridPanel.setFocus(true); gridLayer.batch(); } e.stopPropagation(); }
@Override public void onKeyDown(final KeyDownEvent e) { final int keyCode = e.getNativeKeyCode(); final boolean isShiftKeyDown = e.isShiftKeyDown(); switch (keyCode) { case KeyCodes.KEY_TAB: case KeyCodes.KEY_ESCAPE: gridCell.destroyResources(); case KeyCodes.KEY_ENTER: moveSelection(keyCode, isShiftKeyDown); gridPanel.setFocus(true); gridLayer.batch(); } e.stopPropagation(); }
public ProjectClassListViewImpl() { dataGrid.setEmptyTableCaption( Constants.INSTANCE.project_class_list_no_classes_message() ); dataGrid.setToolBarVisible( false ); addClassNameColumn(); addRemoveRowColumn(); initWidget( uiBinder.createAndBindUi( this ) ); newClassTextBox.addKeyDownHandler( new KeyDownHandler() { @Override public void onKeyDown( KeyDownEvent event ) { presenter.onClassNameChange(); } } ); }
@PostConstruct public void init() { // Configure valueField and customValueField controls valueComboBox.init(this, true, valueField, customValueField, false, false, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); customValueField.addKeyDownHandler((KeyDownEvent event) -> { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } }); }
@PostConstruct public void init() { // Configure name and customName controls nameComboBox.init(this, true, name, customName, false, false, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); customName.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } } }); }
public PopupNumericBigIntegerEditCell( boolean isReadOnly ) { super( isReadOnly ); // Tabbing out of the TextBox commits changes textBox.addKeyDownHandler( new KeyDownHandler() { public void onKeyDown( KeyDownEvent event ) { boolean keyTab = event.getNativeKeyCode() == KeyCodes.KEY_TAB; boolean keyEnter = event.getNativeKeyCode() == KeyCodes.KEY_ENTER; if ( keyEnter || keyTab ) { commit(); } } } ); vPanel.add( textBox ); }
public PopupNumericShortEditCell( boolean isReadOnly ) { super( isReadOnly ); // Tabbing out of the TextBox commits changes textBox.addKeyDownHandler( new KeyDownHandler() { public void onKeyDown( KeyDownEvent event ) { boolean keyTab = event.getNativeKeyCode() == KeyCodes.KEY_TAB; boolean keyEnter = event.getNativeKeyCode() == KeyCodes.KEY_ENTER; if ( keyEnter || keyTab ) { commit(); } } } ); vPanel.add( textBox ); }
public AbstractProxyPopupDropDownTextBox(final TextBox textBox, final AbstractProxyPopupDropDownEditCell proxy) { this.textBox = textBox; // Tabbing out of the ListBox commits changes textBox.addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { boolean keyTab = event.getNativeKeyCode() == KeyCodes.KEY_TAB; boolean keyEnter = event.getNativeKeyCode() == KeyCodes.KEY_ENTER; if (keyEnter || keyTab) { proxy.commit(); } } }); }
public PopupNumericBigDecimalEditCell( boolean isReadOnly ) { super( isReadOnly ); // Tabbing out of the TextBox commits changes textBox.addKeyDownHandler( new KeyDownHandler() { public void onKeyDown( KeyDownEvent event ) { boolean keyTab = event.getNativeKeyCode() == KeyCodes.KEY_TAB; boolean keyEnter = event.getNativeKeyCode() == KeyCodes.KEY_ENTER; if ( keyEnter || keyTab ) { commit(); } } } ); vPanel.add( textBox ); }
public PopupNumericLongEditCell( boolean isReadOnly ) { super( isReadOnly ); // Tabbing out of the TextBox commits changes textBox.addKeyDownHandler( new KeyDownHandler() { public void onKeyDown( KeyDownEvent event ) { boolean keyTab = event.getNativeKeyCode() == KeyCodes.KEY_TAB; boolean keyEnter = event.getNativeKeyCode() == KeyCodes.KEY_ENTER; if ( keyEnter || keyTab ) { commit(); } } } ); vPanel.add( textBox ); }