當前位置: 首頁>>代碼示例>>Java>>正文


Java Event.getTypeInt方法代碼示例

本文整理匯總了Java中com.google.gwt.user.client.Event.getTypeInt方法的典型用法代碼示例。如果您正苦於以下問題:Java Event.getTypeInt方法的具體用法?Java Event.getTypeInt怎麽用?Java Event.getTypeInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.user.client.Event的用法示例。


在下文中一共展示了Event.getTypeInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
    event.preventDefault();
    int eventType = event.getTypeInt();
    switch (eventType) {
        case ONMOUSEDOWN:
        case ONTOUCHSTART:
            onClick();
            break;
        case ONMOUSEUP:
            if (!singleClick) {
                onClick();
            }
            break;
        case ONMOUSEOVER:
            onMouseOver();
            break;
        case ONTOUCHEND:
        case ONMOUSEOUT:
            onMouseOut();
            break;
    }
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:24,代碼來源:AbstractMediaButton.java

示例2: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
	if (!isEnabled()) return;

	super.onBrowserEvent(event);

    if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
    	int type = DOM.eventGetType(event);
    	char keyCode = (char) event.getKeyCode();
    	switch (type) {
    	case Event.ONKEYDOWN:
    		if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
    			if (iDown != null) setResource(iDown);
    		}
    		break;
        case Event.ONKEYUP:
        	if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
        		setResource(iUp);
        		onClick();
        	}
        	break;
    	}
    }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:25,代碼來源:ImageButton.java

示例3: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
/**
 * Invoked by GWT whenever a browser event is dispatched to this component.
 */
@Override
public final void onBrowserEvent(Event event) {
  switch (event.getTypeInt()) {
    case Event.ONMOUSEDOWN:
    case Event.ONMOUSEUP:
    case Event.ONMOUSEMOVE:
    case Event.ONMOUSEOVER:
    case Event.ONMOUSEOUT:
      cancelBrowserEvent(event);
      mouseListeners.fireMouseEvent(this, event);
      break;

    case Event.ONCLICK:
      cancelBrowserEvent(event);
      select();
      break;

    default:
      // Ignore unexpected events
      break;
  }
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:26,代碼來源:MockComponent.java

示例4: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
	debug("VComboBoxMultiselect.SP: onBrowserEvent()");

	if (event.getTypeInt() == Event.ONCLICK) {
		final Element target = DOM.eventGetTarget(event);
		if (target == this.up || target == DOM.getChild(this.up, 0)) {
			this.lazyPageScroller.scrollUp();
		} else if (target == this.down || target == DOM.getChild(this.down, 0)) {
			this.lazyPageScroller.scrollDown();
		}

	}

	/*
	 * Prevent the keyboard focus from leaving the textfield by
	 * preventing the default behaviour of the browser. Fixes #4285.
	 */
	handleMouseDownEvent(event);
}
 
開發者ID:bonprix,項目名稱:vaadin-combobox-multiselect,代碼行數:21,代碼來源:VComboBoxMultiselect.java

示例5: handleMouseDownEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
/**
 * Handles special behavior of the mouse down event.
 *
 * @param event
 */
private void handleMouseDownEvent(Event event) {
	/*
	 * Prevent the keyboard focus from leaving the textfield by preventing
	 * the default behaviour of the browser. Fixes #4285.
	 */
	if (event.getTypeInt() == Event.ONMOUSEDOWN) {
		debug("VComboBoxMultiselect: blocking mouseDown event to avoid blur");

		event.preventDefault();
		event.stopPropagation();

		/*
		 * In IE the above wont work, the blur event will still trigger. So,
		 * we set a flag here to prevent the next blur event from happening.
		 * This is not needed if do not already have focus, in that case
		 * there will not be any blur event and we should not cancel the
		 * next blur.
		 */
		if (BrowserInfo.get()
			.isIE() && this.focused) {
			this.preventNextBlurEventInIE = true;
			debug("VComboBoxMultiselect: Going to prevent next blur event on IE");
		}
	}
}
 
開發者ID:bonprix,項目名稱:vaadin-combobox-multiselect,代碼行數:31,代碼來源:VComboBoxMultiselect.java

示例6: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@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);
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:18,代碼來源:CubaWindowWidget.java

示例7: sinkEvents

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
/**
 * Sink events on the widget.
 *
 * @param widget the {@link Widget} that will handle the events
 * @param typeNames the names of the events to sink
 */
public final void sinkEvents(Widget widget, Set<String> typeNames) {
  if (typeNames == null) {
    return;
  }

  int eventsToSink = 0;
  for (String typeName : typeNames) {
    int typeInt = Event.getTypeInt(typeName);
    if (typeInt < 0) {
      widget.sinkBitlessEvent(typeName);
    } else {
      typeInt = sinkEvent(widget, typeName);
      if (typeInt > 0) {
        eventsToSink |= typeInt;
      }
    }
  }
  if (eventsToSink > 0) {
    widget.sinkEvents(eventsToSink);
  }
}
 
開發者ID:GwtMaterialDesign,項目名稱:gwt-material-table,代碼行數:28,代碼來源:CellBasedWidgetImpl.java

