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


Java KeyDownEvent类代码示例

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


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

示例1: injectEvents

import com.google.gwt.event.dom.client.KeyDownEvent; //导入依赖的package包/类
@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();
			}
		}
	});

}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:20,代码来源:TopPanel.java

示例2: configure

import com.google.gwt.event.dom.client.KeyDownEvent; //导入依赖的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

示例3: VImageViewer

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

示例4: onKeyDown

import com.google.gwt.event.dom.client.KeyDownEvent; //导入依赖的package包/类
@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);
	        }
	   });
	}
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:17,代码来源:KeyShortcutHandler.java

示例5: onKeyDown

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

示例6: install

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

示例7: isRightButtonModKeyDown

import com.google.gwt.event.dom.client.KeyDownEvent; //导入依赖的package包/类
@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;
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:17,代码来源:UserLoginDialogUI.java

示例8: onKeyDown

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

示例9: onKeyDown

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

示例10: Hashtags

import com.google.gwt.event.dom.client.KeyDownEvent; //导入依赖的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

示例11: onKeyDown

import com.google.gwt.event.dom.client.KeyDownEvent; //导入依赖的package包/类
@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();
	}
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:25,代码来源:SinglePageLayout.java

示例12: onKeyDown

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

示例13: addKeyDownHandler

import com.google.gwt.event.dom.client.KeyDownEvent; //导入依赖的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

示例14: addEnterKeyHandler

import com.google.gwt.event.dom.client.KeyDownEvent; //导入依赖的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

示例15: onKeyDown

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


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