当前位置: 首页>>代码示例>>Java>>正文


Java KeyDownHandler类代码示例

本文整理汇总了Java中com.google.gwt.event.dom.client.KeyDownHandler的典型用法代码示例。如果您正苦于以下问题:Java KeyDownHandler类的具体用法?Java KeyDownHandler怎么用?Java KeyDownHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KeyDownHandler类属于com.google.gwt.event.dom.client包,在下文中一共展示了KeyDownHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
@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;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:29,代码来源:EntitiesExplorerViewImpl.java

示例2: testInitWidget

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
@Test
public void testInitWidget() {
    widget.init();
    verify(widget,
           times(1)).init();
    verify(dataTypeComboBox,
           times(1)).init(widget,
                          true,
                          dataType,
                          customDataType,
                          false,
                          true,
                          VariableListItemWidgetView.CUSTOM_PROMPT,
                          VariableListItemWidgetView.ENTER_TYPE_PROMPT);
    verify(name,
           times(1)).setRegExp(regExpCaptor.capture(),
                               anyString(),
                               anyString());
    RegExp regExp = RegExp.compile(regExpCaptor.getValue());
    assertEquals(false,
                 regExp.test("a 1"));
    assertEquals(false,
                 regExp.test("[email protected]"));
    assertEquals(true,
                 regExp.test("a1"));
    verify(customDataType,
           times(1)).addKeyDownHandler(any(KeyDownHandler.class));
    verify(name,
           times(1)).addBlurHandler(any(BlurHandler.class));
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:31,代码来源:VariableListItemWidgetTest.java

示例3: Hashtags

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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());
  }
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:Hashtags.java

示例4: addKeyDownHandler

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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());
                }
            }
        }
    });
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:SecretTextField.java

示例5: addEnterKeyHandler

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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());
                }
            }
        }
    });
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:TextField.java

示例6: setKeyPressed

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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));
					}
				}
			});
		}
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:21,代码来源:EventsExecutor.java

示例7: createSuggestionHandler

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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);
						}
					}
				}
			}
		}
	};
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:19,代码来源:EventFactory.java

示例8: createTextArea

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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;
}
 
开发者ID:spupyrev,项目名称:swcv,代码行数:18,代码来源:WordCloudApp.java

示例9: setup

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
@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());
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:24,代码来源:GuidedDecisionTableModellerPresenterTest.java

示例10: ProjectClassListViewImpl

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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();
            }
        } );
    }
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:18,代码来源:ProjectClassListViewImpl.java

示例11: init

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
@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();
            }
        }
    });
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:22,代码来源:AssigneeListItemWidgetViewImpl.java

示例12: testInitWidget

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
@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));
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:18,代码来源:AssigneeListItemWidgetTest.java

示例13: PopupNumericBigIntegerEditCell

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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 );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:19,代码来源:PopupNumericBigIntegerEditCell.java

示例14: PopupNumericShortEditCell

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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 );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:19,代码来源:PopupNumericShortEditCell.java

示例15: AbstractProxyPopupDropDownTextBox

import com.google.gwt.event.dom.client.KeyDownHandler; //导入依赖的package包/类
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();
            }
        }
    });
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:18,代码来源:AbstractProxyPopupDropDownTextBox.java


注:本文中的com.google.gwt.event.dom.client.KeyDownHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。