示例8: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
	super.onBrowserEvent(event);

    if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
    	int type = DOM.eventGetType(event);
    	char keyCode = (char) event.getKeyCode();
    	switch (type) {
        case Event.ONKEYUP:
        	if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r')
        		onClick();
        	break;
    	}
    }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:16,代碼來源:ClickableHint.java

示例9: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
	if (event.getTypeInt() == Event.ONKEYUP && event.getKeyCode() == KeyCodes.KEY_SPACE) {
		onClick();
	}
	if (event.getTypeInt() == Event.ONCLICK) {
		setValue(!getValue());
	}
	super.onBrowserEvent(event);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:11,代碼來源:AriaToggleButton.java

示例10: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) { 
    if(event.getTypeInt() == Event.ONCLICK) {
    	event.stopPropagation(); 
    } 
    super.onBrowserEvent(event); 
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:8,代碼來源:RoomsTable.java

示例11: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
	
	// If we're not yet dragging, only trigger mouse events if the event occurs
	// in the caption wrapper
	if (this.resizable) {
		switch (event.getTypeInt()) {
		case Event.ONMOUSEDOWN:
		case Event.ONMOUSEUP:
		case Event.ONMOUSEMOVE:
		case Event.ONMOUSEOVER:
		case Event.ONMOUSEOUT:
			
			if (this.dragMode >= 0 || calcDragMode(event.getClientX(),event.getClientY()) >= 0) {
				// paste'n'copy from Widget.onBrowserEvent
				switch (DOM.eventGetType(event)) {
				case Event.ONMOUSEOVER:
					// Only fire the mouse over event if it's coming from outside this
					// widget.
				case Event.ONMOUSEOUT:
					// Only fire the mouse out event if it's leaving this
					// widget.
					Element related = event.getRelatedEventTarget().cast();
					if (related != null && getElement().isOrHasChild(related)) {
						return;
					}
					break;
				}
				DomEvent.fireNativeEvent(event, this, this.getElement());
				return;
			}
			if (this.dragMode<0)
				this.updateCursor(this.dragMode);
		}
	}
	
	super.onBrowserEvent(event);
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:39,代碼來源:WindowBox.java

示例12: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);

    if (isEnabled() && event.getTypeInt() == Event.ONCONTEXTMENU) {
        if (getStyleName().contains("-header-sortable")) {
            _delegate.showSortMenu(td, cid);
        }

        event.preventDefault();
        event.stopPropagation();
    }
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:14,代碼來源:CubaTreeTableWidget.java

示例13: modifiers

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
/**
 * @return A string describing which modifier keys were pressed,
 *        and whether this was a repeat event,  e.g., " shift ctrl"
 */
@SuppressWarnings("deprecation")
public static String modifiers(Event event) {
  // repeat is deprecated, but useful for debugging
  return (event.getAltKey() ? " alt" : "")
  + (event.getShiftKey() ? " shift" : "")
  + (event.getCtrlKey() ? " ctrl" : "")
  + (event.getMetaKey() ? " meta" : "")
  + ((event.getTypeInt() == Event.ONKEYDOWN) && event.getRepeat() ? " repeat" : "");
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:14,代碼來源:EventWrapper.java

示例14: asString

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
public static String asString(Event event) {
  // Start with the event type string
  String string = DOM.eventGetTypeString(event);
  // Next type-specific fields
  switch (event.getTypeInt()) {
  case Event.ONKEYPRESS:
  case Event.ONKEYUP:
  case Event.ONKEYDOWN:
    string += key(event) + modifiers(event);
    break;
  case Event.ONCLICK:
  case Event.ONDBLCLICK:
  case Event.ONMOUSEMOVE:
    string += mousePoint(event) + modifiers(event);
    break;
  case Event.ONMOUSEDOWN:
  case Event.ONMOUSEUP:
    string += mousePoint(event) + mouseButtons(event) + modifiers(event);
    break;
  case Event.ONMOUSEOUT:
    string += mousePoint(event) + modifiers(event) + " to: " + getToElement(event);
    break;
  case Event.ONMOUSEOVER:
    string += mousePoint(event) + modifiers(event) + " from: " + getFromElement(event);
    break;
  case Event.ONMOUSEWHEEL:
    string += " " + getMouseWheelVelocityY(event) + mousePoint(event) + modifiers(event);
    break;
  case Event.ONFOCUS:
  case Event.ONBLUR:
  case Event.ONCHANGE:
  case Event.ONERROR:
  case Event.ONLOAD:
  case Event.ONLOSECAPTURE:
  case Event.ONSCROLL:
    break;
  }
  return string;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:40,代碼來源:EventWrapper.java

示例15: onBrowserEvent

import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
  if (mouseListener == null) {
    super.onBrowserEvent(event);
    return;
  }

  switch (event.getTypeInt()) {
    case Event.ONMOUSEDOWN:
      mouseListener.onMouseDown();
      break;
    case Event.ONMOUSEOUT:
      mouseListener.onMouseLeave();
      break;
    case Event.ONMOUSEOVER:
      mouseListener.onMouseEnter();
      break;
    case Event.ONMOUSEUP:
      mouseListener.onMouseUp();
      break;
    case Event.ONCLICK:
      mouseListener.onClick();
      if (stopPropagation) {
        event.stopPropagation();
      }
      break;
  }
  super.onBrowserEvent(event);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:30,代碼來源:TextButton.java


注:本文中的com.google.gwt.user.client.Event.getTypeInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。