@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();
}
}
});
}
java类com.google.gwt.event.dom.client.KeyDownEvent的实例源码
TopPanel.java 文件源码
项目:ephesoft
阅读 23
收藏 0
点赞 0
评论 0
EntitiesExplorerViewImpl.java 文件源码
项目:appformer
阅读 21
收藏 0
点赞 0
评论 0
@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;
}
VImageViewer.java 文件源码
项目:ImageViewer
阅读 26
收藏 0
点赞 0
评论 0
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);
}
}
});
}
KeyShortcutHandler.java 文件源码
项目:sig-seguimiento-vehiculos
阅读 20
收藏 0
点赞 0
评论 0
@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);
}
});
}
}
EscKeyDownHandler.java 文件源码
项目:cuba
阅读 20
收藏 0
点赞 0
评论 0
@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();
}
}
}
FocusManager.java 文件源码
项目:Wiab.pro
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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();
}
UserLoginDialogUI.java 文件源码
项目:x-cure-chat
阅读 20
收藏 0
点赞 0
评论 0
@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;
}
HistoryPopup.java 文件源码
项目:ontobrowser
阅读 33
收藏 0
点赞 0
评论 0
@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());
}
}
SearchInputView.java 文件源码
项目:ontobrowser
阅读 21
收藏 0
点赞 0
评论 0
@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);
}
}
ApproveRejectComposite.java 文件源码
项目:ontobrowser
阅读 18
收藏 0
点赞 0
评论 0
@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());
}
}
CrossRefPopup.java 文件源码
项目:ontobrowser
阅读 22
收藏 0
点赞 0
评论 0
@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());
}
}
EscKeyDownHandler.java 文件源码
项目:componentrenderer
阅读 18
收藏 0
点赞 0
评论 0
@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();
}
}
}
KeyShortcutHandler.java 文件源码
项目:geowe-core
阅读 21
收藏 0
点赞 0
评论 0
@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);
}
});
}
}
Hashtags.java 文件源码
项目:gerrit
阅读 24
收藏 0
点赞 0
评论 0
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());
}
SinglePageLayout.java 文件源码
项目:djvu-html5
阅读 20
收藏 0
点赞 0
评论 0
@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();
}
}
DlgChatInput.java 文件源码
项目:fullmetalgalaxy
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
}
SecretTextField.java 文件源码
项目:appformer
阅读 22
收藏 0
点赞 0
评论 0
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());
}
}
}
});
}
TextField.java 文件源码
项目:appformer
阅读 19
收藏 0
点赞 0
评论 0
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());
}
}
}
});
}
BaseGridWidgetKeyboardHandler.java 文件源码
项目:appformer
阅读 22
收藏 0
点赞 0
评论 0
@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();
}
}
FullView.java 文件源码
项目:google-apis-explorer
阅读 24
收藏 0
点赞 0
评论 0
@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());
}
}
}
}
EventsExecutor.java 文件源码
项目:platypus-js
阅读 22
收藏 0
点赞 0
评论 0
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));
}
}
});
}
}
}
EventFactory.java 文件源码
项目:qafe-platform
阅读 24
收藏 0
点赞 0
评论 0
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);
}
}
}
}
}
};
}
Spreadsheet.java 文件源码
项目:qafe-platform
阅读 23
收藏 0
点赞 0
评论 0
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:
;
}
}
}
WordCloudApp.java 文件源码
项目:swcv
阅读 19
收藏 0
点赞 0
评论 0
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;
}
DynTreeInTreeTable.java 文件源码
项目:hexa.tools
阅读 48
收藏 0
点赞 0
评论 0
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() );
}
WebLayoutEditor.java 文件源码
项目:prima-aletheia-web-emop
阅读 25
收藏 0
点赞 0
评论 0
@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();
}
}
PresentationManageWidget.java 文件源码
项目:rva
阅读 22
收藏 0
点赞 0
评论 0
@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();
}
}
}
Code.java 文件源码
项目:opennmszh
阅读 20
收藏 0
点赞 0
评论 0
@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;
}
}
}
FocusManager.java 文件源码
项目:incubator-wave
阅读 25
收藏 0
点赞 0
评论 0
/**
* 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();
}
DatePickerSingletonDOMElementFactory.java 文件源码
项目:drools-wb
阅读 24
收藏 0
点赞 0
评论 0
@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;
}