本文整理汇总了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;
}
示例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));
}
示例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());
}
示例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());
}
}
}
});
}
示例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());
}
}
}
});
}
示例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));
}
}
});
}
}
}
示例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);
}
}
}
}
}
};
}
示例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;
}
示例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());
}
示例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();
}
} );
}
示例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();
}
}
});
}
示例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));
}
示例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 );
}
示例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 );
}
示例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();
}
}
});
}