本文整理汇总了Java中com.google.gwt.event.dom.client.KeyDownEvent.isControlKeyDown方法的典型用法代码示例。如果您正苦于以下问题:Java KeyDownEvent.isControlKeyDown方法的具体用法?Java KeyDownEvent.isControlKeyDown怎么用?Java KeyDownEvent.isControlKeyDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.KeyDownEvent
的用法示例。
在下文中一共展示了KeyDownEvent.isControlKeyDown方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@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();
}
}
}
示例3: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@UiHandler("editArea")
void onKeyDown(KeyDownEvent e) {
resizeTimer.cancel();
if ((e.isControlKeyDown() || e.isMetaKeyDown()) && !e.isAltKeyDown() && !e.isShiftKeyDown()) {
switch (e.getNativeKeyCode()) {
case 's':
case 'S':
e.preventDefault();
CallbackGroup group = new CallbackGroup();
save(group);
group.done();
return;
}
} else if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE && !isDirty()) {
if (isNew()) {
removeUI();
restoreSelection();
return;
}
setEdit(false);
if (autoClosed) {
setOpen(false);
}
getCm().focus();
return;
}
expandTimer.schedule(250);
}
示例4: getOperation
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
private KeyboardOperation getOperation(final KeyDownEvent event) {
final int keyCode = event.getNativeKeyCode();
final boolean isShiftKeyDown = event.isShiftKeyDown();
final boolean isControlKeyDown = event.isControlKeyDown();
for (KeyboardOperation operation : operations) {
if (operation.getKeyCode() == keyCode) {
if (keyDownStateMatches(isShiftKeyDown,
operation.isShiftKeyDown()) && keyDownStateMatches(isControlKeyDown,
operation.isControlKeyDown())) {
return operation;
}
}
}
return null;
}
示例5: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
if (!InputSlider.this.isStateValid()) {
return;
}
int paddingValue = 1;
if (event.isControlKeyDown()) {
paddingValue = InputSlider.this.items.size() / 5;
}
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_HOME:
InputSlider.this.handleWidget.moveStart();
this.killEvent(event);
break;
case KeyCodes.KEY_END:
InputSlider.this.handleWidget.moveEnd();
this.killEvent(event);
break;
case KeyCodes.KEY_SPACE:
InputSlider.this.handleWidget.moveMiddle();
this.killEvent(event);
break;
case KeyCodes.KEY_LEFT:
InputSlider.this.handleWidget.moveLeft(paddingValue);
this.killEvent(event);
break;
case KeyCodes.KEY_RIGHT:
InputSlider.this.handleWidget.moveRight(paddingValue);
this.killEvent(event);
break;
default:
break;
}
}
示例6: isAlwaysPropogateZoom
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
private boolean isAlwaysPropogateZoom(KeyDownEvent event) {
return isNeverHandleAndAlwaysPropagateZoomHotkeys() && event.isControlKeyDown() && (event.getNativeKeyCode() == KeyCodes.KEY_NUM_PLUS || event.getNativeKeyCode() == KeyCodes.KEY_NUM_MINUS || event.getNativeKeyCode() == KeyCodes.KEY_ZERO);
}
示例7: isRightButtonModKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
protected boolean isRightButtonModKeyDown(KeyDownEvent event) {
//NOTE: we want to be able to send the chat message by just pressing enter
//with Ctrl-Enter we do a line shift here in the text area
return !event.isControlKeyDown();
}
示例8: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
if ( !isEnabled( ) || isReadOnly( ) )
return;
if (Utils.isNotBlank(promptText) && promptText.equals(super.getText())
&& !(event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB)) {
removePrompts();
}
int keyCode = event.getNativeEvent().getKeyCode();
// allow special keys
switch(keyCode) {
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_BACKSPACE:
case KeyCodes.KEY_DELETE:
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
case KeyCodes.KEY_UP:
case KeyCodes.KEY_DOWN:
case KeyCodes.KEY_END:
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
case KeyCodes.KEY_PAGEDOWN:
case KeyCodes.KEY_PAGEUP:
case KeyCodes.KEY_HOME:
case KeyCodes.KEY_SHIFT:
case KeyCodes.KEY_ALT:
case KeyCodes.KEY_CTRL:
return;
default:
if (event.isAltKeyDown() || (event.isControlKeyDown() &&
(keyCode == KeyCodes.KEY_C || keyCode == KeyCodes.KEY_V
|| keyCode == KeyCodes.KEY_X )))
return;
if (!event.isShiftKeyDown()) {
// check for decimal '.'
if (isDecimal() && isDot(keyCode) && !getText().contains("."))
return;
// check for negative sign '-'
if (getCursorPos() == 0 && isDash(keyCode) && !getText().startsWith("-"))
return;
// filter out non-digits
if (isDigit(keyCode)) {
return;
}
}
}
cancelKey();
}
示例9: isRightButtonModKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
/**
* Allows to detect if the modification key related to the right-button action key is down
* @param event the key down event
* @return true if the modification key is down, otherwise false
*/
protected boolean isRightButtonModKeyDown(KeyDownEvent event) {
return event.isControlKeyDown();
}