本文整理汇总了Java中com.google.gwt.event.dom.client.KeyDownEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java KeyDownEvent.getSource方法的具体用法?Java KeyDownEvent.getSource怎么用?Java KeyDownEvent.getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.KeyDownEvent
的用法示例。
在下文中一共展示了KeyDownEvent.getSource方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSuggestionHandler
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的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);
}
}
}
}
}
};
}
示例2: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
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:
;
}
}
}
示例3: createKeyEnterHandler
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
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);
}
}
};
}
示例4: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
final Object sender = event.getSource();
if (sender == textBoxQuery || sender == textBoxCreator) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
search();
}
}
}
示例5: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
if (event.getSource() == textBoxBody) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
sendMessage();
}
}
}
示例6: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
public void onKeyDown(KeyDownEvent event) {
int keycode = event.getNativeKeyCode();
// Catch tab and move between select:s
if (keycode == KeyCodes.KEY_TAB && event.getSource() == options
&& !event.isShiftKeyDown()) {
// Prevent default behavior
event.preventDefault();
// Remove current selections
clearSelections(options, true);
// Focus selections
selections.setFocus(true);
}
if (keycode == KeyCodes.KEY_TAB && event.isShiftKeyDown()
&& event.getSource() == selections) {
// Prevent default behavior
event.preventDefault();
// Remove current selections
clearSelections(selections, true);
// Focus options
options.setFocus(true);
}
if (keycode == getNavigationSelectKey()) {
// Prevent default behavior
event.preventDefault();
// Decide which select the selection was made in
if (event.getSource() == options) {
// Prevents the selection to become a single selection when
// using Enter key as the selection key (default)
options.setFocus(false);
addItem();
} else if (event.getSource() == selections) {
// Prevents the selection to become a single selection when
// using Enter key as the selection key (default)
selections.setFocus(false);
removeItem();
}
}
}
示例7: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
int keycode = event.getNativeKeyCode();
// Catch tab and move between select:s
if (keycode == KeyCodes.KEY_TAB && event.getSource() == optionsListBox) {
// Prevent default behavior
event.preventDefault();
// Remove current selections
for (int i = 0; i < optionsListBox.getItemCount(); i++) {
optionsListBox.setItemSelected(i, false);
}
// Focus selections
selectionsListBox.setFocus(true);
}
if (keycode == KeyCodes.KEY_TAB && event.isShiftKeyDown() && event.getSource() == selectionsListBox) {
// Prevent default behavior
event.preventDefault();
// Remove current selections
for (int i = 0; i < selectionsListBox.getItemCount(); i++) {
selectionsListBox.setItemSelected(i, false);
}
// Focus options
optionsListBox.setFocus(true);
}
if (keycode == getNavigationSelectKey()) {
// Prevent default behavior
event.preventDefault();
// Decide which select the selection was made in
if (event.getSource() == optionsListBox) {
// Prevents the selection to become a single selection when
// using Enter key
// as the selection key (default)
optionsListBox.setFocus(false);
moveSelectedItemsLeftToRight();
} else if (event.getSource() == selectionsListBox) {
// Prevents the selection to become a single selection when
// using Enter key
// as the selection key (default)
selectionsListBox.setFocus(false);
moveSelectedItemsRightToLeft();
}
}
}