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

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

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

Event.getButton介绍

暂无

代码示例

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

/**
 * Gets the mouse buttons that were depressed when the given event occurred.
 * 
 * @param evt the event to be tested
 * @return a bit-field, defined by {@link Event#BUTTON_LEFT},
 *         {@link Event#BUTTON_MIDDLE}, and {@link Event#BUTTON_RIGHT}
 * @deprecated Use {@link Event#getButton()} instead.
 */
@Deprecated
public static int eventGetButton(Event evt) {
 return evt.getButton();
}

代码示例来源: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

/**
  * 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.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: pt.ist/svgwt

/**
 * Gets the mouse buttons that were depressed when the given event occurred.
 * 
 * @return a bit-field, defined by {@link NativeEvent#BUTTON_LEFT},
 *         {@link NativeEvent#BUTTON_MIDDLE}, and
 *         {@link NativeEvent#BUTTON_RIGHT}
 */
public final int getButton() {
  return _event.getButton();
}

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

/**
 * Gets the mouse buttons that were depressed when the given event occurred.
 * 
 * @return a bit-field, defined by {@link NativeEvent#BUTTON_LEFT},
 *         {@link NativeEvent#BUTTON_MIDDLE}, and
 *         {@link NativeEvent#BUTTON_RIGHT}
 */
public final int getButton() {
  return _event.getButton();
}

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

/**
 * Gets the mouse buttons that were depressed when the given event occurred.
 * 
 * @param evt the event to be tested
 * @return a bit-field, defined by {@link Event#BUTTON_LEFT},
 *         {@link Event#BUTTON_MIDDLE}, and {@link Event#BUTTON_RIGHT}
 * @deprecated Use {@link Event#getButton()} instead.
 */
@Deprecated
public static int eventGetButton(Event evt) {
 return evt.getButton();
}

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

/**
 * Gets the mouse buttons that were depressed when the given event occurred.
 * 
 * @param evt the event to be tested
 * @return a bit-field, defined by {@link Event#BUTTON_LEFT},
 *         {@link Event#BUTTON_MIDDLE}, and {@link Event#BUTTON_RIGHT}
 * @deprecated Use {@link Event#getButton()} instead.
 */
@Deprecated
public static int eventGetButton(Event evt) {
 return evt.getButton();
}

代码示例来源:origin: net.wetheinter/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: 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: com.google.gwt/gwt-servlet

if (event.getButton() == Event.BUTTON_LEFT) {
 setFocus(true);
 onClickStart();
 isCapturing = false;
 DOM.releaseCapture(getElement());
 if (isHovering() && event.getButton() == Event.BUTTON_LEFT) {
  onClick();

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

&& (event.getButton() == Event.BUTTON_LEFT)) {
elementClicked(DOM.eventGetTarget(event));

代码示例来源:origin: com.vaadin.external.gwt/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.extjs/gxt

@Override
protected void handleMouseDown(GridEvent<M> e) {
 if (e.getEvent().getButton() != Event.BUTTON_LEFT || isLocked()) {
  return;
 }
 selectCell(e.getRowIndex(), e.getColIndex());
}

代码示例来源:origin: com.extjs/gxt

@Override
protected void handleMouseDown(GridEvent<M> e) {
 if (e.getEvent().getButton() == Event.BUTTON_LEFT && e.getTarget().getClassName().equals("x-grid3-row-checker")) {
  M m = listStore.getAt(e.getRowIndex());
  if (m != null) {
   if (isSelected(m)) {
    deselect(m);
   } else {
    select(m, true);
   }
  }
 } else {
  super.handleMouseDown(e);
 }
}

代码示例来源:origin: com.extjs/gxt

protected void onAutoEditClick(GridEvent<M> e) {
 if (e.getEvent().getButton() != Event.BUTTON_LEFT) {
  return;
 }
 int row = grid.getView().findRowIndex(e.getTarget());
 int cell = grid.getView().findRowIndex(e.getTarget());
 if (row != -1 && cell != -1) {
  stopEditing();
 }
}

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

@Override
public void onBrowserEvent(Event event) {
  if (contextMenuHandler != null && event.getTypeInt() == Event.ONCONTEXTMENU) {
    contextMenuHandler.onContextMenu(event);
    return;
  }
  if ((event.getTypeInt() == Event.ONCLICK
      || event.getTypeInt() == Event.ONMOUSEDOWN)
      && event.getButton() != NativeEvent.BUTTON_LEFT) {
    event.preventDefault();
    event.stopPropagation();
    return;
  }
  super.onBrowserEvent(event);
}

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

protected void releaseCapture(Event event) {
  if (event.getButton() == Event.BUTTON_LEFT && dragDrop) {
    dragDrop = false;
    DOM.releaseCapture(resizeElement);
    if (resizeHandler != null) {
      ComputedStyle cs = new ComputedStyle(getElement());
      resizeHandler.sizeChanged(cs.getProperty("width"), cs.getProperty("height"));
      resizeHandler.textChanged(getText());
    }
  }
}

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

protected void captureEvents(Event event) {
  event.preventDefault();
  if (isEnabled() && event.getButton() == Event.BUTTON_LEFT) {
    if (!dragDrop) {
      dragDrop = true;
      DOM.setCapture(resizeElement);
      ComputedStyle cs = new ComputedStyle(getElement());
      setWidth(cs.getProperty("width"));
      setHeight(cs.getProperty("height"));
      getTextArea().getStyle().setProperty("width", "100%");
      getTextArea().getStyle().setProperty("height", "100%");
    }
  }
}

相关文章