com.google.gwt.user.client.Event.getShiftKey()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中com.google.gwt.user.client.Event.getShiftKey()方法的一些代码示例,展示了Event.getShiftKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getShiftKey()方法的具体详情如下:
包路径:com.google.gwt.user.client.Event
类名称:Event
方法名:getShiftKey

Event.getShiftKey介绍

暂无

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Gets whether the shift key was depressed when the given event occurred.
 * 
 * @param evt the event to be tested
 * @return <code>true</code> if shift was depressed when the event occurred
 * @deprecated Use {@link Event#getShiftKey()} instead.
 */
@Deprecated
public static boolean eventGetShiftKey(Event evt) {
 return evt.getShiftKey();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
 public boolean handleAsClick(Event event) {
  int mouseButtons = event.getButton();
  boolean ctrl = event.getCtrlKey();
  boolean shift = event.getShiftKey();
  boolean middle = mouseButtons == Event.BUTTON_MIDDLE;
  boolean right = mouseButtons == Event.BUTTON_RIGHT;
  boolean modifiers;
  
  if (ctrlisModifier) {
   modifiers = shift || ctrl;
  } else {
   modifiers = shift;  
  }

  return !modifiers && !middle && !right;
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Gets the keyboard modifiers associated with a DOMEvent.
 * 
 * @param event the event.
 * @return the modifiers as defined in {@link KeyboardListener}.
 */
public static int getKeyboardModifiers(Event event) {
 return (event.getShiftKey() ? KeyboardListener.MODIFIER_SHIFT : 0)
   | (event.getMetaKey() ? KeyboardListener.MODIFIER_META : 0)
   | (event.getCtrlKey() ? KeyboardListener.MODIFIER_CTRL : 0)
   | (event.getAltKey() ? KeyboardListener.MODIFIER_ALT : 0);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
 public boolean handleAsClick(Event event) {
  int mouseButtons = event.getButton();
  boolean alt = event.getAltKey();
  boolean ctrl = event.getCtrlKey();
  boolean meta = event.getMetaKey();
  boolean shift = event.getShiftKey();
  boolean middle = mouseButtons == Event.BUTTON_MIDDLE;
  boolean right = mouseButtons == Event.BUTTON_RIGHT;

  boolean modifiers = alt || ctrl || meta;
  if (shiftIsModifier) {
   modifiers |= shift;
  }
  
  return !modifiers && !middle && !right;
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
  * Default version, useful for Firefox. Don't fire if it's a rightclick,
  * middleclick, or if any modifiers are held down.
  */
 public boolean handleAsClick(Event event) {   
  int mouseButtons = event.getButton();
  boolean alt = event.getAltKey();
  boolean ctrl = event.getCtrlKey();
  boolean meta = event.getMetaKey();
  boolean shift = event.getShiftKey();    
  boolean modifiers = alt || ctrl || meta || shift;
  boolean middle = mouseButtons == Event.BUTTON_MIDDLE;
  boolean right = mouseButtons == Event.BUTTON_RIGHT;

  return !modifiers && !middle && !right;
 }
}

代码示例来源:origin: pt.ist/svgwt

/**
 * Returns <code>true</code> if the shift key is pressed.
 * 
 * @return the shift key state
 */
public boolean isShiftDown() {
  return _event.getShiftKey();
}

代码示例来源:origin: stackoverflow.com

public class MyTree extends Tree {
  private Event currentEvent;

  ... constructors...

  // Call this method from within the onSelection method to determine if the shift key
  // was pressed.
  public boolean isShiftPressed() {
   return currentEvent != null ? currentEvent.getShiftKey() : false;
  }

  @Override
  public void onBrowserEvent(Event event) {
   currentEvent = event;
   super.onBrowserEvent(event);
   currentEvent = null;
  }
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Gets whether the shift key was depressed when the given event occurred.
 * 
 * @param evt the event to be tested
 * @return <code>true</code> if shift was depressed when the event occurred
 * @deprecated Use {@link Event#getShiftKey()} instead.
 */
@Deprecated
public static boolean eventGetShiftKey(Event evt) {
 return evt.getShiftKey();
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * Gets whether the shift key was depressed when the given event occurred.
 * 
 * @param evt the event to be tested
 * @return <code>true</code> if shift was depressed when the event occurred
 * @deprecated Use {@link Event#getShiftKey()} instead.
 */
@Deprecated
public static boolean eventGetShiftKey(Event evt) {
 return evt.getShiftKey();
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
 public boolean handleAsClick(Event event) {
  int mouseButtons = event.getButton();
  boolean ctrl = event.getCtrlKey();
  boolean shift = event.getShiftKey();
  boolean middle = mouseButtons == Event.BUTTON_MIDDLE;
  boolean right = mouseButtons == Event.BUTTON_RIGHT;
  boolean modifiers;
  
  if (ctrlisModifier) {
   modifiers = shift || ctrl;
  } else {
   modifiers = shift;  
  }

  return !modifiers && !middle && !right;
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Gets the keyboard modifiers associated with a DOMEvent.
 * 
 * @param event the event.
 * @return the modifiers as defined in {@link KeyboardListener}.
 */
public static int getKeyboardModifiers(Event event) {
 return (event.getShiftKey() ? KeyboardListener.MODIFIER_SHIFT : 0)
   | (event.getMetaKey() ? KeyboardListener.MODIFIER_META : 0)
   | (event.getCtrlKey() ? KeyboardListener.MODIFIER_CTRL : 0)
   | (event.getAltKey() ? KeyboardListener.MODIFIER_ALT : 0);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * Gets the keyboard modifiers associated with a DOMEvent.
 * 
 * @param event the event.
 * @return the modifiers as defined in {@link KeyboardListener}.
 */
public static int getKeyboardModifiers(Event event) {
 return (event.getShiftKey() ? KeyboardListener.MODIFIER_SHIFT : 0)
   | (event.getMetaKey() ? KeyboardListener.MODIFIER_META : 0)
   | (event.getCtrlKey() ? KeyboardListener.MODIFIER_CTRL : 0)
   | (event.getAltKey() ? KeyboardListener.MODIFIER_ALT : 0);
}

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

public static boolean isAnyModifierKeyPressed(Event event) {
  return (event.getShiftKey()
      || event.getAltKey()
      || event.getCtrlKey()
      || event.getMetaKey());
}

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

protected boolean isShortcut(Event event) {
    return event.getShiftKey() || event.getAltKey() || event.getCtrlKey() || event.getMetaKey();
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

protected boolean isShortcut(Event event) {
    return event.getShiftKey() || event.getAltKey() || event.getCtrlKey() || event.getMetaKey();
  }
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
  * Default version, useful for Firefox. Don't fire if it's a rightclick,
  * middleclick, or if any modifiers are held down.
  */
 public boolean handleAsClick(Event event) {   
  int mouseButtons = event.getButton();
  boolean alt = event.getAltKey();
  boolean ctrl = event.getCtrlKey();
  boolean meta = event.getMetaKey();
  boolean shift = event.getShiftKey();    
  boolean modifiers = alt || ctrl || meta || shift;
  boolean middle = mouseButtons == Event.BUTTON_MIDDLE;
  boolean right = mouseButtons == Event.BUTTON_RIGHT;

  return !modifiers && !middle && !right;
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
 public boolean handleAsClick(Event event) {
  int mouseButtons = event.getButton();
  boolean alt = event.getAltKey();
  boolean ctrl = event.getCtrlKey();
  boolean meta = event.getMetaKey();
  boolean shift = event.getShiftKey();
  boolean middle = mouseButtons == Event.BUTTON_MIDDLE;
  boolean right = mouseButtons == Event.BUTTON_RIGHT;

  boolean modifiers = alt || ctrl || meta;
  if (shiftIsModifier) {
   modifiers |= shift;
  }
  
  return !modifiers && !middle && !right;
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
  * Default version, useful for Firefox. Don't fire if it's a rightclick,
  * middleclick, or if any modifiers are held down.
  */
 public boolean handleAsClick(Event event) {   
  int mouseButtons = event.getButton();
  boolean alt = event.getAltKey();
  boolean ctrl = event.getCtrlKey();
  boolean meta = event.getMetaKey();
  boolean shift = event.getShiftKey();    
  boolean modifiers = alt || ctrl || meta || shift;
  boolean middle = mouseButtons == Event.BUTTON_MIDDLE;
  boolean right = mouseButtons == Event.BUTTON_RIGHT;

  return !modifiers && !middle && !right;
 }
}

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

@Override
public void onBrowserEvent(Event event) {
  int type = DOM.eventGetType(event);
  if (type == Event.ONKEYDOWN
      && event.getKeyCode() == KeyCodes.KEY_ENTER
      && !event.getAltKey()
      && !event.getShiftKey()
      && !event.getCtrlKey()) {
    event.stopPropagation();
    return;
  }
  super.onBrowserEvent(event);
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
public void onBrowserEvent(Event event) {
  super.onBrowserEvent(event);
  if (Event.ONKEYDOWN == DOM.eventGetType(event) || Event.ONKEYPRESS == DOM.eventGetType(event)) {
    event.preventDefault();
    event.stopPropagation();
  } else if (Event.ONKEYUP == DOM.eventGetType(event)) {
    searchBox.onKeyUp(event.getKeyCode(), event.getShiftKey());
    event.preventDefault();
    event.stopPropagation();
  }
}

相关文章