@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 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()); }
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()); } } } }); }
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); } } } } } }; }
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; }
@Before public void setup() { when(gridLayer.addNodeMouseMoveHandler(any(NodeMouseMoveHandler.class))).thenReturn(mock(HandlerRegistration.class)); when(gridLayer.addNodeMouseOutHandler(any(NodeMouseOutHandler.class))).thenReturn(mock(HandlerRegistration.class)); when(view.addKeyDownHandler(any(KeyDownHandler.class))).thenReturn(mock(HandlerRegistration.class)); when(view.addContextMenuHandler(any(ContextMenuHandler.class))).thenReturn(mock(HandlerRegistration.class)); when(view.addMouseDownHandler(any(MouseDownHandler.class))).thenReturn(mock(HandlerRegistration.class)); when(view.getGridLayerView()).thenReturn(gridLayer); when(view.getBounds()).thenReturn(bounds); final GuidedDecisionTableModellerPresenter wrapped = new GuidedDecisionTableModellerPresenter(view, dtablePresenterProvider, contextMenuSupport, updateRadarEvent, pinnedEvent, columnHeaderPopOver, wizardManagedInstance); presenter = spy(wrapped); when(dtablePresenterProvider.get()).thenReturn(dtablePresenter); when(dtablePresenter.getView()).thenReturn(dtableView); when(dtableView.getModel()).thenReturn(new BaseGridData()); }
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 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(); } } }); }
@Test public void testInitWidget() { widget.init(); verify(widget, times(1)).init(); verify(nameComboBox, times(1)).init(widget, true, name, customName, false, false, AssigneeListItemWidgetView.CUSTOM_PROMPT, AssigneeListItemWidgetView.ENTER_TYPE_PROMPT); verify(customName, times(1)).addKeyDownHandler(any(KeyDownHandler.class)); }
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 ); }
public PopupNumericDoubleEditCell( 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 AbstractProxyPopupDropDownListBox(final AbstractProxyPopupDropDownEditCell proxy) { this.listBox = new ListBox(); this.proxy = proxy; // Tabbing out of the ListBox commits changes listBox.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 PopupTextEditCell( boolean isReadOnly ) { super( isReadOnly ); this.textBox = new TextBox(); // 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 ( keyTab || keyEnter ) { commit(); } } } ); vPanel.add( textBox ); }
public PopupNumericEditCell( 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 PopupValueListDropDownEditCell( final String[] items, final boolean isMultipleSelect, final boolean isReadOnly ) { super( isReadOnly ); this.listBox.setMultipleSelect( isMultipleSelect ); setItems( items ); // Tabbing out of the ListBox commits changes listBox.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( listBox ); }
public PopupNumericIntegerEditCell( 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 PopupNumericByteEditCell( 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 PopupDialectDropDownEditCell( boolean isReadOnly ) { super( isReadOnly ); this.listBox = new ListBox(); setItems( DIALECTS ); // Tabbing out of the ListBox commits changes listBox.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( listBox ); }
public PopupNumericFloatEditCell( 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 ); }
private void fixHandlers(final FilterBox box, Widget w) { if (w instanceof HasBlurHandlers) ((HasBlurHandlers)w).addBlurHandler(box.iBlurHandler); if (w instanceof HasFocusHandlers) ((HasFocusHandlers)w).addFocusHandler(box.iFocusHandler); if (w instanceof HasKeyDownHandlers) ((HasKeyDownHandlers)w).addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) if (box.isFilterPopupShowing()) box.hideFilterPopup(); } }); }
@Inject protected ProjectClasspathViewImpl( org.eclipse.che.ide.Resources resources, JavaLocalizationConstant localization, ProjectClasspathResources commandResources) { this.localization = localization; this.commandResources = commandResources; Map<Object, List<Object>> categories = new HashMap<>(); commandResources.getCss().ensureInjected(); setWidget(UI_BINDER.createAndBindUi(this)); setTitle(localization.projectClasspathTitle()); getWidget().getElement().setId("classpathManagerView"); list = new CategoriesList(resources); list.addDomHandler( new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { switch (event.getNativeKeyCode()) { case KeyboardEvent.KeyCode.INSERT: break; case KeyboardEvent.KeyCode.DELETE: break; } } }, KeyDownEvent.getType()); categoriesPanel.add(list); contentPanel.clear(); createButtons(); getWidget().getElement().getStyle().setPadding(0, Style.Unit.PX); }
/** * Sets the KeyDown event handler in many widgets * @param handler the handler * @param widgets the widgets */ public static void addKeyDownHandler(final KeyDownHandler handler,final HasKeyDownHandlers... widgets) { if (handler != null && widgets != null && widgets.length > 0) { for (HasKeyDownHandlers w : widgets) { if (w != null) w.addKeyDownHandler(handler); } } }
@Override public void onLoad() { super.onLoad(); save.setVisible(Gerrit.isSignedIn()); if (view != null) { addDomHandler( new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KEY_ESCAPE || event.getNativeKeyCode() == ',') { close(); } } }, KeyDownEvent.getType()); updateContextTimer = new Timer() { @Override public void run() { if (prefs.context() == WHOLE_FILE_CONTEXT) { contextEntireFile.setValue(true); } if (view.canRenderEntireFile(prefs)) { renderEntireFile.setEnabled(true); renderEntireFile.setValue(prefs.renderEntireFile()); } else { renderEntireFile.setValue(false); renderEntireFile.setEnabled(false); } view.setContext(prefs.context()); } }; } }
protected KeyDownHandler getEnterDomHandler() { return new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (handleDefaultAction()) { event.preventDefault(); event.stopPropagation(); } } } }; }
public PlatypusSplitButton(String aTitle, boolean asHtml, ImageResource aImage, MenuBar aMenu) { super(aTitle, asHtml, aImage, aMenu); addKeyDownHandler(new KeyDownHandler(){ @Override public void onKeyDown(KeyDownEvent event) { if(event.getNativeKeyCode() == KeyCodes.KEY_ENTER || event.getNativeKeyCode() == KeyCodes.KEY_SPACE){ ActionEvent.fire(PlatypusSplitButton.this, PlatypusSplitButton.this); } } }); }
public static KeyDownHandler createOnEnterListener(final EventListenerGVO ev, final List<InputVariableGVO> input) { return new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { CallbackHandler.createCallBack(event.getSource(), QAMLConstants.EVENT_ONENTER, ev, input); } } }; }
public static KeyDownHandler createOnKeyDownListener(final EventListenerGVO ev, final List<InputVariableGVO> input) { return new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { handleKeyInput(event.getSource(), event.getNativeEvent(), QAMLConstants.EVENT_ONKEYDOWN, ev, input); } }; }
private static KeyDownHandler createKeyEnterHandler(final ComponentGVO componentGVO, final EventListenerGVO eventGVO, final NotifyHandler notifyHandler, final String windowId, final String context, final AbstractActivity activity) { return new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { UIObject widget = (UIObject)event.getSource(); List<InputVariableGVO> inputVariables = eventGVO.getInputvariablesList(); handleEvent(componentGVO, widget, eventGVO, event, QAMLConstants.EVENT_ONENTER, inputVariables, notifyHandler, windowId, context, activity); } } }; }
@Test public void checkDOMElementCreationChecksListBoxIsMultipleSelect() { factory.createDomElement(gridLayer, gridWidget, cellRenderContext); verify(listBox).addMouseDownHandler(any(MouseDownHandler.class)); verify(listBox).addKeyDownHandler(any(KeyDownHandler.class)); verify(listBox).addBlurHandler(any(BlurHandler.class)); verify(listBox).isMultipleSelect(); }
@Test public void testAddKeyDownHandlerAttachesToEditor() { //Ensure nobody thinks its a good idea to attach to the RootPanel at some time in the future! //See https://issues.jboss.org/browse/GUVNOR-3146 final KeyDownHandler handler = mock(KeyDownHandler.class); view.addKeyDownHandler(handler); verify(rootPanel, never()).addDomHandler(eq(handler), eq(KeyDownEvent.getType())); verify(mockGridPanel).addKeyDownHandler(eq(handler)); }
@Override protected KeyDownHandler getHandler() { return new KeyDownHandlerCommon(gridPanel, gridLayer, gridWidget, gridCell, context); }
@Override protected KeyDownHandler getHandler() { return new KeyDownHandlerDatePicker(gridPanel, gridLayer, gridWidget, gridCell, context); }