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


Java KeyDownEvent.isControlKeyDown方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:25,代码来源:SinglePageLayout.java

示例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();
		}
	}
}
 
开发者ID:Rise-Vision,项目名称:rva,代码行数:21,代码来源:PresentationManageWidget.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:29,代码来源:DraftBox.java

示例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;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:16,代码来源:BaseGridWidgetKeyboardHandler.java

示例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;
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:35,代码来源:InputSlider.java

示例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);
}
 
开发者ID:ainslec,项目名称:gwt-promptly,代码行数:4,代码来源:PromptlyPanel.java

示例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();
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:7,代码来源:SendChatMessageDialogUI.java

示例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();
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:58,代码来源:NumberBox.java

示例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();
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:9,代码来源:ActionGridDialog.java


